source: branches/1.2/workflow/inc/engine/compiler/agents_pre.php @ 1349

Revision 1349, 1.1 KB checked in by niltonneto, 15 years ago (diff)

Ticket #561 - Inclusão do módulo Workflow faltante nessa versão.

  • Property svn:executable set to *
Line 
1<?php
2//Code to be executed before an activity by agents
3
4//retrieve agents list
5$activity_agents =& $this->activity->getAgents();
6//for all agents we create ui_agent object to handle agents executing tasks
7foreach ($activity_agents as $agent)
8{
9        //create an empty temp ui_agent object
10        $ui_agent =& createObject('workflow.ui_agent_'.$agent['wf_agent_type']);
11        //build this object
12        $ui_agent->load($agent['wf_agent_id']);
13        //At runtime agents need to handle relations with the instance and the activity
14        $ui_agent->runtime($instance, $activity);
15        //store it in an array
16        $this->agents[$agent['wf_agent_type']] = $ui_agent;
17        //delete the temp object
18        unset($ui_agent);
19}
20
21if (!($GLOBALS['workflow']['__leave_activity']))
22{
23  foreach ($this->agents as $agent_type => $ui_agent)
24  {
25    if (!($ui_agent->run_activity_pre()))
26    {
27      galaxia_show_error($ui_agent->get_error(),false);
28    }
29
30  }
31}
32else
33{
34  foreach ($this->agents as $agent_type => $ui_agent)
35  {
36    if (!($ui_agent->run_leaving_activity_pre()))
37    {
38      galaxia_show_error($ui_agent->get_error(), false);
39    }
40  }
41}
42?>
Note: See TracBrowser for help on using the repository browser.