Changeset 2233 for sandbox/workflow


Ignore:
Timestamp:
03/12/10 10:59:32 (14 years ago)
Author:
pedroerp
Message:

Ticket #609 - Migração das classes do módulo workflow para a nova factory.

Location:
sandbox/workflow/branches/609
Files:
76 edited

Legend:

Unmodified
Added
Removed
  • sandbox/workflow/branches/609/controller.php

    r1484 r2233  
    1616        { 
    1717                require_once dirname(__FILE__) . '/inc/common.inc.php'; 
    18                 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment(); 
     18                Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 
    1919        } 
    2020 
  • sandbox/workflow/branches/609/inc/class.CachedLDAP.inc.php

    r1310 r2233  
    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/branches/609/inc/class.JobRunner.inc.php

    r795 r2233  
    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/branches/609/inc/class.JobScheduler.inc.php

    r795 r2233  
    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/branches/609/inc/class.Logger.inc.php

    r900 r2233  
    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/branches/609/inc/class.ResourcesRedirector.inc.php

    r795 r2233  
    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/branches/609/inc/class.TemplateServer.inc.php

    r795 r2233  
    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/branches/609/inc/class.UserPictureProvider.inc.php

    r795 r2233  
    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/branches/609/inc/class.WorkflowJobManager.inc.php

    r795 r2233  
    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/branches/609/inc/class.WorkflowLDAP.inc.php

    r795 r2233  
    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/branches/609/inc/class.WorkflowMacro.inc.php

    r795 r2233  
    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/branches/609/inc/class.WorkflowObjects.inc.php

    r795 r2233  
    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::newInstance('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::newInstance('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::newInstance('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/branches/609/inc/class.WorkflowSecurity.inc.php

    r795 r2233  
    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/branches/609/inc/class.WorkflowUtils.inc.php

    r795 r2233  
    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 
     
    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) { 
  • sandbox/workflow/branches/609/inc/class.bo_adminaccess.inc.php

    r795 r2233  
    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/branches/609/inc/class.bo_adminjobs.inc.php

    r795 r2233  
    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/branches/609/inc/class.bo_adminsource.inc.php

    r795 r2233  
    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/branches/609/inc/class.bo_ajaxinterface.inc.php

    r795 r2233  
    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/branches/609/inc/class.bo_monitors.inc.php

    r795 r2233  
    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/branches/609/inc/class.bo_participants.inc.php

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

    r2085 r2233  
    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                { 
     
    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 */ 
  • sandbox/workflow/branches/609/inc/class.bo_utils.inc.php

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

    r795 r2233  
    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/branches/609/inc/class.run_activity.inc.php

    r2072 r2233  
    301301                        $this->process_version  = $this->process->getVersion(); 
    302302                        $this->activity_name    = $activity->getName(); 
    303                         $this->user_name        = $GLOBALS['phpgw']->accounts->id2name($GLOBALS['user']); 
     303                        $this->user_name        = Factory::getForeignInstance('phpgwapi', 'phpgw')->accounts->id2name($GLOBALS['user']); 
    304304                        $this->view_activity    = $this->GUI->gui_get_process_view_activity($this->process_id); 
    305305 
     
    318318                        $GLOBALS['workflow']['wf_workflow_path']                        = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'; 
    319319                        $GLOBALS['workflow']['wf_resources_path']                       = $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'workflow/redirect.php?pid=' . $this->process_id . '&file='; 
    320                         $GLOBALS['workflow']['wf_default_resources_path']       = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink('processes'); 
    321                         $GLOBALS['workflow']['wf_workflow_resources_path']      = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink(''); 
     320                        $GLOBALS['workflow']['wf_default_resources_path']       = Factory::getInstance('TemplateServer')->generateLink('processes'); 
     321                        $GLOBALS['workflow']['wf_workflow_resources_path']      = Factory::getInstance('TemplateServer')->generateLink(''); 
    322322                        $GLOBALS['workflow']['wf_activity_url']                         = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id; 
    323                         $GLOBALS['workflow']['wf_user_cnname']                          = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 
     323                        $GLOBALS['workflow']['wf_user_cnname']                          = Factory::getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 
    324324                        $GLOBALS['workflow']['wf_back_link']                            = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1'; 
    325325                        $GLOBALS['workflow']['wf_js_path']                                      = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode'; 
     
    376376 
    377377                                /* check some permissions */ 
    378                                 if (($newUser == '*') || (!$this->runtime->checkUserRun($newUser)) || ($GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($newUser) === false)) 
     378                                if (($newUser == '*') || (!$this->runtime->checkUserRun($newUser)) || (Factory::getInstance('WorkflowLDAP')->getName($newUser) === false)) 
    379379                                { 
    380380                                        $_SESSION['phpgw_info']['workflow']['user_groups'] = $actualUserGroups; 
     
    472472 
    473473                        /* activate the security policy */ 
    474                         $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     474                        Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
    475475 
    476476                        /* include the files */ 
     
    661661                        $GLOBALS['workflow']['wf_workflow_path']                        = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'; 
    662662                        $GLOBALS['workflow']['wf_resources_path']                       = $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'workflow/redirect.php?pid=' . $this->process_id . '&file='; 
    663                         $GLOBALS['workflow']['wf_default_resources_path']       = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink('processes'); 
    664                         $GLOBALS['workflow']['wf_workflow_resources_path']      = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink(''); 
     663                        $GLOBALS['workflow']['wf_default_resources_path']       = Factory::getInstance('TemplateServer')->generateLink('processes'); 
     664                        $GLOBALS['workflow']['wf_workflow_resources_path']      = Factory::getInstance('TemplateServer')->generateLink(''); 
    665665                        $GLOBALS['workflow']['wf_activity_url']                         = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id; 
    666                         $GLOBALS['workflow']['wf_user_cnname']                          = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 
     666                        $GLOBALS['workflow']['wf_user_cnname']                          = Factory::getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 
    667667                        $GLOBALS['workflow']['wf_back_link']                            = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1'; 
    668668                        $GLOBALS['workflow']['wf_js_path']                                      = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode'; 
     
    712712 
    713713                        /* activate the security policy */ 
    714                         $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     714                        Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
    715715 
    716716                        $GLOBALS['workflow_env'] = &$env; 
  • sandbox/workflow/branches/609/inc/class.so_adminaccess.inc.php

    r795 r2233  
    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/branches/609/inc/class.so_adminjobs.inc.php

    r795 r2233  
    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/branches/609/inc/class.so_agent.inc.php

    r795 r2233  
    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/branches/609/inc/class.so_external_applications.inc.php

    r795 r2233  
    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/branches/609/inc/class.so_move_instances.inc.php

    r795 r2233  
    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/branches/609/inc/class.so_orgchart.inc.php

    r2063 r2233  
    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        } 
     
    711711 
    712712                $output = $result->GetArray(-1); 
    713                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     713                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    714714                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP_DATABASE); 
    715715                for ($i = 0; $i < count($output); $i++) 
     
    765765 
    766766                /* search for the $searchTerm in the LDAP */ 
    767                 $ldap = &$GLOBALS['workflow']['workflowObjects']->getLDAP(); 
    768                 $list = @ldap_search($ldap, $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getLDAPContext(), $ldapSearch, array('uidnumber', 'cn', 'uid')); 
     767                $ldap = &Factory::getInstance('WorkflowObjects')->getLDAP(); 
     768                $list = @ldap_search($ldap, Factory::getInstance('WorkflowLDAP')->getLDAPContext(), $ldapSearch, array('uidnumber', 'cn', 'uid')); 
    769769                if ($list === false) 
    770770                        die(serialize("O sistema de busca não pode ser utilizado nesta organização.")); 
     
    774774 
    775775                /* search for the $searchTerm in the DB */ 
    776                 $resultSet = $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID->query($DBSearch, $DBValues)->GetArray(-1); 
     776                $resultSet = Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID->query($DBSearch, $DBValues)->GetArray(-1); 
    777777                foreach ($resultSet as $row) 
    778778                        if (!isset($unifiedResult[$row['uidnumber']])) 
     
    823823                { 
    824824                        $errors = array( 
    825                                 "O funcionário \"" . $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($employeeID) . "\" já pertença à área \"{$row['sigla']}\".", 
     825                                "O funcionário \"" . Factory::getInstance('WorkflowLDAP')->getName($employeeID) . "\" já pertença à área \"{$row['sigla']}\".", 
    826826                                '-----------------', 
    827827                                '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.' 
     
    881881                { 
    882882                        $errors = array( 
    883                                 "O funcionário \"" . $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($employeeID) . "\" é titular, substituto, já participou de substituição ou é auxiliar administrativo das seguintes áreas: " . implode(", ", $areas), 
     883                                "O funcionário \"" . Factory::getInstance('WorkflowLDAP')->getName($employeeID) . "\" é titular, substituto, já participou de substituição ou é auxiliar administrativo das seguintes áreas: " . implode(", ", $areas), 
    884884                                '-----------------', 
    885885                                'Se você quiser excluir este funcionário, precisa removê-lo dos "cargos" que ele possui nas áreas citadas.' 
     
    919919                $this->_checkError($result); 
    920920 
    921                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     921                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    922922                while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) 
    923923                { 
     
    999999                        $query = 'SELECT 1 FROM funcionario WHERE (funcionario_id = ?)'; 
    10001000                        if (!$this->db->query($query, $checkEmployee)->fetchRow()) 
    1001                                 $errors[] = "O funcionário \"" . $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($checkEmployee) . "\" não está vinculado a uma área."; 
     1001                                $errors[] = "O funcionário \"" . Factory::getInstance('WorkflowLDAP')->getName($checkEmployee) . "\" não está vinculado a uma área."; 
    10021002                } 
    10031003 
     
    10441044                        $query = 'SELECT 1 FROM funcionario WHERE (funcionario_id = ?)'; 
    10451045                        if (!$this->db->query($query, $checkEmployee)->fetchRow()) 
    1046                                 $errors[] = "O funcionário \"" . $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($checkEmployee) . "\" não está vinculado a uma área."; 
     1046                                $errors[] = "O funcionário \"" . Factory::getInstance('WorkflowLDAP')->getName($checkEmployee) . "\" não está vinculado a uma área."; 
    10471047                } 
    10481048 
     
    10961096                $outputInfo = array(); 
    10971097 
    1098                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     1098                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    10991099 
    11001100                /* here we need fresh information. Let's access ldap first */ 
     
    12621262                ); 
    12631263 
    1264                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     1264                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    12651265                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP_DATABASE); 
    12661266                if (!empty($areaInfo['titular_funcionario_id'])) 
     
    15121512 
    15131513                /* we must query ldap to get full user names. In workflow db we just store uids */ 
    1514                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     1514                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    15151515 
    15161516                $cachedLDAP->getEntryByID(); 
  • sandbox/workflow/branches/609/inc/class.so_userinterface.inc.php

    r2094 r2233  
    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_NORMAL); 
    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_NORMAL); 
    322322                for ($i = 0; $i < count($employees); $i++) 
     
    370370 
    371371                /* searching employees by name in the ldap server */ 
    372                 $list = @ldap_search($ldap, $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getLDAPContext(), ('(&(cn=*' . $searchTerm . '*)(phpgwaccounttype=u))'), array('uidNumber', 'cn', 'telephoneNumber')); 
     372                $list = @ldap_search($ldap, Factory::getInstance('WorkflowLDAP')->getLDAPContext(), ('(&(cn=*' . $searchTerm . '*)(phpgwaccounttype=u))'), array('uidNumber', 'cn', 'telephoneNumber')); 
    373373                if ($list === false) 
    374374                        return false; 
     
    466466 
    467467                /* executing it */ 
    468                 $list = @ldap_search($ldap, $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getLDAPContext(), $ldap_query, array('uidNumber', 'cn', 'telephoneNumber')); 
     468                $list = @ldap_search($ldap, Factory::getInstance('WorkflowLDAP')->getLDAPContext(), $ldap_query, array('uidNumber', 'cn', 'telephoneNumber')); 
    469469                $entries = ldap_get_entries($ldap, $list); 
    470470 
     
    475475 
    476476                /* we will need to search into database 'cache' for users deleted in ldap */ 
    477                 $cachedLDAP = $GLOBALS[ 'workflow' ][ 'factory' ] -> newInstance( 'CachedLDAP' ); 
     477                $cachedLDAP = Factory::newInstance( 'CachedLDAP' ); 
    478478                $cachedLDAP -> setOperationMode( $cachedLDAP -> OPERATION_MODE_DATABASE ); 
    479479 
     
    531531 
    532532                /* searching employees by telephoneNumber in the ldap server */ 
    533                 $list = @ldap_search($ldap, $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getLDAPContext(), ('(&(telephoneNumber=*' . $searchTerm . '*)(phpgwaccounttype=u))'), array('uidNumber', 'cn', 'telephoneNumber')); 
     533                $list = @ldap_search($ldap, Factory::getInstance('WorkflowLDAP')->getLDAPContext(), ('(&(telephoneNumber=*' . $searchTerm . '*)(phpgwaccounttype=u))'), array('uidNumber', 'cn', 'telephoneNumber')); 
    534534 
    535535                if (!$list) return false; 
     
    652652                $result = $this -> db -> query( "SELECT a.sigla as area, a.titular_funcionario_id as titular, s.funcionario_id as substituto, s.data_inicio, s.data_fim FROM area a INNER JOIN substituicao s ON ((a.area_id = s.area_id) AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) WHERE (organizacao_id = ?) ORDER BY area", array( $organizationID ) ); 
    653653 
    654                 $cachedLDAP = $GLOBALS[ 'workflow' ][ 'factory' ] -> newInstance( 'CachedLDAP' ); 
     654                $cachedLDAP = Factory::newInstance( 'CachedLDAP' ); 
    655655                $cachedLDAP -> setOperationMode( $cachedLDAP -> OPERATION_MODE_LDAP_DATABASE ); 
    656656 
     
    719719 
    720720                $employees = $result -> GetArray( -1 ); 
    721                 $cachedLDAP = $GLOBALS[ 'workflow' ][ 'factory' ] -> newInstance( 'CachedLDAP' ); 
     721                $cachedLDAP = Factory::newInstance( 'CachedLDAP' ); 
    722722                $cachedLDAP -> setOperationMode( $cachedLDAP -> OPERATION_MODE_NORMAL ); 
    723723 
     
    791791                $employees = $result -> GetArray( -1 ); 
    792792 
    793                 $cachedLDAP = $GLOBALS[ 'workflow' ][ 'factory' ] -> newInstance( 'CachedLDAP' ); 
     793                $cachedLDAP = Factory::newInstance( 'CachedLDAP' ); 
    794794                $cachedLDAP -> setOperationMode( $cachedLDAP -> OPERATION_MODE_NORMAL ); 
    795795 
     
    817817                usort( $employees, create_function( '$a,$b', 'return strcasecmp($a[\'cn\'],$b[\'cn\']);' ) ); 
    818818 
    819                 $paging = $GLOBALS['workflow']['factory']->newInstance('Paging', 50, $_POST); 
     819                $paging = Factory::newInstance('Paging', 50, $_POST); 
    820820                $employees = $paging->restrictItems( $employees ); 
    821821 
  • sandbox/workflow/branches/609/inc/class.ui_adminaccess.inc.php

    r795 r2233  
    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/branches/609/inc/class.ui_adminactivities.inc.php

    r1710 r2233  
    374374                // fill proc_bar 
    375375                $this->t->set_var('proc_bar', $this->fill_proc_bar($proc_info)); 
    376                  
     376 
    377377                //collect some messages from used objects 
    378378                $this->message[] = $this->activity_manager->get_error(false, _DEBUG); 
     
    380380                $this->message[] = $this->role_manager->get_error(false, _DEBUG); 
    381381 
    382                 $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     382                $templateServer = &Factory::getInstance('TemplateServer'); 
    383383 
    384384                // fill the general variables of the template 
     
    732732                        $this->translate_template('block_process_activities_header'); 
    733733                        $this->t->parse('process_activities_header', 'block_process_activities_header', True); 
    734                         $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     734                        $templateServer = &Factory::getInstance('TemplateServer'); 
    735735                        foreach ($process_activities_data as $activity) 
    736736                        { 
     
    792792                                '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']), 
    793793                                'trans_actFromName'     => $transition['wf_act_from_name'], 
    794                                 'trans_arrow'           => $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink('next.gif'), 
     794                                'trans_arrow'           => Factory::getInstance('TemplateServer')->generateImageLink('next.gif'), 
    795795                                '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']), 
    796796                                'trans_actToName'       => $transition['wf_act_to_name'], 
     
    10361036                $image_name = $proc_info['wf_normalized_name'] . SEP . 'graph' . SEP . $proc_info['wf_normalized_name'] . '.png'; 
    10371037                $image = GALAXIA_PROCESSES . SEP . $image_name; 
    1038                 if ($GLOBALS['workflow']['factory']->getInstance('BrowserInfo')->isOpera()) 
     1038                if (Factory::getInstance('BrowserInfo')->isOpera()) 
    10391039                        $maximumDimension = 1000000; 
    10401040                else 
     
    10691069                } 
    10701070        } 
    1071          
     1071 
    10721072        /** 
    10731073         * Dislays the activity agents config rows 
     
    10901090                        } 
    10911091                        $this->translate_template('admin_agents'); 
    1092                                                                                                 $this->t->parse('agents_config_rows', 'admin_agents'); 
     1092                        $this->t->parse('agents_config_rows', 'admin_agents'); 
    10931093                } 
    10941094        } 
  • sandbox/workflow/branches/609/inc/class.ui_adminjobs.inc.php

    r795 r2233  
    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/branches/609/inc/class.ui_adminprocesses.inc.php

    r989 r2233  
    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/branches/609/inc/class.ui_adminroles.inc.php

    r795 r2233  
    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/branches/609/inc/class.ui_adminsource.inc.php

    r795 r2233  
    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/branches/609/inc/class.ui_ajaxinterface.inc.php

    r1452 r2233  
    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']); 
     
    118118        { 
    119119                $CSSName = "css/{$CSSName}.css"; 
    120                 $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     120                $templateServer = &Factory::getInstance('TemplateServer'); 
    121121                $CSSLink = $templateServer->getWebFile($CSSName); 
    122122                $CSSFile = $templateServer->getSystemFile($CSSName); 
  • sandbox/workflow/branches/609/inc/class.ui_external_applications.inc.php

    r795 r2233  
    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/branches/609/inc/class.ui_generic_select.inc.php

    r795 r2233  
    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/branches/609/inc/class.ui_orgchart.inc.php

    r795 r2233  
    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/branches/609/inc/class.ui_participants.inc.php

    r795 r2233  
    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::getInstance('accounts', $userDN); 
    5858                $organizationList = $this->bo->getOrganizations(); 
    5959 
  • sandbox/workflow/branches/609/inc/class.ui_phpeditor.inc.php

    r795 r2233  
    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/branches/609/inc/class.ui_userinterface.inc.php

    r2223 r2233  
    115115 
    116116                // Get a connection to db workflow and galaxia (module) 
    117                 if ($GLOBALS['workflow']['workflowObjects']->getDBWorkflow()->Error) 
     117                if (Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Error) 
    118118                        $errors[] = 'Unable to connect to database Workflow'; 
    119119 
    120                 if ($errormsg = $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Error) 
     120                if ($errormsg = Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Error) 
    121121                        $errors[] = 'Unable to connect to database Galaxia'; 
    122122 
  • sandbox/workflow/branches/609/inc/class.workflow_acl.inc.php

    r795 r2233  
    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/branches/609/inc/class.workflow_activitymanager.inc.php

    r795 r2233  
    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/branches/609/inc/class.workflow_baseactivity.inc.php

    r795 r2233  
    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/branches/609/inc/class.workflow_gui.inc.php

    r795 r2233  
    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/branches/609/inc/class.workflow_instance.inc.php

    r795 r2233  
    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/branches/609/inc/class.workflow_instancemanager.inc.php

    r795 r2233  
    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/branches/609/inc/class.workflow_process.inc.php

    r795 r2233  
    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/branches/609/inc/class.workflow_processmanager.inc.php

    r795 r2233  
    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") 
  • sandbox/workflow/branches/609/inc/class.workflow_processmonitor.inc.php

    r795 r2233  
    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/branches/609/inc/class.workflow_rolemanager.inc.php

    r795 r2233  
    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/branches/609/inc/class.workflow_wfruntime.inc.php

    r795 r2233  
    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/branches/609/inc/class.workflow_wfsecurity.inc.php

    r1712 r2233  
    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/branches/609/inc/common.inc.php

    r2223 r2233  
    1717 * @name EGW_SERVER_ROOT 
    1818 */ 
    19 define('EGW_SERVER_ROOT', $HTTP_SERVER_VARS['DOCUMENT_ROOT']); 
     19define('EGW_SERVER_ROOT', $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']); 
     20 
     21/** 
     22 * Server include base path. We must define our own constants 
     23 * because there are several cases in which workflow is called 
     24 * directly, thus PHPGW constants are not defined. 
     25 * @name EGW_INC_ROOT 
     26 */ 
     27define('EGW_INC_ROOT', EGW_SERVER_ROOT . '/phpgwapi/inc/'); 
    2028 
    2129/** 
  • sandbox/workflow/branches/609/inc/engine/class.ajax_config.inc.php

    r795 r2233  
    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 
  • sandbox/workflow/branches/609/inc/engine/class.ajax_ldap.inc.php

    r795 r2233  
    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/branches/609/inc/engine/config.ajax.inc.php

    r795 r2233  
    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/branches/609/inc/engine/config.egw.inc.php

    r795 r2233  
    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/branches/609/inc/engine/src/ProcessManager/RoleManager.php

    r795 r2233  
    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/branches/609/inc/smarty/wf_plugins/function.wf_generic_select.php

    r795 r2233  
    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/branches/609/inc/smarty/wf_plugins/function.wf_redir_menu.php

    r795 r2233  
    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/branches/609/inc/smarty/wf_plugins/function.wf_select_city.php

    r795 r2233  
    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/branches/609/inc/smarty/wf_plugins/function.wf_select_ldap_users.php

    r795 r2233  
    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/branches/609/inc/smarty/wf_plugins/function.wf_select_state.php

    r795 r2233  
    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/branches/609/inc/smarty/wf_plugins/function.wf_select_user.php

    r795 r2233  
    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/branches/609/inc/smarty/wf_plugins/function.wf_select_users.php

    r795 r2233  
    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/branches/609/inc/smarty/wf_plugins/prefilter.wf_default_template.php

    r795 r2233  
    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/branches/609/lib/factory/BaseFactory.php

    r2222 r2233  
    154154                /* not found */ 
    155155                if (!($entry = $this->_getEntry($className))) 
    156                         throw new Exception('You are not allowed to instantiate '.$className.' class.'); 
     156                        throw new Exception('You are not allowed to instantiate \''.$className.'\' class.'); 
    157157 
    158                 $fullPath = $entry['basePath'] . SEP . $entry['path'] . SEP . $entry['filename']; 
     158                $fullPath = $entry['basePath'] . '/' . $entry['path'] . '/' . $entry['filename']; 
    159159 
    160160                /* file not found */ 
  • sandbox/workflow/branches/609/lib/factory/Factory.php

    r2223 r2233  
    6464         * @static 
    6565         */ 
    66         public static function getInstance() { 
     66        public static function &getInstance() { 
    6767 
    6868                /* oops. we are in the process space. */ 
     
    9393         * Just forward this call to the correct class. 
    9494         * 
    95          * @todo I must implement it! 
    9695         * @access public 
    9796         * @retun object 
    9897         * @static 
    9998         */ 
    100         public static function newInstance() { 
     99        public static function &newInstance() { 
     100 
     101                /* oops. we are in the process space. */ 
     102                if (Security::isEnabled()) { 
     103 
     104                        /* must instatiate it */ 
     105                        if (is_null(self::$_securedFactory)) 
     106                                self::$_securedFactory = new ProcessFactory(); 
     107 
     108                        $args = func_get_args(); 
     109                        return call_user_func_array(array(self::$_securedFactory, "newInstance"), $args); 
     110 
     111                } 
     112                /* regular module space */ 
     113                else { 
     114 
     115                        /* must instatiate it */ 
     116                        if (is_null(self::$_unsecuredFactory)) 
     117                                self::$_unsecuredFactory = new WorkflowFactory(); 
     118 
     119                        $args = func_get_args(); 
     120                        return call_user_func_array(array(self::$_unsecuredFactory, "newInstance"), $args); 
     121                } 
    101122        } 
    102123} 
  • sandbox/workflow/branches/609/lib/factory/WorkflowFactory.php

    r2223 r2233  
    4949                /* registering allowed classes */ 
    5050                $this->registerFileInfo('WorkflowObjects', 'class.WorkflowObjects.inc.php', 'inc'); 
     51                $this->registerFileInfo('WorkflowWatcher', 'class.WorkflowWatcher.inc.php', 'inc'); 
     52                $this->registerFileInfo('WorkflowLDAP', 'class.WorkflowLDAP.inc.php', 'inc'); 
     53                $this->registerFileInfo('WorkflowSecurity', 'class.WorkflowSecurity.inc.php', 'inc'); 
     54                $this->registerFileInfo('ResourcesRedirector', 'class.ResourcesRedirector.inc.php', 'inc'); 
    5155                $this->registerFileInfo('TemplateServer', 'class.TemplateServer.inc.php', 'inc'); 
     56                $this->registerFileInfo('CachedLDAP', 'class.CachedLDAP.inc.php', 'inc'); 
     57                $this->registerFileInfo('BrowserInfo', 'class.BrowserInfo.inc.php', 'inc'); 
     58 
    5259                $this->registerFileInfo('workflow_smarty', 'class.workflow_smarty.inc.php', 'inc'); 
     60                $this->registerFileInfo('workflow_acl', 'class.workflow_acl.inc.php', 'inc'); 
     61                $this->registerFileInfo('workflow_processmanager', 'class.workflow_processmanager.inc.php', 'inc'); 
     62 
     63                $this->registerFileInfo('bo_participants', 'class.bo_participants.inc.php', 'inc'); 
    5364 
    5465                /* registering egw class example */ 
    55                 //$this->registerFileInfo('db', 'x', 'inc', PHPGW_API_INC); 
     66                $this->registerFileInfo('phpgw', 'class.phpgw.inc.php', '', EGW_INC_ROOT); 
     67                $this->registerFileInfo('db', 'class.db.inc.php', '', EGW_INC_ROOT); 
     68                $this->registerFileInfo('accounts', 'class.accounts.inc.php', '', EGW_INC_ROOT); 
    5669 
    5770                /* ok. no more instances of this class.. */ 
  • sandbox/workflow/branches/609/redirect.php

    r1468 r2233  
    1212if (empty($_SESSION)) 
    1313        exit(0); 
    14 $GLOBALS['workflow']['factory']->getInstance('ResourcesRedirector')->redirect(); 
     14Factory::getInstance('ResourcesRedirector')->redirect(); 
    1515?> 
  • sandbox/workflow/branches/609/showUserPicture.php

    r1468 r2233  
    1212if (empty($_SESSION)) 
    1313        exit(0); 
    14 $GLOBALS['workflow']['factory']->getInstance('UserPictureProvider')->serve(); 
     14Factory::getInstance('UserPictureProvider')->serve(); 
    1515?> 
  • sandbox/workflow/branches/609/templateFile.php

    r2223 r2233  
    1212if (empty($_SESSION)) 
    1313        exit(0); 
    14 //$GLOBALS['workflow']['factory']->getInstance('TemplateServer')->redirect(); 
    1514Factory::getInstance('TemplateServer')->redirect(); 
    1615?> 
Note: See TracChangeset for help on using the changeset viewer.