Skip to content
matamouros edited this page Oct 2, 2011 · 1 revision

You should feel encouraged to change things and contribute them back to the project. In that sense, there are specific parts of Cintient that were especially thought out to become easier to extend.

Notifications

Currently there's support for Notifo.com user account notifications. With Notifo.com you have free push notifications not just to your desktop environment but also to your smartphone, e.g., iPhone. When these are properly configured, Cintient will notify you of failed builds and of a few other events. You can fine tune what events you want Cintient to notify you of.

So Notifo.com notifications are a specific notification handler in Cintient, and notification handlers are pretty much pluggable. You should only worry about writing one single class and that's it. The details:

  1. Write a new Notification_<NEW_NOTIFICATION_HANDLER> class. The file for that class should be named <NEW_NOTIFICATION_HANDLER>.php as indicated, and placed in the src/Notification/ directory. This naming and file hierarchy scheme respects the way our autoloader is rigged to work.

  2. Have your new class extend the NotificationAbstract class and implement all its abstract methods. Take a look at any other of the Notification_* classes in the same directory, to see some examples.

  3. The getView() method should write to stdout the HTML markup necessary to show a form in a web page to actually edit the notification configuration, i.e., to have a user change - through a form - your class' attributes. This method will be called by the View layer.

  4. The fire() method should have the notification triggering logic. It is called when a notification is requested. Check out the required parameters, on the other existing classes.

  5. The isEmpty() method should implement an is empty check on your notification configuration parameters. It is used to check if a specific notification handler is properly setup or instead not configured by the user - and thus not active.

  6. If any external third party lib should be required, you should put it on the lib/ directory. If you follow these instructions, your notification handler should automatically show up in Cintient. As soon as the user configures your handler with enough data, it starts getting triggered whenever new notifications are generated by the application.

Clone this wiki locally