Changeset 1293


Ignore:
Timestamp:
08/07/09 16:06:07 (15 years ago)
Author:
gbisotto
Message:

Ticket #609 - Modificada a classe Factory e ProcessFactory? para automatizaro acesso ao objetos

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  
    1212        { 
    1313                require_once dirname(__FILE__) . '/inc/common.inc.php'; 
    14                 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment(); 
     14                Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 
    1515        } 
    1616 
  • sandbox/workflow/2.0/inc/class.CachedLDAP.inc.php

    r1067 r1293  
    9797 
    9898                /* load the information and establish a connection */ 
    99                 $tmpLDAP = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     99                $tmpLDAP =& Factory::getInstance('WorkflowLDAP'); 
    100100                $this->userContext  = $tmpLDAP->getUserContext(); 
    101101                $this->groupContext = $tmpLDAP->getGroupContext(); 
    102                 $this->dataSource = &$GLOBALS['workflow']['workflowObjects']->getLDAP(); 
     102                $this->dataSource =& Factory::getInstance('WorkflowObjects')->getLDAP(); 
    103103        } 
    104104 
     
    115115 
    116116                /* establish a connection */ 
    117                 $this->DBLink = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     117                $this->DBLink =& Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    118118        } 
    119119 
  • sandbox/workflow/2.0/inc/class.JobRunner.inc.php

    r795 r1293  
    4343                $this->parameters = unserialize(base64_decode($parameters)); 
    4444                $this->parameters['currentDate'] = new DateTime($this->parameters['currentDate']); 
    45                 $this->jobManager = &$GLOBALS['workflow']['factory']->getInstance('WorkflowJobManager'); 
     45                $this->jobManager =& Factory::getInstance('WorkflowJobManager'); 
    4646        } 
    4747 
     
    6666        { 
    6767                /* activate the security policy */ 
    68                 $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     68                Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
    6969 
    7070                if (!file_exists($this->parameters['file'])) 
     
    9494 
    9595require_once 'common.inc.php'; 
    96 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment(); 
     96Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 
    9797 
    9898$jobRunner = new JobRunner($argv[1]); 
  • sandbox/workflow/2.0/inc/class.JobScheduler.inc.php

    r795 r1293  
    5757        { 
    5858                $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'); 
    6161        } 
    6262 
     
    171171                $previousDir = getcwd(); 
    172172                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 . '"'); 
    174174                chdir($previousDir); 
    175175                return $output; 
     
    192192{ 
    193193        require_once 'common.inc.php'; 
    194         $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment(); 
     194        Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 
    195195 
    196196        $job = new JobScheduler(); 
  • sandbox/workflow/2.0/inc/class.Logger.inc.php

    r900 r1293  
    8080        { 
    8181 
    82                 $this->db =& $GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID; 
     82                $this->db =& Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID; 
    8383 
    8484                if(!empty($curProcessName)){ 
  • sandbox/workflow/2.0/inc/class.ResourcesRedirector.inc.php

    r795 r1293  
    5454                if (!isset($_SESSION['workflow']['ResourcesRedirector'][$this->pid])) 
    5555                { 
    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)); 
    5757                        if ($result->numRows() != 1) 
    5858                                return; 
     
    9494                                { 
    9595                                        /* 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')); 
    9797                                        if (empty($result)) 
    9898                                                return; 
  • sandbox/workflow/2.0/inc/class.TemplateServer.inc.php

    r795 r1293  
    9999                                else 
    100100                                { 
    101                                         $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment(); 
     101                                        Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 
    102102                                        if (!isset($GLOBALS['phpgw_info']['login_template_set'])) 
    103103                                                return false; 
     
    131131                                { 
    132132                                        /* 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')); 
    134134                                        $this->WEB_WORKFLOW_BASE = str_replace('//', '/', "{$webServerURL}/workflow"); 
    135135                                } 
  • sandbox/workflow/2.0/inc/class.UserPictureProvider.inc.php

    r795 r1293  
    114114                                        /* em último caso, tenta buscar a informação em banco de dados */ 
    115115                                        /* 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')); 
    117117                                        if (empty($result)) 
    118118                                                return; 
     
    141141                                mkdir($baseDirectory, 0770, true); 
    142142 
    143                         $contents = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserPicture($this->userID); 
     143                        $contents = Factory::getInstance('WorkflowLDAP')->getUserPicture($this->userID); 
    144144                        $success = true; 
    145145                        if ($contents !== false) 
     
    165165                } 
    166166 
    167                 $GLOBALS['workflow']['factory']->getInstance('ResourcesRedirector')->show($filename); 
     167                Factory::getInstance('ResourcesRedirector')->show($filename); 
    168168        } 
    169169} 
  • sandbox/workflow/2.0/inc/class.WorkflowJobManager.inc.php

    r795 r1293  
    1616        public function WorkflowJobManager() 
    1717        { 
    18                 parent::JobManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     18                parent::JobManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    1919        } 
    2020} 
  • sandbox/workflow/2.0/inc/class.WorkflowLDAP.inc.php

    r795 r1293  
    5050        function WorkflowLDAP() 
    5151        { 
    52                 $this->dataSource = &$GLOBALS['workflow']['workflowObjects']->getLDAP(); 
     52                $this->dataSource =& Factory::getInstance('WorkflowObjects')->getLDAP(); 
    5353 
    5454                /* get the required parameters */ 
  • sandbox/workflow/2.0/inc/class.WorkflowMacro.inc.php

    r795 r1293  
    4040                require dirname(__FILE__) . '/../setup/setup.inc.php'; /* DO NOT USE require_once */ 
    4141                $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(); 
    4343                $_SESSION['phpgw_info']['workflow']['vfs_basedir'] = ($row !== false) ? $row['config_value'] : '/home/expressolivre'; 
    4444                $_SESSION['phpgw_info']['workflow']['phpgw_api_inc'] = PHPGW_API_INC; 
     
    6767                require_once PHPGW_SERVER_ROOT . '/workflow/inc/local/functions/local.functions.php'; 
    6868 
    69                 $runtime = new WfRuntime($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     69                $runtime = new WfRuntime(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    7070                $runtime->loadProcess($processID); 
    7171 
  • sandbox/workflow/2.0/inc/class.WorkflowObjects.inc.php

    r795 r1293  
    8787                        { 
    8888                                /* 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')); 
    9090                                $this->cache['DBGalaxia']->disconnect(); /* for some reason it won't connect to the desired database unless we disconnect it first */ 
    9191                                $this->cache['DBGalaxia']->Halt_On_Error = 'no'; 
     
    9898                                        $dbConfigValues['workflow_database_type'] 
    9999                                ); 
    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); 
    102102                        } 
    103103                        else 
     
    128128                        if (!isset($connectionInfo['db_name'])) 
    129129                        { 
    130                                 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment(); 
     130                                Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 
    131131                                if (isset($GLOBALS['phpgw_info']['server'])) 
    132132                                        $connectionInfo = $GLOBALS['phpgw_info']['server']; 
     
    136136 
    137137                        /* 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')); 
    139139                        $this->cache['DBExpresso']->disconnect(); /* for some reason it won't connect to the desired database unless we disconnect it first */ 
    140140                        $this->cache['DBExpresso']->Halt_On_Error = 'no'; 
     
    147147                                $connectionInfo['db_type'] 
    148148                        ); 
    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); 
    151151                } 
    152152 
     
    177177 
    178178                        /* 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')); 
    180180                        $this->cache['DBWorkflow']->disconnect(); /* for some reason it won't connect to the desired database unless we disconnect it first */ 
    181181                        $this->cache['DBWorkflow']->Halt_On_Error = 'no'; 
     
    188188                                $dbConfigValues['database_type'] 
    189189                        ); 
    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); 
    192192                } 
    193193 
  • sandbox/workflow/2.0/inc/class.WorkflowSecurity.inc.php

    r795 r1293  
    5151        { 
    5252                /* garante que o objeto de DataBase do Expresso estará disponível */ 
    53                 $GLOBALS['workflow']['workflowObjects']->getDBExpresso(); 
     53                Factory::getInstance('WorkflowObjects')->getDBExpresso(); 
    5454        } 
    5555 
     
    7777                                continue; 
    7878                        $this->removeSensitiveInformationFromDatabaseObject($variable); 
    79                         $variable = $GLOBALS['workflow']['factory']->newInstance('WorkflowWatcher', $variable); 
     79                        $variable = Factory::newInstance('WorkflowWatcher', $variable); 
    8080                } 
    8181        } 
  • sandbox/workflow/2.0/inc/class.WorkflowUtils.inc.php

    r795 r1293  
    1616                ); 
    1717                /** 
    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 
    2424                 * @access public 
    2525                 */ 
    2626                var $wf_p_id; 
    2727                /** 
    28                  * @var array $message message array  
     28                 * @var array $message message array 
    2929                 * @access public 
    3030                 */ 
     
    3333                //TODO: when migration to bo_workflow_forms will be closed erase theses vars-------------- 
    3434                //nextmatchs (max number of rows per page) and associated vars 
    35                  
    36                 /** 
    37                  * @var int $nextmatchs  
     35 
     36                /** 
     37                 * @var int $nextmatchs 
    3838                 * @access public 
    3939                 */ 
    4040                var $nextmatchs; 
    41                  
     41 
    4242                /** 
    4343                 * @var int $start actual starting row number 
    4444                 * @access public 
    4545                 */ 
    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 
    6969                 * @access public 
    7070                 */ 
     
    7777                var $stats; 
    7878                /** 
    79                  * @var array $wheres  
     79                 * @var array $wheres 
    8080                 * @access public 
    8181                 */ 
     
    8484                /** 
    8585                 * Constructor of workflow class 
    86                  *   
     86                 * 
    8787                 * @access public 
    8888                 * @return void 
     
    107107                /** 
    108108                 * Fill the process bar 
    109                  *  
     109                 * 
    110110                 * @param array $proc_info 
    111111                 * @access public 
     
    116116                        //echo "proc_info: <pre>";print_r($proc_info);echo "</pre>"; 
    117117                        $this->t->set_file('proc_bar_tpl', 'proc_bar.tpl'); 
    118                         $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     118                        $templateServer = &Factory::getInstance('TemplateServer'); 
    119119 
    120120                        if ($proc_info['wf_is_valid'] == 'y') 
     
    170170                /** 
    171171                 * Select activity representation icon 
    172                  *   
     172                 * 
    173173                 * @var string $type type of activity 
    174174                 * @var bool   $interactive interactive? 
     
    207207                                        $ic="no-activity.gif"; 
    208208                        } 
    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 
    212212                /** 
    213213                 * Translate template file 
    214                  * @param string $template_name template name  
     214                 * @param string $template_name template name 
    215215                 * @return void 
    216216                 * @access public 
     
    238238                 * @param string $error_str destination string to place errors 
    239239                 * @return bool 
    240                  * @access public  
     240                 * @access public 
    241241                 */ 
    242242                function show_errors(&$activity_manager, &$error_str) 
     
    287287                        } 
    288288                } 
    289                  
     289 
    290290                /** 
    291291                 * Get source code 
    292                  * @param string $proc_name process name  
     292                 * @param string $proc_name process name 
    293293                 * @param string $act_name activity name 
    294294                 * @param string $type actyvity type 
     
    319319                /** 
    320320                 * Save the source of process 
    321                  *  
     321                 * 
    322322                 * @param string $proc_name process name 
    323323                 * @param string $act_name activity name 
     
    353353 
    354354                /** 
    355                  * Export process to a xml file to be downloaded  
     355                 * Export process to a xml file to be downloaded 
    356356                 * @access public 
    357357                 * @return void 
     
    375375                        echo $out; 
    376376                } 
    377                  
     377 
    378378                /** 
    379379                * Get the href link for the css file, searching for themes specifics stylesheet if any 
     
    387387                { 
    388388                        $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 
    392392                /** 
    393393                 * Return a given duration in human readable form, usefull for workitems duration 
    394394                 * @param int $to given duration 
    395395                 * @return string given duration in human readable form 
    396                  * @access public  
     396                 * @access public 
    397397                 */ 
    398398                function time_diff($to) { 
     
    402402                        $to = $to - ($hours*3600); 
    403403                        $min = date("i", $to); 
    404                         $to = $to - ($min*60);                   
     404                        $to = $to - ($min*60); 
    405405                        $sec = date("s", $to); 
    406406 
  • sandbox/workflow/2.0/inc/class.bo_adminaccess.inc.php

    r795 r1293  
    4343                parent::bo_ajaxinterface(); 
    4444 
    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'])) 
    4646                        exit(serialize(array('error' => 'Você não tem permissão para executar esta operação.'))); 
    4747 
    48                 $this->so = new so_adminaccess($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     48                $this->so = new so_adminaccess(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    4949        } 
    5050 
     
    5757        function get_all_processes() 
    5858        { 
    59                 $proc_mng = new ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     59                $proc_mng = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    6060                $proc_list = $proc_mng->list_processes(0,-1,'wf_name__ASC'); 
    6161 
  • sandbox/workflow/2.0/inc/class.bo_adminjobs.inc.php

    r795 r1293  
    100100                /* paginate the result */ 
    101101                $logEntriesPerPage = 30; 
    102                 $paging = &$GLOBALS['workflow']['factory']->newInstance('Paging', $logEntriesPerPage, $params); 
     102                $paging =& Factory::newInstance('Paging', $logEntriesPerPage, $params); 
    103103                $logs = $paging->restrictItems($logs); 
    104104 
  • sandbox/workflow/2.0/inc/class.bo_adminsource.inc.php

    r795 r1293  
    1818 
    1919/** 
    20  * Invalid file name identifier  
    21  * @name INVALID_FILE_NAME  
     20 * Invalid file name identifier 
     21 * @name INVALID_FILE_NAME 
    2222 */ 
    2323define( INVALID_FILE_NAME   , 0 ); 
    2424/** 
    25  * Invalid process id identifier  
    26  * @name INVALID_PROCESS_ID  
     25 * Invalid process id identifier 
     26 * @name INVALID_PROCESS_ID 
    2727 */ 
    2828define( INVALID_PROCESS_ID  , 1 ); 
    2929/** 
    3030 * File already exists identifier 
    31  * @name FILE_ALREADY_EXISTS  
     31 * @name FILE_ALREADY_EXISTS 
    3232 */ 
    3333define( FILE_ALREADY_EXISTS , 2 ); 
    3434/** 
    35  * File created indentifier  
     35 * File created indentifier 
    3636 * @name FILE_CREATED 
    3737 */ 
    3838define( FILE_CREATED            , 3 ); 
    3939/** 
    40  * File not created identifier  
     40 * File not created identifier 
    4141 * @name FILE_NOT_CREATED 
    4242 */ 
     
    5252 
    5353        /** 
    54         * @var array $public_functions Array of public functions  
     54        * @var array $public_functions Array of public functions 
    5555        * @access public 
    5656        */ 
    5757        var $public_functions = array('export_file' => true 
    5858                                      ); 
    59          
     59 
    6060        /** 
    6161        * Construtor 
    6262        * 
    63         * @access public  
    64         */       
     63        * @access public 
     64        */ 
    6565        function bo_adminsource() { 
    66                 parent::bo_ajaxinterface();              
    67                 } 
    68          
     66                parent::bo_ajaxinterface(); 
     67                } 
     68 
    6969        /** 
    7070        * Assign Unit To File Size 
    7171        * @param integer $value value 
    72         * @return string file size  
    73         * @access public  
     72        * @return string file size 
     73        * @access public 
    7474        */ 
    7575        function _assignUnitToFileSize($value) 
     
    8080                $fileSizeUnit[] = 'Mb'; 
    8181                $fileSizeUnit[] = 'Gb'; 
    82                  
     82 
    8383                $unitSelect = 0; 
    8484                while ($value > 1024.0) 
     
    8787                        $unitSelect++; 
    8888                } 
    89          
     89 
    9090                $output = round($value, 1); 
    9191                $output .= " " . $fileSizeUnit[$unitSelect]; 
    92          
     92 
    9393                return $output; 
    9494        } 
    95          
     95 
    9696        /** 
    9797        * 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 
    108108                $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 
    111111                if ($proc_info['wf_is_valid'] == 'y') 
    112112                { 
     
    119119                        $alt_validity = tra('invalid'); 
    120120                } 
    121          
     121 
    122122                // 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. 
    123123                if ($proc_info['wf_is_active'] == 'y') 
     
    138138                        $start_stop_img  = ''; 
    139139                } 
    140          
     140 
    141141                /* load other processes link */ 
    142142                $proc_ids = $GLOBALS['ajax']->acl->get_granted_processes($_SESSION['phpgw_info']['workflow']['account_id']); 
     
    145145                else 
    146146                        $where = ' wf_p_id = -1 '; 
    147          
     147 
    148148                $processesInfo = &$process_manager->list_processes(0, -1, 'wf_name__asc', '', $where); 
    149149                $otherProcesses = array(); 
    150150                foreach ($processesInfo['data'] as $pi) 
    151151                        $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 
    153153                $toolbar_data = array ( 
    154154                        'proc_name'                                     => $proc_info['wf_name'], 
     
    177177                        'other_processes'                       => $otherProcesses 
    178178                ); 
    179                          
     179 
    180180                return $toolbar_data; 
    181181                } 
    182                  
    183                  
     182 
     183 
    184184        /** 
    185185        * 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 
    189189        */ 
    190190        function get_model_files($p) 
    191191        { 
    192                 switch($p['type'])  
     192                switch($p['type']) 
    193193                { 
    194194                        case 'include'  : $path = PHPGW_SERVER_ROOT . SEP . 'workflow' . SEP . 'js' . SEP . 'adminsource' . SEP . 'inc'; 
     
    203203                $files          = array(); 
    204204 
    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)) 
    210210                                { 
    211211                                        $files[] = array('file_name'     => $file_name); 
     
    217217                array_multisort($col_file_name,SORT_ASC,$files); 
    218218 
    219                 return $files;  
     219                return $files; 
    220220        } 
    221221 
    222222        /** 
    223223        * 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 
    227227        */ 
    228228        function get_php_files($p) 
    229229        { 
    230                 $process_manager    = new ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     230                $process_manager    = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    231231                $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); 
    233233                $process_activities = $activity_manager->list_activities($p['proc_id'], 0, -1, 'wf_name__asc', '','',false); 
    234234                $path = GALAXIA_PROCESSES . SEP . $proc_info['wf_normalized_name'] . SEP . 'code' . SEP .'activities' . SEP; 
    235                  
     235 
    236236                $files = array(); 
    237237 
     
    242242                foreach ($process_activities['data'] as $process_activity) 
    243243                { 
    244                          
     244 
    245245                        $file_name   = $process_activity['wf_normalized_name'].'.php'; 
    246246                        $activity_id = $process_activity['wf_activity_id']; 
    247247                        $tamanho     = filesize($path.$file_name); 
    248248                        $modificado  = date('d/m/Y H:i:s', filemtime($path.$file_name) ); 
    249                          
     249 
    250250                        $files[] = array('file_name'     => $file_name, 
    251251                                                         'activity_id'   => $activity_id, 
     
    258258                                                         'tipo_codigo'   => 'atividade' 
    259259                        ); 
    260                          
     260 
    261261                        $col_file_name[]  = $file_name; 
    262262                        $col_tamanho[]    = $tamanho; 
    263263                        $col_modificado[] = $modificado; 
    264264                } 
    265                  
    266                 if (isset($p['sort']))  
     265 
     266                if (isset($p['sort'])) 
    267267                { 
    268268                        $order_by = ($p['order_by'] == 1) ? SORT_ASC : SORT_DESC; 
     
    279279                        } 
    280280                } 
    281                  
    282                 return $files;  
    283         } 
    284          
    285         /** 
    286         * Delete process file  
     281 
     282                return $files; 
     283        } 
     284 
     285        /** 
     286        * Delete process file 
    287287        * @param array $p process data 
    288288        * @return array 
    289         * @access public  
     289        * @access public 
    290290        */ 
    291291        function delete_file($p) 
     
    293293                if ((strpos($p['file_name'],'/') !== false) || (strpos($p['file_name'],'/') !== false)) 
    294294                        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']); 
    297297                $file_name = $p['file_name']; 
    298                 $proc_name = $proc_info['wf_normalized_name'];  
     298                $proc_name = $proc_info['wf_normalized_name']; 
    299299                $type      = $p['type']; 
    300300                if (strpos($file_name,'/')) return 'Nome de arquivo inválido.'; 
    301301                if (!strlen($proc_name)) return 'ID de Processo inválido.'; 
    302                  
     302 
    303303    switch($type) 
    304304    { 
     
    315315                                $path = GALAXIA_PROCESSES . '/' . $proc_info['wf_normalized_name'] . '/resources/' . $file_name; 
    316316            break; 
    317                          
     317 
    318318    } 
    319     
    320                 if ($type == 'resource')  
     319 
     320                if ($type == 'resource') 
    321321                { 
    322322                        $complete_path = $path; 
    323                 }  
    324                 else  
     323                } 
     324                else 
    325325                { 
    326326                        $complete_path = GALAXIA_PROCESSES . SEP . $proc_name . SEP . 'code' . SEP . $path; 
    327327                } 
    328          
    329                 if (file_exists($complete_path))  
     328 
     329                if (file_exists($complete_path)) 
    330330                { 
    331331                        if (unlink($complete_path)) 
     
    342342                        return 'O arquivo '.$file_name.' não existe.'; 
    343343                } 
    344         }        
    345         /** 
    346         * Create process new file  
     344        } 
     345        /** 
     346        * Create process new file 
    347347        * @param array $p process 
    348348        * @return array 
    349         * @access public  
     349        * @access public 
    350350        */ 
    351351        function create_file($p) 
    352352        { 
    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']); 
    355355                $file_name = $p['file_name']; 
    356                 $proc_name = $proc_info['wf_normalized_name'];  
     356                $proc_name = $proc_info['wf_normalized_name']; 
    357357                $type      = $p['type']; 
    358358 
     
    386386                } 
    387387 
    388                 if (file_exists($complete_path))  
    389                 { 
    390                         if (!$p['rewrite'])  
     388                if (file_exists($complete_path)) 
     389                { 
     390                        if (!$p['rewrite']) 
    391391                        { 
    392392                                return FILE_ALREADY_EXISTS; 
     
    396396                } 
    397397 
    398                 if ($fp = fopen($complete_path, 'w'))  
     398                if ($fp = fopen($complete_path, 'w')) 
    399399                { 
    400400                        $basepath = PHPGW_SERVER_ROOT.SEP.'workflow'.SEP.'js'.SEP.'adminsource'; 
     
    409409                        if ($type == 'template' || $type == 'include') 
    410410                        { 
    411                                 if (file_exists($basepath.SEP.$p['modelo']))  
     411                                if (file_exists($basepath.SEP.$p['modelo'])) 
    412412                                { 
    413413                                        fwrite($fp,file_get_contents($basepath.SEP.$p['modelo'])); 
     
    423423                } 
    424424        } 
    425          
     425 
    426426        /** 
    427427        * Get process include files 
    428428        * @param  array $p process 
    429429        * @return array 
    430         * @access public  
     430        * @access public 
    431431        */ 
    432432        function get_include_files($p) 
    433433        { 
    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']); 
    436436                $path = GALAXIA_PROCESSES . SEP . $proc_info['wf_normalized_name'] . SEP . 'code'; 
    437437 
     
    442442                $files          = array(); 
    443443 
    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)) 
    449449                                { 
    450450                                        $tamanho     = filesize($path.SEP.$file_name); 
     
    467467 
    468468 
    469                 if (isset($p['sort']))  
     469                if (isset($p['sort'])) 
    470470                { 
    471471                        $order_by = ($p['order_by'] == 1) ? SORT_ASC : SORT_DESC; 
     
    483483                } 
    484484 
    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 
    493493        */ 
    494494        function get_template_files($p) 
    495495        { 
    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']); 
    498498                $path = GALAXIA_PROCESSES . SEP . $proc_info['wf_normalized_name'] . SEP . 'code' . SEP .'templates'; 
    499499 
     
    502502                $col_modificado = array(); 
    503503 
    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)) 
    509509                                { 
    510510                                        $tamanho     = filesize($path.SEP.$file_name); 
     
    541541 
    542542        } 
    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        * 
    551551        * @param array $p process 
    552552        * @return array 
    553         * @access public  
     553        * @access public 
    554554        */ 
    555555        function upload_resource($p) 
    556556        { 
    557                 $process_manager = new ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     557                $process_manager = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    558558                $proc_info = $process_manager->get_process($p['proc_id']); 
    559559                $file_name = basename($_FILES['resource_file']['name']); 
     
    587587                if (strpos($_REQUEST['file_name'],'/') !== false) 
    588588                        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); 
    590590                $proc_info          = $process_manager->get_process($_REQUEST['proc_id']); 
    591591 
     
    617617                        $completePath = GALAXIA_PROCESSES . SEP . $proc_name . SEP . 'code' . SEP . $path; 
    618618 
    619                 $GLOBALS['workflow']['factory']->getInstance('ResourcesRedirector')->show($completePath, 'application/force-download'); 
     619                Factory::getInstance('ResourcesRedirector')->show($completePath, 'application/force-download'); 
    620620                exit; 
    621621        } 
     
    630630        function get_resource_files($p) 
    631631        { 
    632                 $process_manager    = new ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     632                $process_manager    = new ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    633633                $proc_info          = $process_manager->get_process($p['proc_id']); 
    634634 
  • sandbox/workflow/2.0/inc/class.bo_ajaxinterface.inc.php

    r795 r1293  
    6767                { 
    6868                        $GLOBALS['ajax']->ldap = new ajax_ldap(); 
    69                         $GLOBALS['ajax']->db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso(); 
     69                        $GLOBALS['ajax']->db =& Factory::getInstance('WorkflowObjects')->getDBExpresso(); 
    7070                        $GLOBALS['ajax']->db->Halt_On_Error = 'no'; 
    7171 
    72                         $GLOBALS['ajax']->db_workflow = &$GLOBALS['workflow']['workflowObjects']->getDBWorkflow(); 
     72                        $GLOBALS['ajax']->db_workflow =& Factory::getInstance('WorkflowObjects')->getDBWorkflow(); 
    7373                        $GLOBALS['ajax']->db_workflow->Halt_On_Error = 'no'; 
    7474 
    7575                        $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); 
    7777                } 
    7878                else 
  • sandbox/workflow/2.0/inc/class.bo_editor.inc.php

    r795 r1293  
    2020 */ 
    2121class bo_editor extends bo_ajaxinterface 
    22 {        
     22{ 
    2323        /** 
    2424         *  Contructor 
     
    2727         */ 
    2828        function bo_editor() { 
    29                 parent::bo_ajaxinterface();              
     29                parent::bo_ajaxinterface(); 
    3030        } 
    3131        /** 
     
    3333         *  @param string $proc_name process name 
    3434         *  @param string $file_name file name 
    35          *  @param string $type type  
     35         *  @param string $type type 
    3636         *  @access public 
    3737         *  @return string source data 
     
    6464                if (!file_exists($complete_path)) 
    6565                        exit(0); 
    66          
     66 
    6767                if (!$file_size = filesize($complete_path)) return ''; 
    6868        $fp = fopen($complete_path, 'r'); 
     
    7070        fclose($fp); 
    7171 
    72                 //if ($type != 'template')  
     72                //if ($type != 'template') 
    7373                //{ 
    7474                        $data = str_replace("\r", "", $data); 
     
    8383                        //$data = str_replace("\n", "\\n", $data); 
    8484                //} 
    85                  
     85 
    8686        return $data; 
    8787    } 
     
    9090         *  @param string $proc_name process name 
    9191         *  @param string $file_name file name 
    92          *  @param string $type type  
    93          *  @param string $source  
     92         *  @param string $type type 
     93         *  @param string $source 
    9494         *  @access public 
    9595         *  @return string 
     
    126126        // In case you want to be warned when source code is changed: 
    127127        // mail('yourmail@domain.com', 'source changed', "PATH: $complete_path \n\n SOURCE: $source"); 
    128          
     128 
    129129                $erro = false; 
    130                 if ($fp = fopen($complete_path, 'w'))  
     130                if ($fp = fopen($complete_path, 'w')) 
    131131                { 
    132                 $erro = !fwrite($fp, $source);  
     132                $erro = !fwrite($fp, $source); 
    133133                fclose($fp); 
    134134                } 
     
    143143        /** 
    144144         *  Check process 
    145          *  
     145         * 
    146146         *  @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 
    149149         *  @access public 
    150150         *  @return string 
     
    159159            foreach ($errors as $error) 
    160160            { 
    161                                 if (strlen($error) > 0)  
     161                                if (strlen($error) > 0) 
    162162                                { 
    163163                        $error_str .= '<li>'. $error . '<br/>'; 
     
    173173        } 
    174174    } 
    175      
     175 
    176176        /** 
    177177         *  Save template source 
    178          *  
    179          *  @param array $p process  
     178         * 
     179         *  @param array $p process 
    180180         *  @access public 
    181181         *  @return string 
     
    183183        function save_template_source($p) 
    184184        { 
    185                  
     185 
    186186                $proc_name = $p['proc_name']; 
    187187                $file_name = $p['file_name']; 
     
    191191 
    192192                $msg[] = $this->save_source($p['proc_name'],$p['file_name'], $p['tipo_codigo'], $p['code']); 
    193                  
     193 
    194194                return implode('<br />',$msg); 
    195195        } 
    196196        /** 
    197197         *  Save resource 
    198          *  
    199          *  @param array $p process  
     198         * 
     199         *  @param array $p process 
    200200         *  @access public 
    201201         *  @return string 
     
    203203        function save_resource($p) 
    204204        { 
    205                  
     205 
    206206                $proc_name = $p['proc_name']; 
    207207                $file_name = $p['file_name']; 
     
    211211 
    212212                $msg[] = $this->save_source($p['proc_name'],$p['file_name'], $p['tipo_codigo'], $p['code']); 
    213                  
     213 
    214214                return implode('<br />',$msg); 
    215215        } 
    216216        /** 
    217217         *  Save php souurce 
    218          *  
    219          *  @param array $p process  
     218         * 
     219         *  @param array $p process 
    220220         *  @access public 
    221221         *  @return string 
     
    234234                if ($p['tipo_codigo'] != 'include') 
    235235                { 
    236                         $activity_manager   = new ActivityManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     236                        $activity_manager   = new ActivityManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    237237 
    238238                        if ($this->check_process($p['proc_id'], &$activity_manager, &$error_str) == 'n') 
     
    245245        /** 
    246246         *  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) 
    253253        { 
    254254                $code   = $p['code']; 
    255255                $errors = "Check syntax failed."; 
    256                 $fp = fopen('/tmp/check_syn.tmp', 'w');  
     256                $fp = fopen('/tmp/check_syn.tmp', 'w'); 
    257257        if ($fp) { 
    258                         fwrite($fp, $code);  
     258                        fwrite($fp, $code); 
    259259                        $errors = `php -l /tmp/check_syn.tmp`; 
    260260                        $errors = str_replace("in /tmp/check_syn.tmp","",$errors); 
  • sandbox/workflow/2.0/inc/class.bo_monitors.inc.php

    r795 r1293  
    134134        { 
    135135                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); 
    137137                $this->userID                   = $_SESSION['phpgw_info']['workflow']['account_id']; 
    138138                $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); 
    144144        } 
    145145 
     
    335335                $filters[] = '(gia.wf_user IS NOT NULL)'; 
    336336 
    337                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     337                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    338338                if (!$completeData) 
    339339                { 
    340                         $paging = $GLOBALS['workflow']['factory']->newInstance('Paging', 500, $_POST); 
     340                        $paging = Factory::newInstance('Paging', 500, $_POST); 
    341341                        $tmp = $this->processMonitor->monitor_list_instances($paging->nextItem, $paging->itemsPerPage, $order, '', implode(' AND ', $filters)); 
    342342                        $output['data'] = $paging->restrictItems(array_values($tmp['data']), $tmp['cant']); 
     
    353353                $activityMapping = array(); 
    354354                $instanceCount = count($output['data']); 
    355                 $cachedLDAP = &$GLOBALS['workflow']['factory']->getInstance('CachedLDAP'); 
     355                $cachedLDAP = &Factory::getInstance('CachedLDAP'); 
    356356                for ($i = 0; $i < $instanceCount; $i++) 
    357357                { 
     
    476476                /* load the data */ 
    477477                $filters[] = '(gp.wf_p_id = ' . $params['pid'] . ')'; 
    478                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     478                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    479479                if (!$completeData) 
    480480                { 
    481                         $paging = $GLOBALS['workflow']['factory']->newInstance('Paging', 500, $_POST); 
     481                        $paging = Factory::newInstance('Paging', 500, $_POST); 
    482482                        $tmp = $this->processMonitor->monitor_list_completed_instances($paging->nextItem, $paging->itemsPerPage, $order, '', implode(' AND ', $filters)); 
    483483                        $output['data'] = $paging->restrictItems(array_values($tmp['data']), $tmp['cant']); 
     
    491491                } 
    492492 
    493                 $cachedLDAP = &$GLOBALS['workflow']['factory']->getInstance('CachedLDAP'); 
     493                $cachedLDAP = &Factory::getInstance('CachedLDAP'); 
    494494                $userMapping = array(); 
    495495                $instanceCount = count($output['data']); 
     
    627627                        } 
    628628                        else 
    629                                 $output['fullname'] = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($user); 
     629                                $output['fullname'] = Factory::getInstance('WorkflowLDAP')->getName($user); 
    630630 
    631631                $this->instanceManager->set_instance_user($params['iid'], $params['aid'], $user); 
     
    648648                if ($params['ns'] == 'aborted') 
    649649                { 
    650                         $realInstance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     650                        $realInstance = new Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    651651                        $realInstance->getInstance($params['iid']); 
    652652                        if (!empty($realInstance->instanceId)) 
     
    684684 
    685685                /* 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); 
    687687                $realInstance->getInstance($params['iid'], false, false); 
    688688                $user = $realInstance->getNextUser($params['aid']); 
     
    751751 
    752752                $maximumDisplaySize = 100; 
    753                 $instance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     753                $instance = new Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    754754                $instance->getInstance($params['iid']); 
    755755 
     
    783783                        return "Você não tem permissão para executar este procedimento!"; 
    784784 
    785                 $instance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     785                $instance = new Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    786786                $instance->getInstance($params['iid']); 
    787787                $output = $params; 
     
    804804                $maximumDisplaySize = 100; 
    805805 
    806                 $instance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     806                $instance = new Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    807807                $instance->getInstance($params['iid']); 
    808808                $instance->set($params['name'], $params['value']); 
     
    835835                        return "Você não tem permissão para executar este procedimento!"; 
    836836 
    837                 $instance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     837                $instance = new Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    838838                $instance->getInstance($params['iid']); 
    839839                $instance->clear($params['name']); 
     
    904904                /* prepare the data */ 
    905905                $aux2 = array(); 
    906                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     906                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    907907                foreach ($aux as $user => $count) 
    908908                        $aux2[] = array( 
     
    984984 
    985985                /* load LDAP info and sort the result */ 
    986                 $foundUsers = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getNames($users); 
     986                $foundUsers = Factory::getInstance('WorkflowLDAP')->getNames($users); 
    987987                usort($foundUsers, create_function('$a,$b', 'return strcasecmp($a[\'name\'],$b[\'name\']);')); 
    988988 
     
    991991                if (count($users) > count($foundUsers)) 
    992992                { 
    993                         $cachedLDAP = &$GLOBALS['workflow']['factory']->getInstance('CachedLDAP'); 
     993                        $cachedLDAP = &Factory::getInstance('CachedLDAP'); 
    994994                        $foundUsersID = array_map(create_function('$a', 'return $a[\'id\'];'), $foundUsers); 
    995995                        $missingUsers = array_diff($users, $foundUsersID); 
     
    12421242                        return $output; 
    12431243 
    1244                 $BOUserInterface = &$GLOBALS['workflow']['factory']->getInstance('bo_userinterface'); 
     1244                $BOUserInterface = &Factory::getInstance('bo_userinterface'); 
    12451245 
    12461246                /* initialize some variables */ 
     
    13441344 
    13451345                /* load the recipient e-mail */ 
    1346                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     1346                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    13471347                foreach ($output as $key => $value) 
    13481348                { 
     
    13961396 
    13971397                /* 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(); 
    13991399                $GLOBALS['phpgw']->common = CreateObject('phpgwapi.common'); 
    14001400                $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions'); 
     
    14021402 
    14031403                /* get the required configuration */ 
    1404                 $BOEmailAdmin = $GLOBALS['workflow']['factory']->newForeignInstance('emailadmin', 'bo'); 
     1404                $BOEmailAdmin = Factory::newForeignInstance('emailadmin', 'bo'); 
    14051405                $profileList = $BOEmailAdmin->getProfileList(); 
    14061406                $profile = $BOEmailAdmin->getProfile($profileList[0]['profileID']); 
     
    14941494        { 
    14951495                $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'); 
    14981498                foreach ($userIDs as $userID) 
    14991499                { 
     
    15421542                $filters[] = '(gia.wf_user IS NOT NULL)'; 
    15431543 
    1544                 $cachedLDAP = &$GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     1544                $cachedLDAP = &Factory::newInstance('CachedLDAP'); 
    15451545                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP); 
    15461546                $output = array(); 
     
    15591559                } 
    15601560 
    1561                 $validUsers = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getNames(array_keys($userIDs)); 
     1561                $validUsers = Factory::getInstance('WorkflowLDAP')->getNames(array_keys($userIDs)); 
    15621562                array_walk($validUsers, create_function('&$a', '$a = $a[\'id\'];')); 
    15631563 
  • sandbox/workflow/2.0/inc/class.bo_participants.inc.php

    r795 r1293  
    3434        function bo_participants() 
    3535        { 
    36                 $this->ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     36                $this->ldap = &Factory::getInstance('WorkflowLDAP'); 
    3737        } 
    3838 
  • sandbox/workflow/2.0/inc/class.bo_userinterface.inc.php

    r795 r1293  
    4343        function bo_userinterface() 
    4444        { 
    45                 parent::bo_ajaxinterface();      
     45                parent::bo_ajaxinterface(); 
    4646                $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); 
    4848        } 
    4949 
     
    6868                $webserver_url = $_SESSION['phpgw_info']['workflow']['server']['webserver_url']; 
    6969 
    70                 $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     70                $templateServer =& Factory::getInstance('TemplateServer'); 
    7171                foreach ($result['data'] as $line) 
    7272                { 
     
    7878                                $iconweb = $webserver_url . '/workflow/redirect.php?pid=' . $line['wf_p_id'] . '&file=/icon.png'; 
    7979                        else 
    80                                 $iconweb = $templateServer->generateImageLink('navbar.png'); 
     80                                $iconweb = $templateServer->generateImageLink('default_process.png'); 
    8181                        $procname_ver = $line['wf_normalized_name']; 
    8282                        if (!isset($recset[$procname_ver])) 
     
    120120                $pid = $params['pid']; 
    121121                $result = array(); 
    122                  
    123                 $process = new Process($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     122 
     123                $process = new Process(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    124124                $process->getProcess($pid); 
    125125                $result['wf_procname'] = $process->name; 
    126126                $result['wf_version'] = $process->version; 
    127127                $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); 
    130130                $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; 
    135135        } 
    136136 
     
    263263                                else 
    264264                                        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']); 
    266266 
    267267                                /* unset unneeded information */ 
     
    495495                } 
    496496 
    497                 $instance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     497                $instance = new Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    498498                $instance->getInstance($instanceID); 
    499499 
    500                 $process = new Process($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     500                $process = new Process(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    501501                $process->getProcess($instance->pId); 
    502502 
     
    508508                        'wf_instance_id' => $instance->instanceId, 
    509509                        'wf_priority' => $instance->priority, 
    510                         'wf_owner' => $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($instance->owner), 
     510                        'wf_owner' => Factory::getInstance('WorkflowLDAP')->getName($instance->owner), 
    511511                        '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), 
    513513                        'wf_name' => $instance->name, 
    514514                        'wf_category' => $instance->category, 
     
    526526                $result['wf_ended'] = ""; 
    527527 
    528                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     528                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    529529                foreach ($instance->workitems as $line) 
    530530                { 
     
    570570 
    571571        /** 
    572          * Retorna os idiomas   
    573          * @return array   
    574          * @access public 
    575          */      
     572         * Retorna os idiomas 
     573         * @return array 
     574         * @access public 
     575         */ 
    576576        function getLang(){ 
    577                          
     577 
    578578                $keys = array(); 
    579579                $values = array(); 
     
    586586                return $langs; 
    587587        } 
    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         * 
    592592         *  @param $to 
    593593         *  @return string a given duration in human readable form, usefull for workitems duration 
     
    599599                $to = $to - ($hours*3600); 
    600600                $min = date("i", $to); 
    601                 $to = $to - ($min*60);                   
     601                $to = $to - ($min*60); 
    602602                $sec = date("s", $to); 
    603603 
    604604                return tra('%1 days, %2:%3:%4',$days,$hours,$min,$sec); 
    605605        } 
    606          
     606 
    607607        /** 
    608608         *  Instances 
     
    657657                $cod_process = array(); 
    658658 
    659                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     659                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    660660                $viewActivitiesID = array(); 
    661661                foreach ($result['data'] as $row) 
     
    740740        /** 
    741741         * Aplicacoes externas do usuario 
    742          * @return array  
     742         * @return array 
    743743         * @access public 
    744744         */ 
     
    746746        { 
    747747                $webserver_url = $_SESSION['phpgw_info']['workflow']['server']['webserver_url']; 
    748                 $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     748                $templateServer = &Factory::getInstance('TemplateServer'); 
    749749 
    750750                /* load the sites that the user can access */ 
     
    790790        /** 
    791791         * Organograma 
    792          * @return array com as areas da organizacao  
     792         * @return array com as areas da organizacao 
    793793         * @access public 
    794794         */ 
     
    819819        /** 
    820820         * Get the hierarchical Area 
    821          * @return array  
     821         * @return array 
    822822         * @access public 
    823823         */ 
  • sandbox/workflow/2.0/inc/class.bo_utils.inc.php

    r795 r1293  
    3434        { 
    3535                parent::bo_ajaxinterface(); 
    36                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso(); 
     36                $this->db =& Factory::getInstance('WorkflowObjects')->getDBExpresso(); 
    3737        } 
    3838 
  • sandbox/workflow/2.0/inc/class.external_bridge.inc.php

    r795 r1293  
    5252        function external_bridge() 
    5353        { 
    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); 
    5656        } 
    5757        /** 
     
    156156 
    157157                /* assign variables to the template */ 
    158                 $smarty = $GLOBALS['workflow']['factory']->getInstance('workflow_smarty', false); 
     158                $smarty = Factory::getInstance('workflow_smarty', false); 
    159159                $smarty->assign('encodedForm', $encodedForm); 
    160160                $smarty->assign('siteAddress', $this->siteAddress); 
  • sandbox/workflow/2.0/inc/class.run_activity.inc.php

    r795 r1293  
    1010        \**************************************************************************/ 
    1111 
     12        require_once PHPGW_SERVER_ROOT . SEP . 'workflow/inc/common.inc.php'; 
     13 
    1214        require_once(dirname(__FILE__) . SEP . 'class.WorkflowUtils.inc.php'  ); /* superclass source code       */ 
    1315        require_once(dirname(__FILE__) . SEP . 'class.basecontroller.inc.php' ); /* module controller            */ 
    1416        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 */ 
    1618        require_once(dirname(__FILE__) . SEP . 'class.utils.security.php'     ); /* sanitizes input data         */ 
    1719 
     
    2527     */ 
    2628        class run_activity extends WorkflowUtils 
    27         {        
     29        { 
    2830                /** 
    2931                 * @var array  $public_functions func 
     
    5153                 * @access public 
    5254                 */ 
    53                 var $process;    
     55                var $process; 
    5456                /** 
    5557                 * @var object $GUI  GUI engine object. Act carefully with it. 
     
    6365                var $message = Array(); 
    6466                /** 
    65                  * @var object $categories categorie object for categories  
     67                 * @var object $categories categorie object for categories 
    6668                 * @access public 
    6769                 */ 
    6870                var $categories; 
    6971                /** 
    70                  * @var array $conf  
    71                  * @access public 
    72                  */ 
    73                 var $conf = array();     
     72                 * @var array $conf 
     73                 * @access public 
     74                 */ 
     75                var $conf = array(); 
    7476                /** 
    7577                 * @var $wf_template local activity template 
     
    7779                 */ 
    7880                var $wf_template; 
    79                 /**  
     81                /** 
    8082                 * @var object $instance 
    8183                 * @access public 
    8284                 */ 
    8385                var $instance; 
    84                 /**  
     86                /** 
    8587                 * @var object $activity_type The type of activity 
    8688                 * @access public 
     
    8991                // then we retain all usefull vars as members, to make them avaible in user's source code 
    9092                // 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 
    9395                 * @access public 
    9496                 */ 
    9597                var $process_id; 
    96                 /**  
    97                  * @var int $activity_id The activity id  
     98                /** 
     99                 * @var int $activity_id The activity id 
    98100                 * @access public 
    99101                 */ 
    100102                var $activity_id; 
    101                 /**  
     103                /** 
    102104                 * @var int $process_name The process name 
    103105                 * @access public 
    104106                 */ 
    105107                var $process_name; 
    106                 /**  
    107                  * @var int $process_version The process_version  
     108                /** 
     109                 * @var int $process_version The process_version 
    108110                 * @access public 
    109111                 */ 
    110112                var $process_version; 
    111                 /**  
    112                  * @var int $activity_name The process id  
     113                /** 
     114                 * @var int $activity_name The process id 
    113115                 * @access public 
    114116                 */ 
    115117                var $activity_name; 
    116                 /**  
    117                  * @var int $user_name The user name  
     118                /** 
     119                 * @var int $user_name The user name 
    118120                 * @access public 
    119121                 */ 
    120122                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 
    123125                 * @access public 
    124126                 */ 
    125127                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 
    129131                 * @access public 
    130132                 */ 
    131133                var $instance_id=0; 
    132                 /**  
    133                  * @var string $instance_name Instance name  
     134                /** 
     135                 * @var string $instance_name Instance name 
    134136                 * @access public 
    135137                 */ 
    136138                var $instance_name=''; 
    137                 /**  
    138                  * @var int $instance_owner Instance owner id  
     139                /** 
     140                 * @var int $instance_owner Instance owner id 
    139141                 * @access public 
    140142                 */ 
    141143                var $instance_owner=0; 
    142                 /**  
    143                  * @var string $owner_name Owner name  
     144                /** 
     145                 * @var string $owner_name Owner name 
    144146                 * @access public 
    145147                 */ 
    146148                var $owner_name=''; 
    147                  
     149 
    148150                /** 
    149151                 * @var bool $print_mode print mode 
     
    156158                 */ 
    157159                var $enable_print_mode = false; 
    158                  
     160 
    159161                /** 
    160162                 * @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 
    162164                 */ 
    163165                var $act_role_names= Array(); 
    164                  
     166 
    165167                /** 
    166168                 * @var array $agents Array of ui_agent objects 
     
    174176                 * @access public 
    175177                 */ 
    176                 var $smarty;                 
     178                var $smarty; 
    177179                /** 
    178180                 * @var array $wf holds a global environment vector 
    179181                 * @access public 
    180182                 */ 
    181                 var $wf;                     
     183                var $wf; 
    182184                /** 
    183185                 * @var $download_mode activates download mode 
    184186                 * @access public 
    185187                 */ 
    186                 var $download_mode;         
     188                var $download_mode; 
    187189                /** 
    188190                 * @var string $_template_name holds the template's file name 
    189191                 * @access public 
    190192                 */ 
    191                 var $_template_name = null;  
     193                var $_template_name = null; 
    192194                /** 
    193195                 * @var bool Indicates wether the current instance is a child instance or not 
     
    200202                /** 
    201203                 * Constructor 
    202                  *  
    203                  * @access public  
     204                 * 
     205                 * @access public 
    204206                 */ 
    205207                function run_activity() 
     
    301303                        $this->process_version  = $this->process->getVersion(); 
    302304                        $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']); 
    304306                        $this->view_activity    = $this->GUI->gui_get_process_view_activity($this->process_id); 
    305307 
     
    317319                        $GLOBALS['workflow']['wf_workflow_path']                        = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'; 
    318320                        $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(''); 
    321323                        $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']); 
    323325                        $GLOBALS['workflow']['wf_back_link']                            = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1'; 
    324326                        $GLOBALS['workflow']['wf_js_path']                                      = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode'; 
     
    375377 
    376378                                /* 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)) 
    378380                                { 
    379381                                        $_SESSION['phpgw_info']['workflow']['user_groups'] = $actualUserGroups; 
     
    406408                                $smarty->plugins_dir[] = PHPGW_SERVER_ROOT.SEP.'workflow'.SEP.'inc'.SEP.'smarty'.SEP.'wf_plugins'; 
    407409 
    408                                 $GLOBALS['phpgw']->template =& $smarty; 
     410                                Factory::getForeignInstance('phpgwapi', 'phpgw')->template =& $smarty; 
    409411                                $this->wf_template =& $smarty; 
    410412                                $_template_name = null; 
     
    418420                                $smarty->assign('wf_back_link',$GLOBALS['workflow']['wf_back_link']); 
    419421                                $smarty->assign('wf_activity_url',$GLOBALS['workflow']['wf_activity_url']); 
    420                                  
     422 
    421423                                /* register the prefilter smarty plugin wf_default_template */ 
    422424                                $smarty->load_filter('pre', 'wf_default_template'); 
     
    444446 
    445447                        $GLOBALS['workflow_env'] = &$env; 
     448 
    446449                        //echo "<br><br><br><br><br>Including $source <br>In request: <pre>";print_r($_REQUEST);echo "</pre>"; 
    447450                        //[__leave_activity] is setted if needed in the xxx_pre code or by the user in his code 
     
    471474 
    472475                        /* activate the security policy */ 
    473                         $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     476                        Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
    474477 
    475478                        /* include the files */ 
     
    497500                        $this->instance_name    = $instance->getName(); 
    498501                        $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); 
    500503                        if ($this->owner_name == '') 
    501504                        { 
     
    644647                        $this->process_version  = $this->process->getVersion(); 
    645648                        $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']); 
    647650                        $this->view_activity    = $this->GUI->gui_get_process_view_activity($this->process_id); 
    648651 
     
    660663                        $GLOBALS['workflow']['wf_workflow_path']                        = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'; 
    661664                        $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(''); 
    664667                        $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']); 
    666669                        $GLOBALS['workflow']['wf_back_link']                            = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1'; 
    667670                        $GLOBALS['workflow']['wf_js_path']                                      = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode'; 
     
    711714 
    712715                        /* activate the security policy */ 
    713                         $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     716                        Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
    714717 
    715718                        $GLOBALS['workflow_env'] = &$env; 
  • sandbox/workflow/2.0/inc/class.so_adminaccess.inc.php

    r795 r1293  
    7777        { 
    7878                $output = array(); 
    79                 $names = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getNames($userIDs); 
     79                $names = Factory::getInstance('WorkflowLDAP')->getNames($userIDs); 
    8080                foreach ($names as $name) 
    8181                        $output[] = array( 
     
    201201                if (!is_object($GLOBALS['phpgw']->acl)) 
    202202                { 
    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); 
    205205                } 
    206206 
  • sandbox/workflow/2.0/inc/class.so_adminjobs.inc.php

    r795 r1293  
    9696                $this->isAdmin = $_SESSION['phpgw_info']['workflow']['user_is_admin']; 
    9797                $this->acl = &$GLOBALS['ajax']->acl; 
    98                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     98                $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    9999                $this->jobManager = new JobManager(&$this->db); 
    100100        } 
     
    229229                $output = array(); 
    230230                $job = $this->jobManager->getJob($jobID); 
    231                 $jobScheduler = &$GLOBALS['workflow']['factory']->getInstance('JobScheduler'); 
     231                $jobScheduler =& Factory::getInstance('JobScheduler'); 
    232232                $totalTime = microtime(true); 
    233233                $thread = $jobScheduler->execute($job, true); 
  • sandbox/workflow/2.0/inc/class.so_agent.inc.php

    r795 r1293  
    2626{ 
    2727        //public functions 
    28          
     28 
    2929        /** 
    3030         * @var array $public_functions Array of public functions 
    31          * @access public  
     31         * @access public 
    3232         */ 
    3333        var $public_functions = array( 
     
    3636        ); 
    3737        /** 
    38          * @var array $wf_table  
     38         * @var array $wf_table 
    3939         * @access public 
    4040         */ 
    4141        var $wf_table = 'egw_wf_agent_'; 
    4242        /** 
    43          * @var string $agent_table  
     43         * @var string $agent_table 
    4444         * @access public 
    4545         */ 
    4646        var $agent_table = ''; 
    47          
     47 
    4848        // link to the global db-object 
    49          
     49 
    5050        /** 
    51          * @var object $db objeto para conexao do banco de dados  
     51         * @var object $db objeto para conexao do banco de dados 
    5252         * @access public 
    5353         */ 
    5454        var $db; 
    55          
     55 
    5656        /** 
    5757         * Constructor of the so_agent class 
    5858         * do not forget to call it (parent::so_agent();) in child classes 
    5959         * @access public 
    60          * @return object  
     60         * @return object 
    6161         */ 
    62          
     62 
    6363        function so_agent() 
    6464        { 
    65                 $this->db =& $GLOBALS['workflow']['workflowObjects']->getDBGalaxia(); 
     65                $this->db =& Factory::getInstance('WorkflowObjects')->getDBGalaxia(); 
    6666        } 
    67          
     67 
    6868        /** 
    6969         * @abstract read all agent datas from the database 
  • sandbox/workflow/2.0/inc/class.so_external_applications.inc.php

    r795 r1293  
    130130                $this->isAdmin = $_SESSION['phpgw_info']['workflow']['user_is_admin']; 
    131131                $this->acl = &$GLOBALS['ajax']->acl; 
    132                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     132                $this->db =& Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    133133                $this->EXTERNAL_APPLICATION_PATH = $_SESSION['phpgw_info']['workflow']['server']['files_dir'] . '/workflow//workflow/external_applications'; 
    134134        } 
  • sandbox/workflow/2.0/inc/class.so_move_instances.inc.php

    r795 r1293  
    9191                $this->userID = $_SESSION['phpgw_info']['workflow']['account_id']; 
    9292                $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; 
    9595        } 
    9696 
  • sandbox/workflow/2.0/inc/class.so_orgchart.inc.php

    r795 r1293  
    127127                $this->isAdmin = $_SESSION['phpgw_info']['workflow']['user_is_admin']; 
    128128                $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; 
    131131                $this->db->SetFetchMode(ADODB_FETCH_ASSOC); 
    132132        } 
     
    704704 
    705705                $output = $result->GetArray(-1); 
    706                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     706                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    707707                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP_DATABASE); 
    708708                for ($i = 0; $i < count($output); $i++) 
     
    753753 
    754754                /* 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')); 
    757757                if ($list === false) 
    758758                        die(serialize("O sistema de busca não pode ser utilizado nesta organização.")); 
     
    762762 
    763763                /* 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); 
    765765                foreach ($resultSet as $row) 
    766766                        if (!isset($unifiedResult[$row['uidnumber']])) 
     
    811811                { 
    812812                        $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']}\".", 
    814814                                '-----------------', 
    815815                                '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.' 
     
    869869                { 
    870870                        $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), 
    872872                                '-----------------', 
    873873                                'Se você quiser excluir este funcionário, precisa removê-lo dos "cargos" que ele possui nas áreas citadas.' 
     
    899899                $this->_checkError($result); 
    900900 
    901                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     901                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    902902                while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) 
    903903                { 
     
    980980                        $query = 'SELECT 1 FROM funcionario WHERE (funcionario_id = ?)'; 
    981981                        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."; 
    983983                } 
    984984 
     
    10261026                        $query = 'SELECT 1 FROM funcionario WHERE (funcionario_id = ?)'; 
    10271027                        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."; 
    10291029                } 
    10301030 
     
    10781078                $outputInfo = array(); 
    10791079 
    1080                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     1080                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    10811081                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP_DATABASE); 
    10821082                $employeeEntry = $cachedLDAP->getEntryByID($employeeID); 
     
    11681168                ); 
    11691169 
    1170                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     1170                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    11711171                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP_DATABASE); 
    11721172                if (!empty($areaInfo['titular_funcionario_id'])) 
  • sandbox/workflow/2.0/inc/class.so_userinterface.inc.php

    r795 r1293  
    2222        function so_userinterface() 
    2323        { 
    24                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBWorkflow()->Link_ID; 
     24                $this->db =& Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Link_ID; 
    2525                $this->db->SetFetchMode(ADODB_FETCH_ASSOC); 
    2626        } 
     
    9393                if (!empty($externalApplicationsID)) 
    9494                { 
    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"); 
    9696                        $preOutput = $result->GetArray(-1); 
    9797 
     
    245245 
    246246                $employees = $result->GetArray(-1); 
    247                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     247                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    248248                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP_DATABASE); 
    249249                $categoriesCount = array(); 
     
    318318 
    319319                $employees = $result->GetArray(-1); 
    320                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     320                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    321321                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP_DATABASE); 
    322322                for ($i = 0; $i < count($employees); $i++) 
     
    356356 
    357357                /* 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')); 
    360360                if ($list === false) 
    361361                        return false; 
  • sandbox/workflow/2.0/inc/class.ui_adminaccess.inc.php

    r795 r1293  
    4141        function ui_adminaccess() 
    4242        { 
    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'])) 
    4444                { 
    4545                        $GLOBALS['phpgw']->common->phpgw_header(); 
  • sandbox/workflow/2.0/inc/class.ui_adminactivities.inc.php

    r795 r1293  
    1111{ 
    1212        /** 
    13          * @var array $public_functions Array of public functions  
     13         * @var array $public_functions Array of public functions 
    1414         * @access public 
    1515         */ 
     
    1818                'show_graph'    => true 
    1919        ); 
    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  */ 
     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        */ 
    2929        var $activity_manager; 
    30 /** 
    31  * @var object $role_manager 
    32  * @access public  
    33  */ 
     30        /** 
     31        * @var object $role_manager 
     32         * @access public 
     33        */ 
    3434        var $role_manager; 
    35 /** 
    36  * @var $where2  
    37  * @access public  
    38  */      
     35        /** 
     36         * @var $where2 
     37         * @access public 
     38         */ 
    3939        var $where2; 
    4040        /** 
    4141         * @var object $sort_mode2 
    42          * @access public  
    43          */      
     42         * @access public 
     43         */ 
    4444        var $sort_mode2; 
    4545        /** 
     
    5050        /** 
    5151         * @var object $workflow_acl 
    52          * @access public  
     52         * @access public 
    5353         */ 
    5454        var $workflow_acl; 
    5555        /** 
    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(); 
    6565        /** 
    6666         * Constructor da classe ui_adminactivities 
    67          *  
     67         * 
    6868         * @access public 
    6969         * @return void 
    70          */      
     70         */ 
    7171        function ui_adminactivities() 
    7272        { 
     
    112112 
    113113        } 
    114                  
     114 
    115115        /** 
    116116         * Build the form for Activities Administration 
     
    130130                $this->t->set_block('admin_activities', 'block_activity_agents', 'activity_agents'); 
    131131                $this->t->set_block('admin_activities', 'block_select_agents', 'select_agents'); 
    132          
     132 
    133133                $proc_info =& $this->process_manager->get_process($this->wf_p_id); 
    134          
     134 
    135135                $activity_id            = (int)get_var('activity_id', 'any', 0); 
    136136                $name                           = get_var('name', 'any', ''); 
    137                                          
     137 
    138138                // TODO: not all variables below are still required.  clean up 
    139                  
     139 
    140140                $description                    = get_var('description', 'any', ''); 
    141141                $type                                   = get_var('type', 'any', ''); 
     
    175175                { 
    176176                        $rolename = trim($rolename); 
    177                         if( strlen($rolename) > 0 )  
     177                        if( strlen($rolename) > 0 ) 
    178178                        { 
    179179                                //second parameter for read-only mode 
     
    190190                                } 
    191191                        } 
    192                         else  
     192                        else 
    193193                        { 
    194194                                $this->message[] = lang('Invalid role name'); 
     
    221221                { 
    222222                        $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 ) 
    224224                        { 
    225225                                if ($newrole_id) 
     
    236236                if (isset($_POST['delete_act'])) 
    237237                { 
    238                         if( isset($_POST['activities']) )  
     238                        if( isset($_POST['activities']) ) 
    239239                        { 
    240240                                if ($this->delete_activities(array_keys($_POST['activities']))) $this->message[] = lang('Deletion successful'); 
     
    245245                // add transitions 
    246246                if (isset($_POST['add_trans'])) 
    247                 {  
     247                { 
    248248                        $this->message[] = $this->add_transition($_POST['wf_act_from_id'], $_POST['wf_act_to_id']); 
    249249                        $checkvalidity = true; 
     
    305305                $filter_type = get_var('filter_type', 'any', ''); 
    306306                $this->show_select_filter_type($activity_types, $filter_type); 
    307                  
     307 
    308308                $filter_interactive             = get_var('filter_interactive', 'any', ''); 
    309309                $activity_interactive = array('y' => lang('Interactive'), 'n'=>lang('Automatic')); 
    310310                $this->show_select_filter_interactive($activity_interactive, $filter_interactive); 
    311                  
     311 
    312312                $filter_autoroute               = get_var('filter_autoroute', 'any', ''); 
    313313                $activity_autoroute = array('y' => lang('Auto Routed'), 'n'=>lang('Manual')); 
    314314                $this->show_select_filter_autoroute($activity_autoroute, $filter_autoroute); 
    315                  
     315 
    316316                $where = ''; 
    317317                $wheres = array(); 
    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 == '') )  
     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 == '') ) 
    327327                { 
    328328                        $wheres[] = "wf_is_autorouted = '" .$filter_autoroute. "'"; 
    329329                } 
    330                 if( count($wheres) > 0 )  
     330                if( count($wheres) > 0 ) 
    331331                { 
    332332                        $where = implode(' and ', $wheres); 
    333333                } 
    334                  
     334 
    335335                if (empty($process_activities)) $process_activities =& $this->activity_manager->list_activities($this->wf_p_id, 0, -1, $this->sort_mode, $find, $where); 
    336336                $all_transition_activities_from =& $this->activity_manager->get_transition_activities($this->wf_p_id, 'end'); 
     
    373373                // fill proc_bar 
    374374                $this->t->set_var('proc_bar', $this->fill_proc_bar($proc_info)); 
    375                  
     375 
    376376                //collect some messages from used objects 
    377377                $this->message[] = $this->activity_manager->get_error(false, _DEBUG); 
     
    379379                $this->message[] = $this->role_manager->get_error(false, _DEBUG); 
    380380 
    381                 $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     381                $templateServer = &Factory::getInstance('TemplateServer'); 
    382382 
    383383                // fill the general variables of the template 
     
    418418                } 
    419419                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)); 
    421421                        $this->t->set_var('filter_trans_from_value', ''); 
    422422                } 
     
    425425                $this->show_process_activities($process_activities['data']); 
    426426 
    427                  
     427 
    428428                foreach ($activity_types as $type) 
    429429                { 
     
    450450                                        'act_role_ro_checked'   => ($role['wf_readonly'])? 'checked="checked"' : '', 
    451451                                        'act_role_href'         => $GLOBALS['phpgw']->link('/index.php', array( 
    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'], 
     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'], 
    460460                                        )), 
    461                                          'lang_delete'          => lang('delete'), 
     461                                        'lang_delete'           => lang('delete'), 
    462462                                )); 
    463463                                $this->t->parse('activity_roles', 'block_activity_roles', True); 
    464464                        } 
    465                          
    466                 } 
    467                  
     465 
     466                } 
     467 
    468468                //general texts about roles 
    469469                $this->t->set_var(array( 
     
    472472                        'txt_Remove_selected_roles'             => lang('remove selected roles'), 
    473473                        'txt_Use_existing_roles'                => lang('Use existing roles'), 
    474                         ) 
    475                 ); 
    476                  
     474                ) 
     475        ); 
     476 
    477477                // fill activity agents 
    478478                if (!$activity_agents) 
     
    504504                        } 
    505505                } 
    506                  
     506 
    507507                //display agents options 
    508508                $this->display_agents_rows(); 
     
    528528                        $this->t->parse('process_roles', 'block_process_roles', True); 
    529529                } 
    530                  
     530 
    531531                // fill agents select 
    532532                foreach ($agents_list as $agent) 
     
    553553        } 
    554554        /** 
    555         * Show select filter type 
    556         * @param array $all_activity_types 
    557         * @param $filter_type  
    558         * @access public 
    559         * @return void 
    560         */ 
     555         * Show select filter type 
     556         * @param array $all_activity_types 
     557         * @param $filter_type 
     558         * @access public 
     559         * @return void 
     560         */ 
    561561        function show_select_filter_type($all_activity_types, $filter_type) 
    562562        { 
     
    574574                } 
    575575        } 
    576          
    577         /** 
    578         * Show select filter type 
    579         * @param array $all_activity_types 
    580         * @param $filter_type  
    581         * @access public 
    582         * @return void 
    583         */ 
     576 
     577        /** 
     578         * Show select filter type 
     579         * @param array $all_activity_types 
     580         * @param $filter_type 
     581         * @access public 
     582         * @return void 
     583         */ 
    584584        function show_select_filter_interactive($all_activity_interactive, $filter_interactive) 
    585585        { 
     
    598598        } 
    599599        /** 
    600         * Show select filter type 
    601         * @param array $all_activity_types 
    602         * @param $filter_type  
    603         * @access public 
    604         * @return void 
    605         */ 
     600         * Show select filter type 
     601         * @param array $all_activity_types 
     602         * @param $filter_type 
     603         * @access public 
     604         * @return void 
     605         */ 
    606606        function show_select_filter_autoroute($all_activity_autoroute, $filter_autoroute) 
    607607        { 
     
    619619                } 
    620620        } 
    621          
    622         /** 
    623         * Show select filter type 
    624         * @param array $all_activity_types 
    625         * @param $filter_type  
    626         * @access public 
    627         * @return void 
    628         */ 
     621 
     622        /** 
     623         * Show select filter type 
     624         * @param array $all_activity_types 
     625         * @param $filter_type 
     626         * @access public 
     627         * @return void 
     628         */ 
    629629        function update_activities(&$process_activities, $activities_inter, $activities_route) 
    630630        { 
     
    673673         *  Search transitions activities 
    674674         *  @param array $process_activities 
    675          *  @param int $act_id  
     675         *  @param int $act_id 
    676676         *  @return int new role id 
    677677         */ 
     
    714714                        $this->translate_template('block_process_activities_header'); 
    715715                        $this->t->parse('process_activities_header', 'block_process_activities_header', True); 
    716                         $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     716                        $templateServer = &Factory::getInstance('TemplateServer'); 
    717717                        foreach ($process_activities_data as $activity) 
    718718                        { 
     
    725725                                        $act_default_user = $GLOBALS['phpgw']->accounts->id2name($activity['wf_default_user']); 
    726726                                } 
    727                                  
     727 
    728728                                $this->t->set_var(array( 
    729729                                        'act_activity_id'       => $activity['wf_activity_id'], 
     
    747747                        $this->t->parse('process_activities_footer', 'block_process_activities_footer', True); 
    748748                } 
    749                 else  
     749                else 
    750750                { 
    751751                        $this->t->set_var('process_activities_header', ''); 
     
    754754                } 
    755755        } 
    756 /**  
    757  * Show transitions table 
    758  * @var array $process_transition  
    759  * @access public 
    760  * @return void 
    761  */ 
     756        /** 
     757        * Show transitions table 
     758         * @var array $process_transition 
     759        * @access public 
     760        * @return void 
     761        */ 
    762762        function show_transitions_table($process_transitions) 
    763763        { 
     
    774774                                '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']), 
    775775                                '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'), 
    777777                                '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']), 
    778778                                'trans_actToName'       => $transition['wf_act_to_name'], 
     
    785785                        $this->t->set_var('transitions_table', '<tr><td colspan="2" align="center">'. lang('There are no transitions defined')  .'</td></tr>'); 
    786786                        $this->t->set_var('transitions_table_footer', ''); 
    787                 }  
    788                 else  
     787                } 
     788                else 
    789789                { 
    790790                        $this->t->parse('transitions_table_footer', 'block_transitions_table_footer', true); 
     
    794794        /** 
    795795         * Build select box with all transitions activities 
    796          * @param string  $var_name              
     796         * @param string  $var_name 
    797797         * @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 
    801801         * @access public 
    802802         * @return string html code with select box 
    803803         */ 
    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) 
    806806        { 
    807807                //echo "process_activities_data: <pre>";print_r($process_activities_data);echo "</pre>"; 
    808808                $select_str = "<select name='$var_name'" . (($multiple)? " multiple='multiple' size='5'" : "" ) . ">"; 
    809809                if ($show_all) $select_str .= '<option value="">'. lang('All') .'</option>'; 
    810                  
     810 
    811811                foreach ($process_activities_data as $activity) 
    812812                { 
     
    824824                return $select_str; 
    825825        } 
    826          
     826 
    827827        /** 
    828828         * Build select box with all transitions activities filtered 
    829          * @param string  $var_name              
     829         * @param string  $var_name 
    830830         * @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 
    834834         * @access public 
    835835         * @return string html code with select box 
    836          */      
     836         */ 
    837837        function build_select_transition_filtered($var_name, $process_activities_data, $multiple=false, $show_all=true, $from=false) 
    838838        { 
    839839                $select_str = "<select name='$var_name'" . (($multiple)? " multiple='multiple' size='5'" : "" ) . ">"; 
    840840                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 ) 
    843843                { 
    844844                        foreach ($process_activities_data as $activity) 
     
    860860 
    861861        /** 
    862          * Save the edited activity.  
    863          *  
     862         * Save the edited activity. 
     863         * 
    864864         * @param int $activity_id 
    865865         * @param string $name 
     
    868868         * @param string $default_user 
    869869         * @param bool $is_interative 
    870          * @param bool $is_autorouted  
     870         * @param bool $is_autorouted 
    871871         * @return mixed Return the activity_id or false in case of error, $this->message is set in case of error 
    872872         * @access public 
     
    902902 
    903903                $activity_id = $this->activity_manager->replace_activity($this->wf_p_id, $activity_id, $vars); 
    904                  
     904 
    905905                // assign role to activity 
    906                 if ($userole)  
     906                if ($userole) 
    907907                { 
    908908                        $this->activity_manager->add_activity_role($activity_id, $userole, ($userole_ro=='on')); 
    909909                } 
    910                  
     910 
    911911                // assign agent to activity 
    912                 if ($useagent)  
     912                if ($useagent) 
    913913                { 
    914914                        $this->activity_manager->add_activity_agent($activity_id, $useagent); 
     
    919919                { 
    920920                        $agents_conf =& $_POST['wf_agent']; 
    921                          
     921 
    922922                        //retrieve agents list 
    923923                        $activity_agents =& $this->activity_manager->get_activity_agents($activity_id); 
     
    958958                } 
    959959                $this->activity_manager->validate_process_activities($this->wf_p_id); 
    960                  
    961                  
     960 
     961 
    962962                return $activity_id; 
    963963        } 
     
    987987                        $this->message[] = lang('Transitions removed successfully'); 
    988988                } 
    989                 else  
     989                else 
    990990                { 
    991991                        $this->message[] = lang('Select a transition to remove'); 
     
    994994        /** 
    995995         * Add a transition activity 
    996          * @param int $from from activity  
     996         * @param int $from from activity 
    997997         * @param int $to   next activity 
    998998         * @return string Error or success message 
     
    10181018                $image_name = $proc_info['wf_normalized_name'] . SEP . 'graph' . SEP . $proc_info['wf_normalized_name'] . '.png'; 
    10191019                $image = GALAXIA_PROCESSES . SEP . $image_name; 
    1020                 if ($GLOBALS['workflow']['factory']->getInstance('BrowserInfo')->isOpera()) 
     1020                if (Factory::getInstance('BrowserInfo')->isOpera()) 
    10211021                        $maximumDimension = 1000000; 
    10221022                else 
     
    10511051                } 
    10521052        } 
    1053          
     1053 
    10541054        /** 
    10551055         * Dislays the activity agents config rows 
     
    10721072                        } 
    10731073                        $this->translate_template('admin_agents'); 
    1074                                                                                                 $this->t->parse('agents_config_rows', 'admin_agents'); 
     1074                        $this->t->parse('agents_config_rows', 'admin_agents'); 
    10751075                } 
    10761076        } 
  • sandbox/workflow/2.0/inc/class.ui_adminjobs.inc.php

    r795 r1293  
    4141                        'app_header' => $GLOBALS['phpgw_info']['apps']['workflow']['title'] . ' - ' . lang('Jobs') 
    4242                ); 
    43                 $smarty = &$GLOBALS['workflow']['factory']->getInstance('workflow_smarty'); 
     43                $smarty = &Factory::getInstance('workflow_smarty'); 
    4444 
    4545                $javaScripts = $this->get_common_js(); 
     
    5454                $css .= $this->get_css_link('adminjobs'); 
    5555 
    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']); 
    5757                $smarty->assign('processNameVersion', "{$processInfo['wf_name']} v{$processInfo['wf_version']}"); 
    5858                $smarty->assign('processID', (int) $processInfo['wf_p_id']); 
  • sandbox/workflow/2.0/inc/class.ui_adminprocesses.inc.php

    r989 r1293  
    127127                } 
    128128 
    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'])) 
    130130                { 
    131131                        $proc_ids = $this->workflow_acl->get_granted_processes($GLOBALS['phpgw_info']['user']['account_id']); 
     
    589589 
    590590                        $myp_id = $item['wf_p_id']; 
    591                         $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     591                        $templateServer = &Factory::getInstance('TemplateServer'); 
    592592                        $this->t->set_var(array( 
    593593                                'item_wf_p_id'          => $myp_id, 
  • sandbox/workflow/2.0/inc/class.ui_adminroles.inc.php

    r795 r1293  
    7575                $this->role_manager     = CreateObject('workflow.workflow_rolemanager'); 
    7676                $this->form_action = $GLOBALS['phpgw']->link('/index.php', 'menuaction=workflow.ui_adminroles.form'); 
    77                  
     77 
    7878        } 
    7979        /** 
     
    9797 
    9898                if (!$this->wf_p_id) die(lang('No process indicated')); 
    99                  
     99 
    100100                //do we need to check validity, warning high load on database 
    101101                $checkvalidity=false; 
     
    122122                        $checkvalidity = true; 
    123123                } 
    124                  
     124 
    125125                // delete mappings 
    126                 if (isset($_POST['delete_map']))  
     126                if (isset($_POST['delete_map'])) 
    127127                { 
    128128                        $this->delete_maps(array_keys($_POST['map'])); 
     
    137137                // fill proc_bar 
    138138                $this->t->set_var('proc_bar', $this->fill_proc_bar($proc_info)); 
    139                  
     139 
    140140                // retrieve role info 
    141141                if ($role_id || isset($_POST['new_role'])) 
     
    155155                $all_roles = $this->role_manager->list_roles($this->wf_p_id, 0, -1, 'wf_name__asc', ''); 
    156156                //echo "all_roles: <pre>";print_r($all_roles);echo "</pre>"; 
    157                  
     157 
    158158                //collect some messages from used objects 
    159159                $this->message[] = $this->activity_manager->get_error(false, _DEBUG); 
     
    208208                        $this->message[] = lang('Role not saved (maybe a name collision)'); 
    209209                } 
    210                  
     210 
    211211        } 
    212212        /** 
    213213         * Delet selected roles 
    214          * @param array $roles_ids  
     214         * @param array $roles_ids 
    215215         * @access public 
    216216         * @return void 
     
    254254                        $this->t->set_var('list_mappings', '<tr><td colspan="3" align="center">'. lang('There are no mappings defined for this process')  .'</td></tr>'); 
    255255                } 
    256                 else {   
     256                else { 
    257257                        /* 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'); 
    260260                        $userContext  = $tmpLDAP->getUserContext(); 
    261261                        $groupContext = $tmpLDAP->getGroupContext(); 
     
    264264                        { 
    265265                                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, 
    268268                                                                        '(&(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 
    272272                                        $cname = $GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8'); 
    273273                                        $glabel = '[' . lang('Group') . ']'; 
     
    280280                                                $glabel = '<font color="red">(excluído)</font>'; 
    281281                                } 
    282                                  
     282 
    283283                                $this->t->set_var(array( 
    284284                                        'map_user_id'   => $mapping['wf_user'], 
     
    313313         * Show users roles selects 
    314314         * @param string $all_roles_data 
    315          * @return  
     315         * @return 
    316316         */ 
    317317        function show_users_roles_selects($all_roles_data) 
    318318        { 
    319                 $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     319                $templateServer = &Factory::getInstance('TemplateServer'); 
    320320                $imgaddusers = $templateServer->generateImageLink('add_group.png'); 
    321321                $imgdelusers = $templateServer->generateImageLink('delete_group.png'); 
     
    325325                        'src_img_del_users' => $imgdelusers 
    326326                )); 
    327                  
     327 
    328328                $this->t->set_block('admin_roles', 'block_select_roles', 'select_roles'); 
    329329                foreach ($all_roles_data as $role) 
  • sandbox/workflow/2.0/inc/class.ui_adminsource.inc.php

    r795 r1293  
    7878        function form() 
    7979        { 
    80                 $smarty = $GLOBALS['workflow']['factory']->getInstance('workflow_smarty', false); 
     80                $smarty = Factory::getInstance('workflow_smarty', false); 
    8181                $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')); 
    8282 
  • sandbox/workflow/2.0/inc/class.ui_agent.inc.php

    r795 r1293  
    1111 
    1212/** 
    13  * Agents abstraction library. interface layer.  
     13 * Agents abstraction library. interface layer. 
    1414 * This allows the Workflow Engine to connect to various agents 
    1515 * Agents are external elements for the workflow. It could be 
     
    1717 * Use this class to make childrens like, for example in the 
    1818 * class.ui_agent_mail_smtp.inc.php for the mail_smtp susbsytem 
    19  *  
     19 * 
    2020 * @package Workflow 
    2121 * @license http://www.gnu.org/copyleft/gpl.html GPL 
     
    2323 */ 
    2424require_once(dirname(__FILE__) . SEP . 'class.WorkflowUtils.inc.php'); 
    25          
     25 
    2626class ui_agent extends WorkflowUtils 
    2727{ 
     
    3939         * @var bool $interactivity for runtime mode 
    4040         * @access public 
    41          */  
     41         */ 
    4242        var $interactivity = false; 
    43          
     43 
    4444        // concerning Child classes constructors --------------------------------------------- 
    4545        /** 
    4646         * @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 
    4848         */ 
    4949        var $bo_agent = null; 
     
    5454        var $agent_type = ''; 
    5555        // ----------------------------------------------------------------------------------- 
    56          
     56 
    5757        /** 
    5858         * Constructor 
     
    6464                parent::WorkflowUtils(); 
    6565        } 
    66          
     66 
    6767        /** 
    6868         * Function which must be called (internally) at runtime .The agent MUST know if he is runned in an interactive activity or not. 
     
    7979         * Return errors recorded by this object 
    8080         * 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 
    8282         * or give a false parameter you will obtain a single string which can be empty or will contain error messages with <br /> html tags. 
    8383         * @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) 
    8787         { 
    8888                $this->error[] = $this->bo_agent->get_error(); 
     
    9595                return $result_str; 
    9696                } 
    97                          
     97 
    9898        /** 
    9999         * Factory: load the agent values stored somewhere via the agent bo object 
     
    106106                return ( (isset($this->bo_agent)) && ($this->bo_agent->load($agent_id))); 
    107107        } 
    108          
     108 
    109109        /** 
    110110         * Save the agent values somewhere via the agent bo object 
     
    116116        { 
    117117                if (!(isset($this->bo_agent))) 
    118                 {  
     118                { 
    119119                        return false; 
    120120                } 
     
    131131         * we store references to theses objects and we tell the ui object if we are in interactive 
    132132         * mode or not. 
    133          * @param array    $instance  
     133         * @param array    $instance 
    134134         * @param object   $activity activity 
    135135         * @return void 
     
    141141                $this->setInteractivity($activity->isInteractive()); 
    142142        } 
    143          
     143 
    144144        /** 
    145145         * This function show the shared part of all agents when showing configuration in the admin activity form 
     
    147147         * @param string $template_block_name 
    148148         * @return void 
    149          * @access public  
     149         * @access public 
    150150         */ 
    151151        function showAdminActivityOptions ($template_block_name) 
    152         {  
     152        { 
    153153                $admin_name = 'admin_agent_shared'; 
    154154                $this->t->set_file($admin_name, $admin_name . '.tpl'); 
     
    161161                $this->t->parse($template_block_name, $admin_name); 
    162162        } 
    163          
     163 
    164164        /** 
    165165         * Function called by the running object (run_activity) after the activity_pre code 
     
    177177                return true; 
    178178        } 
    179          
     179 
    180180        /** 
    181181         * Function called by the running object (run_activity) after the activity_pre code 
     
    190190                return true; 
    191191        } 
    192          
     192 
    193193        /** 
    194194         * Function called by the running object (run_activity) after the user code 
    195          *  
     195         * 
    196196         * and after the activity_pos code. This code is runned only if the $GLOBALS['__activity_completed'] 
    197197         * IS NOT set (i.e.: the user is not yet completing the activity) 
     
    200200         * user code after completion. 
    201201         * @return bool true or false, if false the $this->error array should contains error messages 
    202          * @access public  
     202         * @access public 
    203203         */ 
    204204        function run_activity_completed_pos() 
     
    206206                return true; 
    207207        } 
    208          
     208 
    209209   /** 
    210210        *  Function called by the running object (run_activity) after the user code 
    211         *  
     211        * 
    212212        *  and after the activity_pos code. This code is runned only if the $GLOBALS['__activity_completed'] 
    213213        *  IS set (i.e.: the user has completing the activity) 
     
    222222                return true; 
    223223        } 
    224          
     224 
    225225        /** 
    226226         * 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  
    1111require_once(dirname(__FILE__) . SEP . 'class.ui_agent.inc.php'); 
    1212/** 
    13  * Mail-SMTP Agent : interface layer.  
     13 * Mail-SMTP Agent : interface layer. 
    1414 * This class connects the workflow agents calls to the mail_smtp agent business layer 
    15  *  
     15 * 
    1616 * @package Workflow 
    1717 * @license http://www.gnu.org/copyleft/gpl.html GPL 
    1818 * @author regis.leroy@glconseil.com 
    19  */              
     19 */ 
    2020class ui_agent_mail_smtp extends ui_agent 
    2121{ 
     
    2424         * @access public 
    2525         * @return object 
    26          */      
     26         */ 
    2727        function ui_agent_mail_smtp() 
    2828        { 
     
    3636         * @param string $template_block_name 
    3737         * @access public 
    38          * @return void   
     38         * @return void 
    3939         */ 
    4040        function showAdminActivityOptions ($template_block_name) 
     
    7171                        } 
    7272                        if ($option_conf['type'] == 'select') 
    73                         {        
     73                        { 
    7474                                $this->t->set_var(array( 
    7575                                        'ag_config_name_s'      => "wf_agent[".$this->agent_type."][".$option_name."]", 
     
    9393                $this->t->parse($template_block_name, $admin_name); 
    9494        } 
    95          
     95 
    9696        /** 
    9797         * Function called by the running object (run_activity) after the activity_pre code 
     
    108108                //load agent data from database 
    109109                $this->bo_agent->init(); 
    110                  
     110 
    111111                //this will send an email only if the configuration says to do so 
    112112                if (!($this->bo_agent->send_start())) 
     
    123123                return $ok; 
    124124        } 
    125          
     125 
    126126        /** 
    127127         * Function called by the running object (run_activity) after the activity_pre code 
     
    136136                return true; 
    137137        } 
    138          
     138 
    139139        /** 
    140140         * Function called by the running object (run_activity) after the user code 
     
    160160                return $ok; 
    161161        } 
    162          
     162 
    163163        /** 
    164164         * Function called by the running object (run_activity) after the user code 
     
    170170         * This function can call two types of mail sending 
    171171         * * 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 
    173173         * completes only after execution of user code (sending after completion is not possible). And we 
    174174         * musn't retrieve POSTed values in this case because it can concerns previous non-automatic activities 
     
    190190                                //erase agent data with the POSTed values 
    191191                                $this->bo_agent->set($this->agent_values); 
    192                                  
     192 
    193193                                //this will send an email only if the configuration says to do so 
    194194                                if (!($this->bo_agent->send_post())) 
     
    224224                        } 
    225225                } 
    226                  
     226 
    227227        } 
    228228?> 
  • sandbox/workflow/2.0/inc/class.ui_ajaxinterface.inc.php

    r795 r1293  
    1818 * Cria o ambiente de sessão para rodar Ajax e implementa alguns métodos 
    1919 * básicos para inclusão de JavaScript e CSS 
    20  *   
     20 * 
    2121 * @package Workflow 
    2222 * @license http://www.gnu.org/copyleft/gpl.html GPL 
     
    2828        * @var int $num_version Identifica a verão dos arquivos JavaScript e CSS. Incremente o valor deste atribuito 
    2929        * sempre que existirem alterações nos arquivos, para forçar o download pelo browser 
    30         * @access public  
    31         */               
     30        * @access public 
     31        */ 
    3232        var $num_version = 213; 
    3333 
     
    3636         * @access public 
    3737         * @return object 
    38          */                      
     38         */ 
    3939        function ui_ajaxinterface() 
    4040        { 
     
    4242 
    4343        /** 
    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 
    4545        * rodar os métodos acionados pelas requisições Ajax. 
    46         *  
     46        * 
    4747        * @return void 
    48         * @access public  
     48        * @access public 
    4949        */ 
    5050        function set_wf_session() 
     
    5656                $vfs = createobject('phpgwapi.vfs'); 
    5757                $_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']; 
    5959                $_SESSION['phpgw_info']['workflow']['lang'] = $GLOBALS['lang']; 
    6060                $_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']); 
    6262                $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; 
    6464                $_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'))); 
    6666 
    6767                $can_monitor = $acl->checkUserGroupAccessToType('MON', $GLOBALS['phpgw_info']['user']['account_id']); 
     
    7474        /** 
    7575        * Insere código html para incorporar arquivos JavaScript de uso comum 
    76         *  
     76        * 
    7777        * @return string codigo html para insercao do javascript 
    78         * @access public  
     78        * @access public 
    7979        */ 
    8080        function get_common_js() 
    8181        { 
    8282                $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'); 
    8484                $result = $result . $this->get_js_link('workflow','jscode', 'common_functions'); 
    8585                $result = $result . $this->get_js_link('workflow','jscode', 'abas'); 
     
    8989                $result = $result . $this->get_js_link('workflow','jscode', 'dJSWin'); 
    9090                $result = $result . $this->get_js_link('workflow','jscode', 'doiMenuDOM'); 
    91                  
     91 
    9292                return $result; 
    9393        } 
     
    9595        /** 
    9696        * Insere o código html para inclusão do arquivo de estilo common.css 
    97         *  
     97        * 
    9898        * @return string tag html completa para inserção do arquivo common.css 
    99         * @access public  
     99        * @access public 
    100100        */ 
    101101        function get_common_css() 
     
    117117        { 
    118118                $CSSName = "css/{$CSSName}.css"; 
    119                 $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     119                $templateServer = &Factory::getInstance('TemplateServer'); 
    120120                $CSSLink = $templateServer->getWebFile($CSSName); 
    121121                $CSSFile = $templateServer->getSystemFile($CSSName); 
     
    126126        /** 
    127127        * Insere o código html para inclusão de um arquivo JavaScript. 
    128         *  
     128        * 
    129129        * @param string $module nome do módulo do eGroupware (preferencialmente workflow) 
    130130        * @param string $js_package nome do grupamento de arquivos javascript 
    131131        * @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 
    135135        */ 
    136136        function get_js_link($module, $js_package, $js_name, $params = null) 
     
    150150                return '<script src="'.$js_file.'?'.implode('&', $params).'" type="text/javascript"></script>'; 
    151151        } 
    152          
     152 
    153153        /** 
    154154        * Executa a função inicial JavaScript que irá montar os dados da interface. 
    155         *  
     155        * 
    156156        * @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 
    159159        */ 
    160160        function run_init_script($param) 
     
    162162                return '<script language="javascript">' . $param . '</script>'; 
    163163                } 
    164          
     164 
    165165        } 
    166166?> 
  • sandbox/workflow/2.0/inc/class.ui_external_applications.inc.php

    r795 r1293  
    4949        function draw() 
    5050        { 
    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'])) 
    5252                { 
    5353                        $GLOBALS['phpgw']->common->phpgw_header(); 
  • sandbox/workflow/2.0/inc/class.ui_generic_select.inc.php

    r795 r1293  
    7979        function form() 
    8080        { 
    81                 $smarty = $GLOBALS['workflow']['factory']->getInstance('workflow_smarty', false); 
     81                $smarty = Factory::getInstance('workflow_smarty', false); 
    8282                $smarty->setHeader(workflow_smarty::SHOW_HEADER | workflow_smarty::SHOW_FOOTER); 
    8383 
  • sandbox/workflow/2.0/inc/class.ui_orgchart.inc.php

    r795 r1293  
    153153                                return false; 
    154154 
    155                         $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     155                        $ldap = &Factory::getInstance('WorkflowLDAP'); 
    156156                        for ($i = 0; $i < count($output); $i++) 
    157157                        { 
  • sandbox/workflow/2.0/inc/class.ui_participants.inc.php

    r795 r1293  
    4141        function ui_participants() 
    4242        { 
    43                 $this->bo = $GLOBALS['workflow']['factory']->getInstance('bo_participants'); 
     43                $this->bo = Factory::getInstance('bo_participants'); 
    4444        } 
    4545 
     
    5151        function form() 
    5252        { 
    53                 $smarty = $GLOBALS['workflow']['factory']->getInstance('workflow_smarty', false); 
     53                $smarty = Factory::getInstance('workflow_smarty', false); 
    5454                $smarty->setHeader(workflow_smarty::SHOW_HEADER | workflow_smarty::SHOW_FOOTER); 
    55                 $ldap = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     55                $ldap = Factory::getInstance('WorkflowLDAP'); 
    5656                $userDN = $GLOBALS['phpgw_info']['user']['account_dn']; 
    57                 $account = $GLOBALS['workflow']['factory']->getForeignInstance('phpgwapi', 'accounts', $userDN); 
     57                $account = Factory::getForeignInstance('phpgwapi', 'accounts', $userDN); 
    5858                $organizationList = $this->bo->getOrganizations(); 
    5959 
  • sandbox/workflow/2.0/inc/class.ui_phpeditor.inc.php

    r795 r1293  
    6262        function form() 
    6363        { 
    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); 
    6666                $proccessInfo = $processManager->get_process($_GET['proc_id']); 
    6767 
  • sandbox/workflow/2.0/inc/class.ui_userinterface.inc.php

    r1227 r1293  
    4545                $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['workflow']['title']; 
    4646                $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'); 
    4848 
    4949                // Check if workflow config is ok 
     
    114114 
    115115                // Get a connection to db workflow and galaxia (module) 
    116                 if ($GLOBALS['workflow']['workflowObjects']->getDBWorkflow()->Error) 
     116                if (Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Error) 
    117117                        $errors[] = 'Unable to connect to database Workflow'; 
    118118 
    119                 if ($errormsg = $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Error) 
     119                if ($errormsg = Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Error) 
    120120                        $errors[] = 'Unable to connect to database Galaxia'; 
    121121 
  • sandbox/workflow/2.0/inc/class.workflow_acl.inc.php

    r795 r1293  
    3030        function workflow_acl() 
    3131        { 
    32                 parent::so_adminaccess($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     32                parent::so_adminaccess(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    3333        } 
    3434 
  • sandbox/workflow/2.0/inc/class.workflow_activitymanager.inc.php

    r795 r1293  
    2020                function workflow_activitymanager() 
    2121                { 
    22                         parent::ActivityManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     22                        parent::ActivityManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    2323                } 
    2424        } 
  • sandbox/workflow/2.0/inc/class.workflow_baseactivity.inc.php

    r795 r1293  
    1717                function workflow_baseactivity() 
    1818                { 
    19                         parent::BaseActivity($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     19                        parent::BaseActivity(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    2020                } 
    2121        } 
  • sandbox/workflow/2.0/inc/class.workflow_gui.inc.php

    r795 r1293  
    2020                function workflow_gui() 
    2121                { 
    22                         parent::GUI($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     22                        parent::GUI(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    2323                } 
    2424        } 
  • sandbox/workflow/2.0/inc/class.workflow_instance.inc.php

    r795 r1293  
    2020                function workflow_Instance() 
    2121                { 
    22                         parent::Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     22                        parent::Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    2323                } 
    2424        } 
  • sandbox/workflow/2.0/inc/class.workflow_instancemanager.inc.php

    r795 r1293  
    1717                function workflow_instancemanager() 
    1818                { 
    19                         parent::InstanceManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     19                        parent::InstanceManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    2020                } 
    2121        } 
  • sandbox/workflow/2.0/inc/class.workflow_process.inc.php

    r795 r1293  
    1616                function workflow_process() 
    1717                { 
    18                         parent::Process($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     18                        parent::Process(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    1919                } 
    2020        } 
  • sandbox/workflow/2.0/inc/class.workflow_processmanager.inc.php

    r795 r1293  
    2626                        'database_user', 
    2727                        'database_password' 
    28                 );  
     28                ); 
    2929           /** 
    3030                 * Constructor 
     
    3434                function workflow_processmanager() 
    3535                { 
    36                         parent::ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     36                        parent::ProcessManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    3737                        $this->workflow_acl = CreateObject('workflow.workflow_acl'); 
    38                          
     38 
    3939                        /* allow regular users to see the process graph */ 
    4040                        if ($_GET['menuaction'] == "workflow.ui_adminactivities.show_graph") 
     
    6767                        { 
    6868                                $proc_name = $this->_normalize_name($data['name'],$data['version']); 
    69                                 foreach($data['templates'] as $tpl)  
     69                                foreach($data['templates'] as $tpl) 
    7070                                { 
    7171                                        $full_fname = GALAXIA_PROCESSES.SEP.$proc_name.SEP.'code'.SEP.'templates'.SEP.$tpl['name']; 
    7272                                        if (file_exists($full_fname)) unlink($full_fname); 
    73                                          
     73 
    7474                                        $fp = fopen($full_fname,"w"); 
    7575                                fwrite($fp, $tpl['code']); 
     
    7777                                } 
    7878 
    79                                 foreach($data['includes'] as $inc)  
     79                                foreach($data['includes'] as $inc) 
    8080                                { 
    8181                                        $full_fname = GALAXIA_PROCESSES.SEP.$proc_name.SEP.'code'.SEP.$inc['name']; 
    8282                                        if (file_exists($full_fname)) unlink($full_fname); 
    83                                          
     83 
    8484                                        $fp = fopen($full_fname,"w"); 
    8585                                fwrite($fp, $inc['code']); 
     
    111111                } 
    112112 
    113                 /**  
     113                /** 
    114114        * Creates an XML representation of a process. 
    115115                * Original from ProcessManager Class 
     
    124124                        if (!isset($this->jobManager)) 
    125125                                $this->jobManager = new JobManager($this->db); 
    126                  
     126 
    127127                        //if (!(isset($this->activity_manager)))  $this->activity_manager = new ActivityManager($this->db); 
    128128                        // <process> 
     
    151151                        //Loop on config values 
    152152                        $out.='  <configs>'."\n"; 
    153                         foreach($proc_info['config'] as $res) {       
     153                        foreach($proc_info['config'] as $res) { 
    154154                          $name = $res['wf_config_name']; 
    155155                          $value_int = $res['wf_config_value_int']; 
    156156                          $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) 
    158158                          { 
    159159                                $out.='    <config>'."\n"; 
     
    167167 
    168168                        // Now loop over activities 
    169                          
     169 
    170170                        $act_list = $this->activity_manager->list_activities($pId, 0, -1, 'wf_name__asc', '','',false); 
    171171                        $out.='  <activities>'."\n"; 
    172                         foreach($act_list['data'] as $res) {       
     172                        foreach($act_list['data'] as $res) { 
    173173                          $name = $res['wf_normalized_name']; 
    174174                          $out.='    <activity>'."\n"; 
     
    193193                                  $out.='        <role>'.htmlspecialchars($role['wf_name']).'</role>'."\n"; 
    194194                                } 
    195                           }   
     195                          } 
    196196                          $out.='      </roles>'."\n"; 
    197197                          $out.='      <agents>'."\n"; 
     
    216216                                $out.='           </agent_datas>'."\n"; 
    217217                                $out.='        </agent>'."\n"; 
    218                           }   
     218                          } 
    219219                          $out.='      </agents>'."\n"; 
    220220 
     
    238238                                $out.='      ]]></template>'; 
    239239                          } 
    240                           $out.='    </activity>'."\n";     
     240                          $out.='    </activity>'."\n"; 
    241241                        } 
    242242                        $out.='  </activities>'."\n"; 
    243                          
     243 
    244244                        //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); 
    247247                        $out.='  <templates>'."\n"; 
    248248                        while (false !== ($name = readdir($handle))) 
     
    263263                                fclose($fp); 
    264264                                $out.='      ]]></code>'; 
    265                                 $out.='    </template>'."\n";     
     265                                $out.='    </template>'."\n"; 
    266266                        } 
    267267                        $out.='  </templates>'."\n"; 
    268268 
    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); 
    272272                        $out.='  <includes>'."\n"; 
    273273                        while (false !== ($name = readdir($handle))) 
     
    291291                                fclose($fp); 
    292292                                $out.='      ]]></code>'; 
    293                                 $out.='    </include>'."\n";     
     293                                $out.='    </include>'."\n"; 
    294294                        } 
    295295                        $out.='  </includes>'."\n"; 
     
    314314                        $out .= "  </jobs>\n"; 
    315315 
    316                         //export all resources  
     316                        //export all resources 
    317317                        $base_path = GALAXIA_PROCESSES . SEP . $wf_procname . SEP . 'resources'; 
    318                         $handle = opendir($base_path);  
     318                        $handle = opendir($base_path); 
    319319                        $out.='  <resources>'."\n"; 
    320320                        while (false !== ($name = readdir($handle))) 
    321                         {  
     321                        { 
    322322                                if (is_dir($base_path.SEP.$name)) 
    323323                                        continue; 
     
    348348                          $out.='       <to>'.htmlspecialchars($tran['wf_act_to_name']).'</to>'."\n"; 
    349349                          $out.='     </transition>'."\n"; 
    350                         }      
     350                        } 
    351351                        $out.='  </transitions>'."\n"; 
    352352                        $out.= '</process>'."\n"; 
    353                          
     353 
    354354                        //$fp = fopen(GALAXIA_PROCESSES."/$wf_procname/$wf_procname.xml","w"); 
    355355                        //fwrite($fp,$out); 
     
    360360                /** 
    361361                 * Creates  a process PHP data structure from its XML representation 
    362                  *  
    363                  * Unserialize process data   
     362                 * 
     363                 * Unserialize process data 
    364364                 * @access public 
    365365                 * @return void 
    366366                 */ 
    367                 function unserialize_process(&$xml)  
     367                function unserialize_process(&$xml) 
    368368                { 
    369369                        // Create SAX parser assign this object as base for handlers 
    370370                        // handlers are private methods defined below. 
    371371                        // keep contexts and parse 
    372                         $this->parser = xml_parser_create("ISO-8859-1");  
     372                        $this->parser = xml_parser_create("ISO-8859-1"); 
    373373                        xml_parser_set_option($this->parser,XML_OPTION_CASE_FOLDING,0); 
    374374                        //xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE, 1); 
     
    376376                        xml_set_element_handler($this->parser, '_start_element_handler', '_end_element_handler'); 
    377377                        xml_set_character_data_handler($this->parser, '_data_handler'); 
    378                           
     378 
    379379                        $aux=Array( 
    380380                          'name'=>'root', 
    381381                          'children'=>Array(), 
    382382                          'parent' => 0, 
    383                           'data'=>'',  
     383                          'data'=>'', 
    384384                          'attribs'     => Array(), 
    385385                        ); 
    386                          
     386 
    387387                        $this->tree[0]=$aux; 
    388388                        $this->current=0; 
    389                          
     389 
    390390                        if (!xml_parse($this->parser, $xml, true)) { 
    391391                           $error = sprintf("XML error: %s at line %d", 
     
    395395                           $this->error[] = $error; 
    396396                        } 
    397                         xml_parser_free($this->parser);    
     397                        xml_parser_free($this->parser); 
    398398                        // Now that we have the tree we can do interesting things 
    399                          
     399 
    400400                        $process=Array(); 
    401401                        $activities=Array(); 
     
    406406                          $z=$this->tree[1]['children'][$i]; 
    407407                          $name = trim($this->tree[$z]['name']); 
    408                            
     408 
    409409                          //config values 
    410410                          if ($name=='configs') { 
     
    422422                                        $configs[]=$aux; 
    423423                                  } 
    424                                 }       
     424                                } 
    425425                          } 
    426426                          //activities 
     
    453453                                                  ); 
    454454                                                } 
    455                                           }  
    456                                           elseif ($name=='agents')  
     455                                          } 
     456                                          elseif ($name=='agents') 
    457457                                          { 
    458458                                                $agents=Array(); 
    459                                                 for($l=0;$l<count($this->tree[$z3]['children']);$l++)  
     459                                                for($l=0;$l<count($this->tree[$z3]['children']);$l++) 
    460460                                                { 
    461461                                                  $z4 = $this->tree[$z3]['children'][$l]; 
     
    472472                                                          // data will be the agent_type or an array for agent_datas 
    473473                                                          $data = trim($this->tree[$z5]['data']); 
    474                                                           if ($name=='agent_type')  
     474                                                          if ($name=='agent_type') 
    475475                                                          { 
    476476                                                                $agent['wf_agent_type']=$data; 
    477                                                           }  
    478                                                           elseif ($name=='agent_datas')  
     477                                                          } 
     478                                                          elseif ($name=='agent_datas') 
    479479                                                          { 
    480480                                                                for($n=0;$n<count($this->tree[$z5]['children']);$n++) 
     
    618618                        return $process; 
    619619                  } 
    620                    
     620 
    621621                /** 
    622622                 * Creates a new process PHP data structure from its XML representation 
    623                  * unserial  
     623                 * unserial 
    624624                 * @access public 
    625625                 * @return void 
     
    641641                /** 
    642642                 * 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 
    646646                 */ 
    647647                  function remove_process($pId) 
     
    653653                /** 
    654654                 * Replace_process 
    655                  *  
    656                  * @param int      $pid     process id  
    657                  * @param array    $vars  
     655                 * 
     656                 * @param int      $pid     process id 
     657                 * @param array    $vars 
    658658                 * @param boolean  $create 
    659                  *    
     659                 * 
    660660                 * @access public 
    661661                 * @return int new id 
     
    671671 
    672672                        return $id; 
    673           }      
     673          } 
    674674        } 
    675675?> 
  • sandbox/workflow/2.0/inc/class.workflow_processmonitor.inc.php

    r795 r1293  
    1717                function workflow_processmonitor() 
    1818                { 
    19                         parent::ProcessMonitor($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     19                        parent::ProcessMonitor(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    2020                } 
    2121        } 
  • sandbox/workflow/2.0/inc/class.workflow_rolemanager.inc.php

    r795 r1293  
    1717                function workflow_rolemanager() 
    1818                { 
    19                         parent::RoleManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     19                        parent::RoleManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    2020                } 
    2121        } 
  • sandbox/workflow/2.0/inc/class.workflow_smarty.inc.php

    r1227 r1293  
    157157                { 
    158158                        ob_start(); 
    159                         $GLOBALS['phpgw']->common->phpgw_header(); 
     159                        Factory::getForeignInstance('phpgwapi', 'phpgw')->common->phpgw_header(); 
    160160                        if ($this->showNavigationBar) 
    161161                                parse_navbar(); 
     
    168168                { 
    169169                        ob_start(); 
    170                         $GLOBALS['phpgw']->common->phpgw_footer(); 
     170                        Factory::getForeignInstance('phpgwapi', 'phpgw')->common->phpgw_footer(); 
    171171                        $this->expressoFooter = ob_get_contents(); 
    172172                        ob_end_clean(); 
  • sandbox/workflow/2.0/inc/class.workflow_wfruntime.inc.php

    r795 r1293  
    1818                function workflow_wfruntime() 
    1919                { 
    20                         parent::WfRuntime($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     20                        parent::WfRuntime(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    2121                } 
    2222        } 
  • sandbox/workflow/2.0/inc/class.workflow_wfsecurity.inc.php

    r795 r1293  
    1818                function workflow_wfsecurity() 
    1919                { 
    20                         parent::WfSecurity($GLOBALS['workflow']['workflowObjects']->getDBGalaxia())->Link_ID; 
     20                        parent::WfSecurity(Factory::getInstance('WorkflowObjects')->getDBGalaxia())->Link_ID; 
    2121                } 
    2222        } 
  • sandbox/workflow/2.0/inc/common.inc.php

    r795 r1293  
    11<?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 
    39 * caracteres acentuados sejam tratados corretamente (e.g. strtoupper) 
    410 */ 
    511setlocale(LC_CTYPE, 'pt_BR', 'pt_BR.iso-8859-1', 'pt_BR.utf-8'); 
    612 
    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 */ 
    816umask(007); 
    917 
    10 require_once dirname(__FILE__) . '/class.factory.inc.php'; 
     18//****************************************************************** 
     19//*********** FIM - CONFIGURACOES INICIAIS DO WORKFLOW ************* 
     20//****************************************************************** 
    1121 
    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//****************************************************************** 
    1825 
    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 
     27define('WF_ROOT',               $_SERVER['DOCUMENT_ROOT'] . "workflow"); 
     28define('WF_LIB',                $_SERVER['DOCUMENT_ROOT'] . "workflow/lib"); 
     29define('WF_INC',                $_SERVER['DOCUMENT_ROOT'] . "workflow/inc"); 
     30define('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 
     41require_once(WF_LIB . "/Factory.php"); 
     42 
     43//****************************************************************** 
     44//****************** FIM - INCLUDES DO WORKFLOW ******************** 
     45//****************************************************************** 
     46 
    2547?> 
  • sandbox/workflow/2.0/inc/engine/class.ajax_config.inc.php

    r795 r1293  
    11<?php 
    22  /** 
    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   * 
    55   * @author  viani 
    66   * @version 1.0 
    77   * @license http://www.gnu.org/copyleft/gpl.html GPL 
    88   * @package Galaxia 
    9    */  
     9   */ 
    1010class ajax_config 
    11 {        
    12         /**              
     11{ 
     12        /** 
    1313        * @var object $db database 
    1414        * @access public 
    1515        */ 
    1616        var $db; 
    17         /**              
     17        /** 
    1818        * @var string $appname Application (module) to config 
    1919        * @access public 
    2020        */ 
    2121        var $appname; 
    22         /**              
     22        /** 
    2323        * @var array $config_data Actual config-data 
    2424        * @access public 
    2525        */ 
    26         var $config_data;        
    27         /**              
     26        var $config_data; 
     27        /** 
    2828        * @var array $read_data Config-data as read from db 
    2929        * @access public 
    3030        */ 
    31         var $read_data;          
     31        var $read_data; 
    3232 
    3333        /** 
    3434        * Set appname and db for ajax config 
    35         *  
     35        * 
    3636        * @param string $appname Which application to config. Default workflow. 
    3737        * @return void 
     
    4545                } 
    4646 
    47                 $this->db      = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso(); 
     47                $this->db      =& Factory::getInstance('WorkflowObjects')->getDBExpresso(); 
    4848                $this->appname = $appname; 
    4949        } 
     
    5151        /** 
    5252        * Reads the whole repository for $this->appname, appname has to be set via the constructor 
    53         *  
     53        * 
    5454        * @return array the whole config-array for that app 
    5555        * @access public 
     
    6060 
    6161                $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()) 
    6363                { 
    6464                        $test = @unserialize($this->db->f('config_value')); 
     
    7575        } 
    7676 
    77         /**  
     77        /** 
    7878        * Updates the whole repository for $this->appname, you have to call read_repository() before (!) 
    79         * @access public         
     79        * @access public 
    8080        * @return void 
    8181        */ 
     
    107107        /** 
    108108        * Updates or insert a single config-value 
    109         *  
     109        * 
    110110        * @param string $name name of the config-value 
    111111        * @param mixed $value content 
     
    158158        /** 
    159159        * Deletes the whole repository for $this->appname, appname has to be set via the constructor 
    160         *  
     160        * 
    161161        * @access public 
    162         * @return void           
    163         */       
     162        * @return void 
     163        */ 
    164164        function delete_repository() 
    165165        { 
     
    169169        /** 
    170170        * Deletes a single value from the repository, you need to call save_repository after 
    171         *  
     171        * 
    172172        * @param string $variable_name name of the config 
    173173        * @return void 
     
    180180        /** 
    181181        * Sets a single value in the repository, you need to call save_repository after 
    182         *  
     182        * 
    183183        * @param string $variable_name name of the config 
    184184        * @param mixed $variable_data the content 
     
    190190                $this->config_data[$variable_name] = $variable_data; 
    191191        } 
    192          
     192 
    193193} 
    194194?> 
  • sandbox/workflow/2.0/inc/engine/class.ajax_ldap.inc.php

    r795 r1293  
    2929        function ajax_ldap() 
    3030        { 
    31                 $tmpLDAP = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     31                $tmpLDAP = &Factory::getInstance('WorkflowLDAP'); 
    3232                $this->user_context  = $tmpLDAP->getUserContext(); 
    3333                $this->group_context = $tmpLDAP->getGroupContext(); 
    3434 
    35                 $this->ds = &$GLOBALS['workflow']['workflowObjects']->getLDAP(); 
     35                $this->ds =& Factory::getInstance('WorkflowObjects')->getLDAP(); 
    3636        } 
    3737 
     
    8383        function id2fullname($account_id) 
    8484    { 
    85                 return $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($account_id); 
     85                return Factory::getInstance('WorkflowLDAP')->getName($account_id); 
    8686    } 
    8787 
     
    107107                        $accountID = $_SESSION['phpgw_info']['workflow']['account_id']; 
    108108 
    109                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     109                $ldap =& Factory::getInstance('WorkflowLDAP'); 
    110110                if (count($output = $ldap->getUserGroups($accountID)) == 0) 
    111111                        return false; 
  • sandbox/workflow/2.0/inc/engine/config.ajax.inc.php

    r795 r1293  
    170170                if ($loadGroups) 
    171171                { 
    172                         $memberships = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserGroups($user); 
     172                        $memberships = Factory::getInstance('WorkflowLDAP')->getUserGroups($user); 
    173173                        if ($user == $_SESSION['phpgw_info']['workflow']['account_id']) 
    174174                                $_SESSION['phpgw_info']['workflow']['user_groups'] = $memberships; 
     
    196196                { 
    197197                        /* get information regarding the members of the group */ 
    198                         $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     198                        $ldap = &Factory::getInstance('WorkflowLDAP'); 
    199199                        $members = $ldap->getGroupUsers($group); 
    200200 
  • sandbox/workflow/2.0/inc/engine/config.egw.inc.php

    r795 r1293  
    151151        function galaxia_user_can_admin_process() 
    152152        { 
    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')); 
    154154        } 
    155155} 
     
    165165        function galaxia_user_can_admin_instance() 
    166166        { 
    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')); 
    168168        } 
    169169} 
     
    179179        function galaxia_user_can_clean_instances() 
    180180        { 
    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')); 
    182182        } 
    183183} 
     
    191191        function galaxia_user_can_clean_aborted_instances() 
    192192        { 
    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')); 
    194194        } 
    195195} 
     
    203203        function galaxia_user_can_monitor() 
    204204        { 
    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')); 
    206206        } 
    207207} 
     
    221221                                $user = $GLOBALS['phpgw_info']['user']['account_id']; 
    222222 
    223                         $memberships = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserGroups($user); 
     223                        $memberships = Factory::getInstance('WorkflowLDAP')->getUserGroups($user); 
    224224 
    225225                        if ($memberships === false) 
     
    245245                { 
    246246                        /* get information regarding the members of the group */ 
    247                         $members = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getGroupUsers($group); 
     247                        $members = &Factory::getInstance('WorkflowLDAP')->getGroupUsers($group); 
    248248 
    249249                        /* checl for error in the LDAP query */ 
  • sandbox/workflow/2.0/inc/engine/src/ProcessManager/RoleManager.php

    r795 r1293  
    247247    $result = $this->query($query,$bindvars); 
    248248    $ret = Array(); 
    249     $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     249    $ldap = &Factory::getInstance('WorkflowLDAP'); 
    250250    if (!(empty($result))) 
    251251    { 
  • sandbox/workflow/2.0/inc/engine/src/common/WfRuntime.php

    r795 r1293  
    66 * as it handle concurrency and part of the core execution of the instance while avoiding 
    77 * bad manipulation of the instance 
    8  *  
     8 * 
    99 * @package Galaxia 
    10  * @license http://www.gnu.org/copyleft/gpl.html GPL  
     10 * @license http://www.gnu.org/copyleft/gpl.html GPL 
    1111 */ 
    12 class WfRuntime extends Base  
    13 {   
     12class WfRuntime extends Base 
     13{ 
    1414  /** 
    1515   * @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 
    1616   * @access public 
    1717   */ 
    18   var $conf= Array();   
     18  var $conf= Array(); 
    1919  /** 
    2020   * @var object $activity 
    21    * @access public  
     21   * @access public 
    2222   */ 
    2323  var $activity = null; 
    2424  /** 
    2525   * @var object $instance 
    26    * @access public  
     26   * @access public 
    2727   */ 
    2828  var $instance = null; 
    2929  /** 
    3030   * @var int $instance_id 
    31    * @access public  
    32    */ 
    33   var $instance_id = 0;   
     31   * @access public 
     32   */ 
     33  var $instance_id = 0; 
    3434  /** 
    3535   * @var int $activity_id 
    36    * @access public  
     36   * @access public 
    3737   */ 
    3838  var $activity_id = 0; 
    3939  /** 
    4040   * @var object $process Retrieve process information 
    41    * @access public  
     41   * @access public 
    4242   */ 
    4343  var $process = null; 
    4444  /** 
    4545   * @var object $workitems  Reference to $instance->workitems 
    46    * @access public  
     46   * @access public 
    4747   */ 
    4848  var $workitems = null; 
    4949  /** 
    5050   * @var object $activities Reference to $instance->activities 
    51    * @access public  
    52    */   
     51   * @access public 
     52   */ 
    5353  var $activities = null; 
    5454  /** 
    5555   * @var object $security Security object 
    56    * @access public  
    57    */   
     56   * @access public 
     57   */ 
    5858  var $security = null; 
    5959  /** 
    6060   * @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; 
    6464  /** 
    6565   * @var bool $debug Debug state 
    66    * @access public  
    67    */    
     66   * @access public 
     67   */ 
    6868  var $debug=false; 
    6969  /** 
    7070   * @var bool $auto_mode Automatic mode state, non-interactive for instance, big impact on error handling 
    71    * @access public  
    72    */   
     71   * @access public 
     72   */ 
    7373  var $auto_mode=false; 
    7474 
     
    8181  /** 
    8282   * Constructor 
    83    *  
     83   * 
    8484   * @param object &$db ADOdb 
    8585   * @return object WfRuntime instance 
    8686   * @access public 
    8787   */ 
    88   function WfRuntime(&$db)  
     88  function WfRuntime(&$db) 
    8989  { 
    9090    $this->child_name = 'WfRuntime'; 
     
    9494    require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Instance.php'); 
    9595    require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'common'.SEP.'WfSecurity.php'); 
    96      
     96 
    9797    //first the activity is not set 
    9898    $this->activity = null; 
    9999    $this->instance = new Instance($this->db); 
    100100    $this->process = new Process($this->db); 
    101     $this->security = new WfSecurity($this->db);  
     101    $this->security = new WfSecurity($this->db); 
    102102  } 
    103103 
     
    105105   * Collect errors from all linked objects which could have been used by this object 
    106106   * Each child class should instantiate this function with her linked objetcs, calling get_error(true) 
    107    *  
     107   * 
    108108   * @param bool $debug false by default, if true debug messages can be added to 'normal' messages 
    109109   * @param string $prefix appended to the debug message 
    110    * @return void  
     110   * @return void 
    111111   * @access private 
    112112   */ 
     
    122122  /** 
    123123   * Ends-up dying and giving a last message 
    124    *  
     124   * 
    125125   * @param string $last_message last sentence 
    126126   * @param bool $include_errors false by default, if true we'll include error messages 
     
    138138    if ($this->debug) $debug = true; 
    139139    if ($this->auto_mode) $dying = false; 
    140      
     140 
    141141    if ($include_errors) 
    142142    { 
     
    165165   * Loads the config values for the process associated with the runtime 
    166166   * config values are cached while this WfRuntime object stays alive 
    167    *  
     167   * 
    168168   * @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 
    170170   * @return array Values associated with the current process for the asked config options and as well for som WfRuntime internal config options 
    171171   */ 
     
    176176      $this->loadProcess(); 
    177177    } 
    178     $arrayconf['auto-release_on_leaving_activity'] = 1;   
     178    $arrayconf['auto-release_on_leaving_activity'] = 1; 
    179179    $this->conf =  $this->process->getConfigValues($arrayconf); 
    180180    return $this->conf; 
     
    183183  /** 
    184184   * Loads instance, the activity and the process, needed by the runtime engine to 'execute' the activity 
    185    *  
     185   * 
    186186   * @param int $activityId activity id, the activity we will run 
    187187   * @param int $instanceId instance Id, can be empty for a start or standalone activity 
    188    * @return bool  
     188   * @return bool 
    189189   * @access public 
    190190   */ 
     
    208208      return false; 
    209209    } 
    210      
     210 
    211211    //ensure the activity is not completed 
    212212    $this->instance->setActivityCompleted(false); 
    213213        $this->instance->activityID = $activityId; 
    214      
     214 
    215215    //set the workitems and activities links 
    216216    $this->workitems =& $this->instance->workitems; 
     
    218218    return true; 
    219219  } 
    220    
     220 
    221221  /** 
    222222   * Retrieves the process object associated with the activity 
    223    *  
     223   * 
    224224   * @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 
    225225   * @return mixed Process object of the right type or false 
     
    246246    return true; 
    247247  } 
    248    
     248 
    249249  /** 
    250250   * Gets current process instance 
    251    *  
     251   * 
    252252   * @return object Process instance 
    253253   * @access public 
     
    260260  /** 
    261261   * Retrieves the activity of the right type from a baseActivity Object 
    262    *  
     262   * 
    263263   * @param int $activity_id activity_id you want 
    264264   * @param bool $with_roles will load the roles links on the object 
     
    289289    return true; 
    290290  } 
    291    
     291 
    292292  /** 
    293293   * Gets current activity instance 
    294    *  
     294   * 
    295295   * @return object Activity instance 
    296296   * @access public 
    297    */   
     297   */ 
    298298  function &getActivity() 
    299299  { 
    300300    return $this->activity; 
    301301  } 
    302    
     302 
    303303  /** 
    304304   * Gets the instance which could be an empty object 
    305    *  
     305   * 
    306306   * @param int $instanceId is the instance id 
    307307   * @return mixed Instance object which can be empty or string if something was turning bad 
     
    312312    $this->instance_id = $instanceId; 
    313313    $this->instance->getInstance($instanceId); 
    314     if ( ($this->instance->getInstanceId()==0)  
     314    if ( ($this->instance->getInstanceId()==0) 
    315315      && (! (($this->activity->getType()=='standalone') || ($this->activity->getType()=='start') )) ) 
    316316    { 
     
    323323    return true; 
    324324  } 
    325    
     325 
    326326  /** 
    327327   * Perform necessary security checks at runtime before running an activity 
    328328   * This will as well lock the tables via the security object 
    329329   * It should be launched in a transaction 
    330    *  
     330   * 
    331331   * @return bool true if ok, false if the user has no runtime access 
    332332   * @access public 
     
    360360   * This will as well lock the tables via the security object 
    361361   * It should be launched in a transaction 
    362    *  
     362   * 
    363363   * @return bool true if ok, false if the user has no runtime access instance and activity are unsetted in case of false check 
    364364   * @access public 
     
    376376        //we are granted an access to release but there is a special bad case where 
    377377        //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). 
    379379        //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 
    381381        //if we can still grab this instance (avoiding the bad case) 
    382          
     382 
    383383        //test grab before release 
    384384        if ($this->checkUserRun()) 
     
    390390    return false; 
    391391  } 
    392    
     392 
    393393  /** 
    394394   * Sets/unsets the WfRuntime in debug mode 
    395    *  
     395   * 
    396396   * @param bool $debug_mode true by default, set it to false to disable debug mode 
    397397   * @access public 
    398    * @return void  
     398   * @return void 
    399399   */ 
    400400  function setDebug($debug_mode=true) 
     
    402402    $this->debug = $debug_mode; 
    403403  } 
    404    
     404 
    405405  /** 
    406406   * Sets/unsets the WfRuntime in automatic mode. i.e : executing 
    407407   * non-interactive or interactive activities. Automatic mode have big impacts 
    408408   * on error handling and on the way activities are executed 
    409    *  
     409   * 
    410410   * @param bool $auto_mode true by default, set it to false to disable automatic mode 
    411411   * @access public 
    412    * @return void  
     412   * @return void 
    413413   */ 
    414414  function setAuto($auto_mode=true) 
     
    416416    $this->auto_mode = $auto_mode; 
    417417  } 
    418    
     418 
    419419  /** 
    420420   * This function will start a transaction, call it before setActivityUser() 
    421    *  
    422    * @access public 
    423    * @return void  
     421   * 
     422   * @access public 
     423   * @return void 
    424424   */ 
    425425  function StartRun() 
     
    428428    $this->db->StartTrans(); 
    429429  } 
    430    
     430 
    431431  /** 
    432432   * This function ends the transactions started in StartRun() 
    433    *  
     433   * 
    434434   * @access public 
    435435   * @return void 
     
    437437  function EndStartRun() 
    438438  { 
    439     if ($this->transaction_in_progress)  
     439    if ($this->transaction_in_progress) 
    440440    { 
    441441      $this->db->CompleteTrans(); 
     
    443443    } 
    444444  } 
    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. 
    448448   * This will prevent having several user using the same activity on the same intsance at the same time 
    449449   * But if you want this function to behave well you should call it after a checkUserRun or a checkUserRelease 
    450450   * and inside a transaction. Theses others function will ensure the table will be locked and the user 
    451451   * is really granted the action 
    452    *  
     452   * 
    453453   * @param bool $grab true by default, if false the user will be set to '*', releasing the instance-activity record 
    454454   * @access public 
    455    * @return bool  
     455   * @return bool 
    456456   */ 
    457457  function setActivityUser($grab=true) 
    458458  { 
    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)) 
    460460    { 
    461461      if ($this->activity->isInteractive()) 
     
    484484      $this->error[] = $errors; 
    485485      return false; 
    486     }     
    487   } 
    488    
     486    } 
     487  } 
     488 
    489489  /** 
    490490   * Tries to give some usefull info about the current runtime 
    491    *  
     491   * 
    492492   * @return array associative arrays with keys/values which could be usefull 
    493493   * @access public 
     
    514514   * This part of the runtime will be runned just after the activity code inclusion. 
    515515   * We are in fact after all the "user code" part. We should decide what to do next 
    516    *  
     516   * 
    517517   * @param bool $debug false by default 
    518518   * @return array an array which must be analysed by the application run class. It contains 2 keys 
     
    529529  { 
    530530    $result = Array(); 
    531      
     531 
    532532     // re-retrieve instance id which could have been modified by a complete 
    533533     $this->instance_id = $this->instance->getInstanceId(); 
    534       
     534 
    535535     //synchronised instance object with the database 
    536536     $this->instance->sync(); 
     
    541541      if ($this->instance->getActivityCompleted()) 
    542542      { 
    543         // activity is interactive and completed,  
     543        // activity is interactive and completed, 
    544544        // we have to continue the workflow 
    545545        // and send any autorouted activity which could be after this one 
     
    558558        if ($GLOBALS['workflow']['__leave_activity']) 
    559559        { 
    560           // activity is interactive and the activity source set the  
     560          // activity is interactive and the activity source set the 
    561561          // $GLOBALS[workflow][__leave_activity] it's a 'cancel' mode. 
    562562          // we redirect the user to the leave activity page 
     
    565565        } 
    566566        else 
    567         {  
     567        { 
    568568          //the activity is not completed and the user doesn't want to leave 
    569569          // we loop on the form 
     
    574574    } 
    575575    else 
    576     {  
     576    { 
    577577      // in auto mode or with non interactive activities we return engine info 
    578578      // and we collect our errors, we do not let them for other objects 
     
    587587  /** 
    588588   * Gets the the 'Activity Completed' status 
    589    *  
    590    * @access public 
    591    * @return string  
     589   * 
     590   * @access public 
     591   * @return string 
    592592   */ 
    593593  function getActivityCompleted() 
     
    596596  } 
    597597 
    598    
     598 
    599599  //----------- Instance public function mapping ------------------------------------------- 
    600    
     600 
    601601  /** 
    602602   * Sets the next activity to be executed, if the current activity is 
    603603   * 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. 
    605605   * Note that this method receives an activity name as argument (Not an Id) 
    606606   * and that it does not need the activityId like the instance method 
    607    *  
     607   * 
    608608   * @param string $actname name of the next activity 
    609609   * @return bool 
    610610   * @access public 
    611611   */ 
    612   function setNextActivity($actname)  
     612  function setNextActivity($actname) 
    613613  { 
    614614    return $this->instance->setNextActivity($this->activity_id,$actname); 
     
    616616 
    617617  /** 
    618    * Sets the user that must perform the next  
     618   * Sets the user that must perform the next 
    619619   * activity of the process. this effectively "assigns" the instance to 
    620620   * some user 
    621    *  
     621   * 
    622622   * @param int $user the next user id 
    623623   * @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 
    625625   * @access public 
    626626   */ 
     
    635635 
    636636  /** 
    637    * Sets the user role that must perform the next  
     637   * Sets the user role that must perform the next 
    638638   * activity of the process. this effectively "assigns" the instance to 
    639639   * some user 
    640    *  
     640   * 
    641641   * @param string $roleName the next activity role 
    642642   * @param string $activityName The name of the activity that the role will be able to executed. '*' means the next activity. 
     
    659659 
    660660  /** 
    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. 
    662662   * This can be empty if no setNextUser() was done before. 
    663663   * 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() 
    669669  { 
    670670    return $this->instance->getNextUser(); 
    671671  } 
    672   
     672 
    673673  /** 
    674674   * Sets the name of this instance. 
    675    *  
     675   * 
    676676   * @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) 
    681681  { 
    682682    return $this->instance->setName($value); 
     
    685685  /** 
    686686   * Gets the name of this instance 
    687    *  
    688    * @return string  
     687   * 
     688   * @return string 
    689689   * @access public 
    690690   */ 
     
    695695  /** 
    696696   * Sets the category of this instance 
    697    *  
     697   * 
    698698   * @param string $value 
    699699   * @return bool 
    700700   * @access public 
    701701   */ 
    702   function setCategory($value)  
     702  function setCategory($value) 
    703703  { 
    704704    return $this->instance->setcategory($value); 
     
    707707  /** 
    708708   * 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() 
    714714  { 
    715715    return $this->instance->getCategory(); 
    716716  } 
    717    
     717 
    718718  /** 
    719719   * Sets a property in this instance. This method is used in activities to 
     
    722722   * problems (A->z, digits and _ for spaces). If you have several set to call look 
    723723   * at the setProperties function. Each call to this function has an impact on database 
    724    *  
     724   * 
    725725   * @param string $name property name (it will be normalized) 
    726726   * @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) 
    731731  { 
    732732    return $this->instance->set($name,$value); 
    733733  } 
    734    
     734 
    735735  /** 
    736736   * Unsets a property in this instance. This method is used in activities to 
     
    738738   * All property names are normalized for security reasons and to avoid localisation 
    739739   * problems (A->z, digits and _ for spaces). Each call to this function has an impact on database 
    740    *  
     740   * 
    741741   * @param string $name property name (it will be normalized) 
    742742   * @return bool true if it was ok 
    743743   * @access public 
    744744   */ 
    745   function clear($name)  
     745  function clear($name) 
    746746  { 
    747747    return $this->instance->clear($name); 
     
    753753   * All property names are normalized for security reasons and to avoid localisation 
    754754   * problems (A->z, digits and _ for spaces) 
    755    *  
     755   * 
    756756   * @param string $name property name (it will be normalized) 
    757757   * @return bool true if it exists and false otherwise 
     
    770770   * problems (A->z, digits and _ for spaces). If you have several set to call look 
    771771   * at the setProperties function. Each call to this function has an impact on database 
    772    *  
     772   * 
    773773   * @param array $properties_array associative array containing for each record the 
    774774   * property name as the key and the property value as the value. You do not need the complete 
     
    784784  /** 
    785785   * Gets the value of an instance property 
    786    *  
     786   * 
    787787   * @param string $name name of the instance 
    788788   * @param string $defaultValue 
     
    797797  /** 
    798798   * Describes the activities where the instance is present, can be more than one activity if the instance was "splitted" 
    799    *  
     799   * 
    800800   * @access public 
    801801   * @return array Vector of assocs 
    802802   */ 
    803   function getActivities()  
     803  function getActivities() 
    804804  { 
    805805    return $this->instance->getActivities(); 
    806806  } 
    807    
     807 
    808808  /** 
    809809   * Gets the instance status can be 'completed', 'active', 'aborted' or 'exception' 
    810    *  
     810   * 
    811811   * @access public 
    812812   * @return string Instance status 
    813813   */ 
    814   function getStatus()  
     814  function getStatus() 
    815815  { 
    816816    return $this->instance->getStatus(); 
    817817  } 
    818    
     818 
    819819  /** 
    820820   * Sets the instance status 
    821    *  
     821   * 
    822822   * @param $status Desired status, it can be: 'completed', 'active', 'aborted' or 'exception' 
    823823   * @return bool 
    824824   * @access public 
    825825   */ 
    826   function setStatus($status)  
     826  function setStatus($status) 
    827827  { 
    828828    return $this->instance->setStatus($status); 
    829829  } 
    830    
     830 
    831831  /** 
    832832   * Gets the instance priority 
    833    *  
    834    * @access public 
    835    * @return int  
     833   * 
     834   * @access public 
     835   * @return int 
    836836   */ 
    837837  function getPriority() 
    838838  { 
    839839    return $this->instance->getPriority(); 
    840   }  
     840  } 
    841841 
    842842  /** 
    843843   * Sets the instance priority 
    844    *  
     844   * 
    845845   * @param int $priority 
    846846   * @access public 
    847    * @return bool  
     847   * @return bool 
    848848   */ 
    849849  function setPriority($priority) 
     
    851851    return $this->instance->setPriority($priority); 
    852852  } 
    853     
     853 
    854854  /** 
    855855   * 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() 
    861861  { 
    862862    return $this->instance->getInstanceId(); 
    863863  } 
    864    
     864 
    865865  /** 
    866866   * Returns the process id for this instance 
    867    *  
    868    * @return int  
    869    * @access public  
     867   * 
     868   * @return int 
     869   * @access public 
    870870   */ 
    871871  function getProcessId() { 
    872872    return $this->instance->getProcessId(); 
    873873  } 
    874    
     874 
    875875  /** 
    876876   * 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() 
    882882  { 
    883883    return $this->instance->getOwner(); 
    884884  } 
    885    
     885 
    886886  /** 
    887887   * 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) 
    894894  { 
    895895    return $this->instance->setOwner($user); 
    896896  } 
    897    
     897 
    898898  /** 
    899899   * Returns the user that must execute or is already executing an activity where the instance is present 
    900    *  
     900   * 
    901901   * @param int $activityId 
    902902   * @return bool False if the activity was not found for the instance, else return the user id or '*' if no user is defined yet 
    903903   * @access public 
    904    */   
    905   function getActivityUser($activityId)  
     904   */ 
     905  function getActivityUser($activityId) 
    906906  { 
    907907    return $this->instance->getActivityUser($activityId); 
    908908  } 
    909    
     909 
    910910  /** 
    911911   * Sets the status of the instance in some activity 
    912    *  
     912   * 
    913913   * @param int $activityId Activity id 
    914914   * @param string $status New status, it can be 'running' or 'completed' 
    915915   * @return bool False if no activity was found for the instance 
    916916   * @access public 
    917    */   
    918   function setActivityStatus($activityId,$status)  
     917   */ 
     918  function setActivityStatus($activityId,$status) 
    919919  { 
    920920    return $this->instance->setActivityStatus($activityId,$status); 
    921921  } 
    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 
    928928   * @return string 'running' or 'completed' 
    929929   * @access public 
    930930   */ 
    931   function getActivityStatus($activityId)  
     931  function getActivityStatus($activityId) 
    932932  { 
    933933    return $this->instance->getActivityStatus($activityId); 
    934934  } 
    935    
     935 
    936936  /** 
    937937   * Resets the start time of the activity indicated to the current time 
    938    *  
     938   * 
    939939   * @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) 
    944944  { 
    945945    return $this->instance->setActivityStarted($activityId); 
    946946  } 
    947    
     947 
    948948  /** 
    949949   * Gets the Unix timstamp of the starting time for the given activity 
    950    *  
     950   * 
    951951   * @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) 
    956956  { 
    957957    return $this->instance->getActivityStarted($activityId); 
    958958  } 
    959    
     959 
    960960  /** 
    961961   * 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() 
    967967  { 
    968968    return $this->instance->getStarted(); 
    969969  } 
    970    
     970 
    971971  /** 
    972972   * 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() 
    978978  { 
    979979    return $this->instance->getEnded(); 
    980980  } 
    981    
    982    
     981 
     982 
    983983  /** 
    984984   * Completes an activity. 
     
    986986   * the engine does automatically complete automatic activities after 
    987987   * executing them 
    988    *  
     988   * 
    989989   * @return bool True or false, if false it means the complete was not done for some internal reason 
    990990   * consult get_error() for more informations 
    991991   * @access public 
    992992   */ 
    993   function complete()  
     993  function complete() 
    994994  { 
    995995    if (!($this->activity->isInteractive())) 
     
    998998      return false; 
    999999    } 
    1000      
     1000 
    10011001    return $this->instance->complete($this->activity_id); 
    10021002  } 
     
    10051005   * Aborts an activity and terminates the whole instance. We still create a workitem to keep track 
    10061006   * 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() 
    10121012  { 
    10131013    return $this->instance->abort(); 
    10141014  } 
    1015    
     1015 
    10161016  /** 
    10171017   * Gets a comment for this instance 
    1018    *  
     1018   * 
    10191019   * @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) 
    10241024  { 
    10251025    return $this->instance->get_instance_comment($cId); 
    10261026  } 
    1027    
     1027 
    10281028  /** 
    10291029   * Inserts or updates an instance comment 
    1030    *  
     1030   * 
    10311031   * @param int $cId Commend id 
    1032    * @param int $activityId  
    1033    * @param object $activity  
     1032   * @param int $activityId 
     1033   * @param object $activity 
    10341034   * @param int $user User id 
    10351035   * @param string $title Comment's title 
    10361036   * @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) 
    10411041  { 
    10421042    return $this->instance->replace_instance_comment($cId, $activityId, $activity, $user, $title, $comment); 
    10431043  } 
    1044    
     1044 
    10451045  /** 
    10461046   * Removes an instance comment 
    1047    *  
     1047   * 
    10481048   * @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) 
    10531053  { 
    10541054    return $this->instance->remove_instance_comment($cId); 
    10551055  } 
    1056   
     1056 
    10571057  /** 
    10581058   * 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() 
    10641064  { 
    10651065    return $this->instance->get_instance_comments(); 
  • sandbox/workflow/2.0/inc/local/classes/class.JobBase.php

    r795 r1293  
    8989        { 
    9090                require_once 'common.inc.php'; 
    91                 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment(); 
     91                Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 
    9292                $this->jobID = $jobID; 
    9393                $this->processID = $processID; 
    9494                $this->currentDate = $currentDate; 
    95                 $this->jobManager = &$GLOBALS['workflow']['factory']->getInstance('WorkflowJobManager'); 
     95                $this->jobManager = &Factory::getInstance('WorkflowJobManager'); 
    9696                $this->testMode = $testMode; 
    9797                $this->maximumExecutionTime = $maximumExecutionTime; 
     
    148148        final private function prepareEnvironment() 
    149149        { 
    150                 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareProcessEnvironment($this->processID); 
     150                Factory::getInstance('WorkflowMacro')->prepareProcessEnvironment($this->processID); 
    151151 
    152152                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  
    291291                /* build the SQL query */ 
    292292                $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; 
    294294                $resultSet = $db->query($query, array($activityID, $processID)); 
    295295 
     
    319319                /* build the SQL query */ 
    320320                $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; 
    322322                $resultSet = $db->query($query, array($activityName, $processID)); 
    323323 
  • sandbox/workflow/2.0/inc/local/classes/class.wf_instance.php

    r795 r1293  
    9292        { 
    9393                /* load the DB */ 
    94                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     94                $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    9595 
    9696                /* load the process ID from the runtime */ 
     
    420420                /* load the required instance (for the required user) */ 
    421421                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); 
    423423                $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); 
    424424                $userInstance = $userInstance['data']; 
  • sandbox/workflow/2.0/inc/local/classes/class.wf_ldap.php

    r1067 r1293  
    4141        function wf_ldap() 
    4242        { 
    43                 $tmpLDAP = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     43                $tmpLDAP =& Factory::getInstance('WorkflowLDAP'); 
    4444                $this->user_context  = $tmpLDAP->getUserContext(); 
    4545                $this->group_context = $tmpLDAP->getGroupContext(); 
    4646 
    47                 $this->ds = &$GLOBALS['workflow']['workflowObjects']->getLDAP(); 
     47                $this->ds =& Factory::getInstance('WorkflowObjects')->getLDAP(); 
    4848 
    4949                $this->cachedLDAP = new wf_cached_ldap(); 
  • sandbox/workflow/2.0/inc/local/classes/class.wf_location.php

    r795 r1293  
    3636        function initialize() 
    3737        { 
    38                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID; 
     38                $this->db = &Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID; 
    3939                $this->db->setFetchMode(ADODB_FETCH_ASSOC); 
    4040                $this->cityInfo = array(); 
  • sandbox/workflow/2.0/inc/local/classes/class.wf_orgchart.php

    r1131 r1293  
    2424        function wf_orgchart() 
    2525        { 
    26                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBWorkflow()->Link_ID; 
     26                $this->db = &Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Link_ID; 
    2727                $this->db->setFetchMode(ADODB_FETCH_ASSOC); 
    2828        } 
  • sandbox/workflow/2.0/inc/local/classes/class.wf_role.php

    r1048 r1293  
    5757                        $this->processID = (int) $GLOBALS['workflow']['job']['processID']; 
    5858 
    59                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     59                $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    6060                $this->roleManager = CreateObject('workflow.workflow_rolemanager'); 
    6161                $this->activityManager = CreateObject('workflow.workflow_activitymanager'); 
     
    186186                        $users = array((int) $users); 
    187187                $roleID = $this->roleManager->get_role_id($this->processID, $roleName); 
    188                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     188                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    189189                foreach ($users as $user) 
    190190                { 
     
    212212                $users = $this->roleManager->list_mapped_users($this->processID, false, array('wf_role_name' => $roleName)); 
    213213 
    214                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     214                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    215215                $output = array(); 
    216216                foreach ($users as $id => $login) 
     
    367367 
    368368                /* get the roles */ 
    369                 $userGroups = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserGroups($userID); 
     369                $userGroups = Factory::getInstance('WorkflowLDAP')->getUserGroups($userID); 
    370370                $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 (?))'; 
    371371                $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  
    2929        public function wf_workitem() 
    3030        { 
    31                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     31                $this->db =& Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    3232                $this->processID = (int) $GLOBALS['workflow']['wf_runtime']->activity->getProcessId(); 
    3333        } 
  • sandbox/workflow/2.0/inc/local/functions/function.wf_get_activity_link_by_id.php

    r795 r1293  
    55 * @return string url para a atividade passada como parametro 
    66 * @license http://www.gnu.org/copyleft/gpl.html GPL 
    7  * @package Workflow  
    8  * @subpackage local  
     7 * @package Workflow 
     8 * @subpackage local 
    99 * @access public 
    1010 * @author Alessandra Heil 
     
    1414        /* load some variables */ 
    1515        $instance =& $GLOBALS['workflow']['wf_runtime']; 
    16          
     16 
    1717        $currentActivity = $instance->activity_id; 
    1818        $instanceId = $instance->instance_id; 
    1919        $urlBase = $_SERVER['SERVER_NAME']; 
    20          
     20 
    2121        if (isset($currentActivity) && ($instanceId != 0)) 
    2222                $output = "http://".$urlBase."/index.php?menuaction=workflow.run_activity.go&activity_id=$activityId"; 
    2323        else 
    2424                $output = "http://".$urlBase."/workflow/index.php?start_tab=0"; 
    25          
     25 
    2626        return $output ; 
    2727} 
  • sandbox/workflow/2.0/inc/local/functions/function.wf_get_next_activity_link.php

    r795 r1293  
    44 * @return string 
    55 * @license http://www.gnu.org/copyleft/gpl.html GPL 
    6  * @package Workflow  
    7  * @subpackage local  
     6 * @package Workflow 
     7 * @subpackage local 
    88 * @access public 
    99 */ 
     
    2222                if (isset($instance->instance->nextActivity[$currentActivity])) 
    2323                        $nextActivityId = $instance->instance->nextActivity[$currentActivity]; 
    24          
     24 
    2525        if (isset($nextActivityId) && ($instanceId != 0)) 
    2626                $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  
    11<?php 
    22/** 
    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. 
    44 * @package Smarty 
    55 * @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 
    1313 * @return string $output código que insere o componente. 
    14  * @access public   
     14 * @access public 
    1515 */ 
    1616function smarty_function_wf_generic_select($params, &$smarty) 
     
    2929                'title', 
    3030                'container_number'); 
    31          
     31 
    3232        /* verifica se todos os parâmetros obrigatórios foram passados */ 
    3333        foreach ($requiredParams as $required) 
    3434                if (!array_key_exists($required, $params) || (empty($params[$required]))) 
    3535                        $smarty->trigger_error("[wf_select_user] missing required parameter(s): $required", E_USER_ERROR); 
    36          
     36 
    3737        /* atribui valores default para os parâmetros não passados */ 
    3838        foreach ($defaultValues as $key => $value) 
    3939                if (!isset($params[$key])) 
    4040                        $params[$key] = $value; 
    41          
     41 
    4242        /* extrai alguns parâmetros da matriz de parâmetros */ 
    4343        foreach ($extractParams as $extract) 
    4444                $$extract = $params[$extract]; 
    45          
     45 
    4646        $name_desc = $name . "_desc"; 
    4747        $digest = md5($_SERVER['REQUEST_URI']); 
     
    5353EOF; 
    5454 
    55         $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     55        $templateServer = &Factory::getInstance('TemplateServer'); 
    5656        $imageAdd = $templateServer->generateImageLink('add.png'); 
    5757        $imageRemove = $templateServer->generateImageLink('close.png'); 
  • sandbox/workflow/2.0/inc/smarty/wf_plugins/function.wf_redir_menu.php

    r795 r1293  
    5353        $select_tag .= "<option value=\"og\">Organograma</option>"; 
    5454 
    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'))) { 
    5758                $select_tag .= "<option value=\"ad\">Administração</option>"; 
    5859        } 
    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'))) { 
    6061                $select_tag .= "<option value=\"mo\">Monitoramento</option>"; 
    6162        } 
  • sandbox/workflow/2.0/inc/smarty/wf_plugins/function.wf_select_city.php

    r795 r1293  
    11<?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. 
    44 * 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. 
    66 * @package Smarty 
    77 * @subpackage wf_plugins 
    88 * @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. 
    1212 * - 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 
    1616 */ 
    1717function smarty_function_wf_select_city($params, &$smarty) 
     
    3737                if (!array_key_exists($required, $params) || (empty($params[$required]))) 
    3838                        $smarty->trigger_error("[wf_select_city] missing required parameter(s): $required", E_USER_ERROR); 
    39          
     39 
    4040        /* atribui valores default para os parâmetros não passados */ 
    4141        foreach ($defaultValues as $key => $value) 
    4242                if (!isset($params[$key])) 
    4343                        $params[$key] = $value; 
    44          
     44 
    4545        /* extrai alguns parâmetros da matriz de parâmetros */ 
    4646        foreach ($extractParams as $extract) 
    4747                $$extract = $params[$extract]; 
    48          
     48 
    4949        /* parâmetros extras são "acumulados" em uma única variável */ 
    5050        $extraParams = array(); 
     
    5353                        $extraParams[$key] = $value_params; 
    5454 
    55         $db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID; 
     55        $db = &Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID; 
    5656        if (isset($params['value'])) 
    5757        { 
  • sandbox/workflow/2.0/inc/smarty/wf_plugins/function.wf_select_ldap_users.php

    r795 r1293  
    2525{ 
    2626    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); 
    2828 
    2929        $requiredParams = array( 
  • sandbox/workflow/2.0/inc/smarty/wf_plugins/function.wf_select_state.php

    r795 r1293  
    11<?php 
    22/** 
    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. 
    44 * @package Smarty 
    55 * @subpackage wf_plugins 
    66 * @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á. 
    88 * - value: o ID do Estado que estará previamente selecionado. 
    99 * 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 
    1313 */ 
    1414function smarty_function_wf_select_state($params, &$smarty) 
     
    2323                'name', 
    2424                'value'); 
    25          
     25 
    2626        /* verifica se todos os parâmetros obrigatórios foram passados */ 
    2727        foreach ($requiredParams as $required) 
    2828                if (!array_key_exists($required, $params) || (empty($params[$required]))) 
    2929                        $smarty->trigger_error("[wf_select_state] missing required parameter(s): $required", E_USER_ERROR); 
    30          
     30 
    3131        /* atribui valores default para os parâmetros não passados */ 
    3232        foreach ($defaultValues as $key => $value) 
    3333                if (!isset($params[$key])) 
    3434                        $params[$key] = $value; 
    35          
     35 
    3636        /* extrai alguns parâmetros da matriz de parâmetros */ 
    3737        foreach ($extractParams as $extract) 
    3838                $$extract = $params[$extract]; 
    39          
     39 
    4040        /* parâmetros extras são "acumulados" em uma única variável */ 
    4141        $extraParams = array(); 
     
    4646        $sql = "SELECT id_state, state_name FROM phpgw_cc_state WHERE id_country = 'BR' ORDER BY state_name"; 
    4747 
    48         $result = $GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID->query($sql); 
     48        $result = Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID->query($sql); 
    4949        $estados = array(); 
    5050        while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) 
  • sandbox/workflow/2.0/inc/smarty/wf_plugins/function.wf_select_user.php

    r795 r1293  
    9494                $extraParams .= "&hideSectors=1"; 
    9595 
    96         $image = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink('add_user.png'); 
     96        $image = Factory::getInstance('TemplateServer')->generateImageLink('add_user.png'); 
    9797 
    9898$output .= <<<EOF 
  • sandbox/workflow/2.0/inc/smarty/wf_plugins/function.wf_select_users.php

    r795 r1293  
    1616{ 
    1717    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); 
    1919        $requiredParams = array( 
    2020                'name'); 
  • sandbox/workflow/2.0/inc/smarty/wf_plugins/prefilter.wf_default_template.php

    r795 r1293  
    3131        { 
    3232                /* get the header and footer location */ 
    33                 $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     33                $templateServer = &Factory::getInstance('TemplateServer'); 
    3434                $header = $templateServer->getSystemFile('processes/header.tpl'); 
    3535                $footer = $templateServer->getSystemFile('processes/footer.tpl'); 
  • sandbox/workflow/2.0/index.php

    r795 r1293  
    4747        else 
    4848        { 
    49                 $GLOBALS['phpgw']->preferences->read_repository(); 
     49                Factory::getForeignInstance('phpgwapi', 'phpgw')->preferences->read_repository(); 
    5050                $start_tab = $GLOBALS['phpgw_info']['user']['preferences']['workflow']['startpage']; 
    5151                if (is_null($start_tab)) 
  • sandbox/workflow/2.0/lib/Factory.php

    r795 r1293  
    1010\**************************************************************************/ 
    1111 
     12require_once 'BaseFactory.php'; 
     13 
    1214/** 
    1315 * Implementa o design pattern factory para o módulo Workflow 
     
    1820 * @license http://www.gnu.org/copyleft/gpl.html GPL 
    1921 */ 
    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         } 
     22class Factory extends BaseFactory { 
    5823 
    5924        /** 
     
    6328         * @return void 
    6429         */ 
    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)){ 
    6941                        require_once $file; 
    70                 else 
     42                } else { 
    7143                        trigger_error("O arquivo " . $file . " não existe.", E_USER_ERROR); 
     44                } 
    7245        } 
    7346 
     
    7649         * @param string $key O nome da classe 
    7750         * @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 
    7890         * @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                } 
    84126        } 
    85127 
     
    90132         * @access private 
    91133         */ 
    92         private function &_getEntry($key) 
    93         { 
    94                 return $this->_cache[$key]; 
     134        private function &_getExtEntry($key) { 
     135                return $GLOBALS[$key]; 
    95136        } 
    96137 
     
    99140         * @param string $key Nome da classe 
    100141         * @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); 
    106146        } 
    107147 
     
    112152         * @access public 
    113153         */ 
    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); 
    127162                                return $instance; 
    128163                        } 
     
    131166 
    132167        /** 
    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); 
    147177                        $reflectionObj = new ReflectionClass($className); 
    148178                        return $reflectionObj->newInstanceArgs($args); 
     
    151181 
    152182        /** 
     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        /** 
    153198         * Retorna objetos armazenados ou cria novos objetos utilizando o pattern singleton (somente para módulos externos) 
    154199         * @param string $moduleName O nome do módulo 
     
    157202         * @access public 
    158203         */ 
    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                        } 
    172219                } 
    173220        } 
     
    180227         * @access public 
    181228         */ 
    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); 
    195236                } 
    196237        } 
  • sandbox/workflow/2.0/redirect.php

    r795 r1293  
    1111if (empty($_SESSION)) 
    1212        exit(0); 
     13 
    1314require_once 'inc/common.inc.php'; 
    14 $GLOBALS['workflow']['factory']->getInstance('ResourcesRedirector')->redirect(); 
     15Factory::getInstance('ResourcesRedirector')->redirect(); 
    1516?> 
  • sandbox/workflow/2.0/showUserPicture.php

    r795 r1293  
    1212        exit(0); 
    1313require_once 'inc/common.inc.php'; 
    14 $GLOBALS['workflow']['factory']->getInstance('UserPictureProvider')->serve(); 
     14Factory::getInstance('UserPictureProvider')->serve(); 
    1515?> 
  • sandbox/workflow/2.0/templateFile.php

    r795 r1293  
    1111if (empty($_SESSION)) 
    1212        exit(0); 
     13 
    1314require_once 'inc/common.inc.php'; 
    14 $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->redirect(); 
     15Factory::getInstance('TemplateServer')->redirect(); 
     16 
    1517?> 
Note: See TracChangeset for help on using the changeset viewer.