Changeset 1293
- Timestamp:
- 08/07/09 16:06:07 (15 years ago)
- Location:
- sandbox/workflow/2.0
- Files:
-
- 5 added
- 1 deleted
- 90 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
sandbox/workflow/2.0/controller.php
r795 r1293 12 12 { 13 13 require_once dirname(__FILE__) . '/inc/common.inc.php'; 14 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment();14 Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 15 15 } 16 16 -
sandbox/workflow/2.0/inc/class.CachedLDAP.inc.php
r1067 r1293 97 97 98 98 /* load the information and establish a connection */ 99 $tmpLDAP = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');99 $tmpLDAP =& Factory::getInstance('WorkflowLDAP'); 100 100 $this->userContext = $tmpLDAP->getUserContext(); 101 101 $this->groupContext = $tmpLDAP->getGroupContext(); 102 $this->dataSource = &$GLOBALS['workflow']['workflowObjects']->getLDAP();102 $this->dataSource =& Factory::getInstance('WorkflowObjects')->getLDAP(); 103 103 } 104 104 … … 115 115 116 116 /* establish a connection */ 117 $this->DBLink = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID;117 $this->DBLink =& Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 118 118 } 119 119 -
sandbox/workflow/2.0/inc/class.JobRunner.inc.php
r795 r1293 43 43 $this->parameters = unserialize(base64_decode($parameters)); 44 44 $this->parameters['currentDate'] = new DateTime($this->parameters['currentDate']); 45 $this->jobManager = &$GLOBALS['workflow']['factory']->getInstance('WorkflowJobManager');45 $this->jobManager =& Factory::getInstance('WorkflowJobManager'); 46 46 } 47 47 … … 66 66 { 67 67 /* activate the security policy */ 68 $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy();68 Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); 69 69 70 70 if (!file_exists($this->parameters['file'])) … … 94 94 95 95 require_once 'common.inc.php'; 96 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment();96 Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 97 97 98 98 $jobRunner = new JobRunner($argv[1]); -
sandbox/workflow/2.0/inc/class.JobScheduler.inc.php
r795 r1293 57 57 { 58 58 $this->currentDate = new DateTime(date('Y-n-j G:i:00')); 59 $this->db = & $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID;60 $this->jobManager = & $GLOBALS['workflow']['factory']->getInstance('WorkflowJobManager');59 $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 60 $this->jobManager = &Factory::getInstance('WorkflowJobManager'); 61 61 } 62 62 … … 171 171 $previousDir = getcwd(); 172 172 chdir(GALAXIA_LIBRARY . '/../'); 173 $output = $GLOBALS['workflow']['factory']->newInstance('Thread', 'class.JobRunner.inc.php "' . $parameters . '"');173 $output = Factory::newInstance('Thread', 'class.JobRunner.inc.php "' . $parameters . '"'); 174 174 chdir($previousDir); 175 175 return $output; … … 192 192 { 193 193 require_once 'common.inc.php'; 194 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment();194 Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 195 195 196 196 $job = new JobScheduler(); -
sandbox/workflow/2.0/inc/class.Logger.inc.php
r900 r1293 80 80 { 81 81 82 $this->db =& $GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID;82 $this->db =& Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID; 83 83 84 84 if(!empty($curProcessName)){ -
sandbox/workflow/2.0/inc/class.ResourcesRedirector.inc.php
r795 r1293 54 54 if (!isset($_SESSION['workflow']['ResourcesRedirector'][$this->pid])) 55 55 { 56 $result = $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID->query('SELECT wf_normalized_name FROM egw_wf_processes WHERE wf_p_id = ?', array($this->pid));56 $result = Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID->query('SELECT wf_normalized_name FROM egw_wf_processes WHERE wf_p_id = ?', array($this->pid)); 57 57 if ($result->numRows() != 1) 58 58 return; … … 94 94 { 95 95 /* em último caso, tenta buscar a informação em banco de dados */ 96 $result = $GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID->query('SELECT config_value FROM phpgw_config WHERE config_app = ? AND config_name = ?', array('phpgwapi', 'files_dir'));96 $result = Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID->query('SELECT config_value FROM phpgw_config WHERE config_app = ? AND config_name = ?', array('phpgwapi', 'files_dir')); 97 97 if (empty($result)) 98 98 return; -
sandbox/workflow/2.0/inc/class.TemplateServer.inc.php
r795 r1293 99 99 else 100 100 { 101 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment();101 Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 102 102 if (!isset($GLOBALS['phpgw_info']['login_template_set'])) 103 103 return false; … … 131 131 { 132 132 /* se não for encontrado em nenhuma variável de ambiente, tenta carregar do banco de dados */ 133 $webServerURL = (string) $GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID->GetOne('SELECT config_value FROM phpgw_config WHERE config_app = ? AND config_name = ?', array('phpgwapi', 'webserver_url'));133 $webServerURL = (string) Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID->GetOne('SELECT config_value FROM phpgw_config WHERE config_app = ? AND config_name = ?', array('phpgwapi', 'webserver_url')); 134 134 $this->WEB_WORKFLOW_BASE = str_replace('//', '/', "{$webServerURL}/workflow"); 135 135 } -
sandbox/workflow/2.0/inc/class.UserPictureProvider.inc.php
r795 r1293 114 114 /* em último caso, tenta buscar a informação em banco de dados */ 115 115 /* prepara o ambiente para a carga de informações sobre o banco de dados */ 116 $result = $GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID->query('SELECT config_value FROM phpgw_config WHERE config_app = ? AND config_name = ?', array('phpgwapi', 'files_dir'));116 $result = Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID->query('SELECT config_value FROM phpgw_config WHERE config_app = ? AND config_name = ?', array('phpgwapi', 'files_dir')); 117 117 if (empty($result)) 118 118 return; … … 141 141 mkdir($baseDirectory, 0770, true); 142 142 143 $contents = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserPicture($this->userID);143 $contents = Factory::getInstance('WorkflowLDAP')->getUserPicture($this->userID); 144 144 $success = true; 145 145 if ($contents !== false) … … 165 165 } 166 166 167 $GLOBALS['workflow']['factory']->getInstance('ResourcesRedirector')->show($filename);167 Factory::getInstance('ResourcesRedirector')->show($filename); 168 168 } 169 169 } -
sandbox/workflow/2.0/inc/class.WorkflowJobManager.inc.php
r795 r1293 16 16 public function WorkflowJobManager() 17 17 { 18 parent::JobManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);18 parent::JobManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 19 19 } 20 20 } -
sandbox/workflow/2.0/inc/class.WorkflowLDAP.inc.php
r795 r1293 50 50 function WorkflowLDAP() 51 51 { 52 $this->dataSource = &$GLOBALS['workflow']['workflowObjects']->getLDAP();52 $this->dataSource =& Factory::getInstance('WorkflowObjects')->getLDAP(); 53 53 54 54 /* get the required parameters */ -
sandbox/workflow/2.0/inc/class.WorkflowMacro.inc.php
r795 r1293 40 40 require dirname(__FILE__) . '/../setup/setup.inc.php'; /* DO NOT USE require_once */ 41 41 $GLOBALS['phpgw_info']['apps']['workflow'] = $setup_info['workflow']; 42 $row = $GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID->query('SELECT config_value FROM phpgw_config WHERE config_app = ? AND config_name = ?', array('phpgwapi', 'files_dir'))->fetchRow();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 43 $_SESSION['phpgw_info']['workflow']['vfs_basedir'] = ($row !== false) ? $row['config_value'] : '/home/expressolivre'; 44 44 $_SESSION['phpgw_info']['workflow']['phpgw_api_inc'] = PHPGW_API_INC; … … 67 67 require_once PHPGW_SERVER_ROOT . '/workflow/inc/local/functions/local.functions.php'; 68 68 69 $runtime = new WfRuntime( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);69 $runtime = new WfRuntime(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 70 70 $runtime->loadProcess($processID); 71 71 -
sandbox/workflow/2.0/inc/class.WorkflowObjects.inc.php
r795 r1293 87 87 { 88 88 /* connect to the database */ 89 $this->cache['DBGalaxia'] = $GLOBALS['workflow']['factory']->newInstance('WorkflowWatcher', $GLOBALS['workflow']['factory']->newForeignInstance('phpgwapi', 'db'));89 $this->cache['DBGalaxia'] = Factory::newInstance('WorkflowWatcher', Factory::newForeignInstance('phpgwapi', 'db')); 90 90 $this->cache['DBGalaxia']->disconnect(); /* for some reason it won't connect to the desired database unless we disconnect it first */ 91 91 $this->cache['DBGalaxia']->Halt_On_Error = 'no'; … … 98 98 $dbConfigValues['workflow_database_type'] 99 99 ); 100 $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->removeSensitiveInformationFromDatabaseObject($this->cache['DBGalaxia']);101 $this->cache['DBGalaxia']->Link_ID = $GLOBALS['workflow']['factory']->newInstance('WorkflowWatcher', $this->cache['DBGalaxia']->Link_ID);100 Factory::getInstance('WorkflowSecurity')->removeSensitiveInformationFromDatabaseObject($this->cache['DBGalaxia']); 101 $this->cache['DBGalaxia']->Link_ID = Factory::newInstance('WorkflowWatcher', $this->cache['DBGalaxia']->Link_ID); 102 102 } 103 103 else … … 128 128 if (!isset($connectionInfo['db_name'])) 129 129 { 130 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment();130 Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 131 131 if (isset($GLOBALS['phpgw_info']['server'])) 132 132 $connectionInfo = $GLOBALS['phpgw_info']['server']; … … 136 136 137 137 /* connect to the database */ 138 $this->cache['DBExpresso'] = $GLOBALS['workflow']['factory']->newInstance('WorkflowWatcher', $GLOBALS['workflow']['factory']->newForeignInstance('phpgwapi', 'db'));138 $this->cache['DBExpresso'] = Factory::newInstance('WorkflowWatcher', Factory::newForeignInstance('phpgwapi', 'db')); 139 139 $this->cache['DBExpresso']->disconnect(); /* for some reason it won't connect to the desired database unless we disconnect it first */ 140 140 $this->cache['DBExpresso']->Halt_On_Error = 'no'; … … 147 147 $connectionInfo['db_type'] 148 148 ); 149 $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->removeSensitiveInformationFromDatabaseObject($this->cache['DBExpresso']);150 $this->cache['DBExpresso']->Link_ID = $GLOBALS['workflow']['factory']->newInstance('WorkflowWatcher', $this->cache['DBExpresso']->Link_ID);149 Factory::getInstance('WorkflowSecurity')->removeSensitiveInformationFromDatabaseObject($this->cache['DBExpresso']); 150 $this->cache['DBExpresso']->Link_ID = Factory::newInstance('WorkflowWatcher', $this->cache['DBExpresso']->Link_ID); 151 151 } 152 152 … … 177 177 178 178 /* connect to the database */ 179 $this->cache['DBWorkflow'] = $GLOBALS['workflow']['factory']->newInstance('WorkflowWatcher', $GLOBALS['workflow']['factory']->newForeignInstance('phpgwapi', 'db'));179 $this->cache['DBWorkflow'] = Factory::newInstance('WorkflowWatcher', Factory::newForeignInstance('phpgwapi', 'db')); 180 180 $this->cache['DBWorkflow']->disconnect(); /* for some reason it won't connect to the desired database unless we disconnect it first */ 181 181 $this->cache['DBWorkflow']->Halt_On_Error = 'no'; … … 188 188 $dbConfigValues['database_type'] 189 189 ); 190 $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->removeSensitiveInformationFromDatabaseObject($this->cache['DBWorkflow']);191 $this->cache['DBWorkflow']->Link_ID = $GLOBALS['workflow']['factory']->newInstance('WorkflowWatcher', $this->cache['DBWorkflow']->Link_ID);190 Factory::getInstance('WorkflowSecurity')->removeSensitiveInformationFromDatabaseObject($this->cache['DBWorkflow']); 191 $this->cache['DBWorkflow']->Link_ID = Factory::newInstance('WorkflowWatcher', $this->cache['DBWorkflow']->Link_ID); 192 192 } 193 193 -
sandbox/workflow/2.0/inc/class.WorkflowSecurity.inc.php
r795 r1293 51 51 { 52 52 /* garante que o objeto de DataBase do Expresso estará disponível */ 53 $GLOBALS['workflow']['workflowObjects']->getDBExpresso();53 Factory::getInstance('WorkflowObjects')->getDBExpresso(); 54 54 } 55 55 … … 77 77 continue; 78 78 $this->removeSensitiveInformationFromDatabaseObject($variable); 79 $variable = $GLOBALS['workflow']['factory']->newInstance('WorkflowWatcher', $variable);79 $variable = Factory::newInstance('WorkflowWatcher', $variable); 80 80 } 81 81 } -
sandbox/workflow/2.0/inc/class.WorkflowUtils.inc.php
r795 r1293 16 16 ); 17 17 /** 18 * @var object $t the template 19 * @access public 20 */ 21 var $t; 22 /** 23 * @var int wf_p_id 18 * @var object $t the template 19 * @access public 20 */ 21 var $t; 22 /** 23 * @var int wf_p_id 24 24 * @access public 25 25 */ 26 26 var $wf_p_id; 27 27 /** 28 * @var array $message message array 28 * @var array $message message array 29 29 * @access public 30 30 */ … … 33 33 //TODO: when migration to bo_workflow_forms will be closed erase theses vars-------------- 34 34 //nextmatchs (max number of rows per page) and associated vars 35 36 /** 37 * @var int $nextmatchs 35 36 /** 37 * @var int $nextmatchs 38 38 * @access public 39 39 */ 40 40 var $nextmatchs; 41 41 42 42 /** 43 43 * @var int $start actual starting row number 44 44 * @access public 45 45 */ 46 var $start; 47 /** 48 * @var int $total_records total number of rows 49 * @access public 50 */ 51 var $total_records; 52 /** 53 * @var array $message message array column used for order 54 * @access public 55 */ 56 var $order; 57 /** 58 * @var string $sort ASC or DESC 59 * @access public 60 */ 61 var $sort; 62 /** 63 * @var array $sort_mode combination of order and sort 64 * @access public 65 */ 66 var $sort_mode; 67 /** 68 * @var array $search_str 46 var $start; 47 /** 48 * @var int $total_records total number of rows 49 * @access public 50 */ 51 var $total_records; 52 /** 53 * @var array $message message array column used for order 54 * @access public 55 */ 56 var $order; 57 /** 58 * @var string $sort ASC or DESC 59 * @access public 60 */ 61 var $sort; 62 /** 63 * @var array $sort_mode combination of order and sort 64 * @access public 65 */ 66 var $sort_mode; 67 /** 68 * @var array $search_str 69 69 * @access public 70 70 */ … … 77 77 var $stats; 78 78 /** 79 * @var array $wheres 79 * @var array $wheres 80 80 * @access public 81 81 */ … … 84 84 /** 85 85 * Constructor of workflow class 86 * 86 * 87 87 * @access public 88 88 * @return void … … 107 107 /** 108 108 * Fill the process bar 109 * 109 * 110 110 * @param array $proc_info 111 111 * @access public … … 116 116 //echo "proc_info: <pre>";print_r($proc_info);echo "</pre>"; 117 117 $this->t->set_file('proc_bar_tpl', 'proc_bar.tpl'); 118 $templateServer = & $GLOBALS['workflow']['factory']->getInstance('TemplateServer');118 $templateServer = &Factory::getInstance('TemplateServer'); 119 119 120 120 if ($proc_info['wf_is_valid'] == 'y') … … 170 170 /** 171 171 * Select activity representation icon 172 * 172 * 173 173 * @var string $type type of activity 174 174 * @var bool $interactive interactive? … … 207 207 $ic="no-activity.gif"; 208 208 } 209 return '<img src="'. $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink($ic) .'" alt="'. lang($type) .'" title="'. lang($type) .'" />';210 } 211 209 return '<img src="'. Factory::getInstance('TemplateServer')->generateImageLink($ic) .'" alt="'. lang($type) .'" title="'. lang($type) .'" />'; 210 } 211 212 212 /** 213 213 * Translate template file 214 * @param string $template_name template name 214 * @param string $template_name template name 215 215 * @return void 216 216 * @access public … … 238 238 * @param string $error_str destination string to place errors 239 239 * @return bool 240 * @access public 240 * @access public 241 241 */ 242 242 function show_errors(&$activity_manager, &$error_str) … … 287 287 } 288 288 } 289 289 290 290 /** 291 291 * Get source code 292 * @param string $proc_name process name 292 * @param string $proc_name process name 293 293 * @param string $act_name activity name 294 294 * @param string $type actyvity type … … 319 319 /** 320 320 * Save the source of process 321 * 321 * 322 322 * @param string $proc_name process name 323 323 * @param string $act_name activity name … … 353 353 354 354 /** 355 * Export process to a xml file to be downloaded 355 * Export process to a xml file to be downloaded 356 356 * @access public 357 357 * @return void … … 375 375 echo $out; 376 376 } 377 377 378 378 /** 379 379 * Get the href link for the css file, searching for themes specifics stylesheet if any … … 387 387 { 388 388 $file = "css/$css_name" . (($print_mode !== false) ? '_print' : '') . '.css'; 389 return $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->getWebFile($file);390 } 391 389 return Factory::getInstance('TemplateServer')->getWebFile($file); 390 } 391 392 392 /** 393 393 * Return a given duration in human readable form, usefull for workitems duration 394 394 * @param int $to given duration 395 395 * @return string given duration in human readable form 396 * @access public 396 * @access public 397 397 */ 398 398 function time_diff($to) { … … 402 402 $to = $to - ($hours*3600); 403 403 $min = date("i", $to); 404 $to = $to - ($min*60); 404 $to = $to - ($min*60); 405 405 $sec = date("s", $to); 406 406 -
sandbox/workflow/2.0/inc/class.bo_adminaccess.inc.php
r795 r1293 43 43 parent::bo_ajaxinterface(); 44 44 45 if (! $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($_SESSION['phpgw_info']['workflow']['account_id']))45 if (!Factory::getInstance('workflow_acl')->checkWorkflowAdmin($_SESSION['phpgw_info']['workflow']['account_id'])) 46 46 exit(serialize(array('error' => 'Você não tem permissão para executar esta operação.'))); 47 47 48 $this->so = new so_adminaccess( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);48 $this->so = new so_adminaccess(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 49 49 } 50 50 … … 57 57 function get_all_processes() 58 58 { 59 $proc_mng = new ProcessManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);59 $proc_mng = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 60 60 $proc_list = $proc_mng->list_processes(0,-1,'wf_name__ASC'); 61 61 -
sandbox/workflow/2.0/inc/class.bo_adminjobs.inc.php
r795 r1293 100 100 /* paginate the result */ 101 101 $logEntriesPerPage = 30; 102 $paging = &$GLOBALS['workflow']['factory']->newInstance('Paging', $logEntriesPerPage, $params);102 $paging =& Factory::newInstance('Paging', $logEntriesPerPage, $params); 103 103 $logs = $paging->restrictItems($logs); 104 104 -
sandbox/workflow/2.0/inc/class.bo_adminsource.inc.php
r795 r1293 18 18 19 19 /** 20 * Invalid file name identifier 21 * @name INVALID_FILE_NAME 20 * Invalid file name identifier 21 * @name INVALID_FILE_NAME 22 22 */ 23 23 define( INVALID_FILE_NAME , 0 ); 24 24 /** 25 * Invalid process id identifier 26 * @name INVALID_PROCESS_ID 25 * Invalid process id identifier 26 * @name INVALID_PROCESS_ID 27 27 */ 28 28 define( INVALID_PROCESS_ID , 1 ); 29 29 /** 30 30 * File already exists identifier 31 * @name FILE_ALREADY_EXISTS 31 * @name FILE_ALREADY_EXISTS 32 32 */ 33 33 define( FILE_ALREADY_EXISTS , 2 ); 34 34 /** 35 * File created indentifier 35 * File created indentifier 36 36 * @name FILE_CREATED 37 37 */ 38 38 define( FILE_CREATED , 3 ); 39 39 /** 40 * File not created identifier 40 * File not created identifier 41 41 * @name FILE_NOT_CREATED 42 42 */ … … 52 52 53 53 /** 54 * @var array $public_functions Array of public functions 54 * @var array $public_functions Array of public functions 55 55 * @access public 56 56 */ 57 57 var $public_functions = array('export_file' => true 58 58 ); 59 59 60 60 /** 61 61 * Construtor 62 62 * 63 * @access public 64 */ 63 * @access public 64 */ 65 65 function bo_adminsource() { 66 parent::bo_ajaxinterface(); 67 } 68 66 parent::bo_ajaxinterface(); 67 } 68 69 69 /** 70 70 * Assign Unit To File Size 71 71 * @param integer $value value 72 * @return string file size 73 * @access public 72 * @return string file size 73 * @access public 74 74 */ 75 75 function _assignUnitToFileSize($value) … … 80 80 $fileSizeUnit[] = 'Mb'; 81 81 $fileSizeUnit[] = 'Gb'; 82 82 83 83 $unitSelect = 0; 84 84 while ($value > 1024.0) … … 87 87 $unitSelect++; 88 88 } 89 89 90 90 $output = round($value, 1); 91 91 $output .= " " . $fileSizeUnit[$unitSelect]; 92 92 93 93 return $output; 94 94 } 95 95 96 96 /** 97 97 * Get process toolbar data 98 * @param array $p process process data 99 * @return array 100 * @access public 101 */ 102 function get_toolbar_data($p) 103 { 104 105 $process_manager = new ProcessManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);106 $proc_info = $process_manager->get_process($p['proc_id']); 107 98 * @param array $p process process data 99 * @return array 100 * @access public 101 */ 102 function get_toolbar_data($p) 103 { 104 105 $process_manager = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 106 $proc_info = $process_manager->get_process($p['proc_id']); 107 108 108 $web_server_url = $_SESSION['phpgw_info']['workflow']['server']['webserver_url']; 109 $img_default_dir = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink('');110 109 $img_default_dir = Factory::getInstance('TemplateServer')->generateImageLink(''); 110 111 111 if ($proc_info['wf_is_valid'] == 'y') 112 112 { … … 119 119 $alt_validity = tra('invalid'); 120 120 } 121 121 122 122 // if process is active show stop button. Else show start button, but only if it is valid. If it's not valid, don't show any activation or stop button. 123 123 if ($proc_info['wf_is_active'] == 'y') … … 138 138 $start_stop_img = ''; 139 139 } 140 140 141 141 /* load other processes link */ 142 142 $proc_ids = $GLOBALS['ajax']->acl->get_granted_processes($_SESSION['phpgw_info']['workflow']['account_id']); … … 145 145 else 146 146 $where = ' wf_p_id = -1 '; 147 147 148 148 $processesInfo = &$process_manager->list_processes(0, -1, 'wf_name__asc', '', $where); 149 149 $otherProcesses = array(); 150 150 foreach ($processesInfo['data'] as $pi) 151 151 $otherProcesses[] = array("name" => $pi['wf_name'] . " (v" . $pi['wf_version'] . ")", "link" => $web_server_url . "/index.php?menuaction=workflow.ui_adminsource.form&p_id=" . $pi['wf_p_id'], "pid" => $pi['wf_p_id']); 152 152 153 153 $toolbar_data = array ( 154 154 'proc_name' => $proc_info['wf_name'], … … 177 177 'other_processes' => $otherProcesses 178 178 ); 179 179 180 180 return $toolbar_data; 181 181 } 182 183 182 183 184 184 /** 185 185 * Get process model files 186 * @param array $p process process data 187 * @return array 188 * @access public 186 * @param array $p process process data 187 * @return array 188 * @access public 189 189 */ 190 190 function get_model_files($p) 191 191 { 192 switch($p['type']) 192 switch($p['type']) 193 193 { 194 194 case 'include' : $path = PHPGW_SERVER_ROOT . SEP . 'workflow' . SEP . 'js' . SEP . 'adminsource' . SEP . 'inc'; … … 203 203 $files = array(); 204 204 205 if ($handle = opendir($path)) 206 { 207 while (false !== ($file_name = readdir($handle))) 208 { 209 if (!is_dir($path.SEP.$file_name)) 205 if ($handle = opendir($path)) 206 { 207 while (false !== ($file_name = readdir($handle))) 208 { 209 if (!is_dir($path.SEP.$file_name)) 210 210 { 211 211 $files[] = array('file_name' => $file_name); … … 217 217 array_multisort($col_file_name,SORT_ASC,$files); 218 218 219 return $files; 219 return $files; 220 220 } 221 221 222 222 /** 223 223 * Get process php files 224 * @param array $p process data 225 * @return array 226 * @access public 224 * @param array $p process data 225 * @return array 226 * @access public 227 227 */ 228 228 function get_php_files($p) 229 229 { 230 $process_manager = new ProcessManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);230 $process_manager = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 231 231 $proc_info = $process_manager->get_process($p['proc_id']); 232 $activity_manager = new ActivityManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);232 $activity_manager = new ActivityManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 233 233 $process_activities = $activity_manager->list_activities($p['proc_id'], 0, -1, 'wf_name__asc', '','',false); 234 234 $path = GALAXIA_PROCESSES . SEP . $proc_info['wf_normalized_name'] . SEP . 'code' . SEP .'activities' . SEP; 235 235 236 236 $files = array(); 237 237 … … 242 242 foreach ($process_activities['data'] as $process_activity) 243 243 { 244 244 245 245 $file_name = $process_activity['wf_normalized_name'].'.php'; 246 246 $activity_id = $process_activity['wf_activity_id']; 247 247 $tamanho = filesize($path.$file_name); 248 248 $modificado = date('d/m/Y H:i:s', filemtime($path.$file_name) ); 249 249 250 250 $files[] = array('file_name' => $file_name, 251 251 'activity_id' => $activity_id, … … 258 258 'tipo_codigo' => 'atividade' 259 259 ); 260 260 261 261 $col_file_name[] = $file_name; 262 262 $col_tamanho[] = $tamanho; 263 263 $col_modificado[] = $modificado; 264 264 } 265 266 if (isset($p['sort'])) 265 266 if (isset($p['sort'])) 267 267 { 268 268 $order_by = ($p['order_by'] == 1) ? SORT_ASC : SORT_DESC; … … 279 279 } 280 280 } 281 282 return $files; 283 } 284 285 /** 286 * Delete process file 281 282 return $files; 283 } 284 285 /** 286 * Delete process file 287 287 * @param array $p process data 288 288 * @return array 289 * @access public 289 * @access public 290 290 */ 291 291 function delete_file($p) … … 293 293 if ((strpos($p['file_name'],'/') !== false) || (strpos($p['file_name'],'/') !== false)) 294 294 return 'Não foi possível executar a operação solicitada'; 295 $process_manager = new ProcessManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);296 $proc_info = $process_manager->get_process($p['proc_id']); 295 $process_manager = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 296 $proc_info = $process_manager->get_process($p['proc_id']); 297 297 $file_name = $p['file_name']; 298 $proc_name = $proc_info['wf_normalized_name']; 298 $proc_name = $proc_info['wf_normalized_name']; 299 299 $type = $p['type']; 300 300 if (strpos($file_name,'/')) return 'Nome de arquivo inválido.'; 301 301 if (!strlen($proc_name)) return 'ID de Processo inválido.'; 302 302 303 303 switch($type) 304 304 { … … 315 315 $path = GALAXIA_PROCESSES . '/' . $proc_info['wf_normalized_name'] . '/resources/' . $file_name; 316 316 break; 317 317 318 318 } 319 320 if ($type == 'resource') 319 320 if ($type == 'resource') 321 321 { 322 322 $complete_path = $path; 323 } 324 else 323 } 324 else 325 325 { 326 326 $complete_path = GALAXIA_PROCESSES . SEP . $proc_name . SEP . 'code' . SEP . $path; 327 327 } 328 329 if (file_exists($complete_path)) 328 329 if (file_exists($complete_path)) 330 330 { 331 331 if (unlink($complete_path)) … … 342 342 return 'O arquivo '.$file_name.' não existe.'; 343 343 } 344 } 345 /** 346 * Create process new file 344 } 345 /** 346 * Create process new file 347 347 * @param array $p process 348 348 * @return array 349 * @access public 349 * @access public 350 350 */ 351 351 function create_file($p) 352 352 { 353 $process_manager = new ProcessManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);354 $proc_info = $process_manager->get_process($p['proc_id']); 353 $process_manager = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 354 $proc_info = $process_manager->get_process($p['proc_id']); 355 355 $file_name = $p['file_name']; 356 $proc_name = $proc_info['wf_normalized_name']; 356 $proc_name = $proc_info['wf_normalized_name']; 357 357 $type = $p['type']; 358 358 … … 386 386 } 387 387 388 if (file_exists($complete_path)) 389 { 390 if (!$p['rewrite']) 388 if (file_exists($complete_path)) 389 { 390 if (!$p['rewrite']) 391 391 { 392 392 return FILE_ALREADY_EXISTS; … … 396 396 } 397 397 398 if ($fp = fopen($complete_path, 'w')) 398 if ($fp = fopen($complete_path, 'w')) 399 399 { 400 400 $basepath = PHPGW_SERVER_ROOT.SEP.'workflow'.SEP.'js'.SEP.'adminsource'; … … 409 409 if ($type == 'template' || $type == 'include') 410 410 { 411 if (file_exists($basepath.SEP.$p['modelo'])) 411 if (file_exists($basepath.SEP.$p['modelo'])) 412 412 { 413 413 fwrite($fp,file_get_contents($basepath.SEP.$p['modelo'])); … … 423 423 } 424 424 } 425 425 426 426 /** 427 427 * Get process include files 428 428 * @param array $p process 429 429 * @return array 430 * @access public 430 * @access public 431 431 */ 432 432 function get_include_files($p) 433 433 { 434 $process_manager = new ProcessManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);435 $proc_info = $process_manager->get_process($p['proc_id']); 434 $process_manager = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 435 $proc_info = $process_manager->get_process($p['proc_id']); 436 436 $path = GALAXIA_PROCESSES . SEP . $proc_info['wf_normalized_name'] . SEP . 'code'; 437 437 … … 442 442 $files = array(); 443 443 444 if ($handle = opendir($path)) 445 { 446 while (false !== ($file_name = readdir($handle))) 447 { 448 if (!is_dir($path.SEP.$file_name)) 444 if ($handle = opendir($path)) 445 { 446 while (false !== ($file_name = readdir($handle))) 447 { 448 if (!is_dir($path.SEP.$file_name)) 449 449 { 450 450 $tamanho = filesize($path.SEP.$file_name); … … 467 467 468 468 469 if (isset($p['sort'])) 469 if (isset($p['sort'])) 470 470 { 471 471 $order_by = ($p['order_by'] == 1) ? SORT_ASC : SORT_DESC; … … 483 483 } 484 484 485 return $files; 486 } 487 488 /** 489 * Get process template files 490 * @param array $p process data 491 * @return array 492 * @access public 485 return $files; 486 } 487 488 /** 489 * Get process template files 490 * @param array $p process data 491 * @return array 492 * @access public 493 493 */ 494 494 function get_template_files($p) 495 495 { 496 $process_manager = new ProcessManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);497 $proc_info = $process_manager->get_process($p['proc_id']); 496 $process_manager = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 497 $proc_info = $process_manager->get_process($p['proc_id']); 498 498 $path = GALAXIA_PROCESSES . SEP . $proc_info['wf_normalized_name'] . SEP . 'code' . SEP .'templates'; 499 499 … … 502 502 $col_modificado = array(); 503 503 504 if ($handle = opendir($path)) 505 { 506 while (false !== ($file_name = readdir($handle))) 507 { 508 if (!is_dir($path.SEP.$file_name)) 504 if ($handle = opendir($path)) 505 { 506 while (false !== ($file_name = readdir($handle))) 507 { 508 if (!is_dir($path.SEP.$file_name)) 509 509 { 510 510 $tamanho = filesize($path.SEP.$file_name); … … 541 541 542 542 } 543 } 544 545 return $files; 546 } 547 548 /** 549 * Upload process resource 550 * 543 } 544 545 return $files; 546 } 547 548 /** 549 * Upload process resource 550 * 551 551 * @param array $p process 552 552 * @return array 553 * @access public 553 * @access public 554 554 */ 555 555 function upload_resource($p) 556 556 { 557 $process_manager = new ProcessManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);557 $process_manager = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 558 558 $proc_info = $process_manager->get_process($p['proc_id']); 559 559 $file_name = basename($_FILES['resource_file']['name']); … … 587 587 if (strpos($_REQUEST['file_name'],'/') !== false) 588 588 return 'Não foi possível executar a operação solicitada'; 589 $process_manager = new ProcessManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);589 $process_manager = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 590 590 $proc_info = $process_manager->get_process($_REQUEST['proc_id']); 591 591 … … 617 617 $completePath = GALAXIA_PROCESSES . SEP . $proc_name . SEP . 'code' . SEP . $path; 618 618 619 $GLOBALS['workflow']['factory']->getInstance('ResourcesRedirector')->show($completePath, 'application/force-download');619 Factory::getInstance('ResourcesRedirector')->show($completePath, 'application/force-download'); 620 620 exit; 621 621 } … … 630 630 function get_resource_files($p) 631 631 { 632 $process_manager = new ProcessManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);632 $process_manager = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 633 633 $proc_info = $process_manager->get_process($p['proc_id']); 634 634 -
sandbox/workflow/2.0/inc/class.bo_ajaxinterface.inc.php
r795 r1293 67 67 { 68 68 $GLOBALS['ajax']->ldap = new ajax_ldap(); 69 $GLOBALS['ajax']->db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso();69 $GLOBALS['ajax']->db =& Factory::getInstance('WorkflowObjects')->getDBExpresso(); 70 70 $GLOBALS['ajax']->db->Halt_On_Error = 'no'; 71 71 72 $GLOBALS['ajax']->db_workflow = &$GLOBALS['workflow']['workflowObjects']->getDBWorkflow();72 $GLOBALS['ajax']->db_workflow =& Factory::getInstance('WorkflowObjects')->getDBWorkflow(); 73 73 $GLOBALS['ajax']->db_workflow->Halt_On_Error = 'no'; 74 74 75 75 $GLOBALS['phpgw']->ADOdb = &$GLOBALS['ajax']->db->Link_ID; 76 $GLOBALS['ajax']->acl = new so_adminaccess( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);76 $GLOBALS['ajax']->acl = new so_adminaccess(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 77 77 } 78 78 else -
sandbox/workflow/2.0/inc/class.bo_editor.inc.php
r795 r1293 20 20 */ 21 21 class bo_editor extends bo_ajaxinterface 22 { 22 { 23 23 /** 24 24 * Contructor … … 27 27 */ 28 28 function bo_editor() { 29 parent::bo_ajaxinterface(); 29 parent::bo_ajaxinterface(); 30 30 } 31 31 /** … … 33 33 * @param string $proc_name process name 34 34 * @param string $file_name file name 35 * @param string $type type 35 * @param string $type type 36 36 * @access public 37 37 * @return string source data … … 64 64 if (!file_exists($complete_path)) 65 65 exit(0); 66 66 67 67 if (!$file_size = filesize($complete_path)) return ''; 68 68 $fp = fopen($complete_path, 'r'); … … 70 70 fclose($fp); 71 71 72 //if ($type != 'template') 72 //if ($type != 'template') 73 73 //{ 74 74 $data = str_replace("\r", "", $data); … … 83 83 //$data = str_replace("\n", "\\n", $data); 84 84 //} 85 85 86 86 return $data; 87 87 } … … 90 90 * @param string $proc_name process name 91 91 * @param string $file_name file name 92 * @param string $type type 93 * @param string $source 92 * @param string $type type 93 * @param string $source 94 94 * @access public 95 95 * @return string … … 126 126 // In case you want to be warned when source code is changed: 127 127 // mail('yourmail@domain.com', 'source changed', "PATH: $complete_path \n\n SOURCE: $source"); 128 128 129 129 $erro = false; 130 if ($fp = fopen($complete_path, 'w')) 130 if ($fp = fopen($complete_path, 'w')) 131 131 { 132 $erro = !fwrite($fp, $source); 132 $erro = !fwrite($fp, $source); 133 133 fclose($fp); 134 134 } … … 143 143 /** 144 144 * Check process 145 * 145 * 146 146 * @param integer $pid pid 147 * @param object $activity_manager 148 * @param string $error_str error string 147 * @param object $activity_manager 148 * @param string $error_str error string 149 149 * @access public 150 150 * @return string … … 159 159 foreach ($errors as $error) 160 160 { 161 if (strlen($error) > 0) 161 if (strlen($error) > 0) 162 162 { 163 163 $error_str .= '<li>'. $error . '<br/>'; … … 173 173 } 174 174 } 175 175 176 176 /** 177 177 * Save template source 178 * 179 * @param array $p process 178 * 179 * @param array $p process 180 180 * @access public 181 181 * @return string … … 183 183 function save_template_source($p) 184 184 { 185 185 186 186 $proc_name = $p['proc_name']; 187 187 $file_name = $p['file_name']; … … 191 191 192 192 $msg[] = $this->save_source($p['proc_name'],$p['file_name'], $p['tipo_codigo'], $p['code']); 193 193 194 194 return implode('<br />',$msg); 195 195 } 196 196 /** 197 197 * Save resource 198 * 199 * @param array $p process 198 * 199 * @param array $p process 200 200 * @access public 201 201 * @return string … … 203 203 function save_resource($p) 204 204 { 205 205 206 206 $proc_name = $p['proc_name']; 207 207 $file_name = $p['file_name']; … … 211 211 212 212 $msg[] = $this->save_source($p['proc_name'],$p['file_name'], $p['tipo_codigo'], $p['code']); 213 213 214 214 return implode('<br />',$msg); 215 215 } 216 216 /** 217 217 * Save php souurce 218 * 219 * @param array $p process 218 * 219 * @param array $p process 220 220 * @access public 221 221 * @return string … … 234 234 if ($p['tipo_codigo'] != 'include') 235 235 { 236 $activity_manager = new ActivityManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);236 $activity_manager = new ActivityManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 237 237 238 238 if ($this->check_process($p['proc_id'], &$activity_manager, &$error_str) == 'n') … … 245 245 /** 246 246 * Check syntax 247 * 248 * @param array $p process 249 * @access public 250 * @return string 251 */ 252 function check_syntax($p) 247 * 248 * @param array $p process 249 * @access public 250 * @return string 251 */ 252 function check_syntax($p) 253 253 { 254 254 $code = $p['code']; 255 255 $errors = "Check syntax failed."; 256 $fp = fopen('/tmp/check_syn.tmp', 'w'); 256 $fp = fopen('/tmp/check_syn.tmp', 'w'); 257 257 if ($fp) { 258 fwrite($fp, $code); 258 fwrite($fp, $code); 259 259 $errors = `php -l /tmp/check_syn.tmp`; 260 260 $errors = str_replace("in /tmp/check_syn.tmp","",$errors); -
sandbox/workflow/2.0/inc/class.bo_monitors.inc.php
r795 r1293 134 134 { 135 135 parent::bo_ajaxinterface(); 136 $GLOBALS['ajax']->gui = new GUI( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);136 $GLOBALS['ajax']->gui = new GUI(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 137 137 $this->userID = $_SESSION['phpgw_info']['workflow']['account_id']; 138 138 $this->isWorkflowAdmin = $GLOBALS['ajax']->acl->checkWorkflowAdmin($this->userID); 139 $this->processManager = new ProcessManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);140 $this->activityManager = new ActivityManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);141 $this->instanceManager = new InstanceManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);142 $this->roleManager = new RoleManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);143 $this->processMonitor = new ProcessMonitor( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);139 $this->processManager = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 140 $this->activityManager = new ActivityManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 141 $this->instanceManager = new InstanceManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 142 $this->roleManager = new RoleManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 143 $this->processMonitor = new ProcessMonitor(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 144 144 } 145 145 … … 335 335 $filters[] = '(gia.wf_user IS NOT NULL)'; 336 336 337 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');337 $ldap = &Factory::getInstance('WorkflowLDAP'); 338 338 if (!$completeData) 339 339 { 340 $paging = $GLOBALS['workflow']['factory']->newInstance('Paging', 500, $_POST);340 $paging = Factory::newInstance('Paging', 500, $_POST); 341 341 $tmp = $this->processMonitor->monitor_list_instances($paging->nextItem, $paging->itemsPerPage, $order, '', implode(' AND ', $filters)); 342 342 $output['data'] = $paging->restrictItems(array_values($tmp['data']), $tmp['cant']); … … 353 353 $activityMapping = array(); 354 354 $instanceCount = count($output['data']); 355 $cachedLDAP = & $GLOBALS['workflow']['factory']->getInstance('CachedLDAP');355 $cachedLDAP = &Factory::getInstance('CachedLDAP'); 356 356 for ($i = 0; $i < $instanceCount; $i++) 357 357 { … … 476 476 /* load the data */ 477 477 $filters[] = '(gp.wf_p_id = ' . $params['pid'] . ')'; 478 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');478 $ldap = &Factory::getInstance('WorkflowLDAP'); 479 479 if (!$completeData) 480 480 { 481 $paging = $GLOBALS['workflow']['factory']->newInstance('Paging', 500, $_POST);481 $paging = Factory::newInstance('Paging', 500, $_POST); 482 482 $tmp = $this->processMonitor->monitor_list_completed_instances($paging->nextItem, $paging->itemsPerPage, $order, '', implode(' AND ', $filters)); 483 483 $output['data'] = $paging->restrictItems(array_values($tmp['data']), $tmp['cant']); … … 491 491 } 492 492 493 $cachedLDAP = & $GLOBALS['workflow']['factory']->getInstance('CachedLDAP');493 $cachedLDAP = &Factory::getInstance('CachedLDAP'); 494 494 $userMapping = array(); 495 495 $instanceCount = count($output['data']); … … 627 627 } 628 628 else 629 $output['fullname'] = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($user);629 $output['fullname'] = Factory::getInstance('WorkflowLDAP')->getName($user); 630 630 631 631 $this->instanceManager->set_instance_user($params['iid'], $params['aid'], $user); … … 648 648 if ($params['ns'] == 'aborted') 649 649 { 650 $realInstance = new Instance( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);650 $realInstance = new Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 651 651 $realInstance->getInstance($params['iid']); 652 652 if (!empty($realInstance->instanceId)) … … 684 684 685 685 /* use next user or * for the new instance */ 686 $realInstance = new Instance( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);686 $realInstance = new Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 687 687 $realInstance->getInstance($params['iid'], false, false); 688 688 $user = $realInstance->getNextUser($params['aid']); … … 751 751 752 752 $maximumDisplaySize = 100; 753 $instance = new Instance( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);753 $instance = new Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 754 754 $instance->getInstance($params['iid']); 755 755 … … 783 783 return "Você não tem permissão para executar este procedimento!"; 784 784 785 $instance = new Instance( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);785 $instance = new Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 786 786 $instance->getInstance($params['iid']); 787 787 $output = $params; … … 804 804 $maximumDisplaySize = 100; 805 805 806 $instance = new Instance( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);806 $instance = new Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 807 807 $instance->getInstance($params['iid']); 808 808 $instance->set($params['name'], $params['value']); … … 835 835 return "Você não tem permissão para executar este procedimento!"; 836 836 837 $instance = new Instance( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);837 $instance = new Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 838 838 $instance->getInstance($params['iid']); 839 839 $instance->clear($params['name']); … … 904 904 /* prepare the data */ 905 905 $aux2 = array(); 906 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');906 $ldap = &Factory::getInstance('WorkflowLDAP'); 907 907 foreach ($aux as $user => $count) 908 908 $aux2[] = array( … … 984 984 985 985 /* load LDAP info and sort the result */ 986 $foundUsers = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getNames($users);986 $foundUsers = Factory::getInstance('WorkflowLDAP')->getNames($users); 987 987 usort($foundUsers, create_function('$a,$b', 'return strcasecmp($a[\'name\'],$b[\'name\']);')); 988 988 … … 991 991 if (count($users) > count($foundUsers)) 992 992 { 993 $cachedLDAP = & $GLOBALS['workflow']['factory']->getInstance('CachedLDAP');993 $cachedLDAP = &Factory::getInstance('CachedLDAP'); 994 994 $foundUsersID = array_map(create_function('$a', 'return $a[\'id\'];'), $foundUsers); 995 995 $missingUsers = array_diff($users, $foundUsersID); … … 1242 1242 return $output; 1243 1243 1244 $BOUserInterface = & $GLOBALS['workflow']['factory']->getInstance('bo_userinterface');1244 $BOUserInterface = &Factory::getInstance('bo_userinterface'); 1245 1245 1246 1246 /* initialize some variables */ … … 1344 1344 1345 1345 /* load the recipient e-mail */ 1346 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');1346 $ldap = &Factory::getInstance('WorkflowLDAP'); 1347 1347 foreach ($output as $key => $value) 1348 1348 { … … 1396 1396 1397 1397 /* prepare the environment to load some configuration values from other module */ 1398 $GLOBALS['phpgw']->db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso();1398 $GLOBALS['phpgw']->db =& Factory::getInstance('WorkflowObjects')->getDBExpresso(); 1399 1399 $GLOBALS['phpgw']->common = CreateObject('phpgwapi.common'); 1400 1400 $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions'); … … 1402 1402 1403 1403 /* get the required configuration */ 1404 $BOEmailAdmin = $GLOBALS['workflow']['factory']->newForeignInstance('emailadmin', 'bo');1404 $BOEmailAdmin = Factory::newForeignInstance('emailadmin', 'bo'); 1405 1405 $profileList = $BOEmailAdmin->getProfileList(); 1406 1406 $profile = $BOEmailAdmin->getProfile($profileList[0]['profileID']); … … 1494 1494 { 1495 1495 $output = array(); 1496 $cachedLDAP = & $GLOBALS['workflow']['factory']->getInstance('CachedLDAP');1497 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');1496 $cachedLDAP = &Factory::getInstance('CachedLDAP'); 1497 $ldap = &Factory::getInstance('WorkflowLDAP'); 1498 1498 foreach ($userIDs as $userID) 1499 1499 { … … 1542 1542 $filters[] = '(gia.wf_user IS NOT NULL)'; 1543 1543 1544 $cachedLDAP = & $GLOBALS['workflow']['factory']->newInstance('CachedLDAP');1544 $cachedLDAP = &Factory::newInstance('CachedLDAP'); 1545 1545 $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP); 1546 1546 $output = array(); … … 1559 1559 } 1560 1560 1561 $validUsers = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getNames(array_keys($userIDs));1561 $validUsers = Factory::getInstance('WorkflowLDAP')->getNames(array_keys($userIDs)); 1562 1562 array_walk($validUsers, create_function('&$a', '$a = $a[\'id\'];')); 1563 1563 -
sandbox/workflow/2.0/inc/class.bo_participants.inc.php
r795 r1293 34 34 function bo_participants() 35 35 { 36 $this->ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');36 $this->ldap = &Factory::getInstance('WorkflowLDAP'); 37 37 } 38 38 -
sandbox/workflow/2.0/inc/class.bo_userinterface.inc.php
r795 r1293 43 43 function bo_userinterface() 44 44 { 45 parent::bo_ajaxinterface(); 45 parent::bo_ajaxinterface(); 46 46 $this->so = new so_userinterface(); 47 $GLOBALS['ajax']->gui = new GUI( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);47 $GLOBALS['ajax']->gui = new GUI(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 48 48 } 49 49 … … 68 68 $webserver_url = $_SESSION['phpgw_info']['workflow']['server']['webserver_url']; 69 69 70 $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer');70 $templateServer =& Factory::getInstance('TemplateServer'); 71 71 foreach ($result['data'] as $line) 72 72 { … … 78 78 $iconweb = $webserver_url . '/workflow/redirect.php?pid=' . $line['wf_p_id'] . '&file=/icon.png'; 79 79 else 80 $iconweb = $templateServer->generateImageLink(' navbar.png');80 $iconweb = $templateServer->generateImageLink('default_process.png'); 81 81 $procname_ver = $line['wf_normalized_name']; 82 82 if (!isset($recset[$procname_ver])) … … 120 120 $pid = $params['pid']; 121 121 $result = array(); 122 123 $process = new Process( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);122 123 $process = new Process(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 124 124 $process->getProcess($pid); 125 125 $result['wf_procname'] = $process->name; 126 126 $result['wf_version'] = $process->version; 127 127 $result['wf_description'] = $process->description; 128 129 $activ_manager = new ActivityManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);128 129 $activ_manager = new ActivityManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 130 130 $result['wf_activities'] = $activ_manager->get_process_activities($pid); 131 132 $this->disconnect_all(); 133 134 return $result; 131 132 $this->disconnect_all(); 133 134 return $result; 135 135 } 136 136 … … 263 263 else 264 264 if ($row['wf_user'] != '') 265 $row['wf_user_fullname'] = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($row['wf_user']);265 $row['wf_user_fullname'] = Factory::getInstance('WorkflowLDAP')->getName($row['wf_user']); 266 266 267 267 /* unset unneeded information */ … … 495 495 } 496 496 497 $instance = new Instance( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);497 $instance = new Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 498 498 $instance->getInstance($instanceID); 499 499 500 $process = new Process( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);500 $process = new Process(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 501 501 $process->getProcess($instance->pId); 502 502 … … 508 508 'wf_instance_id' => $instance->instanceId, 509 509 'wf_priority' => $instance->priority, 510 'wf_owner' => $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($instance->owner),510 'wf_owner' => Factory::getInstance('WorkflowLDAP')->getName($instance->owner), 511 511 'wf_next_activity' => $instance->nextActivity, 512 'wf_next_user' => $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($instance->nextUser),512 'wf_next_user' => Factory::getInstance('WorkflowLDAP')->getName($instance->nextUser), 513 513 'wf_name' => $instance->name, 514 514 'wf_category' => $instance->category, … … 526 526 $result['wf_ended'] = ""; 527 527 528 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');528 $ldap = &Factory::getInstance('WorkflowLDAP'); 529 529 foreach ($instance->workitems as $line) 530 530 { … … 570 570 571 571 /** 572 * Retorna os idiomas 573 * @return array 574 * @access public 575 */ 572 * Retorna os idiomas 573 * @return array 574 * @access public 575 */ 576 576 function getLang(){ 577 577 578 578 $keys = array(); 579 579 $values = array(); … … 586 586 return $langs; 587 587 } 588 589 /** 590 * Return a given duration in human readable form, usefull for workitems duration 591 * 588 589 /** 590 * Return a given duration in human readable form, usefull for workitems duration 591 * 592 592 * @param $to 593 593 * @return string a given duration in human readable form, usefull for workitems duration … … 599 599 $to = $to - ($hours*3600); 600 600 $min = date("i", $to); 601 $to = $to - ($min*60); 601 $to = $to - ($min*60); 602 602 $sec = date("s", $to); 603 603 604 604 return tra('%1 days, %2:%3:%4',$days,$hours,$min,$sec); 605 605 } 606 606 607 607 /** 608 608 * Instances … … 657 657 $cod_process = array(); 658 658 659 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');659 $ldap = &Factory::getInstance('WorkflowLDAP'); 660 660 $viewActivitiesID = array(); 661 661 foreach ($result['data'] as $row) … … 740 740 /** 741 741 * Aplicacoes externas do usuario 742 * @return array 742 * @return array 743 743 * @access public 744 744 */ … … 746 746 { 747 747 $webserver_url = $_SESSION['phpgw_info']['workflow']['server']['webserver_url']; 748 $templateServer = & $GLOBALS['workflow']['factory']->getInstance('TemplateServer');748 $templateServer = &Factory::getInstance('TemplateServer'); 749 749 750 750 /* load the sites that the user can access */ … … 790 790 /** 791 791 * Organograma 792 * @return array com as areas da organizacao 792 * @return array com as areas da organizacao 793 793 * @access public 794 794 */ … … 819 819 /** 820 820 * Get the hierarchical Area 821 * @return array 821 * @return array 822 822 * @access public 823 823 */ -
sandbox/workflow/2.0/inc/class.bo_utils.inc.php
r795 r1293 34 34 { 35 35 parent::bo_ajaxinterface(); 36 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso();36 $this->db =& Factory::getInstance('WorkflowObjects')->getDBExpresso(); 37 37 } 38 38 -
sandbox/workflow/2.0/inc/class.external_bridge.inc.php
r795 r1293 52 52 function external_bridge() 53 53 { 54 $this->db = $GLOBALS['workflow']['workflowObjects']->getDBGalaxia();55 $this->acl = new so_adminaccess( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);54 $this->db = Factory::getInstance('WorkflowObjects')->getDBGalaxia(); 55 $this->acl = new so_adminaccess(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 56 56 } 57 57 /** … … 156 156 157 157 /* assign variables to the template */ 158 $smarty = $GLOBALS['workflow']['factory']->getInstance('workflow_smarty', false);158 $smarty = Factory::getInstance('workflow_smarty', false); 159 159 $smarty->assign('encodedForm', $encodedForm); 160 160 $smarty->assign('siteAddress', $this->siteAddress); -
sandbox/workflow/2.0/inc/class.run_activity.inc.php
r795 r1293 10 10 \**************************************************************************/ 11 11 12 require_once PHPGW_SERVER_ROOT . SEP . 'workflow/inc/common.inc.php'; 13 12 14 require_once(dirname(__FILE__) . SEP . 'class.WorkflowUtils.inc.php' ); /* superclass source code */ 13 15 require_once(dirname(__FILE__) . SEP . 'class.basecontroller.inc.php' ); /* module controller */ 14 16 require_once(dirname(__FILE__) . SEP . 'class.basemodel.inc.php' ); /* module logic */ 15 require_once (dirname(__FILE__) . SEP . 'class.process_factory.inc.php'); /* module process factory class */17 require_once WF_PROC_LIB . SEP . 'ProcessFactory.php'; /* module process factory class */ 16 18 require_once(dirname(__FILE__) . SEP . 'class.utils.security.php' ); /* sanitizes input data */ 17 19 … … 25 27 */ 26 28 class run_activity extends WorkflowUtils 27 { 29 { 28 30 /** 29 31 * @var array $public_functions func … … 51 53 * @access public 52 54 */ 53 var $process; 55 var $process; 54 56 /** 55 57 * @var object $GUI GUI engine object. Act carefully with it. … … 63 65 var $message = Array(); 64 66 /** 65 * @var object $categories categorie object for categories 67 * @var object $categories categorie object for categories 66 68 * @access public 67 69 */ 68 70 var $categories; 69 71 /** 70 * @var array $conf 71 * @access public 72 */ 73 var $conf = array(); 72 * @var array $conf 73 * @access public 74 */ 75 var $conf = array(); 74 76 /** 75 77 * @var $wf_template local activity template … … 77 79 */ 78 80 var $wf_template; 79 /** 81 /** 80 82 * @var object $instance 81 83 * @access public 82 84 */ 83 85 var $instance; 84 /** 86 /** 85 87 * @var object $activity_type The type of activity 86 88 * @access public … … 89 91 // then we retain all usefull vars as members, to make them avaible in user's source code 90 92 // theses are data which can be set before the user code and which are not likely to change because of the user code 91 /** 92 * @var int $process_id The process id 93 /** 94 * @var int $process_id The process id 93 95 * @access public 94 96 */ 95 97 var $process_id; 96 /** 97 * @var int $activity_id The activity id 98 /** 99 * @var int $activity_id The activity id 98 100 * @access public 99 101 */ 100 102 var $activity_id; 101 /** 103 /** 102 104 * @var int $process_name The process name 103 105 * @access public 104 106 */ 105 107 var $process_name; 106 /** 107 * @var int $process_version The process_version 108 /** 109 * @var int $process_version The process_version 108 110 * @access public 109 111 */ 110 112 var $process_version; 111 /** 112 * @var int $activity_name The process id 113 /** 114 * @var int $activity_name The process id 113 115 * @access public 114 116 */ 115 117 var $activity_name; 116 /** 117 * @var int $user_name The user name 118 /** 119 * @var int $user_name The user name 118 120 * @access public 119 121 */ 120 122 var $user_name; 121 /** 122 * @var int $view_activity activity id of the view activity avaible for this process 123 /** 124 * @var int $view_activity activity id of the view activity avaible for this process 123 125 * @access public 124 126 */ 125 127 var $view_activity; 126 // theses 4 vars aren't avaible for the user code, they're set only after this user code was executed 127 /** 128 * @var int $instance_id Instance id 128 // theses 4 vars aren't avaible for the user code, they're set only after this user code was executed 129 /** 130 * @var int $instance_id Instance id 129 131 * @access public 130 132 */ 131 133 var $instance_id=0; 132 /** 133 * @var string $instance_name Instance name 134 /** 135 * @var string $instance_name Instance name 134 136 * @access public 135 137 */ 136 138 var $instance_name=''; 137 /** 138 * @var int $instance_owner Instance owner id 139 /** 140 * @var int $instance_owner Instance owner id 139 141 * @access public 140 142 */ 141 143 var $instance_owner=0; 142 /** 143 * @var string $owner_name Owner name 144 /** 145 * @var string $owner_name Owner name 144 146 * @access public 145 147 */ 146 148 var $owner_name=''; 147 149 148 150 /** 149 151 * @var bool $print_mode print mode … … 156 158 */ 157 159 var $enable_print_mode = false; 158 160 159 161 /** 160 162 * @var array $act_role_names of roles associated with the activity, usefull for lists of users associated with theses roles 161 * @access public 163 * @access public 162 164 */ 163 165 var $act_role_names= Array(); 164 166 165 167 /** 166 168 * @var array $agents Array of ui_agent objects … … 174 176 * @access public 175 177 */ 176 var $smarty; 178 var $smarty; 177 179 /** 178 180 * @var array $wf holds a global environment vector 179 181 * @access public 180 182 */ 181 var $wf; 183 var $wf; 182 184 /** 183 185 * @var $download_mode activates download mode 184 186 * @access public 185 187 */ 186 var $download_mode; 188 var $download_mode; 187 189 /** 188 190 * @var string $_template_name holds the template's file name 189 191 * @access public 190 192 */ 191 var $_template_name = null; 193 var $_template_name = null; 192 194 /** 193 195 * @var bool Indicates wether the current instance is a child instance or not … … 200 202 /** 201 203 * Constructor 202 * 203 * @access public 204 * 205 * @access public 204 206 */ 205 207 function run_activity() … … 301 303 $this->process_version = $this->process->getVersion(); 302 304 $this->activity_name = $activity->getName(); 303 $this->user_name = $GLOBALS['phpgw']->accounts->id2name($GLOBALS['user']);305 $this->user_name = Factory::getForeignInstance('phpgwapi', 'phpgw')->accounts->id2name($GLOBALS['user']); 304 306 $this->view_activity = $this->GUI->gui_get_process_view_activity($this->process_id); 305 307 … … 317 319 $GLOBALS['workflow']['wf_workflow_path'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'; 318 320 $GLOBALS['workflow']['wf_resources_path'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'workflow/redirect.php?pid=' . $this->process_id . '&file='; 319 $GLOBALS['workflow']['wf_default_resources_path'] = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink('processes');320 $GLOBALS['workflow']['wf_workflow_resources_path'] = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink('');321 $GLOBALS['workflow']['wf_default_resources_path'] = Factory::getInstance('TemplateServer')->generateLink('processes'); 322 $GLOBALS['workflow']['wf_workflow_resources_path'] = Factory::getInstance('TemplateServer')->generateLink(''); 321 323 $GLOBALS['workflow']['wf_activity_url'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id; 322 $GLOBALS['workflow']['wf_user_cnname'] = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($GLOBALS['user']);324 $GLOBALS['workflow']['wf_user_cnname'] = Factory::getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 323 325 $GLOBALS['workflow']['wf_back_link'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1'; 324 326 $GLOBALS['workflow']['wf_js_path'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode'; … … 375 377 376 378 /* check some permissions */ 377 if (($newUser == '*') || (!$this->runtime->checkUserRun($newUser)) || ( $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($newUser) === false))379 if (($newUser == '*') || (!$this->runtime->checkUserRun($newUser)) || (Factory::getInstance('WorkflowLDAP')->getName($newUser) === false)) 378 380 { 379 381 $_SESSION['phpgw_info']['workflow']['user_groups'] = $actualUserGroups; … … 406 408 $smarty->plugins_dir[] = PHPGW_SERVER_ROOT.SEP.'workflow'.SEP.'inc'.SEP.'smarty'.SEP.'wf_plugins'; 407 409 408 $GLOBALS['phpgw']->template =& $smarty;410 Factory::getForeignInstance('phpgwapi', 'phpgw')->template =& $smarty; 409 411 $this->wf_template =& $smarty; 410 412 $_template_name = null; … … 418 420 $smarty->assign('wf_back_link',$GLOBALS['workflow']['wf_back_link']); 419 421 $smarty->assign('wf_activity_url',$GLOBALS['workflow']['wf_activity_url']); 420 422 421 423 /* register the prefilter smarty plugin wf_default_template */ 422 424 $smarty->load_filter('pre', 'wf_default_template'); … … 444 446 445 447 $GLOBALS['workflow_env'] = &$env; 448 446 449 //echo "<br><br><br><br><br>Including $source <br>In request: <pre>";print_r($_REQUEST);echo "</pre>"; 447 450 //[__leave_activity] is setted if needed in the xxx_pre code or by the user in his code … … 471 474 472 475 /* activate the security policy */ 473 $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy();476 Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); 474 477 475 478 /* include the files */ … … 497 500 $this->instance_name = $instance->getName(); 498 501 $this->instance_owner = $instance->getOwner(); 499 $this->owner_name = $GLOBALS['phpgw']->accounts->id2name($this->instance_owner);502 $this->owner_name = Factory::getForeignInstance('phpgwapi', 'phpgw')->accounts->id2name($this->instance_owner); 500 503 if ($this->owner_name == '') 501 504 { … … 644 647 $this->process_version = $this->process->getVersion(); 645 648 $this->activity_name = $activity->getName(); 646 $this->user_name = $GLOBALS['phpgw']->accounts->id2name($GLOBALS['user']);649 $this->user_name = Factory::getForeignInstance('phpgwapi', 'phpgw')->accounts->id2name($GLOBALS['user']); 647 650 $this->view_activity = $this->GUI->gui_get_process_view_activity($this->process_id); 648 651 … … 660 663 $GLOBALS['workflow']['wf_workflow_path'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'; 661 664 $GLOBALS['workflow']['wf_resources_path'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'workflow/redirect.php?pid=' . $this->process_id . '&file='; 662 $GLOBALS['workflow']['wf_default_resources_path'] = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink('processes');663 $GLOBALS['workflow']['wf_workflow_resources_path'] = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink('');665 $GLOBALS['workflow']['wf_default_resources_path'] = Factory::getInstance('TemplateServer')->generateLink('processes'); 666 $GLOBALS['workflow']['wf_workflow_resources_path'] = Factory::getInstance('TemplateServer')->generateLink(''); 664 667 $GLOBALS['workflow']['wf_activity_url'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id; 665 $GLOBALS['workflow']['wf_user_cnname'] = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($GLOBALS['user']);668 $GLOBALS['workflow']['wf_user_cnname'] = Factory::getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 666 669 $GLOBALS['workflow']['wf_back_link'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1'; 667 670 $GLOBALS['workflow']['wf_js_path'] = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode'; … … 711 714 712 715 /* activate the security policy */ 713 $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy();716 Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); 714 717 715 718 $GLOBALS['workflow_env'] = &$env; -
sandbox/workflow/2.0/inc/class.so_adminaccess.inc.php
r795 r1293 77 77 { 78 78 $output = array(); 79 $names = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getNames($userIDs);79 $names = Factory::getInstance('WorkflowLDAP')->getNames($userIDs); 80 80 foreach ($names as $name) 81 81 $output[] = array( … … 201 201 if (!is_object($GLOBALS['phpgw']->acl)) 202 202 { 203 $GLOBALS['phpgw']->db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso();204 $GLOBALS['phpgw']->acl = &$GLOBALS['workflow']['factory']->getForeignInstance('phpgwapi', 'acl', $userID);203 $GLOBALS['phpgw']->db =& Factory::getInstance('WorkflowObjects')->getDBExpresso(); 204 $GLOBALS['phpgw']->acl =& Factory::getForeignInstance('phpgwapi', 'acl', $userID); 205 205 } 206 206 -
sandbox/workflow/2.0/inc/class.so_adminjobs.inc.php
r795 r1293 96 96 $this->isAdmin = $_SESSION['phpgw_info']['workflow']['user_is_admin']; 97 97 $this->acl = &$GLOBALS['ajax']->acl; 98 $this->db = & $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID;98 $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 99 99 $this->jobManager = new JobManager(&$this->db); 100 100 } … … 229 229 $output = array(); 230 230 $job = $this->jobManager->getJob($jobID); 231 $jobScheduler = &$GLOBALS['workflow']['factory']->getInstance('JobScheduler');231 $jobScheduler =& Factory::getInstance('JobScheduler'); 232 232 $totalTime = microtime(true); 233 233 $thread = $jobScheduler->execute($job, true); -
sandbox/workflow/2.0/inc/class.so_agent.inc.php
r795 r1293 26 26 { 27 27 //public functions 28 28 29 29 /** 30 30 * @var array $public_functions Array of public functions 31 * @access public 31 * @access public 32 32 */ 33 33 var $public_functions = array( … … 36 36 ); 37 37 /** 38 * @var array $wf_table 38 * @var array $wf_table 39 39 * @access public 40 40 */ 41 41 var $wf_table = 'egw_wf_agent_'; 42 42 /** 43 * @var string $agent_table 43 * @var string $agent_table 44 44 * @access public 45 45 */ 46 46 var $agent_table = ''; 47 47 48 48 // link to the global db-object 49 49 50 50 /** 51 * @var object $db objeto para conexao do banco de dados 51 * @var object $db objeto para conexao do banco de dados 52 52 * @access public 53 53 */ 54 54 var $db; 55 55 56 56 /** 57 57 * Constructor of the so_agent class 58 58 * do not forget to call it (parent::so_agent();) in child classes 59 59 * @access public 60 * @return object 60 * @return object 61 61 */ 62 62 63 63 function so_agent() 64 64 { 65 $this->db =& $GLOBALS['workflow']['workflowObjects']->getDBGalaxia();65 $this->db =& Factory::getInstance('WorkflowObjects')->getDBGalaxia(); 66 66 } 67 67 68 68 /** 69 69 * @abstract read all agent datas from the database -
sandbox/workflow/2.0/inc/class.so_external_applications.inc.php
r795 r1293 130 130 $this->isAdmin = $_SESSION['phpgw_info']['workflow']['user_is_admin']; 131 131 $this->acl = &$GLOBALS['ajax']->acl; 132 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID;132 $this->db =& Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 133 133 $this->EXTERNAL_APPLICATION_PATH = $_SESSION['phpgw_info']['workflow']['server']['files_dir'] . '/workflow//workflow/external_applications'; 134 134 } -
sandbox/workflow/2.0/inc/class.so_move_instances.inc.php
r795 r1293 91 91 $this->userID = $_SESSION['phpgw_info']['workflow']['account_id']; 92 92 $this->isAdmin = $_SESSION['phpgw_info']['workflow']['user_is_admin']; 93 $this->acl = &$GLOBALS['ajax']->acl;94 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID;93 $this->acl =& $GLOBALS['ajax']->acl; 94 $this->db =& Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 95 95 } 96 96 -
sandbox/workflow/2.0/inc/class.so_orgchart.inc.php
r795 r1293 127 127 $this->isAdmin = $_SESSION['phpgw_info']['workflow']['user_is_admin']; 128 128 $this->acl = &$GLOBALS['ajax']->acl; 129 $this->db = & $GLOBALS['workflow']['workflowObjects']->getDBWorkflow()->Link_ID;130 $this->db = & $GLOBALS['workflow']['workflowObjects']->getDBWorkflow()->Link_ID;129 $this->db = &Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Link_ID; 130 $this->db = &Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Link_ID; 131 131 $this->db->SetFetchMode(ADODB_FETCH_ASSOC); 132 132 } … … 704 704 705 705 $output = $result->GetArray(-1); 706 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP');706 $cachedLDAP = Factory::newInstance('CachedLDAP'); 707 707 $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP_DATABASE); 708 708 for ($i = 0; $i < count($output); $i++) … … 753 753 754 754 /* search for the $searchTerm in the LDAP */ 755 $ldap = & $GLOBALS['workflow']['workflowObjects']->getLDAP();756 $list = @ldap_search($ldap, $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getLDAPContext(), $ldapSearch, array('uidnumber', 'cn', 'uid'));755 $ldap = &Factory::getInstance('WorkflowObjects')->getLDAP(); 756 $list = @ldap_search($ldap, Factory::getInstance('WorkflowLDAP')->getLDAPContext(), $ldapSearch, array('uidnumber', 'cn', 'uid')); 757 757 if ($list === false) 758 758 die(serialize("O sistema de busca não pode ser utilizado nesta organização.")); … … 762 762 763 763 /* search for the $searchTerm in the DB */ 764 $resultSet = $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID->query($DBSearch, $DBValues)->GetArray(-1);764 $resultSet = Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID->query($DBSearch, $DBValues)->GetArray(-1); 765 765 foreach ($resultSet as $row) 766 766 if (!isset($unifiedResult[$row['uidnumber']])) … … 811 811 { 812 812 $errors = array( 813 "O funcionário \"" . $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($employeeID) . "\" já pertença à área \"{$row['sigla']}\".",813 "O funcionário \"" . Factory::getInstance('WorkflowLDAP')->getName($employeeID) . "\" já pertença à área \"{$row['sigla']}\".", 814 814 '-----------------', 815 815 'Caso você queira colocá-lo na área selecionada, siga o procedimento: faça uma busca por seu nome, clique para editá-lo e, troque pela área desejada.' … … 869 869 { 870 870 $errors = array( 871 "O funcionário \"" . $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($employeeID) . "\" é titular, substituto ou auxiliar administrativo das seguintes áreas: " . implode(", ", $areas),871 "O funcionário \"" . Factory::getInstance('WorkflowLDAP')->getName($employeeID) . "\" é titular, substituto ou auxiliar administrativo das seguintes áreas: " . implode(", ", $areas), 872 872 '-----------------', 873 873 'Se você quiser excluir este funcionário, precisa removê-lo dos "cargos" que ele possui nas áreas citadas.' … … 899 899 $this->_checkError($result); 900 900 901 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');901 $ldap = &Factory::getInstance('WorkflowLDAP'); 902 902 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) 903 903 { … … 980 980 $query = 'SELECT 1 FROM funcionario WHERE (funcionario_id = ?)'; 981 981 if (!$this->db->query($query, $checkEmployee)->fetchRow()) 982 $errors[] = "O funcionário \"" . $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($checkEmployee) . "\" não está vinculado a uma área.";982 $errors[] = "O funcionário \"" . Factory::getInstance('WorkflowLDAP')->getName($checkEmployee) . "\" não está vinculado a uma área."; 983 983 } 984 984 … … 1026 1026 $query = 'SELECT 1 FROM funcionario WHERE (funcionario_id = ?)'; 1027 1027 if (!$this->db->query($query, $checkEmployee)->fetchRow()) 1028 $errors[] = "O funcionário \"" . $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($checkEmployee) . "\" não está vinculado a uma área.";1028 $errors[] = "O funcionário \"" . Factory::getInstance('WorkflowLDAP')->getName($checkEmployee) . "\" não está vinculado a uma área."; 1029 1029 } 1030 1030 … … 1078 1078 $outputInfo = array(); 1079 1079 1080 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP');1080 $cachedLDAP = Factory::newInstance('CachedLDAP'); 1081 1081 $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP_DATABASE); 1082 1082 $employeeEntry = $cachedLDAP->getEntryByID($employeeID); … … 1168 1168 ); 1169 1169 1170 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP');1170 $cachedLDAP = Factory::newInstance('CachedLDAP'); 1171 1171 $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP_DATABASE); 1172 1172 if (!empty($areaInfo['titular_funcionario_id'])) -
sandbox/workflow/2.0/inc/class.so_userinterface.inc.php
r795 r1293 22 22 function so_userinterface() 23 23 { 24 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBWorkflow()->Link_ID;24 $this->db =& Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Link_ID; 25 25 $this->db->SetFetchMode(ADODB_FETCH_ASSOC); 26 26 } … … 93 93 if (!empty($externalApplicationsID)) 94 94 { 95 $result = $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID->query("SELECT DISTINCT external_application_id, name, address, image, authentication, intranet_only FROM egw_wf_external_application WHERE (external_application_id IN (" . implode(', ', $externalApplicationsID) . ")) ORDER BY name");95 $result = Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID->query("SELECT DISTINCT external_application_id, name, address, image, authentication, intranet_only FROM egw_wf_external_application WHERE (external_application_id IN (" . implode(', ', $externalApplicationsID) . ")) ORDER BY name"); 96 96 $preOutput = $result->GetArray(-1); 97 97 … … 245 245 246 246 $employees = $result->GetArray(-1); 247 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP');247 $cachedLDAP = Factory::newInstance('CachedLDAP'); 248 248 $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP_DATABASE); 249 249 $categoriesCount = array(); … … 318 318 319 319 $employees = $result->GetArray(-1); 320 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP');320 $cachedLDAP = Factory::newInstance('CachedLDAP'); 321 321 $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP_DATABASE); 322 322 for ($i = 0; $i < count($employees); $i++) … … 356 356 357 357 /* search for the $searchTerm in the LDAP */ 358 $ldap = &$GLOBALS['workflow']['workflowObjects']->getLDAP();359 $list = @ldap_search($ldap, $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getLDAPContext(), ('(&(cn=*' . $searchTerm . '*)(phpgwaccounttype=u))'), array('uidNumber', 'cn', 'telephoneNumber'));358 $ldap =& Factory::getInstance('WorkflowObjects')->getLDAP(); 359 $list = @ldap_search($ldap, Factory::getInstance('WorkflowLDAP')->getLDAPContext(), ('(&(cn=*' . $searchTerm . '*)(phpgwaccounttype=u))'), array('uidNumber', 'cn', 'telephoneNumber')); 360 360 if ($list === false) 361 361 return false; -
sandbox/workflow/2.0/inc/class.ui_adminaccess.inc.php
r795 r1293 41 41 function ui_adminaccess() 42 42 { 43 if (! $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']))43 if (!Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id'])) 44 44 { 45 45 $GLOBALS['phpgw']->common->phpgw_header(); -
sandbox/workflow/2.0/inc/class.ui_adminactivities.inc.php
r795 r1293 11 11 { 12 12 /** 13 * @var array $public_functions Array of public functions 13 * @var array $public_functions Array of public functions 14 14 * @access public 15 15 */ … … 18 18 'show_graph' => true 19 19 ); 20 /**21 * @var object $process_manager Process manager22 * @access public 23 */24 var $process_manager; 25 /**26 * @var object $activity_manager27 * @access public 28 */20 /** 21 * @var object $process_manager Process manager 22 * @access public 23 */ 24 var $process_manager; 25 /** 26 * @var object $activity_manager 27 * @access public 28 */ 29 29 var $activity_manager; 30 /**31 * @var object $role_manager32 * @access public 33 */30 /** 31 * @var object $role_manager 32 * @access public 33 */ 34 34 var $role_manager; 35 /**36 * @var $where2 37 * @access public 38 */ 35 /** 36 * @var $where2 37 * @access public 38 */ 39 39 var $where2; 40 40 /** 41 41 * @var object $sort_mode2 42 * @access public 43 */ 42 * @access public 43 */ 44 44 var $sort_mode2; 45 45 /** … … 50 50 /** 51 51 * @var object $workflow_acl 52 * @access public 52 * @access public 53 53 */ 54 54 var $workflow_acl; 55 55 /** 56 * @var object $fs object for reading process folder 57 * @access public 58 */ 59 var $fs; 60 /** 61 * @var array $invalidFiles invalid files list 62 * @access public 63 */ 64 var $invalidFiles = array(); 56 * @var object $fs object for reading process folder 57 * @access public 58 */ 59 var $fs; 60 /** 61 * @var array $invalidFiles invalid files list 62 * @access public 63 */ 64 var $invalidFiles = array(); 65 65 /** 66 66 * Constructor da classe ui_adminactivities 67 * 67 * 68 68 * @access public 69 69 * @return void 70 */ 70 */ 71 71 function ui_adminactivities() 72 72 { … … 112 112 113 113 } 114 114 115 115 /** 116 116 * Build the form for Activities Administration … … 130 130 $this->t->set_block('admin_activities', 'block_activity_agents', 'activity_agents'); 131 131 $this->t->set_block('admin_activities', 'block_select_agents', 'select_agents'); 132 132 133 133 $proc_info =& $this->process_manager->get_process($this->wf_p_id); 134 134 135 135 $activity_id = (int)get_var('activity_id', 'any', 0); 136 136 $name = get_var('name', 'any', ''); 137 137 138 138 // TODO: not all variables below are still required. clean up 139 139 140 140 $description = get_var('description', 'any', ''); 141 141 $type = get_var('type', 'any', ''); … … 175 175 { 176 176 $rolename = trim($rolename); 177 if( strlen($rolename) > 0 ) 177 if( strlen($rolename) > 0 ) 178 178 { 179 179 //second parameter for read-only mode … … 190 190 } 191 191 } 192 else 192 else 193 193 { 194 194 $this->message[] = lang('Invalid role name'); … … 221 221 { 222 222 $activity_id = $this->save_activity($activity_id, $name, $description, $type, $default_user, $is_interactive, $is_autorouted, $userole, $userole_ro, $useagent, $rolename, $menu_path); 223 if( $activity_id ) 223 if( $activity_id ) 224 224 { 225 225 if ($newrole_id) … … 236 236 if (isset($_POST['delete_act'])) 237 237 { 238 if( isset($_POST['activities']) ) 238 if( isset($_POST['activities']) ) 239 239 { 240 240 if ($this->delete_activities(array_keys($_POST['activities']))) $this->message[] = lang('Deletion successful'); … … 245 245 // add transitions 246 246 if (isset($_POST['add_trans'])) 247 { 247 { 248 248 $this->message[] = $this->add_transition($_POST['wf_act_from_id'], $_POST['wf_act_to_id']); 249 249 $checkvalidity = true; … … 305 305 $filter_type = get_var('filter_type', 'any', ''); 306 306 $this->show_select_filter_type($activity_types, $filter_type); 307 307 308 308 $filter_interactive = get_var('filter_interactive', 'any', ''); 309 309 $activity_interactive = array('y' => lang('Interactive'), 'n'=>lang('Automatic')); 310 310 $this->show_select_filter_interactive($activity_interactive, $filter_interactive); 311 311 312 312 $filter_autoroute = get_var('filter_autoroute', 'any', ''); 313 313 $activity_autoroute = array('y' => lang('Auto Routed'), 'n'=>lang('Manual')); 314 314 $this->show_select_filter_autoroute($activity_autoroute, $filter_autoroute); 315 315 316 316 $where = ''; 317 317 $wheres = array(); 318 if( !($filter_type == '') ) 319 { 320 321 } 322 if( !($filter_interactive == '') ) 323 { 324 325 } 326 if( !($filter_autoroute == '') ) 318 if( !($filter_type == '') ) 319 { 320 $wheres[] = "wf_type = '" .$filter_type. "'"; 321 } 322 if( !($filter_interactive == '') ) 323 { 324 $wheres[] = "wf_is_interactive = '" .$filter_interactive. "'"; 325 } 326 if( !($filter_autoroute == '') ) 327 327 { 328 328 $wheres[] = "wf_is_autorouted = '" .$filter_autoroute. "'"; 329 329 } 330 if( count($wheres) > 0 ) 330 if( count($wheres) > 0 ) 331 331 { 332 332 $where = implode(' and ', $wheres); 333 333 } 334 334 335 335 if (empty($process_activities)) $process_activities =& $this->activity_manager->list_activities($this->wf_p_id, 0, -1, $this->sort_mode, $find, $where); 336 336 $all_transition_activities_from =& $this->activity_manager->get_transition_activities($this->wf_p_id, 'end'); … … 373 373 // fill proc_bar 374 374 $this->t->set_var('proc_bar', $this->fill_proc_bar($proc_info)); 375 375 376 376 //collect some messages from used objects 377 377 $this->message[] = $this->activity_manager->get_error(false, _DEBUG); … … 379 379 $this->message[] = $this->role_manager->get_error(false, _DEBUG); 380 380 381 $templateServer = & $GLOBALS['workflow']['factory']->getInstance('TemplateServer');381 $templateServer = &Factory::getInstance('TemplateServer'); 382 382 383 383 // fill the general variables of the template … … 418 418 } 419 419 else { 420 $this->t->set_var('filter_trans_from', $this->build_select_transition_filtered('filter_trans_from', $process_activities_with_transitions['data'], false, true, false)); 420 $this->t->set_var('filter_trans_from', $this->build_select_transition_filtered('filter_trans_from', $process_activities_with_transitions['data'], false, true, false)); 421 421 $this->t->set_var('filter_trans_from_value', ''); 422 422 } … … 425 425 $this->show_process_activities($process_activities['data']); 426 426 427 427 428 428 foreach ($activity_types as $type) 429 429 { … … 450 450 'act_role_ro_checked' => ($role['wf_readonly'])? 'checked="checked"' : '', 451 451 'act_role_href' => $GLOBALS['phpgw']->link('/index.php', array( 452 453 454 455 456 457 458 459 452 'menuaction' => 'workflow.ui_adminactivities.form', 453 'where2' => $where2, 454 'sort_mode2' => $sort_mode2, 455 'find' => $find, 456 'where' => $where, 457 'activity_id' => $activity_info['wf_activity_id'], 458 'p_id' => $this->wf_p_id, 459 'remove_role' => $role['wf_role_id'], 460 460 )), 461 461 'lang_delete' => lang('delete'), 462 462 )); 463 463 $this->t->parse('activity_roles', 'block_activity_roles', True); 464 464 } 465 466 } 467 465 466 } 467 468 468 //general texts about roles 469 469 $this->t->set_var(array( … … 472 472 'txt_Remove_selected_roles' => lang('remove selected roles'), 473 473 'txt_Use_existing_roles' => lang('Use existing roles'), 474 475 476 474 ) 475 ); 476 477 477 // fill activity agents 478 478 if (!$activity_agents) … … 504 504 } 505 505 } 506 506 507 507 //display agents options 508 508 $this->display_agents_rows(); … … 528 528 $this->t->parse('process_roles', 'block_process_roles', True); 529 529 } 530 530 531 531 // fill agents select 532 532 foreach ($agents_list as $agent) … … 553 553 } 554 554 /** 555 * Show select filter type556 * @param array $all_activity_types557 * @param $filter_type558 * @access public559 * @return void560 */555 * Show select filter type 556 * @param array $all_activity_types 557 * @param $filter_type 558 * @access public 559 * @return void 560 */ 561 561 function show_select_filter_type($all_activity_types, $filter_type) 562 562 { … … 574 574 } 575 575 } 576 577 /** 578 * Show select filter type579 * @param array $all_activity_types580 * @param $filter_type581 * @access public582 * @return void583 */576 577 /** 578 * Show select filter type 579 * @param array $all_activity_types 580 * @param $filter_type 581 * @access public 582 * @return void 583 */ 584 584 function show_select_filter_interactive($all_activity_interactive, $filter_interactive) 585 585 { … … 598 598 } 599 599 /** 600 * Show select filter type601 * @param array $all_activity_types602 * @param $filter_type603 * @access public604 * @return void605 */600 * Show select filter type 601 * @param array $all_activity_types 602 * @param $filter_type 603 * @access public 604 * @return void 605 */ 606 606 function show_select_filter_autoroute($all_activity_autoroute, $filter_autoroute) 607 607 { … … 619 619 } 620 620 } 621 622 /** 623 * Show select filter type624 * @param array $all_activity_types625 * @param $filter_type626 * @access public627 * @return void628 */621 622 /** 623 * Show select filter type 624 * @param array $all_activity_types 625 * @param $filter_type 626 * @access public 627 * @return void 628 */ 629 629 function update_activities(&$process_activities, $activities_inter, $activities_route) 630 630 { … … 673 673 * Search transitions activities 674 674 * @param array $process_activities 675 * @param int $act_id 675 * @param int $act_id 676 676 * @return int new role id 677 677 */ … … 714 714 $this->translate_template('block_process_activities_header'); 715 715 $this->t->parse('process_activities_header', 'block_process_activities_header', True); 716 $templateServer = & $GLOBALS['workflow']['factory']->getInstance('TemplateServer');716 $templateServer = &Factory::getInstance('TemplateServer'); 717 717 foreach ($process_activities_data as $activity) 718 718 { … … 725 725 $act_default_user = $GLOBALS['phpgw']->accounts->id2name($activity['wf_default_user']); 726 726 } 727 727 728 728 $this->t->set_var(array( 729 729 'act_activity_id' => $activity['wf_activity_id'], … … 747 747 $this->t->parse('process_activities_footer', 'block_process_activities_footer', True); 748 748 } 749 else 749 else 750 750 { 751 751 $this->t->set_var('process_activities_header', ''); … … 754 754 } 755 755 } 756 /** 757 * Show transitions table758 * @var array $process_transition 759 * @access public760 * @return void761 */756 /** 757 * Show transitions table 758 * @var array $process_transition 759 * @access public 760 * @return void 761 */ 762 762 function show_transitions_table($process_transitions) 763 763 { … … 774 774 'trans_href_from' => $GLOBALS['phpgw']->link('/index.php', 'menuaction=workflow.ui_adminactivities.form&where2='. $where2 .'&sort_mode2='. $sort_mode2 .'&p_id='. $this->wf_p_id .'&find='. $find .'&where='. $where .'&sort_mode='. $this->sort_mode .'&activity_id='. $transition['wf_act_from_id']), 775 775 'trans_actFromName' => $transition['wf_act_from_name'], 776 'trans_arrow' => $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink('next.gif'),776 'trans_arrow' => Factory::getInstance('TemplateServer')->generateImageLink('next.gif'), 777 777 'trans_href_to' => $GLOBALS['phpgw']->link('/index.php', 'menuaction=workflow.ui_adminactivities.form&where2='. $where2 .'&sort_mode2='. $sort_mode2 .'&p_id='. $this->wf_p_id .'&find='. $find .'&where='. $where .'&sort_mode='. $this->sort_mode .'&activity_id='. $transition['wf_act_to_id']), 778 778 'trans_actToName' => $transition['wf_act_to_name'], … … 785 785 $this->t->set_var('transitions_table', '<tr><td colspan="2" align="center">'. lang('There are no transitions defined') .'</td></tr>'); 786 786 $this->t->set_var('transitions_table_footer', ''); 787 } 788 else 787 } 788 else 789 789 { 790 790 $this->t->parse('transitions_table_footer', 'block_transitions_table_footer', true); … … 794 794 /** 795 795 * Build select box with all transitions activities 796 * @param string $var_name 796 * @param string $var_name 797 797 * @param array $process_activities_data array of process data 798 * @param boolean $multiple 799 * @param boolean $show_all show all list 800 * @param boolean $from_or_to 798 * @param boolean $multiple 799 * @param boolean $show_all show all list 800 * @param boolean $from_or_to 801 801 * @access public 802 802 * @return string html code with select box 803 803 */ 804 function build_select_transition($var_name, $process_activities_data, $multiple=false, 805 $show_all=true, $from_or_to=false)804 function build_select_transition($var_name, $process_activities_data, $multiple=false, 805 $show_all=true, $from_or_to=false) 806 806 { 807 807 //echo "process_activities_data: <pre>";print_r($process_activities_data);echo "</pre>"; 808 808 $select_str = "<select name='$var_name'" . (($multiple)? " multiple='multiple' size='5'" : "" ) . ">"; 809 809 if ($show_all) $select_str .= '<option value="">'. lang('All') .'</option>'; 810 810 811 811 foreach ($process_activities_data as $activity) 812 812 { … … 824 824 return $select_str; 825 825 } 826 826 827 827 /** 828 828 * Build select box with all transitions activities filtered 829 * @param string $var_name 829 * @param string $var_name 830 830 * @param array $process_activities_data array of process data 831 * @param boolean $multiple 832 * @param boolean $show_all show all list 833 * @param boolean $from_or_to 831 * @param boolean $multiple 832 * @param boolean $show_all show all list 833 * @param boolean $from_or_to 834 834 * @access public 835 835 * @return string html code with select box 836 */ 836 */ 837 837 function build_select_transition_filtered($var_name, $process_activities_data, $multiple=false, $show_all=true, $from=false) 838 838 { 839 839 $select_str = "<select name='$var_name'" . (($multiple)? " multiple='multiple' size='5'" : "" ) . ">"; 840 840 if ($show_all) $select_str .= '<option value="">'. lang('All') .'</option>'; 841 842 if( is_array($process_activities_data) && count($process_activities_data) > 0 ) 841 842 if( is_array($process_activities_data) && count($process_activities_data) > 0 ) 843 843 { 844 844 foreach ($process_activities_data as $activity) … … 860 860 861 861 /** 862 * Save the edited activity. 863 * 862 * Save the edited activity. 863 * 864 864 * @param int $activity_id 865 865 * @param string $name … … 868 868 * @param string $default_user 869 869 * @param bool $is_interative 870 * @param bool $is_autorouted 870 * @param bool $is_autorouted 871 871 * @return mixed Return the activity_id or false in case of error, $this->message is set in case of error 872 872 * @access public … … 902 902 903 903 $activity_id = $this->activity_manager->replace_activity($this->wf_p_id, $activity_id, $vars); 904 904 905 905 // assign role to activity 906 if ($userole) 906 if ($userole) 907 907 { 908 908 $this->activity_manager->add_activity_role($activity_id, $userole, ($userole_ro=='on')); 909 909 } 910 910 911 911 // assign agent to activity 912 if ($useagent) 912 if ($useagent) 913 913 { 914 914 $this->activity_manager->add_activity_agent($activity_id, $useagent); … … 919 919 { 920 920 $agents_conf =& $_POST['wf_agent']; 921 921 922 922 //retrieve agents list 923 923 $activity_agents =& $this->activity_manager->get_activity_agents($activity_id); … … 958 958 } 959 959 $this->activity_manager->validate_process_activities($this->wf_p_id); 960 961 960 961 962 962 return $activity_id; 963 963 } … … 987 987 $this->message[] = lang('Transitions removed successfully'); 988 988 } 989 else 989 else 990 990 { 991 991 $this->message[] = lang('Select a transition to remove'); … … 994 994 /** 995 995 * Add a transition activity 996 * @param int $from from activity 996 * @param int $from from activity 997 997 * @param int $to next activity 998 998 * @return string Error or success message … … 1018 1018 $image_name = $proc_info['wf_normalized_name'] . SEP . 'graph' . SEP . $proc_info['wf_normalized_name'] . '.png'; 1019 1019 $image = GALAXIA_PROCESSES . SEP . $image_name; 1020 if ( $GLOBALS['workflow']['factory']->getInstance('BrowserInfo')->isOpera())1020 if (Factory::getInstance('BrowserInfo')->isOpera()) 1021 1021 $maximumDimension = 1000000; 1022 1022 else … … 1051 1051 } 1052 1052 } 1053 1053 1054 1054 /** 1055 1055 * Dislays the activity agents config rows … … 1072 1072 } 1073 1073 $this->translate_template('admin_agents'); 1074 1074 $this->t->parse('agents_config_rows', 'admin_agents'); 1075 1075 } 1076 1076 } -
sandbox/workflow/2.0/inc/class.ui_adminjobs.inc.php
r795 r1293 41 41 'app_header' => $GLOBALS['phpgw_info']['apps']['workflow']['title'] . ' - ' . lang('Jobs') 42 42 ); 43 $smarty = & $GLOBALS['workflow']['factory']->getInstance('workflow_smarty');43 $smarty = &Factory::getInstance('workflow_smarty'); 44 44 45 45 $javaScripts = $this->get_common_js(); … … 54 54 $css .= $this->get_css_link('adminjobs'); 55 55 56 $processInfo = $GLOBALS['workflow']['factory']->getInstance('workflow_processmanager')->get_process((int) $_REQUEST['p_id']);56 $processInfo = Factory::getInstance('workflow_processmanager')->get_process((int) $_REQUEST['p_id']); 57 57 $smarty->assign('processNameVersion', "{$processInfo['wf_name']} v{$processInfo['wf_version']}"); 58 58 $smarty->assign('processID', (int) $processInfo['wf_p_id']); -
sandbox/workflow/2.0/inc/class.ui_adminprocesses.inc.php
r989 r1293 127 127 } 128 128 129 if (! $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']))129 if (!Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id'])) 130 130 { 131 131 $proc_ids = $this->workflow_acl->get_granted_processes($GLOBALS['phpgw_info']['user']['account_id']); … … 589 589 590 590 $myp_id = $item['wf_p_id']; 591 $templateServer = & $GLOBALS['workflow']['factory']->getInstance('TemplateServer');591 $templateServer = &Factory::getInstance('TemplateServer'); 592 592 $this->t->set_var(array( 593 593 'item_wf_p_id' => $myp_id, -
sandbox/workflow/2.0/inc/class.ui_adminroles.inc.php
r795 r1293 75 75 $this->role_manager = CreateObject('workflow.workflow_rolemanager'); 76 76 $this->form_action = $GLOBALS['phpgw']->link('/index.php', 'menuaction=workflow.ui_adminroles.form'); 77 77 78 78 } 79 79 /** … … 97 97 98 98 if (!$this->wf_p_id) die(lang('No process indicated')); 99 99 100 100 //do we need to check validity, warning high load on database 101 101 $checkvalidity=false; … … 122 122 $checkvalidity = true; 123 123 } 124 124 125 125 // delete mappings 126 if (isset($_POST['delete_map'])) 126 if (isset($_POST['delete_map'])) 127 127 { 128 128 $this->delete_maps(array_keys($_POST['map'])); … … 137 137 // fill proc_bar 138 138 $this->t->set_var('proc_bar', $this->fill_proc_bar($proc_info)); 139 139 140 140 // retrieve role info 141 141 if ($role_id || isset($_POST['new_role'])) … … 155 155 $all_roles = $this->role_manager->list_roles($this->wf_p_id, 0, -1, 'wf_name__asc', ''); 156 156 //echo "all_roles: <pre>";print_r($all_roles);echo "</pre>"; 157 157 158 158 //collect some messages from used objects 159 159 $this->message[] = $this->activity_manager->get_error(false, _DEBUG); … … 208 208 $this->message[] = lang('Role not saved (maybe a name collision)'); 209 209 } 210 210 211 211 } 212 212 /** 213 213 * Delet selected roles 214 * @param array $roles_ids 214 * @param array $roles_ids 215 215 * @access public 216 216 * @return void … … 254 254 $this->t->set_var('list_mappings', '<tr><td colspan="3" align="center">'. lang('There are no mappings defined for this process') .'</td></tr>'); 255 255 } 256 else { 256 else { 257 257 /* load the LDAP information */ 258 $cachedLDAP = $GLOBALS['workflow']['factory']->getInstance('CachedLDAP');259 $tmpLDAP = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');258 $cachedLDAP = Factory::getInstance('CachedLDAP'); 259 $tmpLDAP = &Factory::getInstance('WorkflowLDAP'); 260 260 $userContext = $tmpLDAP->getUserContext(); 261 261 $groupContext = $tmpLDAP->getGroupContext(); … … 264 264 { 265 265 if ($mapping['wf_account_type'] == 'g') { 266 $sri = ldap_search( $GLOBALS['workflow']['workflowObjects']->getLDAP(),267 $groupContext, 266 $sri = ldap_search(Factory::getInstance('WorkflowObjects')->getLDAP(), 267 $groupContext, 268 268 '(&(gidnumber=' . (int)$mapping['wf_user'] . ')(phpgwAccountType=g))'); 269 270 $allValues = ldap_get_entries( $GLOBALS['workflow']['workflowObjects']->getLDAP(), $sri);271 269 270 $allValues = ldap_get_entries(Factory::getInstance('WorkflowObjects')->getLDAP(), $sri); 271 272 272 $cname = $GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8'); 273 273 $glabel = '[' . lang('Group') . ']'; … … 280 280 $glabel = '<font color="red">(excluído)</font>'; 281 281 } 282 282 283 283 $this->t->set_var(array( 284 284 'map_user_id' => $mapping['wf_user'], … … 313 313 * Show users roles selects 314 314 * @param string $all_roles_data 315 * @return 315 * @return 316 316 */ 317 317 function show_users_roles_selects($all_roles_data) 318 318 { 319 $templateServer = & $GLOBALS['workflow']['factory']->getInstance('TemplateServer');319 $templateServer = &Factory::getInstance('TemplateServer'); 320 320 $imgaddusers = $templateServer->generateImageLink('add_group.png'); 321 321 $imgdelusers = $templateServer->generateImageLink('delete_group.png'); … … 325 325 'src_img_del_users' => $imgdelusers 326 326 )); 327 327 328 328 $this->t->set_block('admin_roles', 'block_select_roles', 'select_roles'); 329 329 foreach ($all_roles_data as $role) -
sandbox/workflow/2.0/inc/class.ui_adminsource.inc.php
r795 r1293 78 78 function form() 79 79 { 80 $smarty = $GLOBALS['workflow']['factory']->getInstance('workflow_smarty', false);80 $smarty = Factory::getInstance('workflow_smarty', false); 81 81 $smarty->setHeader(workflow_smarty::SHOW_HEADER | workflow_smarty::SHOW_NAVIGATION_BAR | workflow_smarty::SHOW_FOOTER, $GLOBALS['phpgw_info']['apps']['workflow']['title'] . ' - ' . lang('Admin Processes Sources')); 82 82 -
sandbox/workflow/2.0/inc/class.ui_agent.inc.php
r795 r1293 11 11 12 12 /** 13 * Agents abstraction library. interface layer. 13 * Agents abstraction library. interface layer. 14 14 * This allows the Workflow Engine to connect to various agents 15 15 * Agents are external elements for the workflow. It could be … … 17 17 * Use this class to make childrens like, for example in the 18 18 * class.ui_agent_mail_smtp.inc.php for the mail_smtp susbsytem 19 * 19 * 20 20 * @package Workflow 21 21 * @license http://www.gnu.org/copyleft/gpl.html GPL … … 23 23 */ 24 24 require_once(dirname(__FILE__) . SEP . 'class.WorkflowUtils.inc.php'); 25 25 26 26 class ui_agent extends WorkflowUtils 27 27 { … … 39 39 * @var bool $interactivity for runtime mode 40 40 * @access public 41 */ 41 */ 42 42 var $interactivity = false; 43 43 44 44 // concerning Child classes constructors --------------------------------------------- 45 45 /** 46 46 * @var object bo_agent object which have to be set in your child class to the right bo_agent child 47 * @access public 47 * @access public 48 48 */ 49 49 var $bo_agent = null; … … 54 54 var $agent_type = ''; 55 55 // ----------------------------------------------------------------------------------- 56 56 57 57 /** 58 58 * Constructor … … 64 64 parent::WorkflowUtils(); 65 65 } 66 66 67 67 /** 68 68 * Function which must be called (internally) at runtime .The agent MUST know if he is runned in an interactive activity or not. … … 79 79 * Return errors recorded by this object 80 80 * You should always call this function after failed operations on a workflow object to obtain messages 81 * @param array $as_array if true the result will be send as an array of errors or an empty array. Else, if you do not give any parameter 81 * @param array $as_array if true the result will be send as an array of errors or an empty array. Else, if you do not give any parameter 82 82 * or give a false parameter you will obtain a single string which can be empty or will contain error messages with <br /> html tags. 83 83 * @access public 84 * @return array errors 85 */ 86 function get_error($as_array=false) 84 * @return array errors 85 */ 86 function get_error($as_array=false) 87 87 { 88 88 $this->error[] = $this->bo_agent->get_error(); … … 95 95 return $result_str; 96 96 } 97 97 98 98 /** 99 99 * Factory: load the agent values stored somewhere via the agent bo object … … 106 106 return ( (isset($this->bo_agent)) && ($this->bo_agent->load($agent_id))); 107 107 } 108 108 109 109 /** 110 110 * Save the agent values somewhere via the agent bo object … … 116 116 { 117 117 if (!(isset($this->bo_agent))) 118 { 118 { 119 119 return false; 120 120 } … … 131 131 * we store references to theses objects and we tell the ui object if we are in interactive 132 132 * mode or not. 133 * @param array $instance 133 * @param array $instance 134 134 * @param object $activity activity 135 135 * @return void … … 141 141 $this->setInteractivity($activity->isInteractive()); 142 142 } 143 143 144 144 /** 145 145 * This function show the shared part of all agents when showing configuration in the admin activity form … … 147 147 * @param string $template_block_name 148 148 * @return void 149 * @access public 149 * @access public 150 150 */ 151 151 function showAdminActivityOptions ($template_block_name) 152 { 152 { 153 153 $admin_name = 'admin_agent_shared'; 154 154 $this->t->set_file($admin_name, $admin_name . '.tpl'); … … 161 161 $this->t->parse($template_block_name, $admin_name); 162 162 } 163 163 164 164 /** 165 165 * Function called by the running object (run_activity) after the activity_pre code … … 177 177 return true; 178 178 } 179 179 180 180 /** 181 181 * Function called by the running object (run_activity) after the activity_pre code … … 190 190 return true; 191 191 } 192 192 193 193 /** 194 194 * Function called by the running object (run_activity) after the user code 195 * 195 * 196 196 * and after the activity_pos code. This code is runned only if the $GLOBALS['__activity_completed'] 197 197 * IS NOT set (i.e.: the user is not yet completing the activity) … … 200 200 * user code after completion. 201 201 * @return bool true or false, if false the $this->error array should contains error messages 202 * @access public 202 * @access public 203 203 */ 204 204 function run_activity_completed_pos() … … 206 206 return true; 207 207 } 208 208 209 209 /** 210 210 * Function called by the running object (run_activity) after the user code 211 * 211 * 212 212 * and after the activity_pos code. This code is runned only if the $GLOBALS['__activity_completed'] 213 213 * IS set (i.e.: the user has completing the activity) … … 222 222 return true; 223 223 } 224 224 225 225 /** 226 226 * Retrieve infos set by the user in interactive forms ans store it with the bo_agent object -
sandbox/workflow/2.0/inc/class.ui_agent_mail_smtp.inc.php
r795 r1293 11 11 require_once(dirname(__FILE__) . SEP . 'class.ui_agent.inc.php'); 12 12 /** 13 * Mail-SMTP Agent : interface layer. 13 * Mail-SMTP Agent : interface layer. 14 14 * This class connects the workflow agents calls to the mail_smtp agent business layer 15 * 15 * 16 16 * @package Workflow 17 17 * @license http://www.gnu.org/copyleft/gpl.html GPL 18 18 * @author regis.leroy@glconseil.com 19 */ 19 */ 20 20 class ui_agent_mail_smtp extends ui_agent 21 21 { … … 24 24 * @access public 25 25 * @return object 26 */ 26 */ 27 27 function ui_agent_mail_smtp() 28 28 { … … 36 36 * @param string $template_block_name 37 37 * @access public 38 * @return void 38 * @return void 39 39 */ 40 40 function showAdminActivityOptions ($template_block_name) … … 71 71 } 72 72 if ($option_conf['type'] == 'select') 73 { 73 { 74 74 $this->t->set_var(array( 75 75 'ag_config_name_s' => "wf_agent[".$this->agent_type."][".$option_name."]", … … 93 93 $this->t->parse($template_block_name, $admin_name); 94 94 } 95 95 96 96 /** 97 97 * Function called by the running object (run_activity) after the activity_pre code … … 108 108 //load agent data from database 109 109 $this->bo_agent->init(); 110 110 111 111 //this will send an email only if the configuration says to do so 112 112 if (!($this->bo_agent->send_start())) … … 123 123 return $ok; 124 124 } 125 125 126 126 /** 127 127 * Function called by the running object (run_activity) after the activity_pre code … … 136 136 return true; 137 137 } 138 138 139 139 /** 140 140 * Function called by the running object (run_activity) after the user code … … 160 160 return $ok; 161 161 } 162 162 163 163 /** 164 164 * Function called by the running object (run_activity) after the user code … … 170 170 * This function can call two types of mail sending 171 171 * * sending email on POST queries (usefull for interactive forms), retrieving POSTed values 172 * * sending email at each reach of the end of the code (usefull for automatic activities which 172 * * sending email at each reach of the end of the code (usefull for automatic activities which 173 173 * completes only after execution of user code (sending after completion is not possible). And we 174 174 * musn't retrieve POSTed values in this case because it can concerns previous non-automatic activities … … 190 190 //erase agent data with the POSTed values 191 191 $this->bo_agent->set($this->agent_values); 192 192 193 193 //this will send an email only if the configuration says to do so 194 194 if (!($this->bo_agent->send_post())) … … 224 224 } 225 225 } 226 226 227 227 } 228 228 ?> -
sandbox/workflow/2.0/inc/class.ui_ajaxinterface.inc.php
r795 r1293 18 18 * Cria o ambiente de sessão para rodar Ajax e implementa alguns métodos 19 19 * básicos para inclusão de JavaScript e CSS 20 * 20 * 21 21 * @package Workflow 22 22 * @license http://www.gnu.org/copyleft/gpl.html GPL … … 28 28 * @var int $num_version Identifica a verão dos arquivos JavaScript e CSS. Incremente o valor deste atribuito 29 29 * sempre que existirem alterações nos arquivos, para forçar o download pelo browser 30 * @access public 31 */ 30 * @access public 31 */ 32 32 var $num_version = 213; 33 33 … … 36 36 * @access public 37 37 * @return object 38 */ 38 */ 39 39 function ui_ajaxinterface() 40 40 { … … 42 42 43 43 /** 44 * Coloca na variável de sessão todas as informações que serão necessárias para 44 * Coloca na variável de sessão todas as informações que serão necessárias para 45 45 * rodar os métodos acionados pelas requisições Ajax. 46 * 46 * 47 47 * @return void 48 * @access public 48 * @access public 49 49 */ 50 50 function set_wf_session() … … 56 56 $vfs = createobject('phpgwapi.vfs'); 57 57 $_SESSION['phpgw_info']['workflow']['vfs_basedir'] = $vfs->basedir; 58 $_SESSION['phpgw_info']['workflow']['server'] = $GLOBALS['phpgw_info']['server']; 58 $_SESSION['phpgw_info']['workflow']['server'] = $GLOBALS['phpgw_info']['server']; 59 59 $_SESSION['phpgw_info']['workflow']['lang'] = $GLOBALS['lang']; 60 60 $_SESSION['phpgw_info']['workflow']['account_id'] = $GLOBALS['phpgw_info']['user']['account_id']; 61 $_SESSION['phpgw_info']['workflow']['user_groups'] = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserGroups($GLOBALS['phpgw_info']['user']['account_id']);61 $_SESSION['phpgw_info']['workflow']['user_groups'] = Factory::getInstance('WorkflowLDAP')->getUserGroups($GLOBALS['phpgw_info']['user']['account_id']); 62 62 $user_is_admin = $acl->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']); 63 $_SESSION['phpgw_info']['workflow']['user_is_admin'] = $user_is_admin; 63 $_SESSION['phpgw_info']['workflow']['user_is_admin'] = $user_is_admin; 64 64 $_SESSION['phpgw_info']['workflow']['user_can_admin_process'] = ($user_is_admin || ($GLOBALS['phpgw']->acl->check('admin_workflow',1,'workflow'))); 65 $_SESSION['phpgw_info']['workflow']['user_can_admin_instance'] = ($user_is_admin || ($GLOBALS['phpgw']->acl->check('admin_instance_workflow',1,'workflow'))); 65 $_SESSION['phpgw_info']['workflow']['user_can_admin_instance'] = ($user_is_admin || ($GLOBALS['phpgw']->acl->check('admin_instance_workflow',1,'workflow'))); 66 66 67 67 $can_monitor = $acl->checkUserGroupAccessToType('MON', $GLOBALS['phpgw_info']['user']['account_id']); … … 74 74 /** 75 75 * Insere código html para incorporar arquivos JavaScript de uso comum 76 * 76 * 77 77 * @return string codigo html para insercao do javascript 78 * @access public 78 * @access public 79 79 */ 80 80 function get_common_js() 81 81 { 82 82 $result = "<script language='javascript'>var _web_server_url = '" . $GLOBALS['phpgw_info']['server']['webserver_url'] . "';</script>"; 83 $result = $result . $this->get_js_link('workflow','jscode', 'globals'); 83 $result = $result . $this->get_js_link('workflow','jscode', 'globals'); 84 84 $result = $result . $this->get_js_link('workflow','jscode', 'common_functions'); 85 85 $result = $result . $this->get_js_link('workflow','jscode', 'abas'); … … 89 89 $result = $result . $this->get_js_link('workflow','jscode', 'dJSWin'); 90 90 $result = $result . $this->get_js_link('workflow','jscode', 'doiMenuDOM'); 91 91 92 92 return $result; 93 93 } … … 95 95 /** 96 96 * Insere o código html para inclusão do arquivo de estilo common.css 97 * 97 * 98 98 * @return string tag html completa para inserção do arquivo common.css 99 * @access public 99 * @access public 100 100 */ 101 101 function get_common_css() … … 117 117 { 118 118 $CSSName = "css/{$CSSName}.css"; 119 $templateServer = & $GLOBALS['workflow']['factory']->getInstance('TemplateServer');119 $templateServer = &Factory::getInstance('TemplateServer'); 120 120 $CSSLink = $templateServer->getWebFile($CSSName); 121 121 $CSSFile = $templateServer->getSystemFile($CSSName); … … 126 126 /** 127 127 * Insere o código html para inclusão de um arquivo JavaScript. 128 * 128 * 129 129 * @param string $module nome do módulo do eGroupware (preferencialmente workflow) 130 130 * @param string $js_package nome do grupamento de arquivos javascript 131 131 * @param string $js_name nome do arquivo javascript 132 * @param array $params parametros 133 * @return string tag html completa para inserção do arquivo solicitado 134 * @access public 132 * @param array $params parametros 133 * @return string tag html completa para inserção do arquivo solicitado 134 * @access public 135 135 */ 136 136 function get_js_link($module, $js_package, $js_name, $params = null) … … 150 150 return '<script src="'.$js_file.'?'.implode('&', $params).'" type="text/javascript"></script>'; 151 151 } 152 152 153 153 /** 154 154 * Executa a função inicial JavaScript que irá montar os dados da interface. 155 * 155 * 156 156 * @param string $param nome da função JavaScript 157 * @return string tag html completa com a chamada da função 158 * @access public 157 * @return string tag html completa com a chamada da função 158 * @access public 159 159 */ 160 160 function run_init_script($param) … … 162 162 return '<script language="javascript">' . $param . '</script>'; 163 163 } 164 164 165 165 } 166 166 ?> -
sandbox/workflow/2.0/inc/class.ui_external_applications.inc.php
r795 r1293 49 49 function draw() 50 50 { 51 if (! $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']))51 if (!Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id'])) 52 52 { 53 53 $GLOBALS['phpgw']->common->phpgw_header(); -
sandbox/workflow/2.0/inc/class.ui_generic_select.inc.php
r795 r1293 79 79 function form() 80 80 { 81 $smarty = $GLOBALS['workflow']['factory']->getInstance('workflow_smarty', false);81 $smarty = Factory::getInstance('workflow_smarty', false); 82 82 $smarty->setHeader(workflow_smarty::SHOW_HEADER | workflow_smarty::SHOW_FOOTER); 83 83 -
sandbox/workflow/2.0/inc/class.ui_orgchart.inc.php
r795 r1293 153 153 return false; 154 154 155 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');155 $ldap = &Factory::getInstance('WorkflowLDAP'); 156 156 for ($i = 0; $i < count($output); $i++) 157 157 { -
sandbox/workflow/2.0/inc/class.ui_participants.inc.php
r795 r1293 41 41 function ui_participants() 42 42 { 43 $this->bo = $GLOBALS['workflow']['factory']->getInstance('bo_participants');43 $this->bo = Factory::getInstance('bo_participants'); 44 44 } 45 45 … … 51 51 function form() 52 52 { 53 $smarty = $GLOBALS['workflow']['factory']->getInstance('workflow_smarty', false);53 $smarty = Factory::getInstance('workflow_smarty', false); 54 54 $smarty->setHeader(workflow_smarty::SHOW_HEADER | workflow_smarty::SHOW_FOOTER); 55 $ldap = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');55 $ldap = Factory::getInstance('WorkflowLDAP'); 56 56 $userDN = $GLOBALS['phpgw_info']['user']['account_dn']; 57 $account = $GLOBALS['workflow']['factory']->getForeignInstance('phpgwapi', 'accounts', $userDN);57 $account = Factory::getForeignInstance('phpgwapi', 'accounts', $userDN); 58 58 $organizationList = $this->bo->getOrganizations(); 59 59 -
sandbox/workflow/2.0/inc/class.ui_phpeditor.inc.php
r795 r1293 62 62 function form() 63 63 { 64 $smarty = $GLOBALS['workflow']['factory']->getInstance('workflow_smarty', false);65 $processManager = new ProcessManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);64 $smarty = Factory::getInstance('workflow_smarty', false); 65 $processManager = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 66 66 $proccessInfo = $processManager->get_process($_GET['proc_id']); 67 67 -
sandbox/workflow/2.0/inc/class.ui_userinterface.inc.php
r1227 r1293 45 45 $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['workflow']['title']; 46 46 $GLOBALS['phpgw_info']['flags'] = array('noheader' => false, 'nonavbar' => false, 'currentapp' => 'workflow'); 47 $smarty = CreateObject('workflow.workflow_smarty');47 $smarty = Factory::newInstance('workflow_smarty'); //CreateObject('workflow.workflow_smarty'); 48 48 49 49 // Check if workflow config is ok … … 114 114 115 115 // Get a connection to db workflow and galaxia (module) 116 if ( $GLOBALS['workflow']['workflowObjects']->getDBWorkflow()->Error)116 if (Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Error) 117 117 $errors[] = 'Unable to connect to database Workflow'; 118 118 119 if ($errormsg = $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Error)119 if ($errormsg = Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Error) 120 120 $errors[] = 'Unable to connect to database Galaxia'; 121 121 -
sandbox/workflow/2.0/inc/class.workflow_acl.inc.php
r795 r1293 30 30 function workflow_acl() 31 31 { 32 parent::so_adminaccess( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);32 parent::so_adminaccess(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 33 33 } 34 34 -
sandbox/workflow/2.0/inc/class.workflow_activitymanager.inc.php
r795 r1293 20 20 function workflow_activitymanager() 21 21 { 22 parent::ActivityManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);22 parent::ActivityManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 23 23 } 24 24 } -
sandbox/workflow/2.0/inc/class.workflow_baseactivity.inc.php
r795 r1293 17 17 function workflow_baseactivity() 18 18 { 19 parent::BaseActivity( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);19 parent::BaseActivity(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 20 20 } 21 21 } -
sandbox/workflow/2.0/inc/class.workflow_gui.inc.php
r795 r1293 20 20 function workflow_gui() 21 21 { 22 parent::GUI( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);22 parent::GUI(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 23 23 } 24 24 } -
sandbox/workflow/2.0/inc/class.workflow_instance.inc.php
r795 r1293 20 20 function workflow_Instance() 21 21 { 22 parent::Instance( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);22 parent::Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 23 23 } 24 24 } -
sandbox/workflow/2.0/inc/class.workflow_instancemanager.inc.php
r795 r1293 17 17 function workflow_instancemanager() 18 18 { 19 parent::InstanceManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);19 parent::InstanceManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 20 20 } 21 21 } -
sandbox/workflow/2.0/inc/class.workflow_process.inc.php
r795 r1293 16 16 function workflow_process() 17 17 { 18 parent::Process( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);18 parent::Process(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 19 19 } 20 20 } -
sandbox/workflow/2.0/inc/class.workflow_processmanager.inc.php
r795 r1293 26 26 'database_user', 27 27 'database_password' 28 ); 28 ); 29 29 /** 30 30 * Constructor … … 34 34 function workflow_processmanager() 35 35 { 36 parent::ProcessManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);36 parent::ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 37 37 $this->workflow_acl = CreateObject('workflow.workflow_acl'); 38 38 39 39 /* allow regular users to see the process graph */ 40 40 if ($_GET['menuaction'] == "workflow.ui_adminactivities.show_graph") … … 67 67 { 68 68 $proc_name = $this->_normalize_name($data['name'],$data['version']); 69 foreach($data['templates'] as $tpl) 69 foreach($data['templates'] as $tpl) 70 70 { 71 71 $full_fname = GALAXIA_PROCESSES.SEP.$proc_name.SEP.'code'.SEP.'templates'.SEP.$tpl['name']; 72 72 if (file_exists($full_fname)) unlink($full_fname); 73 73 74 74 $fp = fopen($full_fname,"w"); 75 75 fwrite($fp, $tpl['code']); … … 77 77 } 78 78 79 foreach($data['includes'] as $inc) 79 foreach($data['includes'] as $inc) 80 80 { 81 81 $full_fname = GALAXIA_PROCESSES.SEP.$proc_name.SEP.'code'.SEP.$inc['name']; 82 82 if (file_exists($full_fname)) unlink($full_fname); 83 83 84 84 $fp = fopen($full_fname,"w"); 85 85 fwrite($fp, $inc['code']); … … 111 111 } 112 112 113 /** 113 /** 114 114 * Creates an XML representation of a process. 115 115 * Original from ProcessManager Class … … 124 124 if (!isset($this->jobManager)) 125 125 $this->jobManager = new JobManager($this->db); 126 126 127 127 //if (!(isset($this->activity_manager))) $this->activity_manager = new ActivityManager($this->db); 128 128 // <process> … … 151 151 //Loop on config values 152 152 $out.=' <configs>'."\n"; 153 foreach($proc_info['config'] as $res) { 153 foreach($proc_info['config'] as $res) { 154 154 $name = $res['wf_config_name']; 155 155 $value_int = $res['wf_config_value_int']; 156 156 $value = $res['wf_config_value']; 157 if (array_search($name,$this->not_export_attributes) === false) 157 if (array_search($name,$this->not_export_attributes) === false) 158 158 { 159 159 $out.=' <config>'."\n"; … … 167 167 168 168 // Now loop over activities 169 169 170 170 $act_list = $this->activity_manager->list_activities($pId, 0, -1, 'wf_name__asc', '','',false); 171 171 $out.=' <activities>'."\n"; 172 foreach($act_list['data'] as $res) { 172 foreach($act_list['data'] as $res) { 173 173 $name = $res['wf_normalized_name']; 174 174 $out.=' <activity>'."\n"; … … 193 193 $out.=' <role>'.htmlspecialchars($role['wf_name']).'</role>'."\n"; 194 194 } 195 } 195 } 196 196 $out.=' </roles>'."\n"; 197 197 $out.=' <agents>'."\n"; … … 216 216 $out.=' </agent_datas>'."\n"; 217 217 $out.=' </agent>'."\n"; 218 } 218 } 219 219 $out.=' </agents>'."\n"; 220 220 … … 238 238 $out.=' ]]></template>'; 239 239 } 240 $out.=' </activity>'."\n"; 240 $out.=' </activity>'."\n"; 241 241 } 242 242 $out.=' </activities>'."\n"; 243 243 244 244 //export all templates 245 $base_path = GALAXIA_PROCESSES.SEP.$wf_procname.SEP.'code'.SEP.'templates'; 246 $handle = opendir($base_path); 245 $base_path = GALAXIA_PROCESSES.SEP.$wf_procname.SEP.'code'.SEP.'templates'; 246 $handle = opendir($base_path); 247 247 $out.=' <templates>'."\n"; 248 248 while (false !== ($name = readdir($handle))) … … 263 263 fclose($fp); 264 264 $out.=' ]]></code>'; 265 $out.=' </template>'."\n"; 265 $out.=' </template>'."\n"; 266 266 } 267 267 $out.=' </templates>'."\n"; 268 268 269 //export all includes 270 $base_path = GALAXIA_PROCESSES.SEP.$wf_procname.SEP.'code'; 271 $handle = opendir($base_path); 269 //export all includes 270 $base_path = GALAXIA_PROCESSES.SEP.$wf_procname.SEP.'code'; 271 $handle = opendir($base_path); 272 272 $out.=' <includes>'."\n"; 273 273 while (false !== ($name = readdir($handle))) … … 291 291 fclose($fp); 292 292 $out.=' ]]></code>'; 293 $out.=' </include>'."\n"; 293 $out.=' </include>'."\n"; 294 294 } 295 295 $out.=' </includes>'."\n"; … … 314 314 $out .= " </jobs>\n"; 315 315 316 //export all resources 316 //export all resources 317 317 $base_path = GALAXIA_PROCESSES . SEP . $wf_procname . SEP . 'resources'; 318 $handle = opendir($base_path); 318 $handle = opendir($base_path); 319 319 $out.=' <resources>'."\n"; 320 320 while (false !== ($name = readdir($handle))) 321 { 321 { 322 322 if (is_dir($base_path.SEP.$name)) 323 323 continue; … … 348 348 $out.=' <to>'.htmlspecialchars($tran['wf_act_to_name']).'</to>'."\n"; 349 349 $out.=' </transition>'."\n"; 350 } 350 } 351 351 $out.=' </transitions>'."\n"; 352 352 $out.= '</process>'."\n"; 353 353 354 354 //$fp = fopen(GALAXIA_PROCESSES."/$wf_procname/$wf_procname.xml","w"); 355 355 //fwrite($fp,$out); … … 360 360 /** 361 361 * Creates a process PHP data structure from its XML representation 362 * 363 * Unserialize process data 362 * 363 * Unserialize process data 364 364 * @access public 365 365 * @return void 366 366 */ 367 function unserialize_process(&$xml) 367 function unserialize_process(&$xml) 368 368 { 369 369 // Create SAX parser assign this object as base for handlers 370 370 // handlers are private methods defined below. 371 371 // keep contexts and parse 372 $this->parser = xml_parser_create("ISO-8859-1"); 372 $this->parser = xml_parser_create("ISO-8859-1"); 373 373 xml_parser_set_option($this->parser,XML_OPTION_CASE_FOLDING,0); 374 374 //xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE, 1); … … 376 376 xml_set_element_handler($this->parser, '_start_element_handler', '_end_element_handler'); 377 377 xml_set_character_data_handler($this->parser, '_data_handler'); 378 378 379 379 $aux=Array( 380 380 'name'=>'root', 381 381 'children'=>Array(), 382 382 'parent' => 0, 383 'data'=>'', 383 'data'=>'', 384 384 'attribs' => Array(), 385 385 ); 386 386 387 387 $this->tree[0]=$aux; 388 388 $this->current=0; 389 389 390 390 if (!xml_parse($this->parser, $xml, true)) { 391 391 $error = sprintf("XML error: %s at line %d", … … 395 395 $this->error[] = $error; 396 396 } 397 xml_parser_free($this->parser); 397 xml_parser_free($this->parser); 398 398 // Now that we have the tree we can do interesting things 399 399 400 400 $process=Array(); 401 401 $activities=Array(); … … 406 406 $z=$this->tree[1]['children'][$i]; 407 407 $name = trim($this->tree[$z]['name']); 408 408 409 409 //config values 410 410 if ($name=='configs') { … … 422 422 $configs[]=$aux; 423 423 } 424 } 424 } 425 425 } 426 426 //activities … … 453 453 ); 454 454 } 455 } 456 elseif ($name=='agents') 455 } 456 elseif ($name=='agents') 457 457 { 458 458 $agents=Array(); 459 for($l=0;$l<count($this->tree[$z3]['children']);$l++) 459 for($l=0;$l<count($this->tree[$z3]['children']);$l++) 460 460 { 461 461 $z4 = $this->tree[$z3]['children'][$l]; … … 472 472 // data will be the agent_type or an array for agent_datas 473 473 $data = trim($this->tree[$z5]['data']); 474 if ($name=='agent_type') 474 if ($name=='agent_type') 475 475 { 476 476 $agent['wf_agent_type']=$data; 477 } 478 elseif ($name=='agent_datas') 477 } 478 elseif ($name=='agent_datas') 479 479 { 480 480 for($n=0;$n<count($this->tree[$z5]['children']);$n++) … … 618 618 return $process; 619 619 } 620 620 621 621 /** 622 622 * Creates a new process PHP data structure from its XML representation 623 * unserial 623 * unserial 624 624 * @access public 625 625 * @return void … … 641 641 /** 642 642 * Remove process 643 * @param int $pId process id 644 * @access public 645 * @return string 643 * @param int $pId process id 644 * @access public 645 * @return string 646 646 */ 647 647 function remove_process($pId) … … 653 653 /** 654 654 * Replace_process 655 * 656 * @param int $pid process id 657 * @param array $vars 655 * 656 * @param int $pid process id 657 * @param array $vars 658 658 * @param boolean $create 659 * 659 * 660 660 * @access public 661 661 * @return int new id … … 671 671 672 672 return $id; 673 } 673 } 674 674 } 675 675 ?> -
sandbox/workflow/2.0/inc/class.workflow_processmonitor.inc.php
r795 r1293 17 17 function workflow_processmonitor() 18 18 { 19 parent::ProcessMonitor( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);19 parent::ProcessMonitor(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 20 20 } 21 21 } -
sandbox/workflow/2.0/inc/class.workflow_rolemanager.inc.php
r795 r1293 17 17 function workflow_rolemanager() 18 18 { 19 parent::RoleManager( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);19 parent::RoleManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 20 20 } 21 21 } -
sandbox/workflow/2.0/inc/class.workflow_smarty.inc.php
r1227 r1293 157 157 { 158 158 ob_start(); 159 $GLOBALS['phpgw']->common->phpgw_header();159 Factory::getForeignInstance('phpgwapi', 'phpgw')->common->phpgw_header(); 160 160 if ($this->showNavigationBar) 161 161 parse_navbar(); … … 168 168 { 169 169 ob_start(); 170 $GLOBALS['phpgw']->common->phpgw_footer();170 Factory::getForeignInstance('phpgwapi', 'phpgw')->common->phpgw_footer(); 171 171 $this->expressoFooter = ob_get_contents(); 172 172 ob_end_clean(); -
sandbox/workflow/2.0/inc/class.workflow_wfruntime.inc.php
r795 r1293 18 18 function workflow_wfruntime() 19 19 { 20 parent::WfRuntime( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);20 parent::WfRuntime(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 21 21 } 22 22 } -
sandbox/workflow/2.0/inc/class.workflow_wfsecurity.inc.php
r795 r1293 18 18 function workflow_wfsecurity() 19 19 { 20 parent::WfSecurity( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia())->Link_ID;20 parent::WfSecurity(Factory::getInstance('WorkflowObjects')->getDBGalaxia())->Link_ID; 21 21 } 22 22 } -
sandbox/workflow/2.0/inc/common.inc.php
r795 r1293 1 1 <?php 2 /* garante que durante a execução de funções que modificam strings, os 2 3 //****************************************************************** 4 //************** CONFIGURACOES INICIAIS DO WORKFLOW **************** 5 //****************************************************************** 6 7 /** 8 * Garante que durante a execução de funções que modificam strings, os 3 9 * caracteres acentuados sejam tratados corretamente (e.g. strtoupper) 4 10 */ 5 11 setlocale(LC_CTYPE, 'pt_BR', 'pt_BR.iso-8859-1', 'pt_BR.utf-8'); 6 12 7 /* define o umask para a criação de arquivos por parte do Workflow */ 13 /** 14 * Define o umask para a criação de arquivos por parte do Workflow 15 */ 8 16 umask(007); 9 17 10 require_once dirname(__FILE__) . '/class.factory.inc.php'; 18 //****************************************************************** 19 //*********** FIM - CONFIGURACOES INICIAIS DO WORKFLOW ************* 20 //****************************************************************** 11 21 12 /** 13 * Objeto que implementa uma Factory 14 * @global object $GLOBALS['workflow']['factory'] 15 * @name $factory 16 */ 17 $GLOBALS['workflow']['factory'] = new Factory(); 22 //****************************************************************** 23 //********************* DEFINES DO WORKFLOW ************************ 24 //****************************************************************** 18 25 19 /** 20 * Objeto que cria objetos voltados exclusivamente para o módulo Workflow 21 * @global object $GLOBALS['workflow']['workflowObjects'] 22 * @name $workflowObjects 23 */ 24 $GLOBALS['workflow']['workflowObjects'] = $GLOBALS['workflow']['factory']->newInstance('WorkflowObjects'); 26 27 define('WF_ROOT', $_SERVER['DOCUMENT_ROOT'] . "workflow"); 28 define('WF_LIB', $_SERVER['DOCUMENT_ROOT'] . "workflow/lib"); 29 define('WF_INC', $_SERVER['DOCUMENT_ROOT'] . "workflow/inc"); 30 define('WF_PROC_LIB', $_SERVER['DOCUMENT_ROOT'] . "workflow/inc/local/lib"); 31 32 33 //****************************************************************** 34 //****************** FIM - DEFINES DO WORKFLOW ********************* 35 //****************************************************************** 36 37 //****************************************************************** 38 //********************* INCLUDES DO WORKFLOW *********************** 39 //****************************************************************** 40 41 require_once(WF_LIB . "/Factory.php"); 42 43 //****************************************************************** 44 //****************** FIM - INCLUDES DO WORKFLOW ******************** 45 //****************************************************************** 46 25 47 ?> -
sandbox/workflow/2.0/inc/engine/class.ajax_config.inc.php
r795 r1293 1 1 <?php 2 2 /** 3 * Realiza operações com os dados de configuração do workflow 4 * 3 * Realiza operações com os dados de configuração do workflow 4 * 5 5 * @author viani 6 6 * @version 1.0 7 7 * @license http://www.gnu.org/copyleft/gpl.html GPL 8 8 * @package Galaxia 9 */ 9 */ 10 10 class ajax_config 11 { 12 /** 11 { 12 /** 13 13 * @var object $db database 14 14 * @access public 15 15 */ 16 16 var $db; 17 /** 17 /** 18 18 * @var string $appname Application (module) to config 19 19 * @access public 20 20 */ 21 21 var $appname; 22 /** 22 /** 23 23 * @var array $config_data Actual config-data 24 24 * @access public 25 25 */ 26 var $config_data; 27 /** 26 var $config_data; 27 /** 28 28 * @var array $read_data Config-data as read from db 29 29 * @access public 30 30 */ 31 var $read_data; 31 var $read_data; 32 32 33 33 /** 34 34 * Set appname and db for ajax config 35 * 35 * 36 36 * @param string $appname Which application to config. Default workflow. 37 37 * @return void … … 45 45 } 46 46 47 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso();47 $this->db =& Factory::getInstance('WorkflowObjects')->getDBExpresso(); 48 48 $this->appname = $appname; 49 49 } … … 51 51 /** 52 52 * Reads the whole repository for $this->appname, appname has to be set via the constructor 53 * 53 * 54 54 * @return array the whole config-array for that app 55 55 * @access public … … 60 60 61 61 $this->db->query("select * from phpgw_config where config_app='" . $this->appname . "'",__LINE__,__FILE__); 62 while ($this->db->next_record()) 62 while ($this->db->next_record()) 63 63 { 64 64 $test = @unserialize($this->db->f('config_value')); … … 75 75 } 76 76 77 /** 77 /** 78 78 * Updates the whole repository for $this->appname, you have to call read_repository() before (!) 79 * @access public 79 * @access public 80 80 * @return void 81 81 */ … … 107 107 /** 108 108 * Updates or insert a single config-value 109 * 109 * 110 110 * @param string $name name of the config-value 111 111 * @param mixed $value content … … 158 158 /** 159 159 * Deletes the whole repository for $this->appname, appname has to be set via the constructor 160 * 160 * 161 161 * @access public 162 * @return void 163 */ 162 * @return void 163 */ 164 164 function delete_repository() 165 165 { … … 169 169 /** 170 170 * Deletes a single value from the repository, you need to call save_repository after 171 * 171 * 172 172 * @param string $variable_name name of the config 173 173 * @return void … … 180 180 /** 181 181 * Sets a single value in the repository, you need to call save_repository after 182 * 182 * 183 183 * @param string $variable_name name of the config 184 184 * @param mixed $variable_data the content … … 190 190 $this->config_data[$variable_name] = $variable_data; 191 191 } 192 192 193 193 } 194 194 ?> -
sandbox/workflow/2.0/inc/engine/class.ajax_ldap.inc.php
r795 r1293 29 29 function ajax_ldap() 30 30 { 31 $tmpLDAP = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');31 $tmpLDAP = &Factory::getInstance('WorkflowLDAP'); 32 32 $this->user_context = $tmpLDAP->getUserContext(); 33 33 $this->group_context = $tmpLDAP->getGroupContext(); 34 34 35 $this->ds = &$GLOBALS['workflow']['workflowObjects']->getLDAP();35 $this->ds =& Factory::getInstance('WorkflowObjects')->getLDAP(); 36 36 } 37 37 … … 83 83 function id2fullname($account_id) 84 84 { 85 return $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($account_id);85 return Factory::getInstance('WorkflowLDAP')->getName($account_id); 86 86 } 87 87 … … 107 107 $accountID = $_SESSION['phpgw_info']['workflow']['account_id']; 108 108 109 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');109 $ldap =& Factory::getInstance('WorkflowLDAP'); 110 110 if (count($output = $ldap->getUserGroups($accountID)) == 0) 111 111 return false; -
sandbox/workflow/2.0/inc/engine/config.ajax.inc.php
r795 r1293 170 170 if ($loadGroups) 171 171 { 172 $memberships = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserGroups($user);172 $memberships = Factory::getInstance('WorkflowLDAP')->getUserGroups($user); 173 173 if ($user == $_SESSION['phpgw_info']['workflow']['account_id']) 174 174 $_SESSION['phpgw_info']['workflow']['user_groups'] = $memberships; … … 196 196 { 197 197 /* get information regarding the members of the group */ 198 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');198 $ldap = &Factory::getInstance('WorkflowLDAP'); 199 199 $members = $ldap->getGroupUsers($group); 200 200 -
sandbox/workflow/2.0/inc/engine/config.egw.inc.php
r795 r1293 151 151 function galaxia_user_can_admin_process() 152 152 { 153 return ( $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('admin_workflow', 1, 'workflow'));153 return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('admin_workflow', 1, 'workflow')); 154 154 } 155 155 } … … 165 165 function galaxia_user_can_admin_instance() 166 166 { 167 return ( $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('admin_instance_workflow', 1, 'workflow'));167 return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('admin_instance_workflow', 1, 'workflow')); 168 168 } 169 169 } … … 179 179 function galaxia_user_can_clean_instances() 180 180 { 181 return ( $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('cleanup_workflow', 1, 'workflow'));181 return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('cleanup_workflow', 1, 'workflow')); 182 182 } 183 183 } … … 191 191 function galaxia_user_can_clean_aborted_instances() 192 192 { 193 return ( $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('cleanup_aborted_workflow', 1, 'workflow'));193 return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('cleanup_aborted_workflow', 1, 'workflow')); 194 194 } 195 195 } … … 203 203 function galaxia_user_can_monitor() 204 204 { 205 return ( $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('monitor_workflow', 1, 'workflow'));205 return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('monitor_workflow', 1, 'workflow')); 206 206 } 207 207 } … … 221 221 $user = $GLOBALS['phpgw_info']['user']['account_id']; 222 222 223 $memberships = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserGroups($user);223 $memberships = Factory::getInstance('WorkflowLDAP')->getUserGroups($user); 224 224 225 225 if ($memberships === false) … … 245 245 { 246 246 /* get information regarding the members of the group */ 247 $members = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getGroupUsers($group);247 $members = &Factory::getInstance('WorkflowLDAP')->getGroupUsers($group); 248 248 249 249 /* checl for error in the LDAP query */ -
sandbox/workflow/2.0/inc/engine/src/ProcessManager/RoleManager.php
r795 r1293 247 247 $result = $this->query($query,$bindvars); 248 248 $ret = Array(); 249 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');249 $ldap = &Factory::getInstance('WorkflowLDAP'); 250 250 if (!(empty($result))) 251 251 { -
sandbox/workflow/2.0/inc/engine/src/common/WfRuntime.php
r795 r1293 6 6 * as it handle concurrency and part of the core execution of the instance while avoiding 7 7 * bad manipulation of the instance 8 * 8 * 9 9 * @package Galaxia 10 * @license http://www.gnu.org/copyleft/gpl.html GPL 10 * @license http://www.gnu.org/copyleft/gpl.html GPL 11 11 */ 12 class WfRuntime extends Base 13 { 12 class WfRuntime extends Base 13 { 14 14 /** 15 15 * @var array processes config values cached for this object life duration, init is done at first use for the only process associated with this runtime object 16 16 * @access public 17 17 */ 18 var $conf= Array(); 18 var $conf= Array(); 19 19 /** 20 20 * @var object $activity 21 * @access public 21 * @access public 22 22 */ 23 23 var $activity = null; 24 24 /** 25 25 * @var object $instance 26 * @access public 26 * @access public 27 27 */ 28 28 var $instance = null; 29 29 /** 30 30 * @var int $instance_id 31 * @access public 32 */ 33 var $instance_id = 0; 31 * @access public 32 */ 33 var $instance_id = 0; 34 34 /** 35 35 * @var int $activity_id 36 * @access public 36 * @access public 37 37 */ 38 38 var $activity_id = 0; 39 39 /** 40 40 * @var object $process Retrieve process information 41 * @access public 41 * @access public 42 42 */ 43 43 var $process = null; 44 44 /** 45 45 * @var object $workitems Reference to $instance->workitems 46 * @access public 46 * @access public 47 47 */ 48 48 var $workitems = null; 49 49 /** 50 50 * @var object $activities Reference to $instance->activities 51 * @access public 52 */ 51 * @access public 52 */ 53 53 var $activities = null; 54 54 /** 55 55 * @var object $security Security object 56 * @access public 57 */ 56 * @access public 57 */ 58 58 var $security = null; 59 59 /** 60 60 * @var bool $transaction_in_progress Transaction state 61 * @access public 62 */ 63 var $transaction_in_progress = false; 61 * @access public 62 */ 63 var $transaction_in_progress = false; 64 64 /** 65 65 * @var bool $debug Debug state 66 * @access public 67 */ 66 * @access public 67 */ 68 68 var $debug=false; 69 69 /** 70 70 * @var bool $auto_mode Automatic mode state, non-interactive for instance, big impact on error handling 71 * @access public 72 */ 71 * @access public 72 */ 73 73 var $auto_mode=false; 74 74 … … 81 81 /** 82 82 * Constructor 83 * 83 * 84 84 * @param object &$db ADOdb 85 85 * @return object WfRuntime instance 86 86 * @access public 87 87 */ 88 function WfRuntime(&$db) 88 function WfRuntime(&$db) 89 89 { 90 90 $this->child_name = 'WfRuntime'; … … 94 94 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Instance.php'); 95 95 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'common'.SEP.'WfSecurity.php'); 96 96 97 97 //first the activity is not set 98 98 $this->activity = null; 99 99 $this->instance = new Instance($this->db); 100 100 $this->process = new Process($this->db); 101 $this->security = new WfSecurity($this->db); 101 $this->security = new WfSecurity($this->db); 102 102 } 103 103 … … 105 105 * Collect errors from all linked objects which could have been used by this object 106 106 * Each child class should instantiate this function with her linked objetcs, calling get_error(true) 107 * 107 * 108 108 * @param bool $debug false by default, if true debug messages can be added to 'normal' messages 109 109 * @param string $prefix appended to the debug message 110 * @return void 110 * @return void 111 111 * @access private 112 112 */ … … 122 122 /** 123 123 * Ends-up dying and giving a last message 124 * 124 * 125 125 * @param string $last_message last sentence 126 126 * @param bool $include_errors false by default, if true we'll include error messages … … 138 138 if ($this->debug) $debug = true; 139 139 if ($this->auto_mode) $dying = false; 140 140 141 141 if ($include_errors) 142 142 { … … 165 165 * Loads the config values for the process associated with the runtime 166 166 * config values are cached while this WfRuntime object stays alive 167 * 167 * 168 168 * @param array $arrayconf Config array with default value, where key is config option name and value is default value 169 * @access private 169 * @access private 170 170 * @return array Values associated with the current process for the asked config options and as well for som WfRuntime internal config options 171 171 */ … … 176 176 $this->loadProcess(); 177 177 } 178 $arrayconf['auto-release_on_leaving_activity'] = 1; 178 $arrayconf['auto-release_on_leaving_activity'] = 1; 179 179 $this->conf = $this->process->getConfigValues($arrayconf); 180 180 return $this->conf; … … 183 183 /** 184 184 * Loads instance, the activity and the process, needed by the runtime engine to 'execute' the activity 185 * 185 * 186 186 * @param int $activityId activity id, the activity we will run 187 187 * @param int $instanceId instance Id, can be empty for a start or standalone activity 188 * @return bool 188 * @return bool 189 189 * @access public 190 190 */ … … 208 208 return false; 209 209 } 210 210 211 211 //ensure the activity is not completed 212 212 $this->instance->setActivityCompleted(false); 213 213 $this->instance->activityID = $activityId; 214 214 215 215 //set the workitems and activities links 216 216 $this->workitems =& $this->instance->workitems; … … 218 218 return true; 219 219 } 220 220 221 221 /** 222 222 * Retrieves the process object associated with the activity 223 * 223 * 224 224 * @param int $pId Process id of the process you want, if you do not give it we will try to take it from the activity 225 225 * @return mixed Process object of the right type or false … … 246 246 return true; 247 247 } 248 248 249 249 /** 250 250 * Gets current process instance 251 * 251 * 252 252 * @return object Process instance 253 253 * @access public … … 260 260 /** 261 261 * Retrieves the activity of the right type from a baseActivity Object 262 * 262 * 263 263 * @param int $activity_id activity_id you want 264 264 * @param bool $with_roles will load the roles links on the object … … 289 289 return true; 290 290 } 291 291 292 292 /** 293 293 * Gets current activity instance 294 * 294 * 295 295 * @return object Activity instance 296 296 * @access public 297 */ 297 */ 298 298 function &getActivity() 299 299 { 300 300 return $this->activity; 301 301 } 302 302 303 303 /** 304 304 * Gets the instance which could be an empty object 305 * 305 * 306 306 * @param int $instanceId is the instance id 307 307 * @return mixed Instance object which can be empty or string if something was turning bad … … 312 312 $this->instance_id = $instanceId; 313 313 $this->instance->getInstance($instanceId); 314 if ( ($this->instance->getInstanceId()==0) 314 if ( ($this->instance->getInstanceId()==0) 315 315 && (! (($this->activity->getType()=='standalone') || ($this->activity->getType()=='start') )) ) 316 316 { … … 323 323 return true; 324 324 } 325 325 326 326 /** 327 327 * Perform necessary security checks at runtime before running an activity 328 328 * This will as well lock the tables via the security object 329 329 * It should be launched in a transaction 330 * 330 * 331 331 * @return bool true if ok, false if the user has no runtime access 332 332 * @access public … … 360 360 * This will as well lock the tables via the security object 361 361 * It should be launched in a transaction 362 * 362 * 363 363 * @return bool true if ok, false if the user has no runtime access instance and activity are unsetted in case of false check 364 364 * @access public … … 376 376 //we are granted an access to release but there is a special bad case where 377 377 //we are a user authorized at releasing instances owned by others and where 378 //this instance is owned by another (for some quite complex reasons). 378 //this instance is owned by another (for some quite complex reasons). 379 379 //we should not release this new user!! 380 //Then this is auto-release, not a conscious act and so we will release only 380 //Then this is auto-release, not a conscious act and so we will release only 381 381 //if we can still grab this instance (avoiding the bad case) 382 382 383 383 //test grab before release 384 384 if ($this->checkUserRun()) … … 390 390 return false; 391 391 } 392 392 393 393 /** 394 394 * Sets/unsets the WfRuntime in debug mode 395 * 395 * 396 396 * @param bool $debug_mode true by default, set it to false to disable debug mode 397 397 * @access public 398 * @return void 398 * @return void 399 399 */ 400 400 function setDebug($debug_mode=true) … … 402 402 $this->debug = $debug_mode; 403 403 } 404 404 405 405 /** 406 406 * Sets/unsets the WfRuntime in automatic mode. i.e : executing 407 407 * non-interactive or interactive activities. Automatic mode have big impacts 408 408 * on error handling and on the way activities are executed 409 * 409 * 410 410 * @param bool $auto_mode true by default, set it to false to disable automatic mode 411 411 * @access public 412 * @return void 412 * @return void 413 413 */ 414 414 function setAuto($auto_mode=true) … … 416 416 $this->auto_mode = $auto_mode; 417 417 } 418 418 419 419 /** 420 420 * This function will start a transaction, call it before setActivityUser() 421 * 422 * @access public 423 * @return void 421 * 422 * @access public 423 * @return void 424 424 */ 425 425 function StartRun() … … 428 428 $this->db->StartTrans(); 429 429 } 430 430 431 431 /** 432 432 * This function ends the transactions started in StartRun() 433 * 433 * 434 434 * @access public 435 435 * @return void … … 437 437 function EndStartRun() 438 438 { 439 if ($this->transaction_in_progress) 439 if ($this->transaction_in_progress) 440 440 { 441 441 $this->db->CompleteTrans(); … … 443 443 } 444 444 } 445 446 /** 447 * For interactive activities this function will set the current user on the instance-activities table. 445 446 /** 447 * For interactive activities this function will set the current user on the instance-activities table. 448 448 * This will prevent having several user using the same activity on the same intsance at the same time 449 449 * But if you want this function to behave well you should call it after a checkUserRun or a checkUserRelease 450 450 * and inside a transaction. Theses others function will ensure the table will be locked and the user 451 451 * is really granted the action 452 * 452 * 453 453 * @param bool $grab true by default, if false the user will be set to '*', releasing the instance-activity record 454 454 * @access public 455 * @return bool 455 * @return bool 456 456 */ 457 457 function setActivityUser($grab=true) 458 458 { 459 if(isset($GLOBALS['user']) && !empty($this->instance->instanceId) && !empty($this->activity_id)) 459 if(isset($GLOBALS['user']) && !empty($this->instance->instanceId) && !empty($this->activity_id)) 460 460 { 461 461 if ($this->activity->isInteractive()) … … 484 484 $this->error[] = $errors; 485 485 return false; 486 } 487 } 488 486 } 487 } 488 489 489 /** 490 490 * Tries to give some usefull info about the current runtime 491 * 491 * 492 492 * @return array associative arrays with keys/values which could be usefull 493 493 * @access public … … 514 514 * This part of the runtime will be runned just after the activity code inclusion. 515 515 * We are in fact after all the "user code" part. We should decide what to do next 516 * 516 * 517 517 * @param bool $debug false by default 518 518 * @return array an array which must be analysed by the application run class. It contains 2 keys … … 529 529 { 530 530 $result = Array(); 531 531 532 532 // re-retrieve instance id which could have been modified by a complete 533 533 $this->instance_id = $this->instance->getInstanceId(); 534 534 535 535 //synchronised instance object with the database 536 536 $this->instance->sync(); … … 541 541 if ($this->instance->getActivityCompleted()) 542 542 { 543 // activity is interactive and completed, 543 // activity is interactive and completed, 544 544 // we have to continue the workflow 545 545 // and send any autorouted activity which could be after this one … … 558 558 if ($GLOBALS['workflow']['__leave_activity']) 559 559 { 560 // activity is interactive and the activity source set the 560 // activity is interactive and the activity source set the 561 561 // $GLOBALS[workflow][__leave_activity] it's a 'cancel' mode. 562 562 // we redirect the user to the leave activity page … … 565 565 } 566 566 else 567 { 567 { 568 568 //the activity is not completed and the user doesn't want to leave 569 569 // we loop on the form … … 574 574 } 575 575 else 576 { 576 { 577 577 // in auto mode or with non interactive activities we return engine info 578 578 // and we collect our errors, we do not let them for other objects … … 587 587 /** 588 588 * Gets the the 'Activity Completed' status 589 * 590 * @access public 591 * @return string 589 * 590 * @access public 591 * @return string 592 592 */ 593 593 function getActivityCompleted() … … 596 596 } 597 597 598 598 599 599 //----------- Instance public function mapping ------------------------------------------- 600 600 601 601 /** 602 602 * Sets the next activity to be executed, if the current activity is 603 603 * a switch activity the complete() method will use the activity setted 604 * in this method as the next activity for the instance. 604 * in this method as the next activity for the instance. 605 605 * Note that this method receives an activity name as argument (Not an Id) 606 606 * and that it does not need the activityId like the instance method 607 * 607 * 608 608 * @param string $actname name of the next activity 609 609 * @return bool 610 610 * @access public 611 611 */ 612 function setNextActivity($actname) 612 function setNextActivity($actname) 613 613 { 614 614 return $this->instance->setNextActivity($this->activity_id,$actname); … … 616 616 617 617 /** 618 * Sets the user that must perform the next 618 * Sets the user that must perform the next 619 619 * activity of the process. this effectively "assigns" the instance to 620 620 * some user 621 * 621 * 622 622 * @param int $user the next user id 623 623 * @param string $activityName The name of the activity that the user will be able to executed. '*' means the next activity. 624 * @return bool 624 * @return bool 625 625 * @access public 626 626 */ … … 635 635 636 636 /** 637 * Sets the user role that must perform the next 637 * Sets the user role that must perform the next 638 638 * activity of the process. this effectively "assigns" the instance to 639 639 * some user 640 * 640 * 641 641 * @param string $roleName the next activity role 642 642 * @param string $activityName The name of the activity that the role will be able to executed. '*' means the next activity. … … 659 659 660 660 /** 661 * Gets the user that must perform the next activity of the process. 661 * Gets the user that must perform the next activity of the process. 662 662 * This can be empty if no setNextUser() was done before. 663 663 * It wont return the default user but only the user which was assigned by a setNextUser 664 * 665 * @return int 666 * @access public 667 */ 668 function getNextUser() 664 * 665 * @return int 666 * @access public 667 */ 668 function getNextUser() 669 669 { 670 670 return $this->instance->getNextUser(); 671 671 } 672 672 673 673 /** 674 674 * Sets the name of this instance. 675 * 675 * 676 676 * @param string $value new name of the instance 677 * @return bool 678 * @access public 679 */ 680 function setName($value) 677 * @return bool 678 * @access public 679 */ 680 function setName($value) 681 681 { 682 682 return $this->instance->setName($value); … … 685 685 /** 686 686 * Gets the name of this instance 687 * 688 * @return string 687 * 688 * @return string 689 689 * @access public 690 690 */ … … 695 695 /** 696 696 * Sets the category of this instance 697 * 697 * 698 698 * @param string $value 699 699 * @return bool 700 700 * @access public 701 701 */ 702 function setCategory($value) 702 function setCategory($value) 703 703 { 704 704 return $this->instance->setcategory($value); … … 707 707 /** 708 708 * Gets category of this instance 709 * 710 * @return string 711 * @access public 712 */ 713 function getCategory() 709 * 710 * @return string 711 * @access public 712 */ 713 function getCategory() 714 714 { 715 715 return $this->instance->getCategory(); 716 716 } 717 717 718 718 /** 719 719 * Sets a property in this instance. This method is used in activities to … … 722 722 * problems (A->z, digits and _ for spaces). If you have several set to call look 723 723 * at the setProperties function. Each call to this function has an impact on database 724 * 724 * 725 725 * @param string $name property name (it will be normalized) 726 726 * @param mixed $value value for this property 727 * @return bool 728 * @access public 729 */ 730 function set($name,$value) 727 * @return bool 728 * @access public 729 */ 730 function set($name,$value) 731 731 { 732 732 return $this->instance->set($name,$value); 733 733 } 734 734 735 735 /** 736 736 * Unsets a property in this instance. This method is used in activities to … … 738 738 * All property names are normalized for security reasons and to avoid localisation 739 739 * problems (A->z, digits and _ for spaces). Each call to this function has an impact on database 740 * 740 * 741 741 * @param string $name property name (it will be normalized) 742 742 * @return bool true if it was ok 743 743 * @access public 744 744 */ 745 function clear($name) 745 function clear($name) 746 746 { 747 747 return $this->instance->clear($name); … … 753 753 * All property names are normalized for security reasons and to avoid localisation 754 754 * problems (A->z, digits and _ for spaces) 755 * 755 * 756 756 * @param string $name property name (it will be normalized) 757 757 * @return bool true if it exists and false otherwise … … 770 770 * problems (A->z, digits and _ for spaces). If you have several set to call look 771 771 * at the setProperties function. Each call to this function has an impact on database 772 * 772 * 773 773 * @param array $properties_array associative array containing for each record the 774 774 * property name as the key and the property value as the value. You do not need the complete … … 784 784 /** 785 785 * Gets the value of an instance property 786 * 786 * 787 787 * @param string $name name of the instance 788 788 * @param string $defaultValue … … 797 797 /** 798 798 * Describes the activities where the instance is present, can be more than one activity if the instance was "splitted" 799 * 799 * 800 800 * @access public 801 801 * @return array Vector of assocs 802 802 */ 803 function getActivities() 803 function getActivities() 804 804 { 805 805 return $this->instance->getActivities(); 806 806 } 807 807 808 808 /** 809 809 * Gets the instance status can be 'completed', 'active', 'aborted' or 'exception' 810 * 810 * 811 811 * @access public 812 812 * @return string Instance status 813 813 */ 814 function getStatus() 814 function getStatus() 815 815 { 816 816 return $this->instance->getStatus(); 817 817 } 818 818 819 819 /** 820 820 * Sets the instance status 821 * 821 * 822 822 * @param $status Desired status, it can be: 'completed', 'active', 'aborted' or 'exception' 823 823 * @return bool 824 824 * @access public 825 825 */ 826 function setStatus($status) 826 function setStatus($status) 827 827 { 828 828 return $this->instance->setStatus($status); 829 829 } 830 830 831 831 /** 832 832 * Gets the instance priority 833 * 834 * @access public 835 * @return int 833 * 834 * @access public 835 * @return int 836 836 */ 837 837 function getPriority() 838 838 { 839 839 return $this->instance->getPriority(); 840 } 840 } 841 841 842 842 /** 843 843 * Sets the instance priority 844 * 844 * 845 845 * @param int $priority 846 846 * @access public 847 * @return bool 847 * @return bool 848 848 */ 849 849 function setPriority($priority) … … 851 851 return $this->instance->setPriority($priority); 852 852 } 853 853 854 854 /** 855 855 * Returns the instance id 856 * 857 * @return int 858 * @access public 859 */ 860 function getInstanceId() 856 * 857 * @return int 858 * @access public 859 */ 860 function getInstanceId() 861 861 { 862 862 return $this->instance->getInstanceId(); 863 863 } 864 864 865 865 /** 866 866 * Returns the process id for this instance 867 * 868 * @return int 869 * @access public 867 * 868 * @return int 869 * @access public 870 870 */ 871 871 function getProcessId() { 872 872 return $this->instance->getProcessId(); 873 873 } 874 874 875 875 /** 876 876 * Returns the owner of the instance 877 * 878 * @return string 879 * @access public 880 */ 881 function getOwner() 877 * 878 * @return string 879 * @access public 880 */ 881 function getOwner() 882 882 { 883 883 return $this->instance->getOwner(); 884 884 } 885 885 886 886 /** 887 887 * Sets the instance owner 888 * 889 * @param string $user 890 * @access public 891 * @return bool 892 */ 893 function setOwner($user) 888 * 889 * @param string $user 890 * @access public 891 * @return bool 892 */ 893 function setOwner($user) 894 894 { 895 895 return $this->instance->setOwner($user); 896 896 } 897 897 898 898 /** 899 899 * Returns the user that must execute or is already executing an activity where the instance is present 900 * 900 * 901 901 * @param int $activityId 902 902 * @return bool False if the activity was not found for the instance, else return the user id or '*' if no user is defined yet 903 903 * @access public 904 */ 905 function getActivityUser($activityId) 904 */ 905 function getActivityUser($activityId) 906 906 { 907 907 return $this->instance->getActivityUser($activityId); 908 908 } 909 909 910 910 /** 911 911 * Sets the status of the instance in some activity 912 * 912 * 913 913 * @param int $activityId Activity id 914 914 * @param string $status New status, it can be 'running' or 'completed' 915 915 * @return bool False if no activity was found for the instance 916 916 * @access public 917 */ 918 function setActivityStatus($activityId,$status) 917 */ 918 function setActivityStatus($activityId,$status) 919 919 { 920 920 return $this->instance->setActivityStatus($activityId,$status); 921 921 } 922 923 924 /** 925 * Gets the status of the instance in some activity 926 * 927 * @param int $activityId 922 923 924 /** 925 * Gets the status of the instance in some activity 926 * 927 * @param int $activityId 928 928 * @return string 'running' or 'completed' 929 929 * @access public 930 930 */ 931 function getActivityStatus($activityId) 931 function getActivityStatus($activityId) 932 932 { 933 933 return $this->instance->getActivityStatus($activityId); 934 934 } 935 935 936 936 /** 937 937 * Resets the start time of the activity indicated to the current time 938 * 938 * 939 939 * @param int $activityId 940 * @return bool 941 * @access public 942 */ 943 function setActivityStarted($activityId) 940 * @return bool 941 * @access public 942 */ 943 function setActivityStarted($activityId) 944 944 { 945 945 return $this->instance->setActivityStarted($activityId); 946 946 } 947 947 948 948 /** 949 949 * Gets the Unix timstamp of the starting time for the given activity 950 * 950 * 951 951 * @param int $activityId 952 * @return int 953 * @access public 954 */ 955 function getActivityStarted($activityId) 952 * @return int 953 * @access public 954 */ 955 function getActivityStarted($activityId) 956 956 { 957 957 return $this->instance->getActivityStarted($activityId); 958 958 } 959 959 960 960 /** 961 961 * Gets the time where the instance was started 962 * 963 * @return int 964 * @access public 965 */ 966 function getStarted() 962 * 963 * @return int 964 * @access public 965 */ 966 function getStarted() 967 967 { 968 968 return $this->instance->getStarted(); 969 969 } 970 970 971 971 /** 972 972 * Gets the end time of the instance (when the process was completed) 973 * 974 * @return int 975 * @access public 976 */ 977 function getEnded() 973 * 974 * @return int 975 * @access public 976 */ 977 function getEnded() 978 978 { 979 979 return $this->instance->getEnded(); 980 980 } 981 982 981 982 983 983 /** 984 984 * Completes an activity. … … 986 986 * the engine does automatically complete automatic activities after 987 987 * executing them 988 * 988 * 989 989 * @return bool True or false, if false it means the complete was not done for some internal reason 990 990 * consult get_error() for more informations 991 991 * @access public 992 992 */ 993 function complete() 993 function complete() 994 994 { 995 995 if (!($this->activity->isInteractive())) … … 998 998 return false; 999 999 } 1000 1000 1001 1001 return $this->instance->complete($this->activity_id); 1002 1002 } … … 1005 1005 * Aborts an activity and terminates the whole instance. We still create a workitem to keep track 1006 1006 * of where in the process the instance was aborted 1007 * 1008 * @return bool 1009 * @access public 1010 */ 1011 function abort() 1007 * 1008 * @return bool 1009 * @access public 1010 */ 1011 function abort() 1012 1012 { 1013 1013 return $this->instance->abort(); 1014 1014 } 1015 1015 1016 1016 /** 1017 1017 * Gets a comment for this instance 1018 * 1018 * 1019 1019 * @param int $cId Comment id 1020 * @return string 1021 * @access public 1022 */ 1023 function get_instance_comment($cId) 1020 * @return string 1021 * @access public 1022 */ 1023 function get_instance_comment($cId) 1024 1024 { 1025 1025 return $this->instance->get_instance_comment($cId); 1026 1026 } 1027 1027 1028 1028 /** 1029 1029 * Inserts or updates an instance comment 1030 * 1030 * 1031 1031 * @param int $cId Commend id 1032 * @param int $activityId 1033 * @param object $activity 1032 * @param int $activityId 1033 * @param object $activity 1034 1034 * @param int $user User id 1035 1035 * @param string $title Comment's title 1036 1036 * @param string $comment Comment's contents 1037 * @return bool 1038 * @access public 1039 */ 1040 function replace_instance_comment($cId, $activityId, $activity, $user, $title, $comment) 1037 * @return bool 1038 * @access public 1039 */ 1040 function replace_instance_comment($cId, $activityId, $activity, $user, $title, $comment) 1041 1041 { 1042 1042 return $this->instance->replace_instance_comment($cId, $activityId, $activity, $user, $title, $comment); 1043 1043 } 1044 1044 1045 1045 /** 1046 1046 * Removes an instance comment 1047 * 1047 * 1048 1048 * @param int $cId Comment id 1049 * @return bool 1050 * @access public 1051 */ 1052 function remove_instance_comment($cId) 1049 * @return bool 1050 * @access public 1051 */ 1052 function remove_instance_comment($cId) 1053 1053 { 1054 1054 return $this->instance->remove_instance_comment($cId); 1055 1055 } 1056 1056 1057 1057 /** 1058 1058 * Lists instance comments 1059 * 1060 * @return array 1061 * @access public 1062 */ 1063 function get_instance_comments() 1059 * 1060 * @return array 1061 * @access public 1062 */ 1063 function get_instance_comments() 1064 1064 { 1065 1065 return $this->instance->get_instance_comments(); -
sandbox/workflow/2.0/inc/local/classes/class.JobBase.php
r795 r1293 89 89 { 90 90 require_once 'common.inc.php'; 91 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment();91 Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 92 92 $this->jobID = $jobID; 93 93 $this->processID = $processID; 94 94 $this->currentDate = $currentDate; 95 $this->jobManager = & $GLOBALS['workflow']['factory']->getInstance('WorkflowJobManager');95 $this->jobManager = &Factory::getInstance('WorkflowJobManager'); 96 96 $this->testMode = $testMode; 97 97 $this->maximumExecutionTime = $maximumExecutionTime; … … 148 148 final private function prepareEnvironment() 149 149 { 150 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareProcessEnvironment($this->processID);150 Factory::getInstance('WorkflowMacro')->prepareProcessEnvironment($this->processID); 151 151 152 152 require_once PHPGW_SERVER_ROOT . '/workflow/inc/class.process_factory.inc.php'; -
sandbox/workflow/2.0/inc/local/classes/class.wf_engine.php
r795 r1293 291 291 /* build the SQL query */ 292 292 $query = "SELECT wf_activity_id, wf_name, wf_normalized_name, wf_type, wf_description FROM egw_wf_activities WHERE (wf_activity_id = ?) AND (wf_p_id = ?)"; 293 $db = & $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID;293 $db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 294 294 $resultSet = $db->query($query, array($activityID, $processID)); 295 295 … … 319 319 /* build the SQL query */ 320 320 $query = "SELECT wf_activity_id, wf_name, wf_normalized_name, wf_type, wf_description FROM egw_wf_activities WHERE (wf_name = ?) AND (wf_p_id = ?)"; 321 $db = & $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID;321 $db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 322 322 $resultSet = $db->query($query, array($activityName, $processID)); 323 323 -
sandbox/workflow/2.0/inc/local/classes/class.wf_instance.php
r795 r1293 92 92 { 93 93 /* load the DB */ 94 $this->db = & $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID;94 $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 95 95 96 96 /* load the process ID from the runtime */ … … 420 420 /* load the required instance (for the required user) */ 421 421 require_once GALAXIA_LIBRARY . SEP . 'src' . SEP . 'GUI' . SEP . 'GUI.php'; 422 $GUI = new GUI( $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);422 $GUI = new GUI(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 423 423 $userInstance = $GUI->gui_list_user_instances($userID, 0, -1, '', '', "(ga.wf_is_interactive = 'y') AND (gia.wf_activity_id = {$activityID}) AND (gia.wf_instance_id = {$instanceID})", false, $this->processID, true, false, true, false, false, false); 424 424 $userInstance = $userInstance['data']; -
sandbox/workflow/2.0/inc/local/classes/class.wf_ldap.php
r1067 r1293 41 41 function wf_ldap() 42 42 { 43 $tmpLDAP = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');43 $tmpLDAP =& Factory::getInstance('WorkflowLDAP'); 44 44 $this->user_context = $tmpLDAP->getUserContext(); 45 45 $this->group_context = $tmpLDAP->getGroupContext(); 46 46 47 $this->ds = &$GLOBALS['workflow']['workflowObjects']->getLDAP();47 $this->ds =& Factory::getInstance('WorkflowObjects')->getLDAP(); 48 48 49 49 $this->cachedLDAP = new wf_cached_ldap(); -
sandbox/workflow/2.0/inc/local/classes/class.wf_location.php
r795 r1293 36 36 function initialize() 37 37 { 38 $this->db = & $GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID;38 $this->db = &Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID; 39 39 $this->db->setFetchMode(ADODB_FETCH_ASSOC); 40 40 $this->cityInfo = array(); -
sandbox/workflow/2.0/inc/local/classes/class.wf_orgchart.php
r1131 r1293 24 24 function wf_orgchart() 25 25 { 26 $this->db = & $GLOBALS['workflow']['workflowObjects']->getDBWorkflow()->Link_ID;26 $this->db = &Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Link_ID; 27 27 $this->db->setFetchMode(ADODB_FETCH_ASSOC); 28 28 } -
sandbox/workflow/2.0/inc/local/classes/class.wf_role.php
r1048 r1293 57 57 $this->processID = (int) $GLOBALS['workflow']['job']['processID']; 58 58 59 $this->db = & $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID;59 $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 60 60 $this->roleManager = CreateObject('workflow.workflow_rolemanager'); 61 61 $this->activityManager = CreateObject('workflow.workflow_activitymanager'); … … 186 186 $users = array((int) $users); 187 187 $roleID = $this->roleManager->get_role_id($this->processID, $roleName); 188 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');188 $ldap = &Factory::getInstance('WorkflowLDAP'); 189 189 foreach ($users as $user) 190 190 { … … 212 212 $users = $this->roleManager->list_mapped_users($this->processID, false, array('wf_role_name' => $roleName)); 213 213 214 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');214 $ldap = &Factory::getInstance('WorkflowLDAP'); 215 215 $output = array(); 216 216 foreach ($users as $id => $login) … … 367 367 368 368 /* get the roles */ 369 $userGroups = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserGroups($userID);369 $userGroups = Factory::getInstance('WorkflowLDAP')->getUserGroups($userID); 370 370 $query = 'SELECT DISTINCT role.wf_role_id, role.wf_name, role.wf_description FROM egw_wf_roles role, egw_wf_user_roles user_role WHERE (user_role.wf_role_id = role.wf_role_id) AND (role.wf_p_id = ?) AND (role.wf_role_id = ANY (?))'; 371 371 $query .= ' AND (((user_role.wf_user = ?) AND (user_role.wf_account_type = ?))'; -
sandbox/workflow/2.0/inc/local/classes/class.wf_workitem.php
r795 r1293 29 29 public function wf_workitem() 30 30 { 31 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID;31 $this->db =& Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 32 32 $this->processID = (int) $GLOBALS['workflow']['wf_runtime']->activity->getProcessId(); 33 33 } -
sandbox/workflow/2.0/inc/local/functions/function.wf_get_activity_link_by_id.php
r795 r1293 5 5 * @return string url para a atividade passada como parametro 6 6 * @license http://www.gnu.org/copyleft/gpl.html GPL 7 * @package Workflow 8 * @subpackage local 7 * @package Workflow 8 * @subpackage local 9 9 * @access public 10 10 * @author Alessandra Heil … … 14 14 /* load some variables */ 15 15 $instance =& $GLOBALS['workflow']['wf_runtime']; 16 16 17 17 $currentActivity = $instance->activity_id; 18 18 $instanceId = $instance->instance_id; 19 19 $urlBase = $_SERVER['SERVER_NAME']; 20 20 21 21 if (isset($currentActivity) && ($instanceId != 0)) 22 22 $output = "http://".$urlBase."/index.php?menuaction=workflow.run_activity.go&activity_id=$activityId"; 23 23 else 24 24 $output = "http://".$urlBase."/workflow/index.php?start_tab=0"; 25 25 26 26 return $output ; 27 27 } -
sandbox/workflow/2.0/inc/local/functions/function.wf_get_next_activity_link.php
r795 r1293 4 4 * @return string 5 5 * @license http://www.gnu.org/copyleft/gpl.html GPL 6 * @package Workflow 7 * @subpackage local 6 * @package Workflow 7 * @subpackage local 8 8 * @access public 9 9 */ … … 22 22 if (isset($instance->instance->nextActivity[$currentActivity])) 23 23 $nextActivityId = $instance->instance->nextActivity[$currentActivity]; 24 24 25 25 if (isset($nextActivityId) && ($instanceId != 0)) 26 26 $output = "$urlBase/index.php?menuaction=workflow.run_activity.go&activity_id=$nextActivityId&iid=$instanceId"; -
sandbox/workflow/2.0/inc/smarty/wf_plugins/function.wf_generic_select.php
r795 r1293 1 1 <?php 2 2 /** 3 * Insere o componente que permite a seleção de itens genéricos. 3 * Insere o componente que permite a seleção de itens genéricos. 4 4 * @package Smarty 5 5 * @subpackage wf_plugins 6 * @param array $params Array de parametros. O valor padrão para todos os parâmetros não obrigatórios, é uma string vazia. 7 * - name: (obrigatório) o nome que irá armazenar o id do item selecionado; 8 * - container_number: (obrigatório) o número do container onde os itens estão armazenados. 9 * - id_value: (opcional) o id de um item previamente selecionado (não é visível para o usuário). 10 * - desc_value: (opcional) o texto de um item inicialmente selecionado (é visível para o usuário). 11 * - title: (opcional) o título da tooltip quando o usuário passa o mouse sobre o botão de adicionar. 12 * @param object &$smarty Instância do objeto smarty em uso 6 * @param array $params Array de parametros. O valor padrão para todos os parâmetros não obrigatórios, é uma string vazia. 7 * - name: (obrigatório) o nome que irá armazenar o id do item selecionado; 8 * - container_number: (obrigatório) o número do container onde os itens estão armazenados. 9 * - id_value: (opcional) o id de um item previamente selecionado (não é visível para o usuário). 10 * - desc_value: (opcional) o texto de um item inicialmente selecionado (é visível para o usuário). 11 * - title: (opcional) o título da tooltip quando o usuário passa o mouse sobre o botão de adicionar. 12 * @param object &$smarty Instância do objeto smarty em uso 13 13 * @return string $output código que insere o componente. 14 * @access public 14 * @access public 15 15 */ 16 16 function smarty_function_wf_generic_select($params, &$smarty) … … 29 29 'title', 30 30 'container_number'); 31 31 32 32 /* verifica se todos os parâmetros obrigatórios foram passados */ 33 33 foreach ($requiredParams as $required) 34 34 if (!array_key_exists($required, $params) || (empty($params[$required]))) 35 35 $smarty->trigger_error("[wf_select_user] missing required parameter(s): $required", E_USER_ERROR); 36 36 37 37 /* atribui valores default para os parâmetros não passados */ 38 38 foreach ($defaultValues as $key => $value) 39 39 if (!isset($params[$key])) 40 40 $params[$key] = $value; 41 41 42 42 /* extrai alguns parâmetros da matriz de parâmetros */ 43 43 foreach ($extractParams as $extract) 44 44 $$extract = $params[$extract]; 45 45 46 46 $name_desc = $name . "_desc"; 47 47 $digest = md5($_SERVER['REQUEST_URI']); … … 53 53 EOF; 54 54 55 $templateServer = & $GLOBALS['workflow']['factory']->getInstance('TemplateServer');55 $templateServer = &Factory::getInstance('TemplateServer'); 56 56 $imageAdd = $templateServer->generateImageLink('add.png'); 57 57 $imageRemove = $templateServer->generateImageLink('close.png'); -
sandbox/workflow/2.0/inc/smarty/wf_plugins/function.wf_redir_menu.php
r795 r1293 53 53 $select_tag .= "<option value=\"og\">Organograma</option>"; 54 54 55 $user_is_admin = $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']); 56 if ($user_is_admin || ($GLOBALS['phpgw']->acl->check('admin_workflow',1,'workflow'))) { 55 $user_is_admin = Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']); 56 $phpgw =& Factory::getForeignInstance('phpgwapi','phpgw'); 57 if ($user_is_admin || ($phpgw->acl->check('admin_workflow',1,'workflow'))) { 57 58 $select_tag .= "<option value=\"ad\">Administração</option>"; 58 59 } 59 if ($user_is_admin || ($ GLOBALS['phpgw']->acl->check('monitor_workflow',1,'workflow'))) {60 if ($user_is_admin || ($phpgw->acl->check('monitor_workflow',1,'workflow'))) { 60 61 $select_tag .= "<option value=\"mo\">Monitoramento</option>"; 61 62 } -
sandbox/workflow/2.0/inc/smarty/wf_plugins/function.wf_select_city.php
r795 r1293 1 1 <?php 2 /** 3 * Este plugin insere duas combo boxes que permitem ao usuário selecionar uma cidade do Brasil. 2 /** 3 * Este plugin insere duas combo boxes que permitem ao usuário selecionar uma cidade do Brasil. 4 4 * A primeira combo é utilizada para fazer a seleção de um Estado. Uma vez feita esta seleção, é feita uma chamada Ajax que carrega as cidades daquele Estado na segunda combo. 5 * E, é nesta segunda combo que o usuário efetivamente seleciona a cidade. 5 * E, é nesta segunda combo que o usuário efetivamente seleciona a cidade. 6 6 * @package Smarty 7 7 * @subpackage wf_plugins 8 8 * @param array $params Array de parametros 9 * - name: o nome que a combo de seleção de cidade irá receber. 10 * - value: o ID da cidade que aparecerá inicialmente selecionada. 11 * - state_name: o nome da combo de seleção de Estado. 9 * - name: o nome que a combo de seleção de cidade irá receber. 10 * - value: o ID da cidade que aparecerá inicialmente selecionada. 11 * - state_name: o nome da combo de seleção de Estado. 12 12 * - state_value: o ID do Estado inicialmente selecionado. 13 * @param object &$smarty Instância do objeto smarty em uso 14 * @return string $output codigo que insere os comboboxes. 15 * @access public 13 * @param object &$smarty Instância do objeto smarty em uso 14 * @return string $output codigo que insere os comboboxes. 15 * @access public 16 16 */ 17 17 function smarty_function_wf_select_city($params, &$smarty) … … 37 37 if (!array_key_exists($required, $params) || (empty($params[$required]))) 38 38 $smarty->trigger_error("[wf_select_city] missing required parameter(s): $required", E_USER_ERROR); 39 39 40 40 /* atribui valores default para os parâmetros não passados */ 41 41 foreach ($defaultValues as $key => $value) 42 42 if (!isset($params[$key])) 43 43 $params[$key] = $value; 44 44 45 45 /* extrai alguns parâmetros da matriz de parâmetros */ 46 46 foreach ($extractParams as $extract) 47 47 $$extract = $params[$extract]; 48 48 49 49 /* parâmetros extras são "acumulados" em uma única variável */ 50 50 $extraParams = array(); … … 53 53 $extraParams[$key] = $value_params; 54 54 55 $db = & $GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID;55 $db = &Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID; 56 56 if (isset($params['value'])) 57 57 { -
sandbox/workflow/2.0/inc/smarty/wf_plugins/function.wf_select_ldap_users.php
r795 r1293 25 25 { 26 26 require_once $smarty->_get_plugin_filepath('function','html_options'); 27 $imagesPath = substr( $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink(''), 0, -1);27 $imagesPath = substr(Factory::getInstance('TemplateServer')->generateImageLink(''), 0, -1); 28 28 29 29 $requiredParams = array( -
sandbox/workflow/2.0/inc/smarty/wf_plugins/function.wf_select_state.php
r795 r1293 1 1 <?php 2 2 /** 3 * Insere uma combo box que permite ao usuário selecionar um Estado do Brasil. 3 * Insere uma combo box que permite ao usuário selecionar um Estado do Brasil. 4 4 * @package Smarty 5 5 * @subpackage wf_plugins 6 6 * @param array $params Array de parametros (Qualquer outro parâmetro passado será incorporado na tag da combo gerada.) 7 * - name: o nome que o elemento HTML receberá. 7 * - name: o nome que o elemento HTML receberá. 8 8 * - value: o ID do Estado que estará previamente selecionado. 9 9 * Qualquer outro parâmetro passado será incorporado na tag da combo gerada. 10 * @param object &$smarty Instância do objeto smarty em uso 11 * @return string $output codigo que insere a combobox. 12 * @access public 10 * @param object &$smarty Instância do objeto smarty em uso 11 * @return string $output codigo que insere a combobox. 12 * @access public 13 13 */ 14 14 function smarty_function_wf_select_state($params, &$smarty) … … 23 23 'name', 24 24 'value'); 25 25 26 26 /* verifica se todos os parâmetros obrigatórios foram passados */ 27 27 foreach ($requiredParams as $required) 28 28 if (!array_key_exists($required, $params) || (empty($params[$required]))) 29 29 $smarty->trigger_error("[wf_select_state] missing required parameter(s): $required", E_USER_ERROR); 30 30 31 31 /* atribui valores default para os parâmetros não passados */ 32 32 foreach ($defaultValues as $key => $value) 33 33 if (!isset($params[$key])) 34 34 $params[$key] = $value; 35 35 36 36 /* extrai alguns parâmetros da matriz de parâmetros */ 37 37 foreach ($extractParams as $extract) 38 38 $$extract = $params[$extract]; 39 39 40 40 /* parâmetros extras são "acumulados" em uma única variável */ 41 41 $extraParams = array(); … … 46 46 $sql = "SELECT id_state, state_name FROM phpgw_cc_state WHERE id_country = 'BR' ORDER BY state_name"; 47 47 48 $result = $GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID->query($sql);48 $result = Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID->query($sql); 49 49 $estados = array(); 50 50 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) -
sandbox/workflow/2.0/inc/smarty/wf_plugins/function.wf_select_user.php
r795 r1293 94 94 $extraParams .= "&hideSectors=1"; 95 95 96 $image = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink('add_user.png');96 $image = Factory::getInstance('TemplateServer')->generateImageLink('add_user.png'); 97 97 98 98 $output .= <<<EOF -
sandbox/workflow/2.0/inc/smarty/wf_plugins/function.wf_select_users.php
r795 r1293 16 16 { 17 17 require_once $smarty->_get_plugin_filepath('function','html_options'); 18 $imagesPath = substr( $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink(''), 0, -1);18 $imagesPath = substr(Factory::getInstance('TemplateServer')->generateImageLink(''), 0, -1); 19 19 $requiredParams = array( 20 20 'name'); -
sandbox/workflow/2.0/inc/smarty/wf_plugins/prefilter.wf_default_template.php
r795 r1293 31 31 { 32 32 /* get the header and footer location */ 33 $templateServer = & $GLOBALS['workflow']['factory']->getInstance('TemplateServer');33 $templateServer = &Factory::getInstance('TemplateServer'); 34 34 $header = $templateServer->getSystemFile('processes/header.tpl'); 35 35 $footer = $templateServer->getSystemFile('processes/footer.tpl'); -
sandbox/workflow/2.0/index.php
r795 r1293 47 47 else 48 48 { 49 $GLOBALS['phpgw']->preferences->read_repository();49 Factory::getForeignInstance('phpgwapi', 'phpgw')->preferences->read_repository(); 50 50 $start_tab = $GLOBALS['phpgw_info']['user']['preferences']['workflow']['startpage']; 51 51 if (is_null($start_tab)) -
sandbox/workflow/2.0/lib/Factory.php
r795 r1293 10 10 \**************************************************************************/ 11 11 12 require_once 'BaseFactory.php'; 13 12 14 /** 13 15 * Implementa o design pattern factory para o módulo Workflow … … 18 20 * @license http://www.gnu.org/copyleft/gpl.html GPL 19 21 */ 20 class Factory 21 { 22 /** 23 * @var array $_cache Cache dos objetos 24 * @access private 25 */ 26 private $_cache; 27 28 /** 29 * @var array $classPath Caminho de busca das classes 30 * @access protected 31 */ 32 protected $classPath; 33 34 /** 35 * @var array $preffix Prefixo para o nome das classes 36 * @access protected 37 */ 38 protected $preffix; 39 40 /** 41 * @var array $suffix Sufixo para o nome das classes 42 * @access protected 43 */ 44 protected $suffix; 45 46 /** 47 * Construtor da classe 48 * @return object 49 * @access public 50 */ 51 function Factory() 52 { 53 $this->_cache = array(); 54 $this->classPath = dirname(__FILE__); 55 $this->preffix = 'class.'; 56 $this->suffix = '.inc.php'; 57 } 22 class Factory extends BaseFactory { 58 23 59 24 /** … … 63 28 * @return void 64 29 */ 65 private function _import($input) 66 { 67 $file = $this->classPath . '/' . $this->preffix . $input . $this->suffix; 68 if (@file_exists($file)) 30 protected function _import($input) { 31 32 $config = array( 33 'classpath' => WF_INC, 34 'preffix' => 'class.', 35 'suffix' => '.inc.php' 36 ); 37 38 $file = $config['classpath'] . '/' . $config['preffix'] . $input . $config['suffix']; 39 40 if (@file_exists($file)){ 69 41 require_once $file; 70 else42 } else { 71 43 trigger_error("O arquivo " . $file . " não existe.", E_USER_ERROR); 44 } 72 45 } 73 46 … … 76 49 * @param string $key O nome da classe 77 50 * @param object &$item A instância da classe 51 * @return boolean True se for salvo. False caso contrário, ou $item não é um objeto 52 * @access private 53 */ 54 protected function _setEntry($key, &$item) { 55 if(!is_object($item)) 56 return false; 57 58 if(!is_array($GLOBALS['workflow'])){ 59 $GLOBALS['workflow'] = array(); 60 } 61 62 $GLOBALS['workflow'][$key] =& $item; 63 return true; 64 } 65 66 /** 67 * Retorna a referência ao objeto armazenado 68 * @param string $key Nome da classe 69 * @return object 70 * @access private 71 */ 72 protected function &_getEntry($key) { 73 return $GLOBALS['workflow'][$key]; 74 } 75 76 /** 77 * Verifica se uma determinada classe possui objeto armazenado no cache da Factory 78 * @param string $key Nome da classe 79 * @return boolean 80 * @access protected 81 */ 82 protected function _isEntry($key) { 83 return (self::_getEntry($key) !== null); 84 } 85 86 /** 87 * Importa os arquivos da classe externa 88 * @param string $input Nome da classe 89 * @access private 78 90 * @return void 79 * @access private 80 */ 81 private function _setEntry($key, &$item) 82 { 83 $this->_cache[$key] = &$item; 91 */ 92 private function _importForeign($packageName, $className){ 93 94 $config = array( 95 'classpath' => dirname(__FILE__)."/../../{$packageName}/inc", 96 'preffix' => 'class.', 97 'suffix' => '.inc.php' 98 ); 99 100 $file = $config['classpath'] . '/' . $config['preffix'] . $className . $config['suffix']; 101 102 if (@file_exists($file)){ 103 require_once $file; 104 } else { 105 trigger_error("O arquivo " . $file . " não existe.", E_USER_ERROR); 106 } 107 } 108 109 /** 110 * Salva um objeto externo 111 * @params string $key Nome da classe 112 * @params object &$item Instancia da classe 113 * @return boolean True caso seja salvo. False caso contrário ou $item não é um objeto 114 * @access private 115 */ 116 private function _setExtEntry($key, &$item) { 117 if(!is_object($item)) 118 return false; 119 120 if(is_object($GLOBALS[$key])){ 121 return (get_class($GLOBALS[$key]) == get_class($item)); 122 } else { 123 $GLOBALS[$key] =& $item; 124 return true; 125 } 84 126 } 85 127 … … 90 132 * @access private 91 133 */ 92 private function &_getEntry($key) 93 { 94 return $this->_cache[$key]; 134 private function &_getExtEntry($key) { 135 return $GLOBALS[$key]; 95 136 } 96 137 … … 99 140 * @param string $key Nome da classe 100 141 * @return boolean 101 * @access public 102 */ 103 function isEntry($key) 104 { 105 return ($this->_getEntry($key) !== null); 142 * @access private 143 */ 144 private function _isExtEntry($key) { 145 return (self::_getExtEntry($key) !== null); 106 146 } 107 147 … … 112 152 * @access public 113 153 */ 114 function &getInstance() 115 { 116 if (func_num_args() > 0) 117 { 118 $args = func_get_args(); 119 if ($this->isEntry($args[0])) 120 { 121 return($this->_getEntry($args[0])); 122 } 123 else 124 { 125 $instance = call_user_func_array(array(&$this, 'newInstance'), $args); 126 $this->_setEntry($args[0], &$instance); 154 public function &getInstance() { 155 if (func_num_args() > 0) { 156 $args = func_get_args(); 157 if (self::_isEntry($args[0])) { 158 return(self::_getEntry($args[0])); 159 } else { 160 $instance = call_user_func_array(array('Factory', 'newInstance'), $args); 161 self::_setEntry($args[0], &$instance); 127 162 return $instance; 128 163 } … … 131 166 132 167 /** 133 * Cria novos objetos 134 * @param string $className Nome da classe 135 * @return object 136 * @access public 137 */ 138 function &newInstance() 139 { 140 if (func_num_args() > 0) 141 { 142 $args = func_get_args(); 143 $className = $args[0]; 144 array_splice($args, 0, 1); 145 $this->_import($className); 146 168 * Cria os objetos sem importar o arquivo que contem a classe 169 * @params string $className Nome da classe 170 * @return object 171 * @access private 172 */ 173 private function &_newInstance(){ 174 if (func_num_args() > 0){ 175 $args = func_get_args(); 176 $className = array_shift($args); 147 177 $reflectionObj = new ReflectionClass($className); 148 178 return $reflectionObj->newInstanceArgs($args); … … 151 181 152 182 /** 183 * Cria novos objetos 184 * @param string $className Nome da classe 185 * @return object 186 * @access public 187 */ 188 public function &newInstance() { 189 if (func_num_args() > 0) { 190 $args = func_get_args(); 191 $className = $args[0]; 192 self::_import($className); 193 return call_user_func_array(array('Factory', '_newInstance'), $args); 194 } 195 } 196 197 /** 153 198 * Retorna objetos armazenados ou cria novos objetos utilizando o pattern singleton (somente para módulos externos) 154 199 * @param string $moduleName O nome do módulo … … 157 202 * @access public 158 203 */ 159 function &getForeignInstance() 160 { 161 if (func_num_args() > 1) 162 { 163 $args = func_get_args(); 164 165 $oldClassPath = $this->classPath; 166 $this->classPath .= '/../../' . $args[0] . '/inc'; 167 168 array_splice($args, 0, 1); 169 $instance = call_user_func_array(array(&$this, 'getInstance'), $args); 170 $this->classPath = $oldClassPath; 171 return $instance; 204 public function &getForeignInstance() { 205 if (func_num_args() > 1) { 206 $args = func_get_args(); 207 208 if(self::_isExtEntry($args[1])){ 209 return self::_getExtEntry($args[1]); 210 } else { 211 212 $packageName = array_shift($args); 213 self::_importForeign($packageName, $args[0]); 214 215 $instance = call_user_func_array(array('Factory', '_newInstance'), $args); 216 self::_setExtEntry($args[0], &$instance); 217 return $instance; 218 } 172 219 } 173 220 } … … 180 227 * @access public 181 228 */ 182 function &newForeignInstance() 183 { 184 if (func_num_args() > 1) 185 { 186 $args = func_get_args(); 187 188 $oldClassPath = $this->classPath; 189 $this->classPath .= '/../../' . $args[0] . '/inc'; 190 191 array_splice($args, 0, 1); 192 $instance = call_user_func_array(array(&$this, 'newInstance'), $args); 193 $this->classPath = $oldClassPath; 194 return $instance; 229 public function &newForeignInstance() { 230 if (func_num_args() > 1) { 231 $args = func_get_args(); 232 233 $packageName = array_shift($args); 234 self::_importForeign($packageName, $args[0]); 235 return call_user_func_array(array('Factory', '_newInstance'), $args); 195 236 } 196 237 } -
sandbox/workflow/2.0/redirect.php
r795 r1293 11 11 if (empty($_SESSION)) 12 12 exit(0); 13 13 14 require_once 'inc/common.inc.php'; 14 $GLOBALS['workflow']['factory']->getInstance('ResourcesRedirector')->redirect();15 Factory::getInstance('ResourcesRedirector')->redirect(); 15 16 ?> -
sandbox/workflow/2.0/showUserPicture.php
r795 r1293 12 12 exit(0); 13 13 require_once 'inc/common.inc.php'; 14 $GLOBALS['workflow']['factory']->getInstance('UserPictureProvider')->serve();14 Factory::getInstance('UserPictureProvider')->serve(); 15 15 ?> -
sandbox/workflow/2.0/templateFile.php
r795 r1293 11 11 if (empty($_SESSION)) 12 12 exit(0); 13 13 14 require_once 'inc/common.inc.php'; 14 $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->redirect(); 15 Factory::getInstance('TemplateServer')->redirect(); 16 15 17 ?>
Note: See TracChangeset
for help on using the changeset viewer.