Elefant PHP Content Management System

Meet Sitellite's successor: Elefant CMS

A modern PHP framework and content management system based on the improved features of PHP 5.3+. Elefant is an extremely fast and easy to use CMS that inherits all the best of Sitellite, without the fat. Learn more »

Triggering an Event

Workflow in Sitellite is governed by a few basic concepts. When an action occurs in Sitellite (ie. a document being saved), it is called a workflow event. When an event occurs, one or more services are triggered in reaction to it. An example of a service would be the task of emailing a new pending document notice to a site editor. These services are provided in the form of ordinary Sitellite boxes. Which services to trigger for which events is determined by a series of configuration files in the inc/app/cms/conf/services folder in your Sitellite installation.

The Sitellite boxes triggered by workflow events accept certain standardized parameters specific to workflow, and additional parameters specific to the type of even that was triggered. For example, all services will receive the $parameters['transition'] variable, while the "add" and "edit" services also receive $parameters['collection'], $parameters['data'], and several others as well. Instructions for what parameters are expected for a particular service handler should be included in the box's settings.php file.

You can configure any number of event types, but the built-in events include:

  • login
  • logout
  • add
  • edit
  • delete
  • error

In addition to the ordinary event configuration files, there is a global.php event file, which triggers the services listed within for any event type except "error". This way, services such as an activity log can be listed only once and be called automatically for any event type, including new ones that are added later on.

The event configuration files aren't managed directly, however, but rather they are managed exclusively via the "Workflow Services" form under Sitellite's Admin tools. Services made available by all Sitellite apps are auto-discovered and made available on that screen.

An example would help to illustrate how this all works together.


class MyappContactForm extends MailForm {
	function MyappContactForm () {
		parent::MailForm (__FILE__);

	function onSubmit ($vals) {
		// import the workflow package
		loader_import ('cms.Workflow');

		if (@mail (
			'Contact Form Submission',
			$this->formatEmail ($vals),
			'From: ' . $vals['email']
		)) {
			// the message has succeeded,
			// trigger the workflow
			echo Workflow::trigger (
				array (
					'data' => $vals,
					'message' => 'Contact form submission',

			echo template_simple ('contact_sent.spt', $vals);
		} else {
			// the message failed, trigger the
			// workflow to log the error
			echo Workflow::trigger (
				array (
					'message' => 'Contact Form mail() failed',

			echo template_simple ('contact_error.spt', $vals);

; <?php /*

sitellite_action = on
sitellite_access = public
sitellite_status = approved

; */ ?>
; <?php /*


title = Contact Us


type = text
alt = Name


type = text
alt = Email


type = textarea
alt = Message
labelPosition = left


type = submit
setValues = Send

; */ ?>

As you can see, the workflow code is very minimal, and pretty straight-forward. First, you import the cms.Workflow package, then you call Workflow::trigger with the event type and a list of parameters you want to add that are specific to the event type.

Now, on each form submission, Sitellite will look for the file inc/app/cms/conf/services/contact.php and also the file inc/app/cms/conf/services/global.php and will call any services listed in them automatically.