Friday 19 August 2011 5:30:06 am
By : Thiago Campos Viana
In this post I will show how to create and setup the minimum workflow event extension.
First create the following structure inside the extension folder:
Then we define all the events this extension has by creating the minevent/settings/workflow.ini.append.php file:
<?php /* [EventSettings] ExtensionDirectories[]=minevent AvailableEventTypes[]=event_minevent */ ?>
Finally create the minevent/eventtypes/event/minevent/mineventtype.php
<?php class MinEventType extends eZWorkflowEventType { const WORKFLOW_TYPE_STRING = "minevent"; function MinEventType() { $this->eZWorkflowEventType(MinEventType::WORKFLOW_TYPE_STRING, "MinEvent"); /* define trigger here */ $this->setTriggerTypes(array('content' => array('publish' => array('after')))); } function execute($process, $event) { /* code goes here */ echo "Hello Event"; eZExecution::cleanExit(); //return eZWorkflowType::STATUS_ACCEPTED; } } eZWorkflowEventType::registerEventType(MinEventType::WORKFLOW_TYPE_STRING, "MinEventType"); ?>
In administrator user interface, click 'setup' tab->'extensions' menu, select 'minevent', click button 'Apply Changes', click button 'Regenerate autoload arrays for extensions'. Clear the cache.
Create the MinEvent workflow: 'Workflows'->'Standard'->'New workflow'->'minevent' ( name MinEvent ).
Setup MinEvent trigger: 'Triggers'-> 'content-publish-after' ( choose MinEvent ). Apply changes.
Go to "Content", edit and publish some content object, you will see the "Hello Event".
Timing: | Jan 18 2025 00:02:02 |
Script start | |
Timing: | Jan 18 2025 00:02:02 |
Module start 'layout' | |
Timing: | Jan 18 2025 00:02:02 |
Module start 'content' | |
Timing: | Jan 18 2025 00:02:02 |
Module end 'content' | |
Timing: | Jan 18 2025 00:02:02 |
Script end |
Total runtime | 0.0896 sec |
Peak memory usage | 6,144.0000 KB |
Database Queries | 42 |
Checkpoint | Start (sec) | Duration (sec) | Memory at start (KB) | Memory used (KB) |
---|---|---|---|---|
Script start | 0.0000 | 0.0056 | 589.4844 | 152.6406 |
Module start 'layout' | 0.0056 | 0.0035 | 742.1250 | 39.5000 |
Module start 'content' | 0.0091 | 0.0791 | 781.6250 | 362.1172 |
Module end 'content' | 0.0882 | 0.0014 | 1,143.7422 | 15.7031 |
Script end | 0.0896 | 1,159.4453 |
Accumulator | Duration (sec) | Duration (%) | Count | Average (sec) |
---|---|---|---|---|
Ini load | ||||
Load cache | 0.0029 | 3.2619 | 15 | 0.0002 |
Check MTime | 0.0012 | 1.2983 | 15 | 0.0001 |
Mysql Total | ||||
Database connection | 0.0007 | 0.7498 | 1 | 0.0007 |
Mysqli_queries | 0.0334 | 37.2651 | 42 | 0.0008 |
Looping result | 0.0003 | 0.2953 | 40 | 0.0000 |
Template Total | 0.0582 | 64.9 | 2 | 0.0291 |
Template load | 0.0021 | 2.3083 | 2 | 0.0010 |
Template processing | 0.0561 | 62.6168 | 2 | 0.0281 |
Template load and register function | 0.0001 | 0.1083 | 1 | 0.0001 |
states | ||||
state_id_array | 0.0012 | 1.3667 | 1 | 0.0012 |
state_identifier_array | 0.0013 | 1.4872 | 2 | 0.0007 |
Override | ||||
Cache load | 0.0017 | 1.9146 | 24 | 0.0001 |
Sytem overhead | ||||
Fetch class attribute name | 0.0021 | 2.3314 | 3 | 0.0007 |
class_abstraction | ||||
Instantiating content class attribute | 0.0000 | 0.0101 | 3 | 0.0000 |
General | ||||
dbfile | 0.0007 | 0.7309 | 10 | 0.0001 |
String conversion | 0.0000 | 0.0101 | 4 | 0.0000 |
Note: percentages do not add up to 100% because some accumulators overlap |
Usage | Requested template | Template | Template loaded | Edit | Override |
---|---|---|---|---|---|
1 | node/view/full.tpl | blog_entry/full.tpl | extension/community_design/design/suncana/override/templates/blog_entry/full.tpl | ||
2 | content/datatype/view/ezxmltext.tpl | <No override> | extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tpl | ||
6 | content/datatype/view/ezxmltags/paragraph.tpl | <No override> | extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tpl | ||
4 | content/datatype/view/ezxmltags/li.tpl | <No override> | design/standard/templates/content/datatype/view/ezxmltags/li.tpl | ||
4 | content/datatype/view/ezxmltags/ul.tpl | <No override> | design/standard/templates/content/datatype/view/ezxmltags/ul.tpl | ||
2 | content/datatype/view/ezxmltags/literal.tpl | <No override> | extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tpl | ||
1 | content/datatype/view/ezxmltags/line.tpl | <No override> | design/standard/templates/content/datatype/view/ezxmltags/line.tpl | ||
1 | content/datatype/view/ezkeyword.tpl | <No override> | extension/community_design/design/suncana/templates/content/datatype/view/ezkeyword.tpl | ||
1 | print_pagelayout.tpl | <No override> | extension/community/design/community/templates/print_pagelayout.tpl | ||
Number of times templates used: 22 Number of unique templates used: 9 |
Time used to render debug report: 0.0002 secs