Le gestionnaire d'évènements

Le gestionnaire d'évènements permet aux Tag personnalisés ou aux modules de détecter des évènements déclenchés par d'autres modules ; par exemple, le module News envoie un évènement quand un nouvel article est ajouté et il est possible de détecter cet évènement sans être obliger de modifier le code du module de News.


En bref, voici comment cela fonctionne :

a) Un module ou le noyau peut enregistrer puis envoyer un évènement comme "newNews", ou "newFronteEndUser" ou "fileUploaded", "editPage", etc. Actuellement, il y a environ 50 évènements au niveau du noyau ; ensuite, uploads et frontend users ont été conçus pour envoyer des évènements et il reste d'autres modules à faire évoluer comme "selfreg", etc.

b) Dans l'interface d'administration, il y a des pages qui vous permettent de définir quels sont les modules et/ou Tag Personnalisés doivent activer ces évènements et dans quel ordre ils doivent être appelés.

c) if one of the handlers of an event is a module, then.... the modules DoEvent method is called with the name of the event, and whatever data it wants to send. Each triggered event needs to be documented, but as of this moment, most are.

This functionality allows anybody with a bit of php knowledge, and the ability to look through the cms source, etc. to write their own workflows. for example, it should be easy now to write a bridge between frontendusers and any forum software that you want to keep users and groups updated in the forum.

The search module also uses events, and now because of this mechanism, the content submitted with the uploads module, i.e.: the summary, and the description, are searchable with the search module. and a link is provided to the detail report of the file, and then you have the ability to download the file.

Example

To get CMSMS to send someone an email when a content page is updated, do the following:

1. Create a new user defined tag, and call it something like 'EmailEditor'. Put the following in the contents:

mail('my@email.com.au','page updated','the page has been updated');

(replacing my@email.com.au with your email address of course)

Save the UDT.

2. Go to the Events page, and find the entry labelled "ContentEditPost" and click the edit button for it.

3. Select your UDT from the dropdown list (the one you called 'EmailEditor') and click add.

Thats it. Now whenever someone updates a page you will be sent an email.

Because the content object also gets passed to the UDT, you should be able to put the actual page contents / title / author / whatever into the email that gets sent.

You should also probably use the cms mailer function, rather than the built-in php one. This is only a proof of concept. I just did this in CMSMS 1.0.8 and it worked fine.

User Handbook/Admin Panel/Extensions/Event Manager/fr

From CMSMS

Arvixe - A CMSMS Partner