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 | /** |
---|
13 | * Classe que implementa algumas ações que se repetem em várias partes do módulo |
---|
14 | * @package Workflow |
---|
15 | * @author Sidnei Augusto Drovetto Jr. - drovetto@gmail.com |
---|
16 | * @license http://www.gnu.org/copyleft/gpl.html GPL |
---|
17 | */ |
---|
18 | class WorkflowMacro |
---|
19 | { |
---|
20 | /** |
---|
21 | * Construtor da classe WorkflowMacro |
---|
22 | * @return object Objeto da classe WorkflowMacro |
---|
23 | * @access public |
---|
24 | */ |
---|
25 | public function WorkflowMacro() |
---|
26 | { |
---|
27 | } |
---|
28 | |
---|
29 | /** |
---|
30 | * Prepara o ambiente disponibilizado pelo ExpressoLivre/Workflow |
---|
31 | * @return void |
---|
32 | * @access public |
---|
33 | */ |
---|
34 | public function prepareEnvironment() |
---|
35 | { |
---|
36 | define('SEP', '/'); |
---|
37 | $currentApplication = (php_sapi_name() == 'cli') ? 'login' : 'home'; |
---|
38 | $GLOBALS['phpgw_info']['flags'] = array('noheader' => true, 'nonavbar' => true, 'currentapp' => $currentApplication, 'enable_network_class' => true, 'enable_contacts_class' => true, 'enable_nextmatchs_class' => true); |
---|
39 | require_once dirname(__FILE__) . '/../../header.inc.php'; |
---|
40 | require dirname(__FILE__) . '/../setup/setup.inc.php'; /* DO NOT USE require_once */ |
---|
41 | $GLOBALS['phpgw_info']['apps']['workflow'] = $setup_info['workflow']; |
---|
42 | $row = Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID->query('SELECT config_value FROM phpgw_config WHERE config_app = ? AND config_name = ?', array('phpgwapi', 'files_dir'))->fetchRow(); |
---|
43 | $_SESSION['phpgw_info']['workflow']['vfs_basedir'] = ($row !== false) ? $row['config_value'] : '/home/expressolivre'; |
---|
44 | $_SESSION['phpgw_info']['workflow']['phpgw_api_inc'] = PHPGW_API_INC; |
---|
45 | $_SESSION['phpgw_info']['workflow']['account_id'] = $GLOBALS['phpgw_info']['user']['account_id']; |
---|
46 | $_SESSION['phpgw_info']['workflow']['server']['webserver_url'] = $GLOBALS['phpgw_info']['server']['webserver_url']; |
---|
47 | |
---|
48 | require_once PHPGW_API_INC . '/functions.inc.php'; |
---|
49 | require_once 'engine/class.ajax_config.inc.php'; |
---|
50 | require_once 'engine/config.ajax.inc.php'; |
---|
51 | $GLOBALS['ajax']->ldap = &Factory::getInstance('ajax_ldap'); |
---|
52 | |
---|
53 | /* definição de algumas constantes */ |
---|
54 | define('PHPGW_TEMPLATE_DIR', ExecMethod('phpgwapi.phpgw.common.get_tpl_dir', 'phpgwapi')); |
---|
55 | $_SERVER['DOCUMENT_ROOT'] = PHPGW_SERVER_ROOT; |
---|
56 | } |
---|
57 | |
---|
58 | /** |
---|
59 | * Prepara o ambiente disponibilizado pelo Workflow para um dado processo |
---|
60 | * @return void |
---|
61 | * @access public |
---|
62 | */ |
---|
63 | public function prepareProcessEnvironment($processID) |
---|
64 | { |
---|
65 | require_once PHPGW_SERVER_ROOT . '/workflow/inc/local/functions/local.functions.php'; |
---|
66 | |
---|
67 | $runtime = &Factory::getInstance('WfRuntime'); |
---|
68 | $runtime->loadProcess($processID); |
---|
69 | |
---|
70 | /* GLOBALS */ |
---|
71 | $GLOBALS['workflow']['wf_runtime'] = &$runtime; |
---|
72 | $GLOBALS['workflow']['wf_normalized_name'] = $runtime->process->getNormalizedName(); |
---|
73 | } |
---|
74 | } |
---|
75 | ?> |
---|