1 | <?php |
---|
2 | /**************************************************************************\ |
---|
3 | * eGroupWare * |
---|
4 | * http://www.egroupware.org * |
---|
5 | * -------------------------------------------- * |
---|
6 | * This program is free software; you can redistribute it and/or modify it * |
---|
7 | * under the terms of the GNU General Public License as published by the * |
---|
8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
9 | * option) any later version. * |
---|
10 | \**************************************************************************/ |
---|
11 | |
---|
12 | require_once(dirname(__FILE__) . SEP . 'common.inc.php'); /* including common deifinitions */ |
---|
13 | require_once(dirname(__FILE__) . SEP . 'class.WorkflowUtils.inc.php' ); /* superclass source code */ |
---|
14 | require_once(dirname(__FILE__) . SEP . 'class.basecontroller.inc.php' ); /* module controller */ |
---|
15 | require_once(dirname(__FILE__) . SEP . 'class.basemodel.inc.php' ); /* module logic */ |
---|
16 | |
---|
17 | /** |
---|
18 | * @package Workflow |
---|
19 | * @author Mauricio Luiz Viani - viani@celepar.pr.gov.br |
---|
20 | * @author Sidnei Augusto Drovetto Jr. - drovetto@gmail.com |
---|
21 | * @author Carlos Eduardo Nogueira Goncalves - cadu.br@gmail.com |
---|
22 | * @license GPL |
---|
23 | * @license http://www.gnu.org/copyleft/gpl.html GPL |
---|
24 | */ |
---|
25 | class run_activity extends WorkflowUtils |
---|
26 | { |
---|
27 | /** |
---|
28 | * @var array $public_functions func |
---|
29 | * @access public |
---|
30 | */ |
---|
31 | var $public_functions = array( |
---|
32 | 'go' => true, |
---|
33 | 'goAjax' => true |
---|
34 | ); |
---|
35 | /** |
---|
36 | * @var object $runtime Runtime Object from the workflow engine |
---|
37 | * @access public |
---|
38 | */ |
---|
39 | var $runtime; |
---|
40 | // This is the object we'll be running to obtain the rigth activity |
---|
41 | //var $base_activity; |
---|
42 | //This is the right activity object |
---|
43 | /** |
---|
44 | * @var object $activity Activity engine object. |
---|
45 | * @access public |
---|
46 | */ |
---|
47 | var $activity; |
---|
48 | /** |
---|
49 | * @var object $process Process engine object. Used to retrieve at least paths and configuration values |
---|
50 | * @access public |
---|
51 | */ |
---|
52 | var $process; |
---|
53 | /** |
---|
54 | * @var object $GUI GUI engine object. Act carefully with it. |
---|
55 | * @access public |
---|
56 | */ |
---|
57 | var $GUI; |
---|
58 | /** |
---|
59 | * @var array $message a message array |
---|
60 | * @access public |
---|
61 | */ |
---|
62 | var $message = Array(); |
---|
63 | /** |
---|
64 | * @var object $categories categorie object for categories |
---|
65 | * @access public |
---|
66 | */ |
---|
67 | var $categories; |
---|
68 | /** |
---|
69 | * @var array $conf |
---|
70 | * @access public |
---|
71 | */ |
---|
72 | var $conf = array(); |
---|
73 | /** |
---|
74 | * @var $wf_template local activity template |
---|
75 | * @access public |
---|
76 | */ |
---|
77 | var $wf_template; |
---|
78 | /** |
---|
79 | * @var object $instance |
---|
80 | * @access public |
---|
81 | */ |
---|
82 | var $instance; |
---|
83 | /** |
---|
84 | * @var object $activity_type The type of activity |
---|
85 | * @access public |
---|
86 | */ |
---|
87 | var $activity_type; |
---|
88 | // then we retain all usefull vars as members, to make them avaible in user's source code |
---|
89 | // theses are data which can be set before the user code and which are not likely to change because of the user code |
---|
90 | /** |
---|
91 | * @var int $process_id The process id |
---|
92 | * @access public |
---|
93 | */ |
---|
94 | var $process_id; |
---|
95 | /** |
---|
96 | * @var int $activity_id The activity id |
---|
97 | * @access public |
---|
98 | */ |
---|
99 | var $activity_id; |
---|
100 | /** |
---|
101 | * @var int $process_name The process name |
---|
102 | * @access public |
---|
103 | */ |
---|
104 | var $process_name; |
---|
105 | /** |
---|
106 | * @var int $process_version The process_version |
---|
107 | * @access public |
---|
108 | */ |
---|
109 | var $process_version; |
---|
110 | /** |
---|
111 | * @var int $activity_name The process id |
---|
112 | * @access public |
---|
113 | */ |
---|
114 | var $activity_name; |
---|
115 | /** |
---|
116 | * @var int $user_name The user name |
---|
117 | * @access public |
---|
118 | */ |
---|
119 | var $user_name; |
---|
120 | /** |
---|
121 | * @var int $view_activity activity id of the view activity avaible for this process |
---|
122 | * @access public |
---|
123 | */ |
---|
124 | var $view_activity; |
---|
125 | // theses 4 vars aren't avaible for the user code, they're set only after this user code was executed |
---|
126 | /** |
---|
127 | * @var int $instance_id Instance id |
---|
128 | * @access public |
---|
129 | */ |
---|
130 | var $instance_id=0; |
---|
131 | /** |
---|
132 | * @var string $instance_name Instance name |
---|
133 | * @access public |
---|
134 | */ |
---|
135 | var $instance_name=''; |
---|
136 | /** |
---|
137 | * @var int $instance_owner Instance owner id |
---|
138 | * @access public |
---|
139 | */ |
---|
140 | var $instance_owner=0; |
---|
141 | /** |
---|
142 | * @var string $owner_name Owner name |
---|
143 | * @access public |
---|
144 | */ |
---|
145 | var $owner_name=''; |
---|
146 | |
---|
147 | /** |
---|
148 | * @var bool $print_mode print mode |
---|
149 | * @access public |
---|
150 | */ |
---|
151 | var $print_mode = false; |
---|
152 | /** |
---|
153 | * @var bool $enable_print_mode print mode |
---|
154 | * @access public |
---|
155 | */ |
---|
156 | var $enable_print_mode = false; |
---|
157 | |
---|
158 | /** |
---|
159 | * @var array $act_role_names of roles associated with the activity, usefull for lists of users associated with theses roles |
---|
160 | * @access public |
---|
161 | */ |
---|
162 | var $act_role_names= Array(); |
---|
163 | |
---|
164 | /** |
---|
165 | * @var array $agents Array of ui_agent objects |
---|
166 | * @access public |
---|
167 | */ |
---|
168 | var $agents = Array(); |
---|
169 | |
---|
170 | /** |
---|
171 | * @var object $smarty holds a Smarty instance |
---|
172 | * @access public |
---|
173 | */ |
---|
174 | var $smarty; |
---|
175 | /** |
---|
176 | * @var array $wf holds a global environment vector |
---|
177 | * @access public |
---|
178 | */ |
---|
179 | var $wf; |
---|
180 | /** |
---|
181 | * @var $download_mode activates download mode |
---|
182 | * @access public |
---|
183 | */ |
---|
184 | var $download_mode; |
---|
185 | /** |
---|
186 | * @var string $_template_name holds the template's file name |
---|
187 | * @access public |
---|
188 | */ |
---|
189 | var $_template_name = null; |
---|
190 | /** |
---|
191 | * @var bool Indicates wether the current instance is a child instance or not |
---|
192 | * @access public |
---|
193 | */ |
---|
194 | var $isChildInstance = false; |
---|
195 | /** |
---|
196 | * @var object Stores a 'workflow_smarty' object |
---|
197 | * @access private |
---|
198 | */ |
---|
199 | private $workflowSmarty = null; |
---|
200 | /** |
---|
201 | * @var object Log Object |
---|
202 | * @access private |
---|
203 | */ |
---|
204 | private $logger = null; |
---|
205 | |
---|
206 | /** |
---|
207 | * Constructor |
---|
208 | * |
---|
209 | * @access public |
---|
210 | */ |
---|
211 | function run_activity() |
---|
212 | { |
---|
213 | parent::WorkflowUtils(); |
---|
214 | |
---|
215 | /** |
---|
216 | * We should always use newInstance to instantiate |
---|
217 | * 'workflow_wfruntime' |
---|
218 | */ |
---|
219 | $this->runtime = &Factory::newInstance('workflow_wfruntime'); |
---|
220 | $this->runtime->setDebug(_DEBUG); |
---|
221 | $this->GUI = &Factory::getInstance('workflow_gui'); |
---|
222 | $this->categories = &Factory::getInstance('categories'); |
---|
223 | |
---|
224 | $this->workflowSmarty = &Factory::getInstance('workflow_smarty', false); |
---|
225 | |
---|
226 | // never configure a log of type "firebug" here. This will make goAjax stop running well =( |
---|
227 | $this->logger = &Factory::getInstance('Logger', array('file')); |
---|
228 | |
---|
229 | // TODO: open a new connection to the database under a different username to allow privilege handling on tables |
---|
230 | unset($this->db); |
---|
231 | } |
---|
232 | |
---|
233 | /** |
---|
234 | * This function is used to run all activities for specified instances. it could be interactive activities |
---|
235 | * or automatic activities. this second case is the reason why we return some values |
---|
236 | * @param int $activityId is the activity_id it run |
---|
237 | * @param int $iid is the instance id it run for |
---|
238 | * @param $auto is true by default |
---|
239 | * @return mixed AN ARRAY, or at least true or false. This array can contain : |
---|
240 | * a key 'failure' with an error string the engine will retrieve in instance error messages in case of |
---|
241 | * failure (this will mark your execution as Bad), |
---|
242 | * a key 'debug' with a debug string the engine will retrieve in instance error messages, |
---|
243 | */ |
---|
244 | function go($activity_id=0, $iid=0, $auto=0) |
---|
245 | { |
---|
246 | $totalTime = microtime(true); |
---|
247 | |
---|
248 | $result=Array(); |
---|
249 | |
---|
250 | if ($iid) |
---|
251 | { |
---|
252 | $_REQUEST['iid'] = $iid; |
---|
253 | } |
---|
254 | $iid = $_REQUEST['iid']; |
---|
255 | |
---|
256 | //$activity_id is set when we are in auto mode. In interactive mode we get if from POST or GET |
---|
257 | if (!$activity_id) |
---|
258 | { |
---|
259 | $activity_id = (int)get_var('activity_id', array('GET','POST'), 0); |
---|
260 | } |
---|
261 | |
---|
262 | // load activity and instance |
---|
263 | if (!$activity_id) |
---|
264 | { |
---|
265 | $result['failure'] = $this->runtime->fail(lang('Cannot run unknown activity'), true, _DEBUG, $auto); |
---|
266 | return $result; |
---|
267 | } |
---|
268 | |
---|
269 | //initalising activity and instance objects inside the WfRuntime object |
---|
270 | if (!($this->runtime->loadRuntime($activity_id,$iid))) |
---|
271 | { |
---|
272 | $result['failure'] = $this->runtime->fail(lang('Cannot run the activity'), true, _DEBUG, $auto); |
---|
273 | return $result; |
---|
274 | } |
---|
275 | |
---|
276 | $activity =& $this->runtime->getActivity($activity_id, true, true); |
---|
277 | $this->activity =& $activity; |
---|
278 | // the instance is avaible with $instance or $this->instance |
---|
279 | // note that for standalone activities this instance can be an empty instance object, but false is a bad value |
---|
280 | //$this->instance =& $this->runtime->loadInstance($iid); |
---|
281 | |
---|
282 | // HERE IS A BIG POINT: we map the instance to a runtime object |
---|
283 | // user code will manipulate a stance, thinking it's an instance, but it is |
---|
284 | // in fact a WfRuntime object, mapping all instance functions |
---|
285 | $this->instance =& $this->runtime; |
---|
286 | $instance =& $this->instance; |
---|
287 | $GLOBALS['workflow']['wf_runtime'] =& $this->runtime; |
---|
288 | if (!($instance)) |
---|
289 | { |
---|
290 | $result['failure'] = $this->runtime->fail(lang('Cannot run the activity without instance'), true, _DEBUG, $auto); |
---|
291 | return $result; |
---|
292 | } |
---|
293 | $this->instance_id = $instance->getInstanceId(); |
---|
294 | |
---|
295 | // load process |
---|
296 | $this->process =& $this->runtime->getProcess(); |
---|
297 | if (!($this->process)) |
---|
298 | { |
---|
299 | $result['failure'] = $this->runtime->fail(lang('Cannot run the activity without her process').$instance, true, _DEBUG, $auto); |
---|
300 | return $result; |
---|
301 | } |
---|
302 | |
---|
303 | //set some global variables needed |
---|
304 | $GLOBALS['workflow']['__leave_activity']=false; |
---|
305 | $GLOBALS['user'] = $GLOBALS['phpgw_info']['user']['account_id']; |
---|
306 | |
---|
307 | //load role names, just an information |
---|
308 | $this->act_role_names = $activity->getActivityRoleNames(); |
---|
309 | |
---|
310 | //set some other usefull vars |
---|
311 | $this->activity_type = $activity->getType(); |
---|
312 | $this->process_id = $activity->getProcessId(); |
---|
313 | $this->activity_id = $activity_id; |
---|
314 | $this->process_name = $this->process->getName(); |
---|
315 | $this->process_version = $this->process->getVersion(); |
---|
316 | $this->activity_name = $activity->getName(); |
---|
317 | $this->user_name = $GLOBALS['phpgw']->accounts->id2name($GLOBALS['user']); |
---|
318 | $this->view_activity = $this->GUI->gui_get_process_view_activity($this->process_id); |
---|
319 | |
---|
320 | //we set them in $GLOBALS['workflow'] as well |
---|
321 | $GLOBALS['workflow']['wf_activity_type'] =& $this->activity_type; |
---|
322 | $GLOBALS['workflow']['wf_process_id'] =& $this->process_id; |
---|
323 | $GLOBALS['workflow']['wf_activity_id'] =& $this->activity_id; |
---|
324 | $GLOBALS['workflow']['wf_process_name'] =& $this->process_name; |
---|
325 | $GLOBALS['workflow']['wf_normalized_name'] = $this->process->getNormalizedName(); |
---|
326 | $GLOBALS['workflow']['wf_process_version'] =& $this->process_version; |
---|
327 | $GLOBALS['workflow']['wf_activity_name'] =& $this->activity_name; |
---|
328 | $GLOBALS['workflow']['wf_user_name'] =& $this->user_name; |
---|
329 | $GLOBALS['workflow']['wf_user_id'] =& $GLOBALS['user']; |
---|
330 | $GLOBALS['workflow']['wf_view_activity'] =& $this->view_activity; |
---|
331 | $GLOBALS['workflow']['wf_webserver_url'] = $GLOBALS['phpgw_info']['server']['webserver_url']; |
---|
332 | $GLOBALS['workflow']['wf_workflow_path'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'; |
---|
333 | $GLOBALS['workflow']['wf_resources_path'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'workflow/redirect.php?pid=' . $this->process_id . '&file='; |
---|
334 | $GLOBALS['workflow']['wf_default_resources_path'] = Factory::getInstance('TemplateServer')->generateLink('processes'); |
---|
335 | $GLOBALS['workflow']['wf_workflow_resources_path'] = Factory::getInstance('TemplateServer')->generateLink(''); |
---|
336 | $GLOBALS['workflow']['wf_activity_url'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id; |
---|
337 | $GLOBALS['workflow']['wf_user_cnname'] = Factory::getInstance('WorkflowLDAP')->getName($GLOBALS['user']); |
---|
338 | $GLOBALS['workflow']['wf_back_link'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1'; |
---|
339 | $GLOBALS['workflow']['wf_js_path'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode'; |
---|
340 | $GLOBALS['workflow']['wf_user_activities'] = $this->GUI->gui_list_user_activities($GLOBALS['user'], '0', '-1', 'ga.wf_name__ASC', '', '', false, true, true, true, ''); |
---|
341 | if ($iid) |
---|
342 | $GLOBALS['workflow']['wf_instance_url'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id."&iid=".$iid; |
---|
343 | else |
---|
344 | unset($GLOBALS['workflow']['wf_instance_url']); |
---|
345 | $wf =& $GLOBALS['workflow']; |
---|
346 | |
---|
347 | /* path to the local functions developed by Celepar */ |
---|
348 | $functions = PHPGW_SERVER_ROOT . SEP . 'workflow' . SEP . 'inc' . SEP . 'local' . SEP . 'functions' . SEP . 'local.functions.php'; |
---|
349 | |
---|
350 | /* activate local functions */ |
---|
351 | require_once($functions); |
---|
352 | |
---|
353 | //get configuration options with default values if no init was done before |
---|
354 | $myconf = array( |
---|
355 | 'execute_activities_in_debug_mode' => 0, |
---|
356 | 'execute_activities_using_secure_connection' => 0 |
---|
357 | ); |
---|
358 | //this will give use asked options and som others used by WfRuntime |
---|
359 | $this->conf =& $this->runtime->getConfigValues($myconf); |
---|
360 | if ($this->conf['execute_activities_using_secure_connection']) |
---|
361 | { |
---|
362 | if (($GLOBALS['phpgw_info']['server']['use_https'] > 0) && ($_SERVER['HTTPS'] != 'on') && (!isset($GLOBALS['workflow']['job']['processID']))) |
---|
363 | { |
---|
364 | header("Location: https://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"); |
---|
365 | exit; |
---|
366 | } |
---|
367 | } |
---|
368 | |
---|
369 | if ($auto && (!$this->isChildInstance) && $activity->isInteractive()) |
---|
370 | { |
---|
371 | $actualUser = $GLOBALS['user']; |
---|
372 | $actualUserGroups = $_SESSION['phpgw_info']['workflow']['user_groups']; |
---|
373 | foreach ($instance->instance->activities as $actTmp) |
---|
374 | { |
---|
375 | if ($actTmp['wf_activity_id'] == $activity_id) |
---|
376 | { |
---|
377 | $newUser = $actTmp['wf_user']; |
---|
378 | break; |
---|
379 | } |
---|
380 | } |
---|
381 | |
---|
382 | /* pretend to be the user */ |
---|
383 | $_SESSION['phpgw_info']['workflow']['user_groups'] = galaxia_retrieve_user_groups($newUser); |
---|
384 | $_SESSION['phpgw_info']['workflow']['account_id'] = $newUser; |
---|
385 | $GLOBALS['phpgw_info']['user']['account_id'] = $newUser; |
---|
386 | $GLOBALS['workflow']['wf_user_id'] = $newUser; |
---|
387 | $GLOBALS['user'] = $newUser; |
---|
388 | |
---|
389 | /* check some permissions */ |
---|
390 | if (($newUser == '*') || (!$this->runtime->checkUserRun($newUser)) || (Factory::getInstance('WorkflowLDAP')->getName($newUser) === false)) |
---|
391 | { |
---|
392 | $_SESSION['phpgw_info']['workflow']['user_groups'] = $actualUserGroups; |
---|
393 | $_SESSION['phpgw_info']['workflow']['account_id'] = $actualUser; |
---|
394 | $GLOBALS['phpgw_info']['user']['account_id'] = $actualUser; |
---|
395 | $GLOBALS['workflow']['wf_user_id'] = $actualUser; |
---|
396 | $GLOBALS['user'] = $actualUser; |
---|
397 | |
---|
398 | return false; |
---|
399 | } |
---|
400 | $smarty = Factory::getInstance('process_smarty'); |
---|
401 | } |
---|
402 | |
---|
403 | // run the activity |
---|
404 | //interactive section |
---|
405 | if (!$auto && $activity->isInteractive()) |
---|
406 | { |
---|
407 | |
---|
408 | $this->print_mode = get_var('print_mode', array('POST','GET'), false); |
---|
409 | $this->download_mode = get_var('download_mode', array('POST','GET'), false); |
---|
410 | |
---|
411 | $smarty = Factory::getInstance('process_smarty'); |
---|
412 | |
---|
413 | $smarty->template_dir = GALAXIA_PROCESSES.SEP.$this->process->getNormalizedName().SEP.'code'.SEP.'templates'; |
---|
414 | $smarty->compile_dir = GALAXIA_PROCESSES.SEP.$this->process->getNormalizedName().SEP.'smarty'.SEP.'compiled'; |
---|
415 | $smarty->config_dir = GALAXIA_PROCESSES.SEP.$this->process->getNormalizedName().SEP.'code'.SEP.'templates'; |
---|
416 | $smarty->cache_dir = GALAXIA_PROCESSES.SEP.$this->process->getNormalizedName().SEP.'smarty'.SEP.'cache'; |
---|
417 | $smarty->plugins_dir[] = PHPGW_SERVER_ROOT.SEP.'workflow'.SEP.'inc'.SEP.'smarty'.SEP.'wf_plugins'; |
---|
418 | |
---|
419 | $GLOBALS['phpgw']->template =& $smarty; |
---|
420 | $this->wf_template =& $smarty; |
---|
421 | $_template_name = null; |
---|
422 | |
---|
423 | //set resource path to use in templates |
---|
424 | $smarty->assign('wf_resources_path',$GLOBALS['workflow']['wf_resources_path']); |
---|
425 | $smarty->assign('wf_default_resources_path', $GLOBALS['workflow']['wf_default_resources_path']); |
---|
426 | $smarty->assign('wf_workflow_resources_path', $GLOBALS['workflow']['wf_workflow_resources_path']); |
---|
427 | $smarty->assign('wf_workflow_path',$GLOBALS['workflow']['wf_workflow_path']); |
---|
428 | $smarty->assign('wf_js_path',$GLOBALS['workflow']['wf_js_path']); |
---|
429 | $smarty->assign('wf_back_link',$GLOBALS['workflow']['wf_back_link']); |
---|
430 | $smarty->assign('wf_activity_url',$GLOBALS['workflow']['wf_activity_url']); |
---|
431 | |
---|
432 | /* register the prefilter smarty plugin wf_default_template */ |
---|
433 | $smarty->load_filter('pre', 'wf_default_template'); |
---|
434 | } |
---|
435 | |
---|
436 | if ($this->conf['execute_activities_in_debug_mode']) |
---|
437 | { |
---|
438 | ini_set('display_errors',true); |
---|
439 | error_reporting(E_ALL & ~E_NOTICE); |
---|
440 | } |
---|
441 | |
---|
442 | /* BEGIN WORKFLOW MVC SETTINGS */ |
---|
443 | $env = array(); //create settings vector |
---|
444 | $env['view'] =& $smarty; //view layer instance |
---|
445 | $env['template_file'] =& $_template_name; //template file to be shown |
---|
446 | $env['dao'] =& Factory::newInstance('wf_db'); //data access object instance |
---|
447 | $env['workflow'] =& $GLOBALS['workflow']; //workflow environment information |
---|
448 | $env['instance'] =& $instance; //process manager instance |
---|
449 | $env['activity'] =& $activity; //activity manager instance |
---|
450 | $security =& Factory::newInstance('SecurityUtils'); //input sanitizer class |
---|
451 | $env['request'] =& $security->process($_REQUEST); //sanitizes input data from client |
---|
452 | $env['factory'] =& Factory::getInstance('ProcessWrapperFactory'); //instantiation controller class |
---|
453 | $env['natural'] =& Factory::newInstance('wf_natural'); //data access object instance for mainframe |
---|
454 | /* END WORKFLOW MVC SETTINGS */ |
---|
455 | |
---|
456 | $GLOBALS['workflow_env'] = &$env; |
---|
457 | |
---|
458 | /** |
---|
459 | * [__leave_activity] is setted if needed in the xxx_pre code or by the user in his code |
---|
460 | * HERE the user code is 'executed'. Note that we do not use include_once or require_once because |
---|
461 | * it could the same code several times with automatic activities looping in the graph and it still |
---|
462 | * need to be executed |
---|
463 | */ |
---|
464 | $_engineProcessCodeDirectory = GALAXIA_PROCESSES . SEP . $this->process->getNormalizedName(). SEP . 'code'; |
---|
465 | $_engineCompilerDirectory = GALAXIA_LIBRARY . SEP . 'compiler'; |
---|
466 | $_engineFiles = array(); |
---|
467 | |
---|
468 | /* generate the list of needed files */ |
---|
469 | $_engineFiles[] = "{$_engineProcessCodeDirectory}/shared.php"; |
---|
470 | $_engineFiles[] = "{$_engineCompilerDirectory}/_shared_pre.php"; |
---|
471 | $_engineFiles[] = "{$_engineCompilerDirectory}/{$activity->getType()}_pre.php"; |
---|
472 | if ($activity->getAgents() !== false) |
---|
473 | $_engineFiles[] = "{$_engineCompilerDirectory}/agents_pre.php"; |
---|
474 | $_engineFiles[] = "{$_engineProcessCodeDirectory}/activities/{$activity->getNormalizedName()}.php"; |
---|
475 | $_engineFiles[] = "{$_engineCompilerDirectory}/{$activity->getType()}_pos.php"; |
---|
476 | if ($activity->getAgents() !== false) |
---|
477 | $_engineFiles[] = "{$_engineCompilerDirectory}/agents_pos.php"; |
---|
478 | $_engineFiles[] = "{$_engineCompilerDirectory}/_shared_pos.php"; |
---|
479 | |
---|
480 | /* check if the required files exists */ |
---|
481 | foreach ($_engineFiles as $_engineFile) |
---|
482 | if (!file_exists($_engineFile)) |
---|
483 | return array('failure' => $this->runtime->fail(lang('the following file could not be found: %1', $_engineFile), true, _DEBUG)); |
---|
484 | |
---|
485 | /* activate the security policy */ |
---|
486 | Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); |
---|
487 | |
---|
488 | /** |
---|
489 | * Here we are going to use our new Security static class. |
---|
490 | * From now, the factory frontend (static) will forward |
---|
491 | * the messages for the process factory instead of Workflow |
---|
492 | * factory. |
---|
493 | */ |
---|
494 | Security::enable(); |
---|
495 | |
---|
496 | /* include the files */ |
---|
497 | $processTime = microtime(true); |
---|
498 | |
---|
499 | foreach ($_engineFiles as $_engineFile) |
---|
500 | require_once $_engineFile; |
---|
501 | |
---|
502 | $processTime = (microtime(true) - $processTime); |
---|
503 | |
---|
504 | unset($GLOBALS['workflow_env']); |
---|
505 | |
---|
506 | /* check if the developer wants to user the download mode */ |
---|
507 | if (isset($GLOBALS['workflow']['downloadMode']) && ($GLOBALS['workflow']['downloadMode'] == true)) |
---|
508 | $this->download_mode = true; |
---|
509 | |
---|
510 | if ($auto && (!$this->isChildInstance) && $activity->isInteractive() && (!empty($actualUser))) |
---|
511 | { |
---|
512 | $_SESSION['phpgw_info']['workflow']['user_groups'] = $actualUserGroups; |
---|
513 | $_SESSION['phpgw_info']['workflow']['account_id'] = $actualUser; |
---|
514 | $GLOBALS['phpgw_info']['user']['account_id'] = $actualUser; |
---|
515 | $GLOBALS['workflow']['wf_user_id'] = $actualUser; |
---|
516 | $GLOBALS['user'] = $actualUser; |
---|
517 | } |
---|
518 | |
---|
519 | //Now that the instance is ready and that user code has maybe change some things |
---|
520 | // we can catch some others usefull vars |
---|
521 | $this->instance_id = $instance->getInstanceId(); |
---|
522 | $this->instance_name = $instance->getName(); |
---|
523 | $this->instance_owner = $instance->getOwner(); |
---|
524 | $this->owner_name = $GLOBALS['phpgw']->accounts->id2name($this->instance_owner); |
---|
525 | if ($this->owner_name == '') |
---|
526 | { |
---|
527 | $this->owner_name = lang('Nobody'); |
---|
528 | } |
---|
529 | $GLOBALS['workflow']['wf_instance_id'] =& $this->instance_id; |
---|
530 | $GLOBALS['workflow']['wf_instance_name']=& $this->instance_name; |
---|
531 | $GLOBALS['workflow']['wf_instance_owner']=& $this->instance_owner; |
---|
532 | $GLOBALS['workflow']['wf_owner_name']=& $this->owner_name; |
---|
533 | |
---|
534 | //was template changed? |
---|
535 | if ($_template_name) |
---|
536 | { |
---|
537 | $this->_template_name = $_template_name; |
---|
538 | } |
---|
539 | else |
---|
540 | { |
---|
541 | $this->_template_name = $this->activity->getNormalizedName().'.tpl'; |
---|
542 | } |
---|
543 | |
---|
544 | $totalTime = (microtime(true) - $totalTime); |
---|
545 | |
---|
546 | $logTime = sprintf("GO [pid=%s,iid=%s,uid=%s,aid=%s] [eng=%ss,proc=%ss]", |
---|
547 | $this->process_id, |
---|
548 | $this->instance_id, |
---|
549 | $GLOBALS['user'], |
---|
550 | $this->activity_id, |
---|
551 | number_format(($totalTime - $processTime),3), |
---|
552 | number_format($processTime,3) ); |
---|
553 | |
---|
554 | $this->logger->debug($logTime); |
---|
555 | |
---|
556 | // TODO: process instance comments |
---|
557 | $instructions = $this->runtime->handle_postUserCode(_DEBUG); |
---|
558 | switch($instructions['action']) |
---|
559 | { |
---|
560 | //interactive activity completed |
---|
561 | case 'completed': |
---|
562 | // re-retrieve instance data which could have been modified by an automatic activity |
---|
563 | $this->instance_id = $instance->getInstanceId(); |
---|
564 | $this->instance_name = $instance->getName(); |
---|
565 | $this->activityCompleteMessage = $instance->getActivityCompleteMessage(); |
---|
566 | |
---|
567 | if (!$auto) |
---|
568 | { |
---|
569 | $this->assignCommonVariables(); |
---|
570 | // and display completed template |
---|
571 | if ($GLOBALS['phpgw_info']['user']['preferences']['workflow']['show_activity_complete_page'] === '0') |
---|
572 | header('Location: workflow/index.php'); |
---|
573 | else |
---|
574 | $this->showCompletedPage(); |
---|
575 | } |
---|
576 | break; |
---|
577 | //interactive activity still in interactive mode |
---|
578 | case 'loop': |
---|
579 | if (!$auto) |
---|
580 | { |
---|
581 | $this->assignCommonVariables(); |
---|
582 | $this->showForm(); |
---|
583 | } |
---|
584 | break; |
---|
585 | //nothing more |
---|
586 | case 'leaving': |
---|
587 | if (!$auto) |
---|
588 | { |
---|
589 | $this->assignCommonVariables(); |
---|
590 | $this->showCancelledPage(); |
---|
591 | } |
---|
592 | break; |
---|
593 | //non-interactive activities, auto-mode |
---|
594 | case 'return': |
---|
595 | $result=Array(); |
---|
596 | $this->message[] = $this->GUI->get_error(false, _DEBUG); |
---|
597 | $this->message[] = $this->runtime->get_error(false, _DEBUG); |
---|
598 | //$this->message[] = $this->process->get_error(false, _DEBUG); |
---|
599 | $result =& $instructions['engine_info']; |
---|
600 | $this->message[] = $result['debug']; |
---|
601 | $result['debug'] = implode('<br />',array_filter($this->message)); |
---|
602 | return $result; |
---|
603 | break; |
---|
604 | default: |
---|
605 | return $this->runtime->fail(lang('unknown instruction from the workflow engine: %1', $instructions['action']), true, _DEBUG); |
---|
606 | break; |
---|
607 | } |
---|
608 | } |
---|
609 | |
---|
610 | /** |
---|
611 | * goajax |
---|
612 | * |
---|
613 | * @param int $activity_id |
---|
614 | * @param int $iid |
---|
615 | * @param bool $auto |
---|
616 | * @return array |
---|
617 | */ |
---|
618 | function goAjax($activity_id=0, $iid=0, $auto=0) |
---|
619 | { |
---|
620 | $totalTime = microtime(true); |
---|
621 | |
---|
622 | $result=Array(); |
---|
623 | |
---|
624 | if ($iid) |
---|
625 | $_REQUEST['iid'] = $iid; |
---|
626 | $iid = $_REQUEST['iid']; |
---|
627 | |
---|
628 | //$activity_id is set when we are in auto mode. In interactive mode we get if from POST or GET |
---|
629 | if (!$activity_id) |
---|
630 | $activity_id = (int)get_var('activity_id', array('GET','POST'), 0); |
---|
631 | |
---|
632 | // load activity and instance |
---|
633 | if (!$activity_id) |
---|
634 | { |
---|
635 | $result['failure'] = $this->runtime->fail(lang('Cannot run unknown activity'), true, _DEBUG, $auto); |
---|
636 | return $result; |
---|
637 | } |
---|
638 | |
---|
639 | //initalising activity and instance objects inside the WfRuntime object |
---|
640 | if (!($this->runtime->loadRuntime($activity_id,$iid))) |
---|
641 | { |
---|
642 | $result['failure'] = $this->runtime->fail(lang('Cannot run the activity'), true, _DEBUG, $auto); |
---|
643 | return $result; |
---|
644 | } |
---|
645 | |
---|
646 | $activity =& $this->runtime->getActivity($activity_id, true, true); |
---|
647 | $this->activity =& $activity; |
---|
648 | // the instance is avaible with $instance or $this->instance |
---|
649 | // note that for standalone activities this instance can be an empty instance object, but false is a bad value |
---|
650 | // HERE IS A BIG POINT: we map the instance to a runtime object |
---|
651 | // user code will manipulate a stance, thinking it's an instance, but it is |
---|
652 | // in fact a WfRuntime object, mapping all instance functions |
---|
653 | $this->instance =& $this->runtime; |
---|
654 | $instance =& $this->instance; |
---|
655 | $GLOBALS['workflow']['wf_runtime'] =& $this->runtime; |
---|
656 | if (!($instance)) |
---|
657 | { |
---|
658 | $result['failure'] = $this->runtime->fail(lang('Cannot run the activity without instance'), true, _DEBUG, $auto); |
---|
659 | return $result; |
---|
660 | } |
---|
661 | $this->instance_id = $instance->getInstanceId(); |
---|
662 | |
---|
663 | // load process |
---|
664 | $this->process =& $this->runtime->getProcess(); |
---|
665 | if (!($this->process)) |
---|
666 | { |
---|
667 | $result['failure'] = $this->runtime->fail(lang('Cannot run the activity without her process').$instance, true, _DEBUG, $auto); |
---|
668 | return $result; |
---|
669 | } |
---|
670 | |
---|
671 | //set some global variables needed |
---|
672 | $GLOBALS['user'] = $GLOBALS['phpgw_info']['user']['account_id']; |
---|
673 | |
---|
674 | //load role names, just an information |
---|
675 | $this->act_role_names = $activity->getActivityRoleNames(); |
---|
676 | |
---|
677 | //set some other usefull vars |
---|
678 | $this->activity_type = $activity->getType(); |
---|
679 | $this->process_id = $activity->getProcessId(); |
---|
680 | $this->activity_id = $activity_id; |
---|
681 | $this->process_name = $this->process->getName(); |
---|
682 | $this->process_version = $this->process->getVersion(); |
---|
683 | $this->activity_name = $activity->getName(); |
---|
684 | $this->user_name = $GLOBALS['phpgw']->accounts->id2name($GLOBALS['user']); |
---|
685 | $this->view_activity = $this->GUI->gui_get_process_view_activity($this->process_id); |
---|
686 | |
---|
687 | //we set them in $GLOBALS['workflow'] as well |
---|
688 | $GLOBALS['workflow']['wf_activity_type'] =& $this->activity_type; |
---|
689 | $GLOBALS['workflow']['wf_process_id'] =& $this->process_id; |
---|
690 | $GLOBALS['workflow']['wf_activity_id'] =& $this->activity_id; |
---|
691 | $GLOBALS['workflow']['wf_process_name'] =& $this->process_name; |
---|
692 | $GLOBALS['workflow']['wf_normalized_name'] = $this->process->getNormalizedName(); |
---|
693 | $GLOBALS['workflow']['wf_process_version'] =& $this->process_version; |
---|
694 | $GLOBALS['workflow']['wf_activity_name'] =& $this->activity_name; |
---|
695 | $GLOBALS['workflow']['wf_user_name'] =& $this->user_name; |
---|
696 | $GLOBALS['workflow']['wf_user_id'] =& $GLOBALS['user']; |
---|
697 | $GLOBALS['workflow']['wf_view_activity'] =& $this->view_activity; |
---|
698 | $GLOBALS['workflow']['wf_workflow_path'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'; |
---|
699 | $GLOBALS['workflow']['wf_resources_path'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'workflow/redirect.php?pid=' . $this->process_id . '&file='; |
---|
700 | $GLOBALS['workflow']['wf_default_resources_path'] = Factory::getInstance('TemplateServer')->generateLink('processes'); |
---|
701 | $GLOBALS['workflow']['wf_workflow_resources_path'] = Factory::getInstance('TemplateServer')->generateLink(''); |
---|
702 | $GLOBALS['workflow']['wf_activity_url'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id; |
---|
703 | $GLOBALS['workflow']['wf_user_cnname'] = Factory::getInstance('WorkflowLDAP')->getName($GLOBALS['user']); |
---|
704 | $GLOBALS['workflow']['wf_back_link'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1'; |
---|
705 | $GLOBALS['workflow']['wf_js_path'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode'; |
---|
706 | $GLOBALS['workflow']['wf_user_activities'] = $this->GUI->gui_list_user_activities($GLOBALS['user'], '0', '-1', 'ga.wf_name__ASC', '', '', false, true, true, true, ''); |
---|
707 | if ($iid) |
---|
708 | $GLOBALS['workflow']['wf_instance_url'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id."&iid=".$iid; |
---|
709 | else |
---|
710 | unset($GLOBALS['workflow']['wf_instance_url']); |
---|
711 | |
---|
712 | /* activate local functions */ |
---|
713 | require_once(PHPGW_SERVER_ROOT . SEP . 'workflow' . SEP . 'inc' . SEP . 'local' . SEP . 'functions' . SEP . 'local.functions.php'); |
---|
714 | |
---|
715 | //get configuration options with default values if no init was done before |
---|
716 | $myconf = array( |
---|
717 | 'execute_activities_in_debug_mode' => 0, |
---|
718 | 'execute_activities_using_secure_connection' => 0 |
---|
719 | ); |
---|
720 | //this will give use asked options and som others used by WfRuntime |
---|
721 | $this->conf =& $this->runtime->getConfigValues($myconf); |
---|
722 | |
---|
723 | // run the activity |
---|
724 | if ($this->conf['execute_activities_in_debug_mode']) |
---|
725 | { |
---|
726 | ini_set('display_errors',true); |
---|
727 | error_reporting(E_ALL & ~E_NOTICE); |
---|
728 | } |
---|
729 | |
---|
730 | /* BEGIN WORKFLOW MVC SETTINGS */ |
---|
731 | $env = array(); //create settings vector |
---|
732 | $env['dao'] =& Factory::newInstance('wf_db'); //data access object instance |
---|
733 | $env['workflow'] =& $GLOBALS['workflow']; //workflow environment information |
---|
734 | $env['instance'] =& $instance; //process manager instance |
---|
735 | $env['activity'] =& $activity; //activity manager instance |
---|
736 | $security =& Factory::newInstance('SecurityUtils'); //input sanitizer class |
---|
737 | $env['request'] =& $security->process($_REQUEST); //sanitizes input data from client |
---|
738 | $env['factory'] =& Factory::newInstance('ProcessWrapperFactory'); //instantiation controller class |
---|
739 | $env['natural'] =& Factory::newInstance('wf_natural'); //data access object instance for mainframe |
---|
740 | /* END WORKFLOW MVC SETTINGS */ |
---|
741 | |
---|
742 | require_once(dirname(__FILE__) . SEP . 'nano' . SEP . 'JSON.php'); |
---|
743 | require_once(dirname(__FILE__) . SEP . 'nano' . SEP . 'NanoUtil.class.php'); |
---|
744 | require_once(dirname(__FILE__) . SEP . 'nano' . SEP . 'NanoJsonConverter.class.php'); |
---|
745 | require_once(dirname(__FILE__) . SEP . 'nano' . SEP . 'NanoRequest.class.php'); |
---|
746 | require_once(dirname(__FILE__) . SEP . 'nano' . SEP . 'NanoController.class.php'); |
---|
747 | |
---|
748 | /* activate the security policy */ |
---|
749 | Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); |
---|
750 | |
---|
751 | /** |
---|
752 | * here we are going to use our new Security static class. |
---|
753 | * From now, the factory frontend (static) will forward |
---|
754 | * the messages for the process factory instead of Workflow |
---|
755 | * factory. Note that this is the same comment as the previous |
---|
756 | * function... boooring.. |
---|
757 | */ |
---|
758 | Security::enable(); |
---|
759 | |
---|
760 | $GLOBALS['workflow_env'] = &$env; |
---|
761 | $nc = &Factory::newInstance('NanoController'); |
---|
762 | $nc->setClassPath(GALAXIA_PROCESSES . SEP . $this->process->getNormalizedName(). SEP . 'code'); |
---|
763 | |
---|
764 | $processTime = microtime(true); |
---|
765 | $nc->iterateOverVirtualRequests(); |
---|
766 | $processTime = microtime(true) - $processTime; |
---|
767 | |
---|
768 | $nc->outputResultData(); |
---|
769 | unset($GLOBALS['workflow_env']); |
---|
770 | |
---|
771 | if (!is_null($iid)) |
---|
772 | $instance->instance->sync(); |
---|
773 | |
---|
774 | $totalTime = microtime(true) - $totalTime; |
---|
775 | |
---|
776 | $logTime = sprintf("GOAJAX [pid=%s,iid=%s,uid=%s,aid=%s] [eng=%ss,proc=%ss]", |
---|
777 | $this->process_id, |
---|
778 | $this->instance_id, |
---|
779 | $GLOBALS['user'], |
---|
780 | $this->activity_id, |
---|
781 | number_format(($totalTime - $processTime),3), |
---|
782 | number_format($processTime,3) ); |
---|
783 | |
---|
784 | $this->logger->debug($logTime); |
---|
785 | } |
---|
786 | |
---|
787 | /** |
---|
788 | * Create a child instance |
---|
789 | * |
---|
790 | * @param int $activityID |
---|
791 | * @param mixed $properties |
---|
792 | * @param string $user |
---|
793 | * @param bool $parentLock |
---|
794 | * @return int The instance ID of the just created instance |
---|
795 | * @access public |
---|
796 | */ |
---|
797 | function goChildInstance($activityID, $properties, $user, $parentLock) |
---|
798 | { |
---|
799 | $this->isChildInstance = true; |
---|
800 | $this->runtime->instance->isChildInstance = true; |
---|
801 | $this->runtime->instance->activityID = $activityID; |
---|
802 | $this->runtime->instance->parentLock = $parentLock; |
---|
803 | $this->runtime->instance->setProperties($properties); |
---|
804 | if ($user != '*') |
---|
805 | $this->runtime->setNextUser($user); |
---|
806 | |
---|
807 | /* run the selected activity */ |
---|
808 | ob_start(); |
---|
809 | $this->go($activityID, 0, true); |
---|
810 | ob_end_clean(); |
---|
811 | |
---|
812 | /* return the just created child instance */ |
---|
813 | return $this->runtime->instance_id; |
---|
814 | } |
---|
815 | |
---|
816 | /** |
---|
817 | * Show the page avaible when completing an activity |
---|
818 | * @return void |
---|
819 | * @access public |
---|
820 | */ |
---|
821 | function showCompletedPage() |
---|
822 | { |
---|
823 | $this->workflowSmarty->assign('activityEvent', 'completed'); |
---|
824 | $this->showAfterRunningPage(); |
---|
825 | } |
---|
826 | |
---|
827 | /** |
---|
828 | * Show the page avaible when leaving an activity |
---|
829 | * @return void |
---|
830 | * @access public |
---|
831 | */ |
---|
832 | function showCancelledPage() |
---|
833 | { |
---|
834 | $this->workflowSmarty->assign('activityEvent', 'cancelled'); |
---|
835 | $this->showAfterRunningPage(); |
---|
836 | } |
---|
837 | |
---|
838 | /** |
---|
839 | * Common code of pages showed after activity pages |
---|
840 | * @return void |
---|
841 | * @access public |
---|
842 | */ |
---|
843 | function showAfterRunningPage() |
---|
844 | { |
---|
845 | /* get the header/footer */ |
---|
846 | $this->assignHeader(); |
---|
847 | |
---|
848 | /* generate the activity list */ |
---|
849 | $processActivities = array_filter($GLOBALS['workflow']['wf_user_activities']['data'], create_function('$a', 'return ($a["wf_p_id"] == ' . $GLOBALS['workflow']['wf_process_id'] . ');')); |
---|
850 | $activityList = array(0 => '-- Selecione uma atividade --'); |
---|
851 | foreach ($processActivities as $processActivity) |
---|
852 | $activityList[$processActivity['wf_activity_id']] = $processActivity['wf_name']; |
---|
853 | |
---|
854 | /* assign some variables */ |
---|
855 | $this->workflowSmarty->assign('processName', $this->process_name); |
---|
856 | $this->workflowSmarty->assign('processVersion', $this->process_version); |
---|
857 | $this->workflowSmarty->assign('activityName', $this->activity_name); |
---|
858 | $this->workflowSmarty->assign('activityCompleteMessage', $this->activityCompleteMessage); |
---|
859 | $this->workflowSmarty->assign('activityBaseURL', $GLOBALS['phpgw_info']['server']['webserver_url']); |
---|
860 | $this->workflowSmarty->assign('activityList', $activityList); |
---|
861 | |
---|
862 | /* display the template */ |
---|
863 | $this->workflowSmarty->display('after_running.tpl'); |
---|
864 | } |
---|
865 | |
---|
866 | /** |
---|
867 | * Assign common information of interactive forms (e.g., error messages) |
---|
868 | * @return void |
---|
869 | * @access public |
---|
870 | */ |
---|
871 | function assignCommonVariables() |
---|
872 | { |
---|
873 | $this->message[] = $this->GUI->get_error(false, _DEBUG); |
---|
874 | $this->message[] = $this->runtime->get_error(false, _DEBUG); |
---|
875 | $activityErrors = array_filter(array_merge(explode('<br />', $this->message[0]), explode('<br />', $this->message[1]))); |
---|
876 | $this->workflowSmarty->assign('activityErrors', $activityErrors); |
---|
877 | } |
---|
878 | |
---|
879 | /** |
---|
880 | * Show the activity page (workflow template and activity template) |
---|
881 | * @return void |
---|
882 | * @access public |
---|
883 | */ |
---|
884 | function showForm() |
---|
885 | { |
---|
886 | /* define the header */ |
---|
887 | $this->assignHeader(); |
---|
888 | |
---|
889 | /* define the variables */ |
---|
890 | $activityOutput = $this->wf_template->fetch($this->_template_name); |
---|
891 | $actionURL = isset($GLOBALS['workflow']['wf_instance_url']) ? $GLOBALS['workflow']['wf_instance_url'] : $GLOBALS['workflow']['wf_activity_url']; |
---|
892 | $CSSLink = $this->get_css_link('run_activity', $this->print_mode); |
---|
893 | $CSSMedia = $this->print_mode ? 'print' : 'all'; |
---|
894 | |
---|
895 | /* assign the variables to smarty */ |
---|
896 | $this->workflowSmarty->assign('activityOutput', $activityOutput); |
---|
897 | $this->workflowSmarty->assign('actionURL', $actionURL); |
---|
898 | $this->workflowSmarty->assign('CSSLink', $CSSLink); |
---|
899 | $this->workflowSmarty->assign('CSSMedia', $CSSMedia); |
---|
900 | |
---|
901 | $this->workflowSmarty->display('run_activity.tpl'); |
---|
902 | unset($smarty); |
---|
903 | } |
---|
904 | |
---|
905 | /** |
---|
906 | * Define if the header, footer and navigation bar will be shown |
---|
907 | * @return void |
---|
908 | * @access public |
---|
909 | */ |
---|
910 | function assignHeader() |
---|
911 | { |
---|
912 | $headerConfig = 0; |
---|
913 | if (!$this->download_mode and !$this->print_mode) |
---|
914 | { |
---|
915 | $headerConfig |= workflow_smarty::SHOW_HEADER | workflow_smarty::SHOW_FOOTER; |
---|
916 | if ($this->runtime->activity->child_name != 'View') |
---|
917 | $headerConfig |= workflow_smarty::SHOW_NAVIGATION_BAR; |
---|
918 | } |
---|
919 | |
---|
920 | $this->workflowSmarty->setHeader($headerConfig); |
---|
921 | $this->workflowSmarty->assign('header', $this->workflowSmarty->expressoHeader); |
---|
922 | $this->workflowSmarty->assign('footer', $this->workflowSmarty->expressoFooter); |
---|
923 | } |
---|
924 | } |
---|
925 | ?> |
---|