Fetching template in a workflow event

Author Message

Hans Melis

Monday 12 January 2004 9:00:14 am

I've tried to fetch a template in a workflow event, but it doesn't seem to work. My code is nearly an exact replica of the ezwrapping event, only even more simple.


function execute( &$process, &$event )
    {
        include_once( 'lib/ezutils/classes/ezhttptool.php' );
		
		$http =& eZHTTPTool::instance();
		
		if( $http->hasPostVariable("Next") )
		{
			return EZ_WORKFLOW_TYPE_STATUS_ACCEPTED;
		}
		
		$node =& eZContentObjectTreeNode::fetch(2);
		$requestUri = eZSys::requestUri();
		$process->Template = array( 'templateName' => 'design:workflow/eventtype/result/event_eztemplate.tpl',
									'templateVars' => array( 'score' => 6,
															 'request_uri' => $requestUri ));
		return EZ_WORKFLOW_TYPE_STATUS_FETCH_TEMPLATE_REPEAT;
    }

There are no errors in the debug. The workflow seems to end (running the cronjob doesn't help either), but the original contentobject is still in "My pending list". The template is fine, I've cleared the cache and all.

This looks like a bug, but the ezwrapping event is quite old so maybe the code has changed. Anyone got any ideas how to get this to work?

--
Hans

Hans
http://blog.hansmelis.be

Willie Seabrook

Wednesday 14 January 2004 9:01:50 pm

Hi Hans,

The fetch template feature in workflows is broken. You will find that the event is actually executing if you also write to a log for example. In fact you should check this point first.

Second to that I have a fix for fetching templates. However, its gotten a bit messy: I'm now on ezpublish 3.3 except for the entire folder of /kernel/content which contains all files from 3.1 or 3.2 I think along with my modified edit.php. This is because when I upgraded I couldn't get it to work with only replacing edit.php. Email me willie dot seabrook at levity dot co dot nz if your interested. I warn you of its hackyness though ;-)

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 01:23:19
Script start
Timing: Jan 19 2025 01:23:19
Module start 'layout'
Timing: Jan 19 2025 01:23:19
Module start 'content'
Timing: Jan 19 2025 01:23:19
Module end 'content'
Timing: Jan 19 2025 01:23:19
Script end

Main resources:

Total runtime0.8512 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0101 589.2656152.6250
Module start 'layout' 0.01010.0043 741.890639.4453
Module start 'content' 0.01440.8351 781.3359523.2109
Module end 'content' 0.84960.0016 1,304.54698.1563
Script end 0.8512  1,312.7031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4747160.0003
Check MTime0.00140.1673160.0001
Mysql Total
Database connection0.00280.328610.0028
Mysqli_queries0.793393.1970540.0147
Looping result0.00080.0944520.0000
Template Total0.799193.920.3995
Template load0.00320.376920.0016
Template processing0.795893.493520.3979
Template load and register function0.00020.018210.0002
states
state_id_array0.00090.109210.0009
state_identifier_array0.00170.204220.0009
Override
Cache load0.00240.2840140.0002
Sytem overhead
Fetch class attribute can translate value0.00140.168220.0007
Fetch class attribute name0.00160.187630.0005
XML
Image XML parsing0.00090.110320.0005
class_abstraction
Instantiating content class attribute0.00000.001030.0000
General
dbfile0.00090.1004150.0001
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 11
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs