Creating a new trigger. Need help

Author Message

Luis Muñoz

Wednesday 25 August 2004 2:25:57 am

Is it possible to create a trigger which executes a workflow only when a new object of one class is published but not executed when any other thing is published? I need to create triggers for three different content classes and leave the rest without trigger. Is there any other way to do this?

Thanks
Luis

Eirik Alfstad Johansen

Wednesday 25 August 2004 3:42:20 am

Hi Luis,

Personally, I've done this the manual way, by starting the worflow with some code like this:

$db =& eZDB::instance();
		
		// fetch most recently modified content object
		$query =<<<EOF
SELECT
	id, 
	contentclass_id,
	current_version
FROM
	ezcontentobject
WHERE
	status = 1
ORDER BY
	modified DESC
LIMIT
	0,1
EOF;

		// for each returned row
		foreach($db->arrayQuery($query) as $temp)
		{
			// store in result in $object
			$object = $temp;
		}
		
		$contentClassID = $object['contentclass_id'];

Hope this helps!

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Paul Forsyth

Wednesday 25 August 2004 4:29:31 am

You only need to create a new workflow event for this. Use content/publish/after as the trigger and within the event you can decide whether the object is of the right class and do the right thing.

Have a look at creating a workflow event in the docs and come back to this thread if you have problems.

paul

luis muñoz

Wednesday 25 August 2004 4:54:55 am

I created an event multiplexer workflow which first send an email to the user who published the object and after that begins an approval workflow. The problem is that I don&#8217;t want that this workflow executes with forum items. How can I filter the class in both mailer and approval workflows? Or how can I filter in event multiplexer workflow?
I&#8217;m sure that object class is in the parameters that the workflow get but I don&#8217;t know how to get it.

Thanks in advance
Luis

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:21:37
Script start
Timing: Jan 19 2025 01:21:37
Module start 'layout'
Timing: Jan 19 2025 01:21:37
Module start 'content'
Timing: Jan 19 2025 01:21:38
Module end 'content'
Timing: Jan 19 2025 01:21:38
Script end

Main resources:

Total runtime0.7930 sec
Peak memory usage4,096.0000 KB
Database Queries64

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0075 589.1641152.6250
Module start 'layout' 0.00750.0032 741.789139.4609
Module start 'content' 0.01070.7809 781.2500610.5938
Module end 'content' 0.79160.0014 1,391.843812.1563
Script end 0.7930  1,404.0000 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.4275160.0002
Check MTime0.00140.1709160.0001
Mysql Total
Database connection0.00090.114210.0009
Mysqli_queries0.741593.5030640.0116
Looping result0.00150.1884620.0000
Template Total0.754195.120.3771
Template load0.00230.289820.0011
Template processing0.751894.798720.3759
Template load and register function0.00020.022310.0002
states
state_id_array0.00180.226610.0018
state_identifier_array0.00100.130520.0005
Override
Cache load0.00200.2461210.0001
Sytem overhead
Fetch class attribute can translate value0.00060.072140.0001
Fetch class attribute name0.00100.125650.0002
XML
Image XML parsing0.00080.102940.0002
class_abstraction
Instantiating content class attribute0.00000.001550.0000
General
dbfile0.00110.1436160.0001
String conversion0.00000.001240.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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs