|
You are here: Home / Workflow In Sitellite |
Workflow In SitelliteTriggering a workflow eventFirst, let's plug the workflow event trigger code into the submission handler of a standard contact form. The contact form code is listed below, with the workflow additions highlighted in bold. inc/app/myapp/forms/contact/index.php
<?php
class MyappContactForm extends MailForm {
function MyappContactForm () {
parent::MailForm ();
$this->parseSettings ('inc/app/myapp/forms/contact/settings.php');
}
function onSubmit ($vals) {
loader_import ('cms.Workflow');
if (@mail (
'webmaster@example.com',
'Contact Form Submission',
$this->formatEmail ($vals),
'From: ' . $vals['email']
)) {
echo Workflow::trigger (
'contact',
array (
'data' => $vals,
'message' => 'Contact form submission',
)
);
echo template_simple ('contact_sent.spt', $vals);
} else {
echo Workflow::trigger (
'error',
array (
'message' => 'Contact Form mail() failed',
)
);
echo template_simple ('contact_error.spt', $vals);
}
}
}
?>
inc/app/myapp/forms/contact/settings.php ; <?php /* [Form] title = Contact Us [name] type = text alt = Name [email] type = text alt = Email [message] type = textarea alt = Message labelPosition = left [send] type = submit setValues = Send ; */ ?> inc/app/myapp/forms/contact/access.php ; <?php /* sitellite_action = on sitellite_access = public sitellite_status = approved ; */ ?> 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. Page 1: Workflow in Sitellite is governe... |
|
Copyright © 2008, SIMIAN systems Inc. All rights reserved. Privacy policy Some of the icons on this site were created by the Gnome Project. |