INFO: Version en.xModule type:

Editing an event

In the draft view for editing an event, you can define the corresponding actions to be taken when this event occurs. For example, you can set up logging or other actions (e-mail notification, etc.) for an event.

Events are available at system level, project level and directory level. Events are always processed first at directory level and then at project level. System events do not affect any project or directory functions and are fired depending on the respective event.

The events at directory level are explained below.

Editing an event - draft view
Editing an event - draft view

Operation

Within the 'Draft' tab, you can specify the PHP code that is to be executed as an action for the corresponding event. Enter this without the enclosing PHP tags(<?php ... ?>)!
Various code fragments are already offered by default in the right-hand column.

'Input field':

In this field, enter the PHP code that is to be executed as an action for the corresponding event.

'Macros / code examples':

By clicking on one of the macros in the right-hand column (predefined code fragments), the script code is written to the content window. If there is already source code in the content window, the corresponding code is added at the end.

Overview of possible events

An action can be defined for the corresponding events before or after the respective event occurs, which means that the following events are available to you:

  • onBeforeUpload
  • onAfterUpload
  • onBeforeCreateFile
  • onAfterCreateFile
  • onAfterCreateDraft
  • onBeforeExitEdit
  • onAfterExitEdit
  • onAfterPauseEdit
  • onBeforeSaveFile
  • onAfterSaveFile
  • onAfterChangeManualOrderId
  • onBeforeInitWorkflow
  • onBeforeRenameFile
  • onAfterRenameFile
  • onBeforeCopyFile
  • onAfterCopyFile
  • onBeforeMoveFile
  • onAfterMoveFile
  • onBeforePasteFile
  • onAfterPasteFile
  • onBeforeSetOnlineFile
  • onAfterSetOnlineFile
  • onBeforeSetOfflineFile
  • onAfterSetOfflineFile
  • onBeforeCheckInFile
  • onAfterCheckInFile
  • onBeforeCheckOutFile
  • onAfterCheckOutFile
  • onBeforeDeleteFile
  • onAfterDeleteFile
  • onBeforeChangeUserContent
  • onAfterChangeUserContent
  • onBeforeCreateDir
  • onAfterCreateDir
  • onBeforeRenameDir
  • onAfterRenameDir
  • onBeforeDeleteDir
  • onAfterDeleteDir
  • onBeforeShowDir
  • onBeforeCopyDir
  • onAfterCopyDir
  • onBeforePasteDir
  • onAfterPasteDir
  • onBeforeAccessDocument
  • onAfterSubscribeNewsletter
  • onAfterConfirmSubscriptionNewsletter
  • onAfterUnsubscribeNewsletter
  • onAfterAddPersonalizationDataNewsletterText
  • onAfterAddPersonalizationDataNewsletterHTML
  • onAfterAddPersonalizationDataNewsletterWeb
  • onAfterChangeStatusNewsletter
    (possible parameters: dirPath and newsletterStatus)
  • onAfterCopyNewsletter
    (possible parameters: dirPath)
  • onAfterDeleteNewsletter
  • onBeforeImportCSV
  • onAfterImportCSV
  • onAfterApproveFile
  • onBeforeReleaseFile
  • onAfterReleaseFile
  • onAfterRejectFile
  • onAfterCreateImage

Depending on the respective event, the following system parameters are available within the actions in the PHP code:

  • For project events
    • $eventData['wEventObjectType']
      Object type (here: project)
    • $eventData['wEventName']
      Name of the event (e.g. onAfterUpload)
    • $eventData['wEventTime']
      Timestamp of the event (date('Y-m-d H:i:s'))
    • $eventData['wEventUser']
      User who triggered the event (e.g. mustermann)
    • $eventData['userAction']
      Distinguish between saving (saveAndExit) and caching (save)
      (only made available for save actions (onBeforeSave, onAfterSave)
    • $eventData['projectPath']
      Project path in which the event is executed (e.g. /en)
    • $eventData['filePath']
      File path affected by the event (e.g. /en/company/index.php)
    • $eventData['dirPath']
      Directory path affected by the event (e.g. /en/company)
    • $eventData['fileNewPath']
      New directory path affected by the event (e.g. /en/branches)
  • For directory events
    • $eventData['wEventObjectType']
      Object type (here: directory)
    • $eventData['wEventName']
      Name of the event (e.g. onAfterUpload)
    • $eventData['wEventTime']
      Timestamp of the event (date('Y-m-d H:i:s'))
    • $eventData['wEventUser']
      User who triggered the event (e.g. mustermann)
    • $eventData['userAction']
      Distinguish between saving (saveAndExit) and caching (save)
      (only available for save actions (onBeforeSave, onAfterSave)
    • $eventData['projectPath']
      Project path in which the event is executed (e.g. /en)
    • $eventData['filePath']
      File path affected by the event (e.g. /en/company/index.php)
    • $eventData['dirPath']
      Directory path affected by the event (e.g. /en/company)
    • $eventData['fileNewPath']
      New directory path affected by the event (e.g. /en/branches)

The purpose of these system parameters is already clear from their names. Instead of these system parameters, you can of course also use PHP framework functions or your own PHP functions.