Ignore:
Timestamp:
03/29/10 14:46:01 (14 years ago)
Author:
pedroerp
Message:

Ticket #609 - Merged 2197:2356 /sandbox/workflow/branches/609/ em /sandbox/workflow/trunk.

Location:
sandbox/workflow/trunk
Files:
2 deleted
118 edited
9 copied

Legend:

Unmodified
Added
Removed
  • sandbox/workflow/trunk/controller.php

    r1484 r2372  
    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/trunk/inc/class.CachedLDAP.inc.php

    r1310 r2372  
    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/trunk/inc/class.JobRunner.inc.php

    r795 r2372  
    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(); 
     69 
     70                /** 
     71                 * Since all jobs must run in process mode, e. g. it's user code, 
     72                 * we must enable the security. 
     73                 */ 
     74                Security::enable(); 
    6975 
    7076                if (!file_exists($this->parameters['file'])) 
     
    94100 
    95101require_once 'common.inc.php'; 
    96 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment(); 
     102Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 
    97103 
    98 $jobRunner = new JobRunner($argv[1]); 
     104$jobRunner = &Factory::newInstance('JobRunner', $argv[1]); 
    99105$jobRunner->run(); 
    100106?> 
  • sandbox/workflow/trunk/inc/class.JobScheduler.inc.php

    r795 r2372  
    1111 
    1212require_once 'jobs/class.JobEnum.inc.php'; 
    13 require_once 'jobs/class.AbsoluteDate.inc.php'; 
    14 require_once 'jobs/class.WeekDate.inc.php'; 
    15 require_once 'jobs/class.RelativeDate.inc.php'; 
    1613 
    1714/** 
     
    5754        { 
    5855                $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'); 
     56                $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
     57                $this->jobManager = &Factory::getInstance('WorkflowJobManager'); 
    6158        } 
    6259 
     
    7673                { 
    7774                        case DateType::ABSOLUTE_DATE: 
    78                                 $object = new AbsoluteDate($startDate, $interval); 
     75                                $object = &Factory::getInstance('AbsoluteDate', $startDate, $interval); 
    7976                                break; 
    8077 
    8178                        case DateType::WEEK_DATE: 
    82                                 $object = new WeekDate($startDate, $interval); 
     79                                $object = &Factory::getInstance('WeekDate', $startDate, $interval); 
    8380                                $object->setWeekDays($record['week_days']); 
    8481                                break; 
    8582 
    8683                        case DateType::RELATIVE_DATE: 
    87                                 $object = new RelativeDate($startDate, $interval); 
     84                                $object = &Factory::getInstance('RelativeDate', $startDate, $interval); 
    8885                                $object->setOffset($record['month_offset']); 
    8986                                break; 
     
    171168                $previousDir = getcwd(); 
    172169                chdir(GALAXIA_LIBRARY . '/../'); 
    173                 $output = $GLOBALS['workflow']['factory']->newInstance('Thread', 'class.JobRunner.inc.php "' . $parameters . '"'); 
     170                $output = Factory::newInstance('Thread', 'class.JobRunner.inc.php "' . $parameters . '"'); 
    174171                chdir($previousDir); 
    175172                return $output; 
     
    192189{ 
    193190        require_once 'common.inc.php'; 
    194         $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment(); 
     191        Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 
    195192 
    196         $job = new JobScheduler(); 
     193        $job = Factory::newInstance('JobScheduler'); 
    197194        $job->run(); 
    198195} 
  • sandbox/workflow/trunk/inc/class.Logger.inc.php

    r900 r2372  
    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/trunk/inc/class.ResourcesRedirector.inc.php

    r795 r2372  
    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/trunk/inc/class.TemplateServer.inc.php

    r795 r2372  
    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/trunk/inc/class.UserPictureProvider.inc.php

    r795 r2372  
    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/trunk/inc/class.WorkflowJobManager.inc.php

    r795 r2372  
    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/trunk/inc/class.WorkflowLDAP.inc.php

    r795 r2372  
    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/trunk/inc/class.WorkflowMacro.inc.php

    r795 r2372  
    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; 
     
    4848                require_once PHPGW_API_INC . '/functions.inc.php'; 
    4949                require_once 'engine/class.ajax_config.inc.php'; 
    50                 require_once 'engine/class.ajax_ldap.inc.php'; 
    5150                require_once 'engine/config.ajax.inc.php'; 
    52                 $GLOBALS['ajax']->ldap = new ajax_ldap(); 
     51                $GLOBALS['ajax']->ldap = &Factory::getInstance('ajax_ldap'); 
    5352 
    5453                /* definição de algumas constantes */ 
     
    6463        public function prepareProcessEnvironment($processID) 
    6564        { 
    66                 require_once GALAXIA_LIBRARY . '/src/common/WfRuntime.php'; 
    6765                require_once PHPGW_SERVER_ROOT . '/workflow/inc/local/functions/local.functions.php'; 
    6866 
    69                 $runtime = new WfRuntime($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     67                $runtime = &Factory::getInstance('WfRuntime', Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    7068                $runtime->loadProcess($processID); 
    7169 
  • sandbox/workflow/trunk/inc/class.WorkflowObjects.inc.php

    r795 r2372  
    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/trunk/inc/class.WorkflowSecurity.inc.php

    r795 r2372  
    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/trunk/inc/class.WorkflowUtils.inc.php

    r795 r2372  
    11<?php 
     2        require_once 'common.inc.php'; 
     3 
    24        //set here the global DEBUG level which is actually 0 (nothing) or 1 (all) 
    35        if (!defined('_DEBUG')) define('_DEBUG', 0); 
     
    102104                        $this->start            = (int)get_var('start', 'any', 0); 
    103105                        $this->search_str       = get_var('find', 'any', ''); 
    104                         $this->nextmatchs       = CreateObject('phpgwapi.nextmatchs'); 
     106                        $this->nextmatchs       = Factory::getInstance('nextmatchs'); 
    105107                } 
    106108 
    107109                /** 
    108110                 * Fill the process bar 
    109                  *  
     111                 * 
    110112                 * @param array $proc_info 
    111113                 * @access public 
     
    116118                        //echo "proc_info: <pre>";print_r($proc_info);echo "</pre>"; 
    117119                        $this->t->set_file('proc_bar_tpl', 'proc_bar.tpl'); 
    118                         $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     120                        $templateServer = &Factory::getInstance('TemplateServer'); 
    119121 
    120122                        if ($proc_info['wf_is_valid'] == 'y') 
     
    170172                /** 
    171173                 * Select activity representation icon 
    172                  *   
     174                 * 
    173175                 * @var string $type type of activity 
    174176                 * @var bool   $interactive interactive? 
     
    207209                                        $ic="no-activity.gif"; 
    208210                        } 
    209                         return '<img src="'. $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink($ic) .'" alt="'. lang($type) .'" title="'. lang($type) .'" />'; 
    210                 } 
    211          
     211                        return '<img src="'. Factory::getInstance('TemplateServer')->generateImageLink($ic) .'" alt="'. lang($type) .'" title="'. lang($type) .'" />'; 
     212                } 
     213 
    212214                /** 
    213215                 * Translate template file 
    214                  * @param string $template_name template name  
     216                 * @param string $template_name template name 
    215217                 * @return void 
    216218                 * @access public 
     
    359361                function export() 
    360362                { 
    361                         $this->process_manager  = CreateObject('workflow.workflow_processmanager'); 
     363                        $this->process_manager  = Factory::getInstance('workflow_processmanager'); 
    362364 
    363365                        // retrieve process info 
     
    387389                { 
    388390                        $file = "css/$css_name" . (($print_mode !== false) ? '_print' : '') . '.css'; 
    389                         return $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->getWebFile($file); 
    390                 } 
    391                  
     391                        return Factory::getInstance('TemplateServer')->getWebFile($file); 
     392                } 
     393 
    392394                /** 
    393395                 * Return a given duration in human readable form, usefull for workitems duration 
    394396                 * @param int $to given duration 
    395397                 * @return string given duration in human readable form 
    396                  * @access public  
     398                 * @access public 
    397399                 */ 
    398400                function time_diff($to) { 
  • sandbox/workflow/trunk/inc/class.bo_adminaccess.inc.php

    r795 r2372  
    1111 
    1212require_once('class.bo_ajaxinterface.inc.php'); 
    13 require_once('class.so_adminaccess.inc.php'); 
    14 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ProcessManager.php'); 
    1513require_once(PHPGW_API_INC . SEP . 'common_functions.inc.php'); 
    16 require_once(PHPGW_API_INC . SEP . 'class.acl.inc.php'); 
    1714 
    1815/** 
     
    4340                parent::bo_ajaxinterface(); 
    4441 
    45                 if (!$GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($_SESSION['phpgw_info']['workflow']['account_id'])) 
     42                if (!Factory::getInstance('workflow_acl')->checkWorkflowAdmin($_SESSION['phpgw_info']['workflow']['account_id'])) 
    4643                        exit(serialize(array('error' => 'Você não tem permissão para executar esta operação.'))); 
    4744 
    48                 $this->so = new so_adminaccess($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     45                $this->so = &Factory::getInstance('so_adminaccess', Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    4946        } 
    5047 
     
    5754        function get_all_processes() 
    5855        { 
    59                 $proc_mng = new ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     56                $proc_mng = &Factory::newInstance('ProcessManager'); 
    6057                $proc_list = $proc_mng->list_processes(0,-1,'wf_name__ASC'); 
    6158 
     
    315312        { 
    316313                $GLOBALS['phpgw']->db = $GLOBALS['ajax']->db; 
    317                 $acl = new ACL(); 
     314                $acl = &Factory::getInstance('acl'); 
    318315                $output = $this->so->getUserNames($acl->get_ids_for_location('admin_workflow', 1, 'workflow')); 
    319316                unset($GLOBALS['phpgw']->db); 
     
    332329                $ids = explode('.', str_replace('g', '', str_replace('u', '', $params['user_ids']))); 
    333330                $GLOBALS['phpgw']->db = $GLOBALS['ajax']->db; 
    334                 $acl = new ACL(); 
     331                $acl = &Factory::getInstance('acl'); 
    335332                foreach ($ids as $id) 
    336333                        $acl->add_repository('workflow', 'admin_workflow', $id, 1); 
     
    350347        { 
    351348                $GLOBALS['phpgw']->db = $GLOBALS['ajax']->db; 
    352                 $acl = new ACL(); 
     349                $acl = &Factory::getInstance('acl'); 
    353350                $acl->delete_repository('workflow', 'admin_workflow', (int) $params['admin_id']); 
    354351                unset($GLOBALS['phpgw']->db); 
  • sandbox/workflow/trunk/inc/class.bo_adminjobs.inc.php

    r795 r2372  
    1111 
    1212require_once 'class.bo_ajaxinterface.inc.php'; 
    13 require_once 'class.so_adminjobs.inc.php'; 
    14 require_once 'nano/JSON.php'; 
    1513 
    1614/** 
     
    3634        { 
    3735                parent::bo_ajaxinterface(); 
    38                 $this->so = new so_adminjobs(); 
     36                $this->so = &Factory::getInstance('so_adminjobs'); 
    3937        } 
    4038 
     
    10098                /* paginate the result */ 
    10199                $logEntriesPerPage = 30; 
    102                 $paging = &$GLOBALS['workflow']['factory']->newInstance('Paging', $logEntriesPerPage, $params); 
     100                $paging =& Factory::newInstance('Paging', $logEntriesPerPage, $params); 
    103101                $logs = $paging->restrictItems($logs); 
    104102 
  • sandbox/workflow/trunk/inc/class.bo_adminsource.inc.php

    r795 r2372  
    1111 
    1212require_once('class.bo_ajaxinterface.inc.php'); 
    13  
    14 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ProcessManager.php'); 
    15 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'RoleManager.php'); 
    16 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ActivityManager.php'); 
    17 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'API' . SEP . 'Process.php'); 
    1813 
    1914/** 
     
    8075                $fileSizeUnit[] = 'Mb'; 
    8176                $fileSizeUnit[] = 'Gb'; 
    82                  
     77 
    8378                $unitSelect = 0; 
    8479                while ($value > 1024.0) 
     
    8782                        $unitSelect++; 
    8883                } 
    89          
     84 
    9085                $output = round($value, 1); 
    9186                $output .= " " . $fileSizeUnit[$unitSelect]; 
    92          
     87 
    9388                return $output; 
    9489        } 
    95          
     90 
    9691        /** 
    9792        * 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                  
     93        * @param  array $p process process data 
     94        * @return array 
     95        * @access public 
     96        */ 
     97        function get_toolbar_data($p) 
     98        { 
     99 
     100                $process_manager = &Factory::newInstance('ProcessManager'); 
     101                $proc_info       = $process_manager->get_process($p['proc_id']); 
     102 
    108103                $web_server_url  = $_SESSION['phpgw_info']['workflow']['server']['webserver_url']; 
    109                 $img_default_dir = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink(''); 
    110                  
     104                $img_default_dir = Factory::getInstance('TemplateServer')->generateImageLink(''); 
     105 
    111106                if ($proc_info['wf_is_valid'] == 'y') 
    112107                { 
     
    119114                        $alt_validity = tra('invalid'); 
    120115                } 
    121          
     116 
    122117                // 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. 
    123118                if ($proc_info['wf_is_active'] == 'y') 
     
    138133                        $start_stop_img  = ''; 
    139134                } 
    140          
     135 
    141136                /* load other processes link */ 
    142137                $proc_ids = $GLOBALS['ajax']->acl->get_granted_processes($_SESSION['phpgw_info']['workflow']['account_id']); 
     
    145140                else 
    146141                        $where = ' wf_p_id = -1 '; 
    147          
     142 
    148143                $processesInfo = &$process_manager->list_processes(0, -1, 'wf_name__asc', '', $where); 
    149144                $otherProcesses = array(); 
    150145                foreach ($processesInfo['data'] as $pi) 
    151146                        $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          
     147 
    153148                $toolbar_data = array ( 
    154149                        'proc_name'                                     => $proc_info['wf_name'], 
     
    177172                        'other_processes'                       => $otherProcesses 
    178173                ); 
    179                          
     174 
    180175                return $toolbar_data; 
    181176                } 
    182                  
    183                  
     177 
     178 
    184179        /** 
    185180        * Get process model files 
    186         * @param  array $p process process data  
    187         * @return array 
    188         * @access public  
     181        * @param  array $p process process data 
     182        * @return array 
     183        * @access public 
    189184        */ 
    190185        function get_model_files($p) 
    191186        { 
    192                 switch($p['type'])  
     187                switch($p['type']) 
    193188                { 
    194189                        case 'include'  : $path = PHPGW_SERVER_ROOT . SEP . 'workflow' . SEP . 'js' . SEP . 'adminsource' . SEP . 'inc'; 
     
    203198                $files          = array(); 
    204199 
    205                 if ($handle = opendir($path))  
    206                 { 
    207                         while (false !== ($file_name = readdir($handle)))  
    208                         {        
    209                                 if (!is_dir($path.SEP.$file_name))  
     200                if ($handle = opendir($path)) 
     201                { 
     202                        while (false !== ($file_name = readdir($handle))) 
     203                        { 
     204                                if (!is_dir($path.SEP.$file_name)) 
    210205                                { 
    211206                                        $files[] = array('file_name'     => $file_name); 
     
    217212                array_multisort($col_file_name,SORT_ASC,$files); 
    218213 
    219                 return $files;  
     214                return $files; 
    220215        } 
    221216 
    222217        /** 
    223218        * Get process php files 
    224         * @param array $p process data  
    225         * @return array 
    226         * @access public  
     219        * @param array $p process data 
     220        * @return array 
     221        * @access public 
    227222        */ 
    228223        function get_php_files($p) 
    229224        { 
    230                 $process_manager    = new ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     225                $process_manager    = &Factory::newInstance('ProcessManager'); 
    231226                $proc_info          = $process_manager->get_process($p['proc_id']); 
    232                 $activity_manager   = new ActivityManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     227                $activity_manager   = &Factory::newInstance('ActivityManager'); 
    233228                $process_activities = $activity_manager->list_activities($p['proc_id'], 0, -1, 'wf_name__asc', '','',false); 
    234229                $path = GALAXIA_PROCESSES . SEP . $proc_info['wf_normalized_name'] . SEP . 'code' . SEP .'activities' . SEP; 
    235                  
     230 
    236231                $files = array(); 
    237232 
     
    242237                foreach ($process_activities['data'] as $process_activity) 
    243238                { 
    244                          
     239 
    245240                        $file_name   = $process_activity['wf_normalized_name'].'.php'; 
    246241                        $activity_id = $process_activity['wf_activity_id']; 
    247242                        $tamanho     = filesize($path.$file_name); 
    248243                        $modificado  = date('d/m/Y H:i:s', filemtime($path.$file_name) ); 
    249                          
     244 
    250245                        $files[] = array('file_name'     => $file_name, 
    251246                                                         'activity_id'   => $activity_id, 
     
    258253                                                         'tipo_codigo'   => 'atividade' 
    259254                        ); 
    260                          
     255 
    261256                        $col_file_name[]  = $file_name; 
    262257                        $col_tamanho[]    = $tamanho; 
    263258                        $col_modificado[] = $modificado; 
    264259                } 
    265                  
    266                 if (isset($p['sort']))  
     260 
     261                if (isset($p['sort'])) 
    267262                { 
    268263                        $order_by = ($p['order_by'] == 1) ? SORT_ASC : SORT_DESC; 
     
    279274                        } 
    280275                } 
    281                  
    282                 return $files;  
    283         } 
    284          
    285         /** 
    286         * Delete process file  
     276 
     277                return $files; 
     278        } 
     279 
     280        /** 
     281        * Delete process file 
    287282        * @param array $p process data 
    288283        * @return array 
    289         * @access public  
     284        * @access public 
    290285        */ 
    291286        function delete_file($p) 
     
    293288                if ((strpos($p['file_name'],'/') !== false) || (strpos($p['file_name'],'/') !== false)) 
    294289                        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']);  
     290                $process_manager = &Factory::newInstance('ProcessManager'); 
     291                $proc_info = $process_manager->get_process($p['proc_id']); 
    297292                $file_name = $p['file_name']; 
    298                 $proc_name = $proc_info['wf_normalized_name'];  
     293                $proc_name = $proc_info['wf_normalized_name']; 
    299294                $type      = $p['type']; 
    300295                if (strpos($file_name,'/')) return 'Nome de arquivo inválido.'; 
    301296                if (!strlen($proc_name)) return 'ID de Processo inválido.'; 
    302                  
     297 
    303298    switch($type) 
    304299    { 
     
    315310                                $path = GALAXIA_PROCESSES . '/' . $proc_info['wf_normalized_name'] . '/resources/' . $file_name; 
    316311            break; 
    317                          
     312 
    318313    } 
    319     
    320                 if ($type == 'resource')  
     314 
     315                if ($type == 'resource') 
    321316                { 
    322317                        $complete_path = $path; 
    323                 }  
    324                 else  
     318                } 
     319                else 
    325320                { 
    326321                        $complete_path = GALAXIA_PROCESSES . SEP . $proc_name . SEP . 'code' . SEP . $path; 
    327322                } 
    328          
    329                 if (file_exists($complete_path))  
     323 
     324                if (file_exists($complete_path)) 
    330325                { 
    331326                        if (unlink($complete_path)) 
     
    342337                        return 'O arquivo '.$file_name.' não existe.'; 
    343338                } 
    344         }        
    345         /** 
    346         * Create process new file  
     339        } 
     340        /** 
     341        * Create process new file 
    347342        * @param array $p process 
    348343        * @return array 
    349         * @access public  
     344        * @access public 
    350345        */ 
    351346        function create_file($p) 
    352347        { 
    353                 $process_manager = new ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
    354                 $proc_info = $process_manager->get_process($p['proc_id']);  
     348                $process_manager = &Factory::newInstance('ProcessManager'); 
     349                $proc_info = $process_manager->get_process($p['proc_id']); 
    355350                $file_name = $p['file_name']; 
    356                 $proc_name = $proc_info['wf_normalized_name'];  
     351                $proc_name = $proc_info['wf_normalized_name']; 
    357352                $type      = $p['type']; 
    358353 
     
    386381                } 
    387382 
    388                 if (file_exists($complete_path))  
    389                 { 
    390                         if (!$p['rewrite'])  
     383                if (file_exists($complete_path)) 
     384                { 
     385                        if (!$p['rewrite']) 
    391386                        { 
    392387                                return FILE_ALREADY_EXISTS; 
     
    396391                } 
    397392 
    398                 if ($fp = fopen($complete_path, 'w'))  
     393                if ($fp = fopen($complete_path, 'w')) 
    399394                { 
    400395                        $basepath = PHPGW_SERVER_ROOT.SEP.'workflow'.SEP.'js'.SEP.'adminsource'; 
     
    409404                        if ($type == 'template' || $type == 'include') 
    410405                        { 
    411                                 if (file_exists($basepath.SEP.$p['modelo']))  
     406                                if (file_exists($basepath.SEP.$p['modelo'])) 
    412407                                { 
    413408                                        fwrite($fp,file_get_contents($basepath.SEP.$p['modelo'])); 
     
    423418                } 
    424419        } 
    425          
     420 
    426421        /** 
    427422        * Get process include files 
    428423        * @param  array $p process 
    429424        * @return array 
    430         * @access public  
     425        * @access public 
    431426        */ 
    432427        function get_include_files($p) 
    433428        { 
    434                 $process_manager    = new ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
    435                 $proc_info          = $process_manager->get_process($p['proc_id']);  
     429                $process_manager    = &Factory::newInstance('ProcessManager'); 
     430                $proc_info          = $process_manager->get_process($p['proc_id']); 
    436431                $path = GALAXIA_PROCESSES . SEP . $proc_info['wf_normalized_name'] . SEP . 'code'; 
    437432 
     
    442437                $files          = array(); 
    443438 
    444                 if ($handle = opendir($path))  
    445                 { 
    446                         while (false !== ($file_name = readdir($handle)))  
    447                         {        
    448                                 if (!is_dir($path.SEP.$file_name))  
     439                if ($handle = opendir($path)) 
     440                { 
     441                        while (false !== ($file_name = readdir($handle))) 
     442                        { 
     443                                if (!is_dir($path.SEP.$file_name)) 
    449444                                { 
    450445                                        $tamanho     = filesize($path.SEP.$file_name); 
     
    467462 
    468463 
    469                 if (isset($p['sort']))  
     464                if (isset($p['sort'])) 
    470465                { 
    471466                        $order_by = ($p['order_by'] == 1) ? SORT_ASC : SORT_DESC; 
     
    483478                } 
    484479 
    485                 return $files;  
    486         } 
    487  
    488         /** 
    489         * Get process template files  
    490         * @param array $p process data  
    491         * @return array 
    492         * @access public  
     480                return $files; 
     481        } 
     482 
     483        /** 
     484        * Get process template files 
     485        * @param array $p process data 
     486        * @return array 
     487        * @access public 
    493488        */ 
    494489        function get_template_files($p) 
    495490        { 
    496                 $process_manager    = new ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
    497                 $proc_info          = $process_manager->get_process($p['proc_id']);  
     491                $process_manager    = &Factory::newInstance('ProcessManager'); 
     492                $proc_info          = $process_manager->get_process($p['proc_id']); 
    498493                $path = GALAXIA_PROCESSES . SEP . $proc_info['wf_normalized_name'] . SEP . 'code' . SEP .'templates'; 
    499494 
     
    502497                $col_modificado = array(); 
    503498 
    504                 if ($handle = opendir($path))  
    505                 { 
    506                         while (false !== ($file_name = readdir($handle)))  
    507                         {        
    508                                 if (!is_dir($path.SEP.$file_name))  
     499                if ($handle = opendir($path)) 
     500                { 
     501                        while (false !== ($file_name = readdir($handle))) 
     502                        { 
     503                                if (!is_dir($path.SEP.$file_name)) 
    509504                                { 
    510505                                        $tamanho     = filesize($path.SEP.$file_name); 
     
    541536 
    542537        } 
    543     }    
    544  
    545                 return $files;  
    546         } 
    547  
    548         /** 
    549         * Upload process resource   
    550         *  
     538    } 
     539 
     540                return $files; 
     541        } 
     542 
     543        /** 
     544        * Upload process resource 
     545        * 
    551546        * @param array $p process 
    552547        * @return array 
    553         * @access public  
     548        * @access public 
    554549        */ 
    555550        function upload_resource($p) 
    556551        { 
    557                 $process_manager = new ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     552                $process_manager = &Factory::newInstance('ProcessManager'); 
    558553                $proc_info = $process_manager->get_process($p['proc_id']); 
    559554                $file_name = basename($_FILES['resource_file']['name']); 
     
    587582                if (strpos($_REQUEST['file_name'],'/') !== false) 
    588583                        return 'Não foi possível executar a operação solicitada'; 
    589                 $process_manager    = new ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     584                $process_manager    = &Factory::newInstance('ProcessManager'); 
    590585                $proc_info          = $process_manager->get_process($_REQUEST['proc_id']); 
    591586 
     
    617612                        $completePath = GALAXIA_PROCESSES . SEP . $proc_name . SEP . 'code' . SEP . $path; 
    618613 
    619                 $GLOBALS['workflow']['factory']->getInstance('ResourcesRedirector')->show($completePath, 'application/force-download'); 
     614                Factory::getInstance('ResourcesRedirector')->show($completePath, 'application/force-download'); 
    620615                exit; 
    621616        } 
     
    630625        function get_resource_files($p) 
    631626        { 
    632                 $process_manager    = new ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     627                $process_manager    = &Factory::newInstance('ProcessManager'); 
    633628                $proc_info          = $process_manager->get_process($p['proc_id']); 
    634629 
  • sandbox/workflow/trunk/inc/class.bo_agent.inc.php

    r795 r2372  
    278278                        if (!(isset($this->process))) 
    279279                        { 
    280                                 $this->process = CreateObject('workflow.workflow_process'); 
     280                                $this->process = Factory::getInstance('workflow_process'); 
    281281                                $this->process->getProcess($wf_p_id); 
    282282                        } 
  • sandbox/workflow/trunk/inc/class.bo_agent_mail_smtp.inc.php

    r795 r2372  
    109109        { 
    110110                parent::bo_agent(); 
    111                 $this->so_agent = CreateObject('workflow.so_agent_mail_smtp'); 
    112                 $this->bo_emailadmin = CreateObject('emailadmin.bo'); 
     111                $this->so_agent = Factory::getInstance('so_agent_mail_smtp'); 
     112                $this->bo_emailadmin = Factory::getInstance('bo'); 
    113113                //the showProcessConfigurationFields is not done here, quite harder to build 
    114114                $this->ProcessConfigurationFieldsdefault = array( 
     
    312312        function init() 
    313313        { 
    314                 $this->mail = CreateObject('phpgwapi.phpmailer'); 
     314                $this->mail = Factory::getInstance('phpmailer'); 
    315315                //set the $this->conf 
    316316                $this->getProcessConfigurationFields($this->activity->getProcessId()); 
     
    466466                } 
    467467 
    468                 $process = CreateObject('workflow.workflow_process'); 
     468                $process = Factory::getInstance('workflow_process'); 
    469469                $process->getProcess($this->process_id); 
    470470                $this->process_name = $process->getName(); 
     
    637637                                        if ($this->process_name=='') 
    638638                                        { 
    639                                                 $process = CreateObject('workflow.workflow_process'); 
     639                                                $process = Factory::getInstance('workflow_process'); 
    640640                                                $process->getProcess($this->process_id); 
    641641                                                $this->process_name = $process->getName(); 
     
    648648                                        if ($this->process_version=='') 
    649649                                        { 
    650                                                 $process = CreateObject('workflow.workflow_process'); 
     650                                                $process = Factory::getInstance('workflow_process'); 
    651651                                                $process->getProcess($this->process_id); 
    652652                                                $this->process_name = $process->getName(); 
     
    674674                                        if (!is_object($this->account)) 
    675675                                        { 
    676                                                 $this->account = CreateObject('phpgwapi.accounts'); 
     676                                                $this->account = Factory::getInstance('accounts'); 
    677677                                        } 
    678678                                        $ask_user = $this->instance->getOwner(); 
     
    683683                                        if (!is_object($this->role_manager)) 
    684684                                        { 
    685                                                 $this->role_manager = CreateObject('workflow.workflow_rolemanager'); 
     685                                                $this->role_manager = Factory::getInstance('workflow_rolemanager'); 
    686686                                        } 
    687687                                        if (!is_object($this->account)) 
    688688                                        { 
    689                                                 $this->account = CreateObject('phpgwapi.accounts'); 
     689                                                $this->account = Factory::getInstance('accounts'); 
    690690                                        } 
    691691                                        $my_subset = array('wf_activity_name' => $this->activity->getName()); 
     
    718718                                                        if (!is_object($this->account)) 
    719719                                                        { 
    720                                                                 $this->account = CreateObject('phpgwapi.accounts'); 
     720                                                                $this->account = Factory::getInstance('accounts'); 
    721721                                                        } 
    722722                                                        $ask_user = $this->account->name2id($second_part); 
     
    731731                                                        if (!is_object($this->role_manager)) 
    732732                                                        { 
    733                                                                 $this->role_manager = CreateObject('workflow.workflow_rolemanager'); 
     733                                                                $this->role_manager = Factory::getInstance('workflow_rolemanager'); 
    734734                                                        } 
    735735                                                        if (!is_object($this->account)) 
    736736                                                        { 
    737                                                                 $this->account = CreateObject('phpgwapi.accounts'); 
     737                                                                $this->account = Factory::getInstance('accounts'); 
    738738                                                        } 
    739739                                                        $my_subset = array('wf_role_name' => $second_part); 
  • sandbox/workflow/trunk/inc/class.bo_ajaxinterface.inc.php

    r795 r2372  
    3636 
    3737require_once(PHPGW_SERVER_ROOT . SEP . 'workflow' . SEP . 'inc' . SEP . 'common.inc.php'); 
    38 require_once(PHPGW_API_INC . SEP . 'class.db.inc.php'); 
    39 require_once(PHPGW_SERVER_ROOT . SEP . 'workflow' . SEP . 'inc' . SEP . 'engine' . SEP . 'class.ajax_ldap.inc.php'); 
    4038require_once(PHPGW_SERVER_ROOT . SEP . 'workflow' . SEP . 'inc' . SEP . 'engine' . SEP . 'class.ajax_config.inc.php'); 
    4139require_once(PHPGW_SERVER_ROOT . SEP . 'workflow' . SEP . 'inc' . SEP . 'engine' . SEP . 'config.ajax.inc.php'); 
    42 require_once(PHPGW_SERVER_ROOT . SEP . 'workflow' . SEP . 'inc' . SEP . 'class.so_adminaccess.inc.php'); 
    4340 
    4441/** 
     
    6663                if (isset($_SESSION['phpgw_info']['workflow']['account_id'])) 
    6764                { 
    68                         $GLOBALS['ajax']->ldap = new ajax_ldap(); 
    69                         $GLOBALS['ajax']->db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso(); 
     65                        $GLOBALS['ajax']->ldap = &Factory::getInstance('ajax_ldap'); 
     66                        $GLOBALS['ajax']->db =& Factory::getInstance('WorkflowObjects')->getDBExpresso(); 
    7067                        $GLOBALS['ajax']->db->Halt_On_Error = 'no'; 
    7168 
    72                         $GLOBALS['ajax']->db_workflow = &$GLOBALS['workflow']['workflowObjects']->getDBWorkflow(); 
     69                        $GLOBALS['ajax']->db_workflow =& Factory::getInstance('WorkflowObjects')->getDBWorkflow(); 
    7370                        $GLOBALS['ajax']->db_workflow->Halt_On_Error = 'no'; 
    7471 
    7572                        $GLOBALS['phpgw']->ADOdb = &$GLOBALS['ajax']->db->Link_ID; 
    76                         $GLOBALS['ajax']->acl = new so_adminaccess($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     73                        $GLOBALS['ajax']->acl = &Factory::getInstance('so_adminaccess', Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    7774                } 
    7875                else 
  • sandbox/workflow/trunk/inc/class.bo_editor.inc.php

    r795 r2372  
    1111 
    1212require_once('class.bo_ajaxinterface.inc.php'); 
    13 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ActivityManager.php'); 
    14 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ProcessManager.php'); 
    1513/** 
    1614 * @package Workflow 
     
    234232                if ($p['tipo_codigo'] != 'include') 
    235233                { 
    236                         $activity_manager   = new ActivityManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     234                        $activity_manager   = &Factory::newInstance('ActivityManager'); 
    237235 
    238236                        if ($this->check_process($p['proc_id'], &$activity_manager, &$error_str) == 'n') 
  • sandbox/workflow/trunk/inc/class.bo_external_applications.inc.php

    r795 r2372  
    1111\**************************************************************************/ 
    1212 
    13 require_once('class.so_external_applications.inc.php'); 
    1413require_once('class.bo_ajaxinterface.inc.php'); 
    1514/** 
     
    3433        { 
    3534                parent::bo_ajaxinterface(); 
    36                 $this->so = new so_external_applications(); 
     35                $this->so = &Factory::getInstance('so_external_applications'); 
    3736        } 
    3837 
  • sandbox/workflow/trunk/inc/class.bo_monitors.inc.php

    r795 r2372  
    1212require_once('class.bo_ajaxinterface.inc.php'); 
    1313 
    14 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'GUI' . SEP . 'GUI.php'); 
    15 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ProcessManager.php'); 
    16 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ActivityManager.php'); 
    17 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'InstanceManager.php'); 
    18 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'RoleManager.php'); 
    19 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessMonitor' . SEP . 'ProcessMonitor.php'); 
    20 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'API' . SEP . 'Instance.php'); 
    21 require_once('class.workflow_acl.inc.php'); 
    22 require_once('class.bo_adminaccess.inc.php'); 
    23 require_once('class.powergraphic.inc.php'); 
     14 
     15/** 
     16 * DO NOT remove this line. Ever. Somehow, monitors interface will stop working.. 
     17 */ 
     18require_once(PHPGW_API_INC . SEP . 'common_functions.inc.php'); 
     19 
    2420 
    2521/** 
     
    134130        { 
    135131                parent::bo_ajaxinterface(); 
    136                 $GLOBALS['ajax']->gui   = new GUI($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     132                $GLOBALS['ajax']->gui   = &Factory::newInstance('GUI'); 
    137133                $this->userID                   = $_SESSION['phpgw_info']['workflow']['account_id']; 
    138134                $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); 
     135                $this->processManager   = &Factory::newInstance('ProcessManager'); 
     136                $this->activityManager  = &Factory::newInstance('ActivityManager'); 
     137                $this->instanceManager  = &Factory::newInstance('InstanceManager'); 
     138                $this->roleManager              = &Factory::newInstance('RoleManager'); 
     139                $this->processMonitor   = &Factory::newInstance('ProcessMonitor'); 
    144140        } 
    145141 
     
    169165        private function convertFiltersToSQL($filters) 
    170166        { 
    171                 require_once 'nano/JSON.php'; 
    172167 
    173168                /* desserializa os dados */ 
    174                 $JSON = new Services_JSON(); 
     169                $JSON = &Factory::newInstance('Services_JSON'); 
    175170                /* desserializa a array principal, depois desserializa cada elemento desta array e, por fim, converte os elementos (que estão em forma de objeto) para array associativa */ 
    176171                $filters = array_map('get_object_vars', array_map(array($JSON, 'decode'), $JSON->decode($filters))); 
     
    335330                $filters[] = '(gia.wf_user IS NOT NULL)'; 
    336331 
    337                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     332                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    338333                if (!$completeData) 
    339334                { 
    340                         $paging = $GLOBALS['workflow']['factory']->newInstance('Paging', 500, $_POST); 
     335                        $paging = Factory::newInstance('Paging', 500, $_POST); 
    341336                        $tmp = $this->processMonitor->monitor_list_instances($paging->nextItem, $paging->itemsPerPage, $order, '', implode(' AND ', $filters)); 
    342337                        $output['data'] = $paging->restrictItems(array_values($tmp['data']), $tmp['cant']); 
     
    353348                $activityMapping = array(); 
    354349                $instanceCount = count($output['data']); 
    355                 $cachedLDAP = &$GLOBALS['workflow']['factory']->getInstance('CachedLDAP'); 
     350                $cachedLDAP = &Factory::getInstance('CachedLDAP'); 
    356351                for ($i = 0; $i < $instanceCount; $i++) 
    357352                { 
     
    476471                /* load the data */ 
    477472                $filters[] = '(gp.wf_p_id = ' . $params['pid'] . ')'; 
    478                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     473                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    479474                if (!$completeData) 
    480475                { 
    481                         $paging = $GLOBALS['workflow']['factory']->newInstance('Paging', 500, $_POST); 
     476                        $paging = Factory::newInstance('Paging', 500, $_POST); 
    482477                        $tmp = $this->processMonitor->monitor_list_completed_instances($paging->nextItem, $paging->itemsPerPage, $order, '', implode(' AND ', $filters)); 
    483478                        $output['data'] = $paging->restrictItems(array_values($tmp['data']), $tmp['cant']); 
     
    491486                } 
    492487 
    493                 $cachedLDAP = &$GLOBALS['workflow']['factory']->getInstance('CachedLDAP'); 
     488                $cachedLDAP = &Factory::getInstance('CachedLDAP'); 
    494489                $userMapping = array(); 
    495490                $instanceCount = count($output['data']); 
     
    627622                        } 
    628623                        else 
    629                                 $output['fullname'] = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($user); 
     624                                $output['fullname'] = Factory::getInstance('WorkflowLDAP')->getName($user); 
    630625 
    631626                $this->instanceManager->set_instance_user($params['iid'], $params['aid'], $user); 
     
    648643                if ($params['ns'] == 'aborted') 
    649644                { 
    650                         $realInstance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     645                        $realInstance = &Factory::newInstance('Instance'); 
    651646                        $realInstance->getInstance($params['iid']); 
    652647                        if (!empty($realInstance->instanceId)) 
     
    684679 
    685680                /* use next user or * for the new instance */ 
    686                 $realInstance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     681                $realInstance = &Factory::newInstance('Instance'); 
    687682                $realInstance->getInstance($params['iid'], false, false); 
    688683                $user = $realInstance->getNextUser($params['aid']); 
     
    751746 
    752747                $maximumDisplaySize = 100; 
    753                 $instance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     748                $instance = &Factory::newInstance('Instance'); 
    754749                $instance->getInstance($params['iid']); 
    755750 
     
    783778                        return "Você não tem permissão para executar este procedimento!"; 
    784779 
    785                 $instance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     780                $instance = &Factory::newInstance('Instance'); 
    786781                $instance->getInstance($params['iid']); 
    787782                $output = $params; 
     
    804799                $maximumDisplaySize = 100; 
    805800 
    806                 $instance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     801                $instance = &Factory::newInstance('Instance'); 
    807802                $instance->getInstance($params['iid']); 
    808803                $instance->set($params['name'], $params['value']); 
     
    835830                        return "Você não tem permissão para executar este procedimento!"; 
    836831 
    837                 $instance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     832                $instance = &Factory::newInstance('Instance'); 
    838833                $instance->getInstance($params['iid']); 
    839834                $instance->clear($params['name']); 
     
    858853                $output = array(); 
    859854                $urlPrefix = 'workflow/inc/class.powergraphic.inc.php?'; 
    860                 $powergraphic = new powergraphic; 
     855                $powergraphic = &Factory::getInstance('powergraphic'); 
    861856                $powergraphic->graphic_1 = $params['pid']; 
    862857                $powergraphic->skin = 1; 
     
    904899                /* prepare the data */ 
    905900                $aux2 = array(); 
    906                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     901                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    907902                foreach ($aux as $user => $count) 
    908903                        $aux2[] = array( 
     
    984979 
    985980                /* load LDAP info and sort the result */ 
    986                 $foundUsers = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getNames($users); 
     981                $foundUsers = Factory::getInstance('WorkflowLDAP')->getNames($users); 
    987982                usort($foundUsers, create_function('$a,$b', 'return strcasecmp($a[\'name\'],$b[\'name\']);')); 
    988983 
     
    991986                if (count($users) > count($foundUsers)) 
    992987                { 
    993                         $cachedLDAP = &$GLOBALS['workflow']['factory']->getInstance('CachedLDAP'); 
     988                        $cachedLDAP = &Factory::getInstance('CachedLDAP'); 
    994989                        $foundUsersID = array_map(create_function('$a', 'return $a[\'id\'];'), $foundUsers); 
    995990                        $missingUsers = array_diff($users, $foundUsersID); 
     
    12421237                        return $output; 
    12431238 
    1244                 $BOUserInterface = &$GLOBALS['workflow']['factory']->getInstance('bo_userinterface'); 
     1239                $BOUserInterface = &Factory::getInstance('bo_userinterface'); 
    12451240 
    12461241                /* initialize some variables */ 
     
    13441339 
    13451340                /* load the recipient e-mail */ 
    1346                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     1341                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    13471342                foreach ($output as $key => $value) 
    13481343                { 
     
    13961391 
    13971392                /* prepare the environment to load some configuration values from other module */ 
    1398                 $GLOBALS['phpgw']->db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso(); 
    1399                 $GLOBALS['phpgw']->common = CreateObject('phpgwapi.common'); 
    1400                 $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions'); 
     1393                $GLOBALS['phpgw']->db =& Factory::getInstance('WorkflowObjects')->getDBExpresso(); 
     1394                $GLOBALS['phpgw']->common = Factory::getInstance('common'); 
     1395                $GLOBALS['phpgw']->session = Factory::getInstance('sessions'); 
    14011396                function lang($a){return $a;}; 
    14021397 
    14031398                /* get the required configuration */ 
    1404                 $BOEmailAdmin = $GLOBALS['workflow']['factory']->newForeignInstance('emailadmin', 'bo'); 
     1399                $BOEmailAdmin = Factory::getInstance('bo'); 
    14051400                $profileList = $BOEmailAdmin->getProfileList(); 
    14061401                $profile = $BOEmailAdmin->getProfile($profileList[0]['profileID']); 
     1402 
     1403                /** 
     1404                 * XXX - XXX 
     1405                 * It's weird.. There are two almost identical PHPMailer classes. 
     1406                 * The class registered in our factory is under 'EGW_INC_ROOT'. 
     1407                 * The class used here has the same name and it's under another 
     1408                 * directory. For now, let's just include it in the old-fashion 
     1409                 * way, but if someone, someday try to use both classes in the 
     1410                 * same access, it could cause us troubles. 
     1411                 */ 
    14071412 
    14081413                /* configure the PHPMailer class to send the e-mails */ 
     
    14941499        { 
    14951500                $output = array(); 
    1496                 $cachedLDAP = &$GLOBALS['workflow']['factory']->getInstance('CachedLDAP'); 
    1497                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     1501                $cachedLDAP = &Factory::getInstance('CachedLDAP'); 
     1502                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    14981503                foreach ($userIDs as $userID) 
    14991504                { 
     
    15421547                $filters[] = '(gia.wf_user IS NOT NULL)'; 
    15431548 
    1544                 $cachedLDAP = &$GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     1549                $cachedLDAP = &Factory::newInstance('CachedLDAP'); 
    15451550                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP); 
    15461551                $output = array(); 
     
    15591564                } 
    15601565 
    1561                 $validUsers = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getNames(array_keys($userIDs)); 
     1566                $validUsers = Factory::getInstance('WorkflowLDAP')->getNames(array_keys($userIDs)); 
    15621567                array_walk($validUsers, create_function('&$a', '$a = $a[\'id\'];')); 
    15631568 
  • sandbox/workflow/trunk/inc/class.bo_move_instances.inc.php

    r795 r2372  
    1212 
    1313require_once('class.bo_ajaxinterface.inc.php'); 
    14 require_once('class.so_move_instances.inc.php'); 
    15 require_once('nano/JSON.php'); 
    1614 
    1715 
     
    3937        { 
    4038                parent::bo_ajaxinterface(); 
    41                 $this->so = new so_move_instances(); 
     39                $this->so = &Factory::getInstance('so_move_instances'); 
    4240        } 
    4341 
     
    7977        function moveInstances($params) 
    8078        { 
    81                 $JSON = new Services_JSON(); 
     79                $JSON = &Factory::newInstance('Services_JSON'); 
    8280 
    8381                /* convert the mappgin element to array */ 
  • sandbox/workflow/trunk/inc/class.bo_orgchart.inc.php

    r2042 r2372  
    1010\**************************************************************************/ 
    1111 
    12 require_once('class.so_orgchart.inc.php'); 
    1312require_once('class.bo_ajaxinterface.inc.php'); 
    1413/** 
     
    4746        { 
    4847                parent::bo_ajaxinterface(); 
    49                 $this->so = new so_orgchart(); 
     48                $this->so = &Factory::getInstance('so_orgchart'); 
    5049        } 
    5150 
  • sandbox/workflow/trunk/inc/class.bo_participants.inc.php

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

    r2085 r2372  
    1010\**************************************************************************/ 
    1111 
    12 require_once('class.so_userinterface.inc.php'); 
    1312require_once('class.bo_ajaxinterface.inc.php'); 
    14 require_once('class.Paging.inc.php'); 
    15  
    16 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'GUI' . SEP . 'GUI.php'); 
    17 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ActivityManager.php'); 
     13 
    1814/** 
    1915 * @package Workflow 
     
    4339        function bo_userinterface() 
    4440        { 
    45                 parent::bo_ajaxinterface();      
    46                 $this->so = new so_userinterface(); 
    47                 $GLOBALS['ajax']->gui = new GUI($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     41                parent::bo_ajaxinterface(); 
     42                $this->so = &Factory::getInstance('so_userinterface'); 
     43                $GLOBALS['ajax']->gui = &Factory::newInstance('GUI'); 
    4844        } 
    4945 
     
    6864                $webserver_url = $_SESSION['phpgw_info']['workflow']['server']['webserver_url']; 
    6965 
    70                 $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     66                $templateServer =& Factory::getInstance('TemplateServer'); 
    7167                foreach ($result['data'] as $line) 
    7268                { 
     
    120116                $pid = $params['pid']; 
    121117                $result = array(); 
    122                  
    123                 $process = new Process($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     118 
     119                $process = &Factory::newInstance('Process'); 
    124120                $process->getProcess($pid); 
    125121                $result['wf_procname'] = $process->name; 
    126122                $result['wf_version'] = $process->version; 
    127123                $result['wf_description'] = $process->description; 
    128                  
    129                 $activ_manager = new ActivityManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     124 
     125                $activ_manager = &Factory::newInstance('ActivityManager'); 
    130126                $result['wf_activities'] = $activ_manager->get_process_activities($pid); 
    131                  
    132                 $this->disconnect_all(); 
    133                  
    134                 return $result;  
     127 
     128                $this->disconnect_all(); 
     129 
     130                return $result; 
    135131        } 
    136132 
     
    148144                $itemsPerPage = isset($preferences['ui_items_per_page']) ? $preferences['ui_items_per_page'] : 15; 
    149145                $lightVersion = ((isset($preferences['use_light_interface']) ? $preferences['use_light_interface'] : 0) == 1); 
    150                 $paging = new Paging($itemsPerPage, $_POST); 
     146                $paging = Factory::newInstance('Paging', $itemsPerPage, $_POST); 
    151147 
    152148                /* define the sorting */ 
     
    263259                                else 
    264260                                        if ($row['wf_user'] != '') 
    265                                                 $row['wf_user_fullname'] = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($row['wf_user']); 
     261                                                $row['wf_user_fullname'] = Factory::getInstance('WorkflowLDAP')->getName($row['wf_user']); 
    266262 
    267263                                /* unset unneeded information */ 
     
    495491                } 
    496492 
    497                 $instance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     493                $instance = &Factory::newInstance('Instance'); 
    498494                $instance->getInstance($instanceID); 
    499495 
    500                 $process = new Process($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     496                $process = &Factory::newInstance('Process'); 
    501497                $process->getProcess($instance->pId); 
    502498 
     
    508504                        'wf_instance_id' => $instance->instanceId, 
    509505                        'wf_priority' => $instance->priority, 
    510                         'wf_owner' => $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($instance->owner), 
     506                        'wf_owner' => Factory::getInstance('WorkflowLDAP')->getName($instance->owner), 
    511507                        'wf_next_activity' => $instance->nextActivity, 
    512                         'wf_next_user' => $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($instance->nextUser), 
     508                        'wf_next_user' => Factory::getInstance('WorkflowLDAP')->getName($instance->nextUser), 
    513509                        'wf_name' => $instance->name, 
    514510                        'wf_category' => $instance->category, 
     
    526522                $result['wf_ended'] = ""; 
    527523 
    528                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     524                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    529525                foreach ($instance->workitems as $line) 
    530526                { 
     
    657653                $cod_process = array(); 
    658654 
    659                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     655                $ldap = &Factory::getInstance('WorkflowLDAP'); 
    660656                $viewActivitiesID = array(); 
    661657                foreach ($result['data'] as $row) 
     
    726722                        /* paginate the result */ 
    727723                        $itemsPerPage = isset($_SESSION['phpgw_info']['workflow']['user']['preferences']['ui_items_per_page']) ? $_SESSION['phpgw_info']['workflow']['user']['preferences']['ui_items_per_page'] : 15; 
    728                         $paging = new Paging($itemsPerPage, $_POST); 
     724                        $paging = Factory::newInstance('Paging', $itemsPerPage, $_POST); 
    729725                        $output['instances'] = $paging->restrictItems($output['instances']); 
    730726                        $output['paging_links'] = $paging->commonLinks(); 
     
    740736        /** 
    741737         * Aplicacoes externas do usuario 
    742          * @return array  
     738         * @return array 
    743739         * @access public 
    744740         */ 
     
    746742        { 
    747743                $webserver_url = $_SESSION['phpgw_info']['workflow']['server']['webserver_url']; 
    748                 $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     744                $templateServer = &Factory::getInstance('TemplateServer'); 
    749745 
    750746                /* load the sites that the user can access */ 
     
    10701066        function callVoipConnect($params) 
    10711067        { 
    1072                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     1068                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    10731069                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP); 
    10741070 
  • sandbox/workflow/trunk/inc/class.bo_utils.inc.php

    r795 r2372  
    1111 
    1212require_once 'class.bo_ajaxinterface.inc.php'; 
    13 require_once GALAXIA_LIBRARY . SEP . 'src' . SEP . 'GUI' . SEP . 'GUI.php'; 
    14 require_once GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ActivityManager.php'; 
    1513 
    1614/** 
     
    3432        { 
    3533                parent::bo_ajaxinterface(); 
    36                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso(); 
     34                $this->db =& Factory::getInstance('WorkflowObjects')->getDBExpresso(); 
    3735        } 
    3836 
     
    8886                        $ret_name = empty($params['name']) ? 'cn' : $params['name']; 
    8987 
    90                         $ajaxConfig = new ajax_config('contactcenter'); 
     88                        $ajaxConfig = &Factory::newInstance('ajax_config', 'contactcenter'); 
    9189                        $config = $ajaxConfig->read_repository(); 
    9290 
  • sandbox/workflow/trunk/inc/class.bo_workflow_forms.inc.php

    r795 r2372  
    9090                        $this->sort_mode        = $this->order . '__' . $this->sort; 
    9191                        $this->search_str       = get_var('find', 'any', ''); 
    92                         $this->nextmatchs       = CreateObject('phpgwapi.nextmatchs'); 
     92                        $this->nextmatchs       = Factory::getInstance('nextmatchs'); 
    9393                         
    9494                        // number of rows allowed 
  • sandbox/workflow/trunk/inc/class.external_bridge.inc.php

    r795 r2372  
    1313require_once 'common.inc.php'; 
    1414require_once 'engine/config.egw.inc.php'; 
    15 require_once 'class.so_adminaccess.inc.php'; 
    1615 
    1716/** 
     
    5251        function external_bridge() 
    5352        { 
    54                 $this->db = $GLOBALS['workflow']['workflowObjects']->getDBGalaxia(); 
    55                 $this->acl = new so_adminaccess($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     53                $this->db = Factory::getInstance('WorkflowObjects')->getDBGalaxia(); 
     54                $this->acl = &Factory::getInstance('so_adminaccess', Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    5655        } 
    5756        /** 
     
    156155 
    157156                /* assign variables to the template */ 
    158                 $smarty = $GLOBALS['workflow']['factory']->getInstance('workflow_smarty', false); 
     157                $smarty = Factory::getInstance('workflow_smarty', false); 
    159158                $smarty->assign('encodedForm', $encodedForm); 
    160159                $smarty->assign('siteAddress', $this->siteAddress); 
  • sandbox/workflow/trunk/inc/class.powergraphic.inc.php

    r795 r2372  
    139139 
    140140 
    141  
    142  
    143 $PowerGraphic = new powergraphic; 
     141require_once 'common.inc.php'; 
     142 
     143$PowerGraphic = &Factory::newInstance('powergraphic'); 
    144144 
    145145$PowerGraphic->start(); 
  • sandbox/workflow/trunk/inc/class.run_activity.inc.php

    r2072 r2372  
    1010        \**************************************************************************/ 
    1111 
     12        require_once(dirname(__FILE__) . SEP . 'common.inc.php');                                /* including common deifinitions */ 
    1213        require_once(dirname(__FILE__) . SEP . 'class.WorkflowUtils.inc.php'  ); /* superclass source code       */ 
    1314        require_once(dirname(__FILE__) . SEP . 'class.basecontroller.inc.php' ); /* module controller            */ 
    1415        require_once(dirname(__FILE__) . SEP . 'class.basemodel.inc.php'      ); /* module logic                 */ 
    15         require_once(dirname(__FILE__) . SEP . 'class.process_factory.inc.php'); /* module process factory class */ 
    16         require_once(dirname(__FILE__) . SEP . 'class.utils.security.php'     ); /* sanitizes input data         */ 
    1716 
    1817        /** 
     
    206205                { 
    207206                        parent::WorkflowUtils(); 
    208                         $this->runtime          = CreateObject('workflow.workflow_wfruntime'); 
     207 
     208                        /** 
     209                         * We should always use newInstance to instantiate 
     210                         * 'workflow_wfruntime' 
     211                         */ 
     212                        $this->runtime                  = &Factory::newInstance('workflow_wfruntime'); 
    209213                        $this->runtime->setDebug(_DEBUG); 
    210                         //$this->base_activity  = CreateObject('workflow.workflow_baseactivity'); 
    211                         //$this->process                = CreateObject('workflow.workflow_process'); 
    212                         $this->GUI              = CreateObject('workflow.workflow_gui'); 
    213                         $this->categories       = CreateObject('phpgwapi.categories'); 
    214  
    215                         $this->workflowSmarty = CreateObject('workflow.workflow_smarty', false); 
     214                        //$this->base_activity  = Factory::getInstance('workflow_baseactivity'); 
     215                        //$this->process                = Factory::getInstance('workflow_process'); 
     216                        $this->GUI                              = &Factory::getInstance('workflow_gui'); 
     217                        $this->categories               = &Factory::getInstance('categories'); 
     218 
     219                        $this->workflowSmarty   = &Factory::getInstance('workflow_smarty', false); 
    216220                        // TODO: open a new connection to the database under a different username to allow privilege handling on tables 
    217221                        /* CELEPAR */ 
     
    301305                        $this->process_version  = $this->process->getVersion(); 
    302306                        $this->activity_name    = $activity->getName(); 
    303                         $this->user_name        = $GLOBALS['phpgw']->accounts->id2name($GLOBALS['user']); 
     307                        $this->user_name                = $GLOBALS['phpgw']->accounts->id2name($GLOBALS['user']); 
    304308                        $this->view_activity    = $this->GUI->gui_get_process_view_activity($this->process_id); 
    305309 
     
    318322                        $GLOBALS['workflow']['wf_workflow_path']                        = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'; 
    319323                        $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(''); 
     324                        $GLOBALS['workflow']['wf_default_resources_path']       = Factory::getInstance('TemplateServer')->generateLink('processes'); 
     325                        $GLOBALS['workflow']['wf_workflow_resources_path']      = Factory::getInstance('TemplateServer')->generateLink(''); 
    322326                        $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']); 
     327                        $GLOBALS['workflow']['wf_user_cnname']                          = Factory::getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 
    324328                        $GLOBALS['workflow']['wf_back_link']                            = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1'; 
    325329                        $GLOBALS['workflow']['wf_js_path']                                      = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode'; 
     
    376380 
    377381                                /* check some permissions */ 
    378                                 if (($newUser == '*') || (!$this->runtime->checkUserRun($newUser)) || ($GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($newUser) === false)) 
     382                                if (($newUser == '*') || (!$this->runtime->checkUserRun($newUser)) || (Factory::getInstance('WorkflowLDAP')->getName($newUser) === false)) 
    379383                                { 
    380384                                        $_SESSION['phpgw_info']['workflow']['user_groups'] = $actualUserGroups; 
     
    386390                                        return false; 
    387391                                } 
    388                                 $smarty = CreateObject('workflow.process_smarty'); 
     392                                $smarty = Factory::getInstance('process_smarty'); 
    389393                        } 
    390394 
     
    399403                                /* #celepar# smarty code*/ 
    400404 
    401                                 $smarty = CreateObject('workflow.process_smarty'); 
     405                                $smarty = Factory::getInstance('process_smarty'); 
    402406 
    403407                                $smarty->template_dir  = GALAXIA_PROCESSES.SEP.$this->process->getNormalizedName().SEP.'code'.SEP.'templates'; 
     
    438442                        $env['instance']      =& $instance;                        //process manager instance 
    439443                        $env['activity']      =& $activity;                        //activity manager instance 
    440                         $security             =& new SecurityUtils();              //input sanitizer class 
     444                        $security             =& Factory::newInstance('SecurityUtils');              //input sanitizer class 
    441445                        $env['request']       =& $security->process($_REQUEST);    //sanitizes input data from client 
    442                         $env['factory']       =& new ProcessFactory();             //instantiation controller class 
     446                        //$env['factory']       =& new ProcessFactory();             //instantiation controller class 
     447                        $env['factory']       =& Factory::getInstance('ProcessWrapperFactory');  //instantiation controller class 
    443448                        $env['natural']           =& wf_create_object('wf_natural');   //data access object instance for mainframe 
    444449                        /* END WORKFLOW MVC SETTINGS */ 
     
    472477 
    473478                        /* activate the security policy */ 
    474                         $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     479                        Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     480 
     481                        /** 
     482                         * XXX 
     483                         * here we are going to use our new Security static class. 
     484                         * From now, the factory frontend (static) will forward 
     485                         * the messages for the process factory instead of Workflow 
     486                         * factory. 
     487                         * XXX 
     488                        */ 
     489                        Security::enable(); 
    475490 
    476491                        /* include the files */ 
     
    661676                        $GLOBALS['workflow']['wf_workflow_path']                        = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'; 
    662677                        $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(''); 
     678                        $GLOBALS['workflow']['wf_default_resources_path']       = Factory::getInstance('TemplateServer')->generateLink('processes'); 
     679                        $GLOBALS['workflow']['wf_workflow_resources_path']      = Factory::getInstance('TemplateServer')->generateLink(''); 
    665680                        $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']); 
     681                        $GLOBALS['workflow']['wf_user_cnname']                          = Factory::getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 
    667682                        $GLOBALS['workflow']['wf_back_link']                            = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1'; 
    668683                        $GLOBALS['workflow']['wf_js_path']                                      = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode'; 
     
    699714                        $env['instance']      =& $instance;                        //process manager instance 
    700715                        $env['activity']      =& $activity;                        //activity manager instance 
    701                         $security             =& new SecurityUtils();              //input sanitizer class 
     716                        $security             =& Factory::newInstance('SecurityUtils'); //input sanitizer class 
    702717                        $env['request']       =& $security->process($_REQUEST); //sanitizes input data from client 
    703                         $env['factory']       =& new ProcessFactory();                     //instantiation controller class 
     718                        //$env['factory']       =& new ProcessFactory();                           //instantiation controller class 
     719                        $env['factory']       =& Factory::newInstance('ProcessWrapperFactory');  //instantiation controller class 
    704720                        $env['natural']           =& wf_create_object('wf_natural');   //data access object instance for mainframe 
    705721                        /* END WORKFLOW MVC SETTINGS */ 
     
    712728 
    713729                        /* activate the security policy */ 
    714                         $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     730                        Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     731 
     732                        /** 
     733                         * XXX 
     734                         * here we are going to use our new Security static class. 
     735                         * From now, the factory frontend (static) will forward 
     736                         * the messages for the process factory instead of Workflow 
     737                         * factory. Note that this is the same comment as the previous 
     738                         * function... boooring.. =} 
     739                         * XXX 
     740                        */ 
     741                        Security::enable(); 
    715742 
    716743                        $GLOBALS['workflow_env'] = &$env; 
    717                         $nc = new NanoController(); 
     744                        $nc = &Factory::newInstance('NanoController'); 
    718745                        $nc->setClassPath(GALAXIA_PROCESSES . SEP . $this->process->getNormalizedName(). SEP . 'code'); 
    719746                        $nc->iterateOverVirtualRequests(); 
  • sandbox/workflow/trunk/inc/class.so_adminaccess.inc.php

    r795 r2372  
    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::getInstance('acl', $userID); 
    205205                } 
    206206 
  • sandbox/workflow/trunk/inc/class.so_adminjobs.inc.php

    r795 r2372  
    1010\**************************************************************************/ 
    1111 
    12 require_once GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ProcessManager.php'; 
    13 require_once GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'JobManager.php'; 
    14 require_once GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ActivityManager.php'; 
    1512 
    1613/** 
     
    9693                $this->isAdmin = $_SESSION['phpgw_info']['workflow']['user_is_admin']; 
    9794                $this->acl = &$GLOBALS['ajax']->acl; 
    98                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
    99                 $this->jobManager = new JobManager(&$this->db); 
     95                $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
     96                $this->jobManager = &Factory::newInstance('JobManager'); 
    10097        } 
    10198 
     
    229226                $output = array(); 
    230227                $job = $this->jobManager->getJob($jobID); 
    231                 $jobScheduler = &$GLOBALS['workflow']['factory']->getInstance('JobScheduler'); 
     228                $jobScheduler =& Factory::getInstance('JobScheduler'); 
    232229                $totalTime = microtime(true); 
    233230                $thread = $jobScheduler->execute($job, true); 
  • sandbox/workflow/trunk/inc/class.so_agent.inc.php

    r795 r2372  
    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/trunk/inc/class.so_external_applications.inc.php

    r795 r2372  
    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/trunk/inc/class.so_move_instances.inc.php

    r795 r2372  
    1111\**************************************************************************/ 
    1212 
    13 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ProcessManager.php'); 
    14 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ActivityManager.php'); 
    1513 
    1614/** 
     
    9189                $this->userID = $_SESSION['phpgw_info']['workflow']['account_id']; 
    9290                $this->isAdmin = $_SESSION['phpgw_info']['workflow']['user_is_admin']; 
    93                 $this->acl = &$GLOBALS['ajax']->acl; 
    94                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     91                $this->acl =& $GLOBALS['ajax']->acl; 
     92                $this->db =& Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    9593        } 
    9694 
     
    113111                                $where[] = 'wf_p_id IS NULL'; 
    114112                } 
    115                 $processManager = new ProcessManager($this->db); 
     113                $processManager = &Factory::getInstance('ProcessManager', $this->db); 
    116114 
    117115                /* workaround to sort the result using two columns */ 
     
    137135                $this->_checkAccess($processID); 
    138136 
    139                 $activityManager = new ActivityManager($this->db); 
     137                $activityManager = &Factory::newInstance('ActivityManager'); 
    140138                $activities = $activityManager->list_activities($processID, 0, -1, 'wf_name__ASC', '', 'wf_type <> \'standalone\' AND wf_type <> \'view\''); 
    141139                $output = array(); 
  • sandbox/workflow/trunk/inc/class.so_orgchart.inc.php

    r2063 r2372  
    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 
     
    10911091                $this->_checkAccess($organizationID, false, true); 
    10921092 
     1093                /** 
     1094                 * This is so wrong.. We should always use the factory to 
     1095                 * instantiate stuff. Besides, module class should not 
     1096                 * use process classes; the correct is to do the inverse. 
     1097                 */ 
    10931098                require_once dirname(__FILE__) . '/local/classes/class.wf_orgchart.php'; 
    10941099                $orgchart = new wf_orgchart(); 
     
    10961101                $outputInfo = array(); 
    10971102 
    1098                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     1103                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    10991104 
    11001105                /* here we need fresh information. Let's access ldap first */ 
     
    12621267                ); 
    12631268 
    1264                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     1269                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    12651270                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP_DATABASE); 
    12661271                if (!empty($areaInfo['titular_funcionario_id'])) 
     
    15121517 
    15131518                /* we must query ldap to get full user names. In workflow db we just store uids */ 
    1514                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
    1515  
    1516                 $cachedLDAP->getEntryByID(); 
     1519                $cachedLDAP = Factory::getInstance('CachedLDAP'); 
    15171520 
    15181521                $output = $result->GetArray(-1); 
  • sandbox/workflow/trunk/inc/class.so_userinterface.inc.php

    r2094 r2372  
    11<?php 
    2 require_once($_SESSION['phpgw_info']['workflow']['phpgw_api_inc'] . '/class.config.inc.php'); 
    32 
    43/** 
     
    2221        function so_userinterface() 
    2322        { 
    24                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBWorkflow()->Link_ID; 
     23                $this->db =& Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Link_ID; 
    2524                $this->db->SetFetchMode(ADODB_FETCH_ASSOC); 
    2625        } 
     
    6160                $oldDB = $GLOBALS['phpgw']->db; 
    6261                $GLOBALS['phpgw']->db = $GLOBALS['ajax']->db; 
    63                 $config = new config('workflow'); 
     62                $config = &Factory::getInstance('config', 'workflow'); 
    6463                $configValues = $config->read_repository(); 
    6564                $submasksString = $configValues['intranet_subnetworks']; 
     
    9392                if (!empty($externalApplicationsID)) 
    9493                { 
    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"); 
     94                        $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"); 
    9695                        $preOutput = $result->GetArray(-1); 
    9796 
     
    245244 
    246245                $employees = $result->GetArray(-1); 
    247                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     246                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    248247                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_NORMAL); 
    249248                $categoriesCount = array(); 
     
    318317 
    319318                $employees = $result->GetArray(-1); 
    320                 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 
     319                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    321320                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_NORMAL); 
    322321                for ($i = 0; $i < count($employees); $i++) 
     
    370369 
    371370                /* 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')); 
     371                $list = @ldap_search($ldap, Factory::getInstance('WorkflowLDAP')->getLDAPContext(), ('(&(cn=*' . $searchTerm . '*)(phpgwaccounttype=u))'), array('uidNumber', 'cn', 'telephoneNumber')); 
    373372                if ($list === false) 
    374373                        return false; 
     
    466465 
    467466                /* executing it */ 
    468                 $list = @ldap_search($ldap, $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getLDAPContext(), $ldap_query, array('uidNumber', 'cn', 'telephoneNumber')); 
     467                $list = @ldap_search($ldap, Factory::getInstance('WorkflowLDAP')->getLDAPContext(), $ldap_query, array('uidNumber', 'cn', 'telephoneNumber')); 
    469468                $entries = ldap_get_entries($ldap, $list); 
    470469 
     
    475474 
    476475                /* we will need to search into database 'cache' for users deleted in ldap */ 
    477                 $cachedLDAP = $GLOBALS[ 'workflow' ][ 'factory' ] -> newInstance( 'CachedLDAP' ); 
     476                $cachedLDAP = Factory::newInstance( 'CachedLDAP' ); 
    478477                $cachedLDAP -> setOperationMode( $cachedLDAP -> OPERATION_MODE_DATABASE ); 
    479478 
     
    531530 
    532531                /* 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')); 
     532                $list = @ldap_search($ldap, Factory::getInstance('WorkflowLDAP')->getLDAPContext(), ('(&(telephoneNumber=*' . $searchTerm . '*)(phpgwaccounttype=u))'), array('uidNumber', 'cn', 'telephoneNumber')); 
    534533 
    535534                if (!$list) return false; 
     
    594593        function getEmployeeInfo($employeeID, $organizationID) 
    595594        { 
    596                 require_once dirname(__FILE__) . '/class.so_orgchart.inc.php'; 
    597  
    598                 $SOOrgchart = new so_orgchart(); 
     595                $SOOrgchart = &Factory::getInstance('so_orgchart'); 
    599596                $SOOrgchart->setExternalCalls(true); 
    600597                $output = $SOOrgchart->getEmployeeInfo($employeeID, $organizationID); 
     
    614611        function getAreaInfo($areaID, $organizationID) 
    615612        { 
    616                 require_once dirname(__FILE__) . '/class.so_orgchart.inc.php'; 
    617  
    618                 $SOOrgchart = new so_orgchart(); 
     613                $SOOrgchart = &Factory::getInstance('so_orgchart'); 
    619614                $SOOrgchart->setExternalCalls(true); 
    620615                $output = $SOOrgchart->getAreaInfo($areaID, $organizationID); 
     
    652647                $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 ) ); 
    653648 
    654                 $cachedLDAP = $GLOBALS[ 'workflow' ][ 'factory' ] -> newInstance( 'CachedLDAP' ); 
     649                $cachedLDAP = Factory::newInstance( 'CachedLDAP' ); 
    655650                $cachedLDAP -> setOperationMode( $cachedLDAP -> OPERATION_MODE_LDAP_DATABASE ); 
    656651 
     
    719714 
    720715                $employees = $result -> GetArray( -1 ); 
    721                 $cachedLDAP = $GLOBALS[ 'workflow' ][ 'factory' ] -> newInstance( 'CachedLDAP' ); 
     716                $cachedLDAP = Factory::newInstance( 'CachedLDAP' ); 
    722717                $cachedLDAP -> setOperationMode( $cachedLDAP -> OPERATION_MODE_NORMAL ); 
    723718 
     
    791786                $employees = $result -> GetArray( -1 ); 
    792787 
    793                 $cachedLDAP = $GLOBALS[ 'workflow' ][ 'factory' ] -> newInstance( 'CachedLDAP' ); 
     788                $cachedLDAP = Factory::newInstance( 'CachedLDAP' ); 
    794789                $cachedLDAP -> setOperationMode( $cachedLDAP -> OPERATION_MODE_NORMAL ); 
    795790 
     
    817812                usort( $employees, create_function( '$a,$b', 'return strcasecmp($a[\'cn\'],$b[\'cn\']);' ) ); 
    818813 
    819                 $paging = $GLOBALS['workflow']['factory']->newInstance('Paging', 50, $_POST); 
     814                $paging = Factory::newInstance('Paging', 50, $_POST); 
    820815                $employees = $paging->restrictItems( $employees ); 
    821816 
  • sandbox/workflow/trunk/inc/class.ui_adminaccess.inc.php

    r795 r2372  
    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(); 
     
    6363                $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['workflow']['title'] . ' - ' . lang('Access Control List'); 
    6464                $GLOBALS['phpgw_info']['flags'] = array('noheader' => false, 'nonavbar' => false, 'currentapp' => 'workflow'); 
    65                 $smarty = CreateObject('workflow.workflow_smarty'); 
     65                $smarty = Factory::getInstance('workflow_smarty'); 
    6666 
    6767                $javaScripts = $this->get_common_js(); 
  • sandbox/workflow/trunk/inc/class.ui_adminactivities.inc.php

    r1710 r2372  
    22 
    33require_once dirname(__FILE__) . SEP . 'class.WorkflowUtils.inc.php'; 
    4 require_once dirname(__FILE__) . SEP . 'class.fsutils.inc.php'; /* toolkit for filesystem handling */ 
    54require_once 'engine' . SEP . 'config.egw.inc.php'; 
    65/** 
     
    7372                parent::WorkflowUtils(); 
    7473 
    75                 $this->workflow_acl = CreateObject('workflow.workflow_acl'); 
     74                $this->workflow_acl = Factory::getInstance('workflow_acl'); 
    7675                $denyAccess = true; 
    7776                if ($this->workflow_acl->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id'])) 
     
    106105                } 
    107106 
    108                 $this->process_manager  = CreateObject('workflow.workflow_processmanager'); 
    109                 $this->activity_manager = CreateObject('workflow.workflow_activitymanager'); 
    110                 $this->role_manager     = CreateObject('workflow.workflow_rolemanager'); 
    111                 $this->fs = new FsUtils(); /* gets instance */ 
     107                $this->process_manager  = Factory::getInstance('workflow_processmanager'); 
     108                $this->activity_manager = Factory::getInstance('workflow_activitymanager'); 
     109                $this->role_manager     = Factory::getInstance('workflow_rolemanager'); 
     110                $this->fs = &Factory::newInstance('FsUtils'); /* gets instance */ 
    112111 
    113112        } 
     
    374373                // fill proc_bar 
    375374                $this->t->set_var('proc_bar', $this->fill_proc_bar($proc_info)); 
    376                  
     375 
    377376                //collect some messages from used objects 
    378377                $this->message[] = $this->activity_manager->get_error(false, _DEBUG); 
     
    380379                $this->message[] = $this->role_manager->get_error(false, _DEBUG); 
    381380 
    382                 $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     381                $templateServer = &Factory::getInstance('TemplateServer'); 
    383382 
    384383                // fill the general variables of the template 
     
    732731                        $this->translate_template('block_process_activities_header'); 
    733732                        $this->t->parse('process_activities_header', 'block_process_activities_header', True); 
    734                         $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     733                        $templateServer = &Factory::getInstance('TemplateServer'); 
    735734                        foreach ($process_activities_data as $activity) 
    736735                        { 
     
    792791                                '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']), 
    793792                                'trans_actFromName'     => $transition['wf_act_from_name'], 
    794                                 'trans_arrow'           => $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink('next.gif'), 
     793                                'trans_arrow'           => Factory::getInstance('TemplateServer')->generateImageLink('next.gif'), 
    795794                                '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']), 
    796795                                'trans_actToName'       => $transition['wf_act_to_name'], 
     
    10361035                $image_name = $proc_info['wf_normalized_name'] . SEP . 'graph' . SEP . $proc_info['wf_normalized_name'] . '.png'; 
    10371036                $image = GALAXIA_PROCESSES . SEP . $image_name; 
    1038                 if ($GLOBALS['workflow']['factory']->getInstance('BrowserInfo')->isOpera()) 
     1037                if (Factory::getInstance('BrowserInfo')->isOpera()) 
    10391038                        $maximumDimension = 1000000; 
    10401039                else 
     
    10691068                } 
    10701069        } 
    1071          
     1070 
    10721071        /** 
    10731072         * Dislays the activity agents config rows 
     
    10901089                        } 
    10911090                        $this->translate_template('admin_agents'); 
    1092                                                                                                 $this->t->parse('agents_config_rows', 'admin_agents'); 
     1091                        $this->t->parse('agents_config_rows', 'admin_agents'); 
    10931092                } 
    10941093        } 
  • sandbox/workflow/trunk/inc/class.ui_adminjobs.inc.php

    r795 r2372  
    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/trunk/inc/class.ui_adminprocesses.inc.php

    r989 r2372  
    11<?php 
     2require_once 'common.inc.php'; 
    23require_once(dirname(__FILE__) . SEP . 'class.bo_workflow_forms.inc.php'); 
    34require_once('engine' . SEP . 'config.egw.inc.php'); 
     
    5455                parent::bo_workflow_forms('admin_processes'); 
    5556 
    56                 $this->workflow_acl = CreateObject('workflow.workflow_acl'); 
     57                $this->workflow_acl = Factory::getInstance('workflow_acl'); 
    5758                $denyAccess = true; 
    5859                if ($this->workflow_acl->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id'])) 
     
    8384                } 
    8485 
    85                 $this->process_manager  = CreateObject('workflow.workflow_processmanager'); 
    86                 $this->activity_manager = CreateObject('workflow.workflow_activitymanager'); 
     86                $this->process_manager  = Factory::getInstance('workflow_processmanager'); 
     87                $this->activity_manager = Factory::getInstance('workflow_activitymanager'); 
    8788 
    8889                $this->form_action = $GLOBALS['phpgw']->link('/index.php', 'menuaction=workflow.ui_adminprocesses.form'); 
     
    127128                } 
    128129 
    129                 if (!$GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id'])) 
     130                if (!Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id'])) 
    130131                { 
    131132                        $proc_ids = $this->workflow_acl->get_granted_processes($GLOBALS['phpgw_info']['user']['account_id']); 
     
    190191                $known_config_items = array_merge($known_config_items, array('Log Options' => 'title', 'log_level' => $log_levels)); 
    191192 
    192                 $bo_agent = CreateObject('workflow.bo_agent_mail_smtp'); 
     193                $bo_agent = Factory::getInstance('bo_agent_mail_smtp'); 
    193194                $known_config_items = array_merge($known_config_items, $bo_agent->listProcessConfigurationFields()); 
    194195 
     
    589590 
    590591                        $myp_id = $item['wf_p_id']; 
    591                         $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     592                        $templateServer = &Factory::getInstance('TemplateServer'); 
    592593                        $this->t->set_var(array( 
    593594                                'item_wf_p_id'          => $myp_id, 
  • sandbox/workflow/trunk/inc/class.ui_adminroles.inc.php

    r795 r2372  
    4242                parent::WorkflowUtils(); 
    4343 
    44                 $this->workflow_acl = CreateObject('workflow.workflow_acl'); 
     44                $this->workflow_acl = Factory::getInstance('workflow_acl'); 
    4545                $denyAccess = true; 
    4646                if ($this->workflow_acl->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id'])) 
     
    7171                } 
    7272 
    73                 $this->process_manager  = CreateObject('workflow.workflow_processmanager'); 
    74                 $this->activity_manager = CreateObject('workflow.workflow_activitymanager'); 
    75                 $this->role_manager     = CreateObject('workflow.workflow_rolemanager'); 
     73                $this->process_manager  = Factory::getInstance('workflow_processmanager'); 
     74                $this->activity_manager = Factory::getInstance('workflow_activitymanager'); 
     75                $this->role_manager     = Factory::getInstance('workflow_rolemanager'); 
    7676                $this->form_action = $GLOBALS['phpgw']->link('/index.php', 'menuaction=workflow.ui_adminroles.form'); 
    7777                 
     
    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/trunk/inc/class.ui_adminsource.inc.php

    r795 r2372  
    1717 */ 
    1818require_once dirname(__FILE__) . SEP . 'class.ui_ajaxinterface.inc.php'; 
    19 require_once dirname(__FILE__) . SEP . 'class.workflow_acl.inc.php'; 
    2019require_once 'engine' . SEP . 'config.ajax.inc.php'; 
    2120 
     
    4342        function ui_adminsource() 
    4443        { 
    45                 $this->workflow_acl = new workflow_acl(); 
     44                $this->workflow_acl = Factory::getInstance('workflow_acl'); 
    4645                $denyAccess = true; 
    4746                if ($this->workflow_acl->checkWorkflowAdmin($_SESSION['phpgw_info']['workflow']['account_id'])) 
     
    7877        function form() 
    7978        { 
    80                 $smarty = $GLOBALS['workflow']['factory']->getInstance('workflow_smarty', false); 
     79                $smarty = Factory::getInstance('workflow_smarty', false); 
    8180                $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')); 
    8281 
  • sandbox/workflow/trunk/inc/class.ui_agent_mail_smtp.inc.php

    r795 r2372  
    2929                parent::ui_agent(); 
    3030                $this->agent_type = 'mail_smtp'; 
    31                 $this->bo_agent = CreateObject('workflow.bo_agent_mail_smtp'); 
     31                $this->bo_agent = Factory::getInstance('bo_agent_mail_smtp'); 
    3232        } 
    3333 
  • sandbox/workflow/trunk/inc/class.ui_ajaxinterface.inc.php

    r1452 r2372  
    1111\**************************************************************************/ 
    1212 
    13 require_once 'class.workflow_acl.inc.php'; 
    1413require_once 'common.inc.php'; 
    1514require_once 'engine/class.ajax_config.inc.php'; 
     
    5049        function set_wf_session() 
    5150        { 
    52                 $acl = new workflow_acl(); 
     51                $acl = Factory::getInstance('workflow_acl'); 
    5352                $_SESSION['phpgw_info']['workflow']['server_root'] = PHPGW_SERVER_ROOT; 
    5453                $_SESSION['phpgw_info']['workflow']['phpgw_api_inc'] = PHPGW_API_INC; 
     
    5655                $vfs = createobject('phpgwapi.vfs'); 
    5756                $_SESSION['phpgw_info']['workflow']['vfs_basedir'] = $vfs->basedir; 
    58                 $_SESSION['phpgw_info']['workflow']['server'] = $GLOBALS['phpgw_info']['server'];                        
     57                $_SESSION['phpgw_info']['workflow']['server'] = $GLOBALS['phpgw_info']['server']; 
    5958                $_SESSION['phpgw_info']['workflow']['lang'] = $GLOBALS['lang']; 
    6059                $_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']); 
     60                $_SESSION['phpgw_info']['workflow']['user_groups'] = Factory::getInstance('WorkflowLDAP')->getUserGroups($GLOBALS['phpgw_info']['user']['account_id']); 
    6261                $user_is_admin = $acl->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']); 
    63                 $_SESSION['phpgw_info']['workflow']['user_is_admin'] = $user_is_admin;  
     62                $_SESSION['phpgw_info']['workflow']['user_is_admin'] = $user_is_admin; 
    6463                $_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')));  
     64                $_SESSION['phpgw_info']['workflow']['user_can_admin_instance'] = ($user_is_admin || ($GLOBALS['phpgw']->acl->check('admin_instance_workflow',1,'workflow'))); 
    6665 
    6766                $can_monitor = $acl->checkUserGroupAccessToType('MON', $GLOBALS['phpgw_info']['user']['account_id']); 
     
    118117        { 
    119118                $CSSName = "css/{$CSSName}.css"; 
    120                 $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     119                $templateServer = &Factory::getInstance('TemplateServer'); 
    121120                $CSSLink = $templateServer->getWebFile($CSSName); 
    122121                $CSSFile = $templateServer->getSystemFile($CSSName); 
  • sandbox/workflow/trunk/inc/class.ui_external_applications.inc.php

    r795 r2372  
    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(); 
     
    6161                $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['workflow']['title']; 
    6262                $GLOBALS['phpgw_info']['flags'] = array('noheader' => false, 'nonavbar' => false, 'currentapp' => 'workflow'); 
    63                 $smarty = CreateObject('workflow.workflow_smarty'); 
     63                $smarty = Factory::getInstance('workflow_smarty'); 
    6464 
    6565                $this->set_wf_session(); 
  • sandbox/workflow/trunk/inc/class.ui_generic_select.inc.php

    r795 r2372  
    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/trunk/inc/class.ui_monitors.inc.php

    r795 r2372  
    1212 
    1313require_once(dirname(__FILE__) . SEP . 'class.ui_ajaxinterface.inc.php'); 
    14 require_once(dirname(__FILE__) . SEP . 'class.workflow_acl.inc.php'); 
    1514/** 
    1615 * @package Workflow 
     
    3736        { 
    3837                $this->set_wf_session(); 
    39                 $this->workflow_acl = new workflow_acl(); 
     38                $this->workflow_acl = Factory::getInstance('workflow_acl'); 
    4039 
    4140                if (!($this->workflow_acl->checkUserGroupAccessToType('MON', $_SESSION['phpgw_info']['workflow']['account_id']) || ($this->workflow_acl->checkWorkflowAdmin($_SESSION['phpgw_info']['workflow']['account_id'])))) 
     
    5857                $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['workflow']['title'] . ' - ' . lang('%1 monitoring'); 
    5958                $GLOBALS['phpgw_info']['flags'] = array('noheader' => false, 'nonavbar' => false, 'currentapp' => 'workflow'); 
    60                 $smarty = CreateObject('workflow.workflow_smarty'); 
     59                $smarty = Factory::getInstance('workflow_smarty'); 
    6160 
    6261                $javaScripts = $this->get_common_js(); 
  • sandbox/workflow/trunk/inc/class.ui_move_instances.inc.php

    r795 r2372  
    3636        { 
    3737                $GLOBALS['phpgw_info']['flags'] = array('noheader' => false, 'nonavbar' => false, 'currentapp' => 'workflow'); 
    38                 $smarty = CreateObject('workflow.workflow_smarty'); 
     38                $smarty = Factory::getInstance('workflow_smarty'); 
    3939 
    4040                $javaScripts = $this->get_common_js(); 
  • sandbox/workflow/trunk/inc/class.ui_orgchart.inc.php

    r795 r2372  
    11<?php 
    22 
    3         /**************************************************************************\ 
     3/**************************************************************************\ 
    44* eGroupWare                                                 * 
    55* http://www.egroupware.org                                                * 
     
    1212 
    1313require_once(dirname(__FILE__) . SEP . 'class.ui_ajaxinterface.inc.php'); 
    14 require_once(dirname(__FILE__) . SEP . 'class.workflow_acl.inc.php'); 
     14 
    1515/** 
    1616 * @package Workflow 
     
    4747        function draw($tab_index = "") 
    4848        { 
    49                 $this->workflow_acl = CreateObject('workflow.workflow_acl'); 
     49                $this->workflow_acl = Factory::getInstance('workflow_acl'); 
    5050 
    5151                $isAdmin = $this->workflow_acl->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']); 
     
    6363 
    6464                $GLOBALS['phpgw_info']['flags'] = array('noheader' => false, 'nonavbar' => false, 'currentapp' => 'workflow'); 
    65                 $smarty = CreateObject('workflow.workflow_smarty'); 
     65                $smarty = Factory::getInstance('workflow_smarty'); 
    6666 
    6767                $this->set_wf_session(); 
     
    104104                        die(); 
    105105 
    106                 require_once(dirname(__FILE__) . SEP . 'engine' . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'GraphViz.php'); 
    107  
    108                 $config_values = CreateObject('phpgwapi.config','workflow'); 
     106                $config_values = Factory::getInstance('config', 'workflow'); 
    109107                $config_values->read_repository(); 
    110                 $conf_db = $config_values->config_data;  
    111                 $db = CreateObject('phpgwapi.db'); 
     108                $conf_db = $config_values->config_data; 
     109                $db = Factory::getInstance('db'); 
    112110                $db->connect( 
    113111                        $conf_db['database_name'], 
     
    122120                $attributes['ranksep'] = '1.5 equally'; 
    123121                $attributes['rankdir'] = 'LR'; 
    124                 $graph = new Process_GraphViz(true, $attributes); 
     122                $graph = &Factory::getInstance('Process_GraphViz', true, $attributes); 
    125123 
    126124 
     
    153151                                return false; 
    154152 
    155                         $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     153                        $ldap = &Factory::getInstance('WorkflowLDAP'); 
    156154                        for ($i = 0; $i < count($output); $i++) 
    157155                        { 
  • sandbox/workflow/trunk/inc/class.ui_participants.inc.php

    r795 r2372  
    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/trunk/inc/class.ui_phpeditor.inc.php

    r795 r2372  
    1111 
    1212require_once dirname(__FILE__) . SEP . 'engine' . SEP . 'config.ajax.inc.php'; 
    13 require_once GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ProcessManager.php'; 
    1413require_once dirname(__FILE__) . SEP . 'class.ui_ajaxinterface.inc.php'; 
    1514/** 
     
    4544        function ui_phpeditor() 
    4645        { 
    47                 $this->bo = CreateObject('workflow.bo_editor'); 
     46                $this->bo = Factory::getInstance('bo_editor'); 
    4847                $this->loadVariables(); 
    4948        } 
     
    6261        function form() 
    6362        { 
    64                 $smarty = $GLOBALS['workflow']['factory']->getInstance('workflow_smarty', false); 
    65                 $processManager = new ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     63                $smarty = Factory::getInstance('workflow_smarty', false); 
     64                $processManager = &Factory::newInstance('ProcessManager'); 
    6665                $proccessInfo = $processManager->get_process($_GET['proc_id']); 
    6766 
  • sandbox/workflow/trunk/inc/class.ui_userinterface.inc.php

    r2107 r2372  
    4545                $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['workflow']['title']; 
    4646                $GLOBALS['phpgw_info']['flags'] = array('noheader' => false, 'nonavbar' => false, 'currentapp' => 'workflow'); 
    47                 $smarty = CreateObject('workflow.workflow_smarty'); 
     47                $smarty = Factory::getInstance('workflow_smarty'); 
    4848 
    4949                // Check if workflow config is ok 
     
    114114 
    115115                // Get a connection to db workflow and galaxia (module) 
    116                 if ($GLOBALS['workflow']['workflowObjects']->getDBWorkflow()->Error) 
     116                if (Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Error) 
    117117                        $errors[] = 'Unable to connect to database Workflow'; 
    118118 
    119                 if ($errormsg = $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Error) 
     119                if ($errormsg = Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Error) 
    120120                        $errors[] = 'Unable to connect to database Galaxia'; 
    121121 
     
    129129 
    130130                /* create some objects */ 
    131                 require_once 'class.so_userinterface.inc.php'; 
    132                 $so = new so_userinterface(); 
    133                 $smarty = CreateObject('workflow.workflow_smarty'); 
     131                $so = &Factory::getInstance('so_userinterface'); 
     132                $smarty = &Factory::getInstance('workflow_smarty'); 
    134133 
    135134                /* get the user's organization */ 
  • sandbox/workflow/trunk/inc/class.workflow_acl.inc.php

    r795 r2372  
    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/trunk/inc/class.workflow_activitymanager.inc.php

    r795 r2372  
    55 
    66        require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ActivityManager.php'); 
    7         require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'GraphViz.php'); 
    8         require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ProcessManager.php'); 
    9         require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'common' . SEP . 'WfSecurity.php'); 
    107        /** 
    118         * @package Workflow 
     
    2017                function workflow_activitymanager() 
    2118                { 
    22                         parent::ActivityManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     19                        parent::ActivityManager(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    2320                } 
    2421        } 
  • sandbox/workflow/trunk/inc/class.workflow_baseactivity.inc.php

    r795 r2372  
    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/trunk/inc/class.workflow_gui.inc.php

    r795 r2372  
    55 
    66        require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'GUI' . SEP . 'GUI.php'); 
    7         require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'API' . SEP . 'Process.php'); 
    8         require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'API' . SEP . 'Instance.php'); 
    9         require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'common' . SEP . 'WfSecurity.php'); 
     7 
    108        /** 
    119         * @package Workflow 
     
    2018                function workflow_gui() 
    2119                { 
    22                         parent::GUI($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     20                        parent::GUI(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    2321                } 
    2422        } 
  • sandbox/workflow/trunk/inc/class.workflow_instance.inc.php

    r795 r2372  
    66 
    77        require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'API' . SEP . 'Instance.php'); 
    8         require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'common' . SEP . 'WfSecurity.php'); 
    9         require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ActivityManager.php'); 
    108        /** 
    119         * @package Workflow 
     
    2018                function workflow_Instance() 
    2119                { 
    22                         parent::Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     20                        parent::Instance(Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID); 
    2321                } 
    2422        } 
  • sandbox/workflow/trunk/inc/class.workflow_instancemanager.inc.php

    r795 r2372  
    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/trunk/inc/class.workflow_process.inc.php

    r795 r2372  
    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/trunk/inc/class.workflow_processmanager.inc.php

    r795 r2372  
    55 
    66        require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ProcessManager.php'); 
    7         require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'RoleManager.php'); 
    8         require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ActivityManager.php'); 
    9         require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'API' . SEP . 'Process.php'); 
     7 
    108        /** 
    119         * @package Workflow 
     
    2624                        'database_user', 
    2725                        'database_password' 
    28                 );  
     26                ); 
    2927           /** 
    3028                 * Constructor 
     
    3432                function workflow_processmanager() 
    3533                { 
    36                         parent::ProcessManager($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
    37                         $this->workflow_acl = CreateObject('workflow.workflow_acl'); 
    38                          
     34                        parent::ProcessManager(); 
     35                        $this->workflow_acl = Factory::getInstance('workflow_acl'); 
     36 
    3937                        /* allow regular users to see the process graph */ 
    4038                        if ($_GET['menuaction'] == "workflow.ui_adminactivities.show_graph") 
     
    6260                function import_process(&$data) 
    6361                { 
    64                         if (!(isset($this->activity_manager)))  $this->activity_manager = new ActivityManager($this->db); 
     62                        if (!(isset($this->activity_manager)))  $this->activity_manager = &Factory::newInstance('ActivityManager'); 
    6563 
    6664                        if (parent::import_process($data)) 
     
    121119                function serialize_process($pId) 
    122120                { 
    123                         if (!(isset($this->activity_manager)))  $this->activity_manager = new ActivityManager($this->db); 
     121                        if (!(isset($this->activity_manager)))  $this->activity_manager = &Factory::newInstance('ActivityManager'); 
    124122                        if (!isset($this->jobManager)) 
    125                                 $this->jobManager = new JobManager($this->db); 
     123                                $this->jobManager = &Factory::newInstance('JobManager'); 
    126124                 
    127125                        //if (!(isset($this->activity_manager)))  $this->activity_manager = new ActivityManager($this->db); 
  • sandbox/workflow/trunk/inc/class.workflow_processmonitor.inc.php

    r795 r2372  
    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/trunk/inc/class.workflow_rolemanager.inc.php

    r795 r2372  
    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/trunk/inc/class.workflow_smarty.inc.php

    r1227 r2372  
    1111 
    1212require_once 'smarty/Smarty.class.php'; 
    13 //require_once 'class.ui_ajaxinterface.inc.php'; 
    1413 
    1514/** 
  • sandbox/workflow/trunk/inc/class.workflow_wfruntime.inc.php

    r795 r2372  
    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/trunk/inc/class.workflow_wfsecurity.inc.php

    r1712 r2372  
    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/trunk/inc/common.inc.php

    r1484 r2372  
    11<?php 
    2 if (file_exists(dirname(__FILE__) . '/../../header.session.inc.php')) { 
    3         require_once dirname(__FILE__) . '/../../header.session.inc.php'; 
     2/**************************************************************************\ 
     3* eGroupWare                                                               * 
     4* http://www.egroupware.org                                                * 
     5* --------------------------------------------                             * 
     6*  This program is free software; you can redistribute it and/or modify it * 
     7*  under the terms of the GNU General Public License as published by the   * 
     8*  Free Software Foundation; either version 2 of the License, or (at your  * 
     9*  option) any later version.                                              * 
     10\**************************************************************************/ 
     11 
     12/** 
     13 * Server base path. This constant is somewhat simililar to 
     14 * 'PHPGW_SERVER_ROOT'. Nevertheless, there are cases that we 
     15 * access Workflow directly and it must be defined somewhere. 
     16 * Recently discovered, when we are runnnig jobs HTTP_SERVER_VARS 
     17 * exported by apache are not available. 
     18 * Therefore, we are using this workaround here, setting 
     19 * EGW_SERVER_ROOT based on the location of this file. This constant 
     20 * should be updated properly every time we move this file. 
     21 * @name EGW_SERVER_ROOT 
     22 */ 
     23define('EGW_SERVER_ROOT', dirname(dirname(dirname(__FILE__)))); 
     24//define('EGW_SERVER_ROOT', $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']); 
     25 
     26/** 
     27 * Server include base path. We must define our own constants 
     28 * because there are several cases in which workflow is called 
     29 * directly, thus PHPGW constants are not defined. 
     30 * @name EGW_INC_ROOT 
     31 */ 
     32define('EGW_INC_ROOT', EGW_SERVER_ROOT . '/phpgwapi/inc/'); 
     33 
     34/** 
     35 * Workflow base path. 
     36 * @name WF_SERVER_ROOT 
     37 */ 
     38define('WF_SERVER_ROOT', EGW_SERVER_ROOT.'/workflow/'); 
     39 
     40/** 
     41 * Workflow include path. 
     42 * @name WF_INC_ROOT 
     43 */ 
     44define('WF_INC_ROOT', WF_SERVER_ROOT.'/inc/'); 
     45 
     46/** 
     47 * Workflow lib base dir. 
     48 * @name WF_LIB_ROOT 
     49 */ 
     50define('WF_LIB_ROOT', WF_SERVER_ROOT.'/lib/'); 
     51 
     52 
     53if (file_exists(EGW_SERVER_ROOT . '/header.session.inc.php')) { 
     54        require_once EGW_SERVER_ROOT . '/header.session.inc.php'; 
    455} 
    556 
    6 /* garante que durante a execução de funções que modificam strings, os 
    7  * caracteres acentuados sejam tratados corretamente (e.g. strtoupper) 
    8  */ 
     57 
     58/* assure that the correct encondig will be used (e.g string functions) */ 
    959setlocale(LC_CTYPE, 'pt_BR', 'pt_BR.iso-8859-1', 'pt_BR.utf-8'); 
     60 
    1061 
    1162/* define o umask para a criação de arquivos por parte do Workflow */ 
    1263umask(007); 
    1364 
    14 require_once dirname(__FILE__) . '/class.factory.inc.php'; 
    1565 
    16 /** 
    17  * Objeto que implementa uma Factory 
    18  * @global object $GLOBALS['workflow']['factory'] 
    19  * @name $factory 
    20  */ 
    21 $GLOBALS['workflow']['factory'] = new Factory(); 
     66/* including common classes */ 
     67require_once WF_LIB_ROOT . 'security/Security.php'; 
     68require_once WF_LIB_ROOT . 'factory/Factory.php'; 
     69require_once WF_LIB_ROOT . 'factory/BaseFactory.php'; 
     70require_once WF_LIB_ROOT . 'factory/WorkflowFactory.php'; 
     71require_once WF_LIB_ROOT . 'factory/ProcessFactory.php'; 
    2272 
    23 /** 
    24  * Objeto que cria objetos voltados exclusivamente para o módulo Workflow 
    25  * @global object $GLOBALS['workflow']['workflowObjects'] 
    26  * @name $workflowObjects 
    27  */ 
    28 $GLOBALS['workflow']['workflowObjects'] = $GLOBALS['workflow']['factory']->newInstance('WorkflowObjects'); 
     73$GLOBALS['workflow']['workflowObjects'] = Factory::getInstance('WorkflowObjects'); 
    2974?> 
  • sandbox/workflow/trunk/inc/engine/class.ajax_config.inc.php

    r795 r2372  
    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/trunk/inc/engine/class.ajax_ldap.inc.php

    r795 r2372  
    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/trunk/inc/engine/config.ajax.inc.php

    r795 r2372  
    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 
     
    256256        function galaxia_get_config_values($parameters=array()) 
    257257        { 
    258                         $config = new ajax_config(); 
     258                        $config = &Factory::getInstance('ajax_config'); 
    259259                        $config->read_repository(); 
    260260 
  • sandbox/workflow/trunk/inc/engine/config.egw.inc.php

    r795 r2372  
    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 */ 
     
    305305                { 
    306306                        // This way we create a new run_activity instance for the next activity 
    307                         $run_activity = CreateObject('workflow.run_activity.go'); 
     307                        $run_activity = Factory::getInstance('run_activity'); 
    308308                        $data = $run_activity->go($activityId, $iid, $auto); 
    309309                        return $data; 
     
    325325        function galaxia_get_config_values($parameters=array()) 
    326326        { 
    327                         $config = CreateObject('phpgwapi.config'); 
     327                        $config = Factory::getInstance('config'); 
    328328                        $config->read_repository(); 
    329329 
  • sandbox/workflow/trunk/inc/engine/src/API/BaseActivity.php

    r795 r2372  
    9797   * @access public 
    9898   */ 
    99   function BaseActivity(&$db) 
     99  function BaseActivity() 
    100100  { 
    101101    $this->type='base'; 
    102102    $this->child_name = 'BaseActivity'; 
    103     parent::Base($db); 
     103    parent::Base(); 
    104104  } 
    105105 
     
    122122    if(!$result || !$result->numRows() ) return false; 
    123123    $res = $result->fetchRow(); 
     124 
    124125    switch($res['wf_type']) { 
    125126      case 'start': 
    126         require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'Start.php'); 
    127         $act = new Start($this->db);   
    128         break; 
     127        $act = &Factory::newInstance('Start'); 
     128        break; 
     129 
    129130      case 'end': 
    130         require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'End.php'); 
    131         $act = new End($this->db); 
    132         break; 
     131        $act = &Factory::newInstance('End'); 
     132        break; 
     133 
    133134      case 'join': 
    134         require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'Join.php'); 
    135         $act = new Join($this->db); 
    136         break; 
     135        $act = &Factory::newInstance('Join'); 
     136        break; 
     137 
    137138      case 'split': 
    138         require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'Split.php'); 
    139         $act = new Split($this->db); 
    140         break; 
     139        $act = &Factory::newInstance('Split'); 
     140        break; 
     141 
    141142      case 'standalone': 
    142         require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'Standalone.php'); 
    143         $act = new Standalone($this->db); 
    144         break; 
     143        $act = &Factory::newInstance('Standalone'); 
     144        break; 
     145 
    145146      case 'view': 
    146         require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'View.php'); 
    147         $act = new View($this->db); 
    148         break; 
     147        $act = &Factory::newInstance('View'); 
     148        break; 
     149 
    149150      case 'switch': 
    150         require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'SwitchActivity.php'); 
    151         $act = new SwitchActivity($this->db); 
    152         break; 
     151        $act = &Factory::newInstance('SwitchActivity'); 
     152        break; 
     153 
    153154      case 'activity': 
    154         require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'Activity.php'); 
    155         $act = new Activity($this->db); 
    156         break; 
     155        $act = &Factory::newInstance('Activity'); 
     156        break; 
     157 
    157158      default: 
    158159        trigger_error('Unknown activity type:'.$res['wf_type'],E_USER_WARNING); 
    159160    } 
    160      
     161 
    161162    $act->setName($res['wf_name']); 
    162163    $act->setProcessId($res['wf_p_id']); 
  • sandbox/workflow/trunk/inc/engine/src/API/Instance.php

    r795 r2372  
    11<?php 
    22require_once (GALAXIA_LIBRARY.SEP.'src'.SEP.'common'.SEP.'Base.php'); 
    3 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'common' . SEP . 'WfSecurity.php'); 
    43require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ActivityManager.php'); 
    54 
     
    141140 
    142141  var $activityID = null; 
    143   function Instance($db)  
     142  function Instance()  
    144143  { 
    145144    $this->child_name = 'Instance'; 
    146     parent::Base($db); 
     145    parent::Base(); 
    147146  } 
    148147 
     
    11711170     
    11721171    //lock rows and ensure access is granted 
    1173     if (!(isset($this->security))) $this->security =& new WfSecurity($this->db);  
     1172    if (!(isset($this->security))) $this->security = &Factory::getInstance('WfSecurity', $this->db); 
    11741173    if (!($this->security->checkUserAction($activityId,$this->instanceId,'complete'))) 
    11751174    { 
     
    15511550    { 
    15521551      //we check rights for this user on the next activity 
    1553       if (!(isset($this->security))) $this->security =& new WfSecurity($this->db);  
     1552      if (!(isset($this->security))) $this->security = &Factory::getInstance('WfSecurity'); 
    15541553      if ($this->security->checkUserAccess($the_next_user,$activityId)) 
    15551554      { 
     
    15601559    { 
    15611560      // then check to see if there is a default user 
    1562       $activity_manager =& new ActivityManager($this->db); 
     1561      $activity_manager = &Factory::newInstance('ActivityManager'); 
    15631562      //get_default_user will give us '*' if there is no default_user or if the default user has no role 
    15641563      //mapped anymore 
  • sandbox/workflow/trunk/inc/engine/src/API/Process.php

    r795 r2372  
    4848         * @access public 
    4949         */ 
    50         function Process(&$db)  
     50        function Process()  
    5151        { 
    5252                $this->child_name = 'Process'; 
    53                 parent::Base($db); 
     53                parent::Base(); 
    5454        } 
    5555 
  • sandbox/workflow/trunk/inc/engine/src/API/activities/Activity.php

    r795 r2372  
    1616         * @access public 
    1717         */ 
    18         function Activity(&$db) 
     18        function Activity() 
    1919        { 
    20                 parent::Base($db); 
     20                parent::Base(); 
    2121                $this->child_name = 'Activity'; 
    2222        } 
  • sandbox/workflow/trunk/inc/engine/src/API/activities/End.php

    r795 r2372  
    1515         * @access public 
    1616         */ 
    17         function End(&$db) 
     17        function End() 
    1818        { 
    19                 parent::Base($db); 
     19                parent::Base(); 
    2020                $this->child_name = 'End'; 
    2121        } 
  • sandbox/workflow/trunk/inc/engine/src/API/activities/Join.php

    r795 r2372  
    1515         * @access public 
    1616         */ 
    17         function Join(&$db) 
     17        function Join() 
    1818        { 
    19                 parent::Base($db); 
     19                parent::Base(); 
    2020                $this->child_name = 'Join'; 
    2121        } 
  • sandbox/workflow/trunk/inc/engine/src/API/activities/Split.php

    r795 r2372  
    1515         * @access public 
    1616         */ 
    17         function Split(&$db) 
     17        function Split() 
    1818        { 
    19                 parent::Base($db); 
     19                parent::Base(); 
    2020                $this->child_name = 'Split'; 
    2121        } 
  • sandbox/workflow/trunk/inc/engine/src/API/activities/Standalone.php

    r795 r2372  
    1515         * @access public 
    1616         */ 
    17         function Standalone(&$db) 
     17        function Standalone() 
    1818        { 
    19                 parent::Base($db); 
     19                parent::Base(); 
    2020                $this->child_name = 'Standalone'; 
    2121        } 
  • sandbox/workflow/trunk/inc/engine/src/API/activities/Start.php

    r795 r2372  
    1515         * @access public 
    1616         */ 
    17         function Start(&$db) 
     17        function Start() 
    1818        { 
    19                 parent::Base($db); 
     19                parent::Base(); 
    2020                $this->child_name = 'Start'; 
    2121        } 
  • sandbox/workflow/trunk/inc/engine/src/API/activities/SwitchActivity.php

    r795 r2372  
    1616         * @access public 
    1717         */ 
    18         function SwitchActivity(&$db) 
     18        function SwitchActivity() 
    1919        { 
    20            parent::Base($db); 
     20           parent::Base(); 
    2121           $this->child_name = 'Switch'; 
    2222        } 
  • sandbox/workflow/trunk/inc/engine/src/API/activities/View.php

    r795 r2372  
    1616         * @access public 
    1717         */      
    18         function View(&$db) 
     18        function View() 
    1919        { 
    20                 parent::Base($db); 
     20                parent::Base(); 
    2121                $this->child_name = 'View'; 
    2222        } 
  • sandbox/workflow/trunk/inc/engine/src/GUI/GUI.php

    r795 r2372  
    3232   * @access public 
    3333   */ 
    34   function GUI(&$db)  
     34  function GUI() 
    3535  { 
    3636    $this->child_name = 'GUI'; 
    37     parent::Base($db); 
    38     require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'common'.SEP.'WfSecurity.php'); 
    39     $this->wf_security =& new WfSecurity($this->db);  
     37    parent::Base(); 
     38    $this->wf_security = &Factory::getInstance('WfSecurity'); 
    4039  } 
    4140 
     
    703702      if (!(isset($this->pm))) 
    704703      { 
    705         require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'ProcessManager'.SEP.'ProcessManager.php'); 
    706         $this->pm =& new ProcessManager($this->db); 
     704        $this->pm = &Factory::newInstance('ProcessManager'); 
    707705      } 
    708706      $this->process_cache[$pId]['view'] = $this->pm->get_process_view_activity($pId); 
     
    871869    { 
    872870      //the security object said everything was fine 
    873       $instance = new Instance($this->db); 
     871      $instance = &Factory::newInstance('Instance'); 
    874872      $instance->getInstance($instanceId); 
    875873      if (!empty($instance->instanceId))  
     
    975973    { 
    976974      //the security object said everything was fine 
    977       $instance =& new Instance($this->db); 
     975      $instance = &Factory::newInstance('Instance'); 
    978976      $instance->getInstance($instanceId); 
    979977      // we force the execution of the activity 
     
    10121010    { 
    10131011      //the security object said everything was fine 
    1014       $instance =& new Instance($this->db); 
     1012      $instance = &Factory::newInstance('Instance'); 
    10151013      $instance->getInstance($instanceId); 
    10161014      // we force the continuation of the flow 
  • sandbox/workflow/trunk/inc/engine/src/ProcessManager/ActivityManager.php

    r795 r2372  
    2626   * @access public 
    2727   */ 
    28   function ActivityManager(&$db) 
    29   { 
    30     parent::BaseManager($db); 
     28  function ActivityManager() 
     29  { 
     30    parent::BaseManager(); 
    3131    $this->child_name = 'ActivityManager'; 
    3232    require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'ProcessManager' .SEP . 'ProcessManager.php'); 
     
    370370  function build_process_graph($pId) 
    371371  { 
    372     if (!(isset($this->process_manager))) $this->process_manager = new ProcessManager($this->db); 
     372    if (!(isset($this->process_manager))) $this->process_manager = &Factory::newInstance('ProcessManager'); 
    373373    $attributes = Array( 
    374374     
    375375    ); 
    376     $graph = new Process_GraphViz(true,$attributes); 
     376    $graph = &Factory::newInstance('Process_GraphViz', true, $attributes); 
    377377    $name = $this->process_manager->_get_normalized_name($pId); 
    378378    $graph->set_pid($name); 
     
    747747  { 
    748748    require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP . 'BaseActivity.php'); 
    749     $act = new BaseActivity($this->db); 
     749    $act = &Factory::newInstance('BaseActivity'); 
    750750    //Warning, we now use the BaseActivity object for it, interactivity and autorouting is now true/fales, not y/n 
    751751    return ($act->getActivity($activityId,false,true, true)); 
     
    825825  function remove_activity($pId, $activityId, $transaction = true) 
    826826  { 
    827     if (!(isset($this->process_manager))) $this->process_manager = new ProcessManager($this->db); 
     827    if (!(isset($this->process_manager))) $this->process_manager = &Factory::newInstance('ProcessManager'); 
    828828    $proc_info = $this->process_manager->get_process($pId); 
    829829    $actname = $this->_get_normalized_name($activityId); 
     
    888888  function replace_activity($pId, $activityId, $vars, $create_files=true) 
    889889  { 
    890     if (!(isset($this->process_manager))) $this->process_manager = new ProcessManager($this->db); 
     890    if (!(isset($this->process_manager))) $this->process_manager = &Factory::newInstance('ProcessManager'); 
    891891    $TABLE_NAME = GALAXIA_TABLE_PREFIX.'activities'; 
    892892    $now = date("U"); 
     
    11951195    elseif ( (!($result=='*')) && $performAccessCheck) 
    11961196    { 
    1197       $wf_security = new WfSecurity($this->db); 
     1197      $wf_security = &Factory::getInstance('WfSecurity', $this->db); 
    11981198      // perform the check 
    11991199      if (!($wf_security->checkUserAccess($result,$activityId))) 
  • sandbox/workflow/trunk/inc/engine/src/ProcessManager/BaseManager.php

    r2165 r2372  
    1818   * @access public 
    1919   */ 
    20   function BaseManager(&$db) 
     20  function BaseManager() 
    2121  { 
    2222    $this->child_name = 'BaseManager'; 
    23     parent::Base($db); 
     23    parent::Base(); 
    2424  } 
    2525 
  • sandbox/workflow/trunk/inc/engine/src/ProcessManager/InstanceManager.php

    r795 r2372  
    1616   * @access public 
    1717   */ 
    18   function InstanceManager(&$db)  
    19   { 
    20     parent::BaseManager($db); 
     18  function InstanceManager()  
     19  { 
     20    parent::BaseManager(); 
    2121    $this->child_name = 'InstanceManager'; 
    2222  } 
  • sandbox/workflow/trunk/inc/engine/src/ProcessManager/JobManager.php

    r795 r2372  
    7676         * @access public 
    7777         */ 
    78         public function JobManager(&$db) 
    79         { 
    80                 parent::BaseManager($db); 
     78        public function JobManager() 
     79        { 
     80                parent::BaseManager(); 
    8181                $this->child_name = 'JobManager'; 
    8282 
    8383                $this->jobTable = GALAXIA_TABLE_PREFIX . 'jobs'; 
    8484                $this->logTable = GALAXIA_TABLE_PREFIX . 'job_logs'; 
    85                 $this->processManager = new ProcessManager($this->db); 
     85                $this->processManager = &Factory::newInstance('ProcessManager'); 
    8686        } 
    8787 
  • sandbox/workflow/trunk/inc/engine/src/ProcessManager/ProcessManager.php

    r2165 r2372  
    6666         * @access public 
    6767         */ 
    68         function ProcessManager(&$db) 
    69         { 
    70                 parent::BaseManager($db); 
     68        function ProcessManager() 
     69        { 
     70                parent::BaseManager(); 
    7171                $this->child_name = 'ProcessManager'; 
    72                 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'ProcessManager'.SEP.'ActivityManager.php'); 
    73                 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'ProcessManager'.SEP.'JobManager.php'); 
    7472                // $this->activity_manager is not set here to avoid objects loading object A loading object B loading object A, etc 
    7573                //$this->role_manager will only be loaded when needed as well 
     
    131129        function serialize_process($pId) 
    132130        { 
    133                 if (!(isset($this->activity_manager)))  $this->activity_manager = new ActivityManager($this->db); 
     131                if (!(isset($this->activity_manager)))  $this->activity_manager = &Factory::newInstance('ActivityManager'); 
    134132                // <process> 
    135133                $out = '<process>'."\n"; 
     
    459457        { 
    460458                //Now the show begins 
    461                 if (!(isset($this->activity_manager)))  $this->activity_manager = new ActivityManager($this->db); 
    462                 if (!(isset($this->role_manager))) $this->role_manager = new RoleManager($this->db); 
     459                if (!(isset($this->activity_manager)))  $this->activity_manager = &Factory::newInstance('ActivityManager'); 
     460                if (!(isset($this->role_manager))) $this->role_manager = &Factory::newInstance('RoleManager'); 
    463461                if (!isset($this->jobManager)) 
    464                         $this->jobManager = new JobManager($this->db); 
     462                        $this->jobManager = &Factory::newInstance('JobManager'); 
    465463 
    466464                // First create the process. Always inactive and inactive first. 
     
    620618        function new_process_version($pId, $minor=true) 
    621619        { 
    622                 if (!(isset($this->activity_manager)))  $this->activity_manager = new ActivityManager($this->db); 
     620                if (!(isset($this->activity_manager)))  $this->activity_manager = &Factory::newInstance('ActivityManager'); 
    623621                $oldpid = $pId; 
    624622                //retrieve process info with config rows 
     
    671669                } 
    672670                // create roles 
    673                 if (!(isset($this->role_manager))) $this->role_manager = new RoleManager($this->db); 
     671                if (!(isset($this->role_manager))) $this->role_manager = &Factory::newInstance('RoleManager'); 
    674672                $query = 'select * from '.GALAXIA_TABLE_PREFIX.'roles where wf_p_id=?'; 
    675673                $result = $this->query($query, array($oldpid)); 
     
    853851        function remove_process($pId) 
    854852        { 
    855                 if (!(isset($this->activity_manager)))  $this->activity_manager = new ActivityManager($this->db); 
     853                if (!(isset($this->activity_manager)))  $this->activity_manager = &Factory::newInstance('ActivityManager'); 
    856854                if (!isset($this->jobManager)) 
    857                         $this->jobManager = new JobManager($this->db); 
     855                        $this->jobManager = &Factory::newInstance('JobManager'); 
    858856                $this->deactivate_process($pId); 
    859857                $name = $this->_get_normalized_name($pId); 
     
    919917        function replace_process($pId, &$vars, $create = true) 
    920918        { 
    921                 if (!(isset($this->activity_manager)))  $this->activity_manager = new ActivityManager($this->db); 
     919                if (!(isset($this->activity_manager)))  $this->activity_manager = &Factory::newInstance('ActivityManager'); 
    922920                $TABLE_NAME = GALAXIA_TABLE_PREFIX.'processes'; 
    923921                $now = date("U"); 
     
    12961294                { 
    12971295                        //Warning: this means you have to include the Process.php from the API 
    1298                         $this->Process = new Process($this->db); 
     1296                        $this->Process = &Factory::newInstance('Process'); 
    12991297                        $this->Process->getProcess($pId); 
    13001298                        $result_array = $this->Process->getConfigValues($config_array); 
     
    13161314        { 
    13171315                //Warning: this means you have to include the Process.php from the API 
    1318                 $this->Process = new Process($this->db); 
     1316                $this->Process = &Factory::newInstance('Process'); 
    13191317                $this->Process->getProcess($pId); 
    13201318                $this->Process->setConfigValues($config_array); 
  • sandbox/workflow/trunk/inc/engine/src/ProcessManager/RoleManager.php

    r795 r2372  
    1919   * @access public 
    2020   */ 
    21   function RoleManager(&$db)  
    22   { 
    23     parent::Base($db); 
     21  function RoleManager()  
     22  { 
     23    parent::Base(); 
    2424    $this->child_name = 'RoleManager'; 
    2525  } 
     
    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    { 
     
    256256          //we have a group instead of a simple user and we want real users 
    257257          $real_users = galaxia_retrieve_group_users($res['wf_user'], true); 
    258           foreach ($real_users as $key => $value) 
    259           { 
    260             $ret[$key]=$value; 
    261           } 
     258                  if (!empty($real_users)) { 
     259            foreach ($real_users as $key => $value) 
     260            { 
     261              $ret[$key]=$value; 
     262            } 
     263                  } 
    262264        } 
    263265        else 
  • sandbox/workflow/trunk/inc/engine/src/ProcessMonitor/ProcessMonitor.php

    r795 r2372  
    1818   * @access public 
    1919   */ 
    20   function ProcessMonitor(&$db) 
     20  function ProcessMonitor() 
    2121  { 
    2222    $this->child_name = 'ProcessMonitor'; 
    23     parent::Base($db); 
     23    parent::Base(); 
    2424    // check the the actual user can really do this 
    2525    if ( !(galaxia_user_can_monitor())) 
  • sandbox/workflow/trunk/inc/engine/src/common/Base.php

    r2165 r2372  
    3939        var $child_name = 'Base'; 
    4040 
     41        /** 
     42         * @var object $db_shared_obj The database abstraction object shared between 
     43         *                                                    all instances of this class. 
     44         * @acess private 
     45         * @static 
     46         */ 
     47        private static $db_shared_obj = null; 
     48 
    4149  /** 
    4250   * Constructor receiving a database abstraction object 
     
    4654   * @access public 
    4755   */ 
    48   function Base(&$db) 
     56  function Base() 
    4957  { 
    50     if(!$db) { 
     58        /** 
     59         * New Stuff! 
     60         * We decided to get here the database object. In a recent past, 
     61         * all the classes that specialize this one passed a db object. 
     62         * Now, to simplify and save memory, we store the database object 
     63         * into a single and static atribute shared among each instance 
     64         * of this class. 
     65         * 
     66         * To prevent to modify all sub-classes to use "self::$db" instead 
     67         * of "this->db", we made a very tiny workaround here. In the first 
     68         * instantiation of this class, we instantiate the database object 
     69         * and store it into 'self::$db_shared_obj'. Any subsequent 
     70         * instantiations will just point to the static one. 
     71         */ 
     72        if (!self::$db_shared_obj) 
     73                self::$db_shared_obj = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
     74 
     75        $this->db = &self::$db_shared_obj; 
     76 
     77 
     78    if(!$this->db) { 
    5179      die('Invalid db object passed to '.$this->child_name.' constructor'); 
    5280    } 
    5381    //Force transactionnal mysql (Innodb) -> mysqlt 
    54     if ($db->databaseType=='mysql') 
     82    if ($this->db->databaseType=='mysql') 
    5583    { 
    5684        $GLOBALS['phpgw']->db->disconnect(); 
    57         $db = $GLOBALS['phpgw']->db->connect( 
     85        $this->db = $GLOBALS['phpgw']->db->connect( 
    5886                        $GLOBALS['phpgw_info']['server']['db_name'], 
    5987                        $GLOBALS['phpgw_info']['server']['db_host'], 
     
    6492                ); 
    6593    } 
    66     $this->db = &$db; 
    6794  } 
    6895 
  • sandbox/workflow/trunk/inc/engine/src/common/WfRuntime.php

    r795 r2372  
    8686   * @access public 
    8787   */ 
    88   function WfRuntime(&$db)  
     88  function WfRuntime()  
    8989  { 
    9090    $this->child_name = 'WfRuntime'; 
    91     parent::Base($db); 
    92     require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'BaseActivity.php'); 
    93     require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Process.php'); 
    94     require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Instance.php'); 
    95     require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'common'.SEP.'WfSecurity.php'); 
    96      
     91    parent::Base(); 
     92 
    9793    //first the activity is not set 
    9894    $this->activity = null; 
    99     $this->instance = new Instance($this->db); 
    100     $this->process = new Process($this->db); 
    101     $this->security = new WfSecurity($this->db);  
     95    $this->instance = &Factory::newInstance('Instance'); 
     96    $this->process = &Factory::newInstance('Process'); 
     97    $this->security = &Factory::getInstance('WfSecurity'); 
    10298  } 
    10399 
     
    276272      return false; 
    277273    } 
    278     $base_activity = new BaseActivity($this->db); 
     274    $base_activity = &Factory::newInstance('BaseActivity'); 
    279275    $this->activity =& $base_activity->getActivity($activity_id, $with_roles, $with_agents); 
    280276    if (!$this->activity) 
     
    10911087    $workflow = $GLOBALS['workflow']; 
    10921088    unset($_REQUEST['iid']); 
    1093     $run_activity = CreateObject('workflow.run_activity'); 
     1089    $run_activity = Factory::getInstance('run_activity'); 
    10941090    $run_activity->runtime->instance->parentInstanceId = $this->instance_id; 
    10951091    $run_activity->runtime->instance->parentActivityId = $this->activity_id; 
  • sandbox/workflow/trunk/inc/engine/src/common/WfSecurity.php

    r795 r2372  
    2323   * @access public 
    2424   */ 
    25   function WfSecurity(&$db)  
     25  function WfSecurity()  
    2626  { 
    2727    $this->child_name = 'WfSecurity'; 
    28     parent::Base($db); 
    29     require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Instance.php'); 
    30     require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Process.php'); 
    31     require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'BaseActivity.php'); 
     28    parent::Base(); 
    3229  } 
    3330 
     
    5855      ); 
    5956      //check theses values for this process and store the result for this object life duration 
    60       $myProcess = new Process($this->db); 
     57      $myProcess = &Factory::newInstance('Process'); 
    6158      $myProcess->getProcess($pId); 
    6259      $this->processesConfig[$pId] = $myProcess->getConfigValues($arrayConf); 
     
    7875  function checkUserAccess($user, $activity_id, $readonly=false)  
    7976  { 
     77        /* if activity is non-interactive is not necessary checking user access */ 
     78        $activity = &Factory::getInstance('BaseActivity')->getActivity($activity_id); 
     79        if (!$activity->isInteractive()) 
     80                return true; 
     81 
    8082    //group mapping, warning groups and user can have the same id 
    8183    if ($user[0] != 'p') 
     
    577579      if (!(isset($this->pm))) 
    578580      { 
    579         require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'ProcessManager'.SEP.'ProcessManager.php'); 
    580         $this->pm = new ProcessManager($this->db); 
     581        $this->pm = &Factory::newInstance('ProcessManager'); 
    581582      } 
    582583      //$this->error[] = 'DEBUG: checking to see if there is no view activities on process :'.$pId.':'.$this->pm->get_process_view_activity($pId); 
  • sandbox/workflow/trunk/inc/hook_home.inc.php

    r795 r2372  
    11<?php 
     2require_once 'common.inc.php'; 
     3 
    24$GLOBALS['phpgw_info']['flags']['currentapp'] = "workflow"; 
    35if (!isset($_SESSION['phpgw_info']['workflow']['server'])) 
     
    2224 
    2325$title = lang("External Applications"); 
    24 $bo     = CreateObject('workflow.bo_userinterface'); 
     26$bo     = Factory::getInstance('bo_userinterface'); 
    2527$externals      = $bo -> externals(); 
    2628$extra_data = ''; 
     
    4244} 
    4345$extra_data .= "</table></div>"; 
    44 $portalbox = CreateObject('phpgwapi.listbox', 
     46$portalbox = Factory::getInstance('listbox', 
    4547        Array( 
    4648                'title'     => $title, 
  • sandbox/workflow/trunk/inc/hook_sidebox_menu.inc.php

    r795 r2372  
    1414 */ 
    1515 
     16require_once 'common.inc.php'; 
    1617require_once 'engine/config.egw.inc.php'; 
    1718 
    1819{ 
    19         $workflowACL = CreateObject('workflow.workflow_acl'); 
     20        $workflowACL = Factory::getInstance('workflow_acl'); 
    2021        $userID = $GLOBALS['phpgw_info']['user']['account_id']; 
    2122        $apptitle = $GLOBALS['phpgw_info']['apps'][$appname]['title']; 
  • sandbox/workflow/trunk/inc/local/classes/class.JobBase.php

    r1437 r2372  
    8989        { 
    9090                require_once 'common.inc.php'; 
    91                 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment(); 
     91                Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 
    9292                $this->jobID = $jobID; 
    9393                $this->processID = $processID; 
    9494                $this->currentDate = $currentDate; 
    95                 $this->jobManager = &$GLOBALS['workflow']['factory']->getInstance('WorkflowJobManager'); 
     95                $this->jobManager = Factory::getInstance('WorkflowJobManager'); 
    9696                $this->testMode = $testMode; 
    9797                $this->maximumExecutionTime = $maximumExecutionTime; 
     
    148148        final private function prepareEnvironment() 
    149149        { 
    150                 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareProcessEnvironment($this->processID); 
    151  
    152                 require_once PHPGW_SERVER_ROOT . '/workflow/inc/class.process_factory.inc.php'; 
     150                Factory::getInstance('WorkflowMacro')->prepareProcessEnvironment($this->processID); 
    153151 
    154152                $this->environment = array(); 
    155                 $this->environment['factory']  = &new ProcessFactory(); 
     153                $this->environment['factory']  = &Factory::newInstance('ProcessWrapperFactory'); 
    156154        } 
    157155 
     
    202200        final public function createNewInstance($startActivityId, $instanceName=false, $properties=false, $user=false) 
    203201        { 
    204                 $activityManager = CreateObject('workflow.workflow_activitymanager'); 
     202                $activityManager = Factory::getInstance('workflow_activitymanager'); 
    205203                $activity = $activityManager->get_activity($startActivityId); 
    206204 
  • sandbox/workflow/trunk/inc/local/classes/class.wf_engine.php

    r795 r2372  
    6868                $flagObject[0] = is_null($this->processManager); 
    6969                if ($flagObject[0]) 
    70                         $this->processManager = CreateObject('workflow.workflow_processmanager'); 
     70                        $this->processManager = Factory::getInstance('workflow_processmanager'); 
    7171 
    7272                $output = array(); 
     
    9090        function continueInstance($activityID, $instanceID) 
    9191        { 
    92                 require_once 'class.wf_instance.php'; 
    93                 $WFInstance = new wf_instance(); 
     92                $WFInstance = &Factory::getInstance('wf_instance'); 
    9493                return $WFInstance->continueInstance($activityID, $instanceID); 
    9594        } 
     
    104103        function abortInstance($instanceID) 
    105104        { 
    106                 require_once 'class.wf_instance.php'; 
    107                 $WFInstance = new wf_instance(); 
     105                $WFInstance = &Factory::getInstance('wf_instance'); 
    108106                return $WFInstance->abort($instanceID); 
    109107        } 
     
    119117        function setInstanceName($instanceID, $name) 
    120118        { 
    121                 require_once 'class.wf_instance.php'; 
    122                 $WFInstance = new wf_instance(); 
     119                $WFInstance = &Factory::getInstance('wf_instance'); 
    123120                return $WFInstance->setName($instanceID, $name); 
    124121        } 
     
    134131        function setInstancePriority($instanceID, $priority) 
    135132        { 
    136                 require_once 'class.wf_instance.php'; 
    137                 $WFInstance = new wf_instance(); 
     133                $WFInstance = &Factory::getInstance('wf_instance'); 
    138134                return $WFInstance->setPriority($instanceID, $priority); 
    139135        } 
     
    149145        function getIdleInstances($numberOfDays, $activities = null) 
    150146        { 
    151                 require_once 'class.wf_instance.php'; 
    152                 $WFInstance = new wf_instance(); 
     147                $WFInstance = &Factory::getInstance('wf_instance'); 
    153148                return $WFInstance->getIdle($numberOfDays, $activities); 
    154149        } 
     
    175170        function getInstancesByName($name) 
    176171        { 
    177                 require_once 'class.wf_instance.php'; 
    178                 $WFInstance = new wf_instance(); 
     172                $WFInstance = &Factory::getInstance('wf_instance'); 
    179173                $preOutput = $WFInstance->getByName($name); 
    180174                $output = array(); 
     
    197191        function getChildInstances($instanceID = null, $activityID = null) 
    198192        { 
    199                 require_once 'class.wf_instance.php'; 
    200                 $WFInstance = new wf_instance(); 
     193                $WFInstance = &Factory::getInstance('wf_instance'); 
    201194                $preOutput = $WFInstance->getChildren($instanceID, $activityID); 
    202195                $output = array(); 
     
    217210        function getInstanceProperties($instanceID) 
    218211        { 
    219                 require_once 'class.wf_instance.php'; 
    220                 $WFInstance = new wf_instance(); 
     212                $WFInstance = &Factory::getInstance('wf_instance'); 
    221213                return $WFInstance->getProperties($instanceID); 
    222214        } 
     
    231223        function getChildInstanceProperties($instanceID) 
    232224        { 
    233                 require_once 'class.wf_instance.php'; 
    234                 $WFInstance = new wf_instance(); 
     225                $WFInstance = &Factory::getInstance('wf_instance'); 
    235226                return $WFInstance->getProperties($instanceID); 
    236227        } 
     
    247238                $flagObject[0] = is_null($this->acl); 
    248239                if ($flagObject[0]) 
    249                         $this->acl = CreateObject('workflow.workflow_acl'); 
     240                        $this->acl = Factory::getInstance('workflow_acl'); 
    250241 
    251242                $output = $this->acl->getUserPermissions($type, $uid); 
     
    268259                $flagObject[0] = is_null($this->acl); 
    269260                if ($flagObject[0]) 
    270                         $this->acl = CreateObject('workflow.workflow_acl'); 
     261                        $this->acl = Factory::getInstance('workflow_acl'); 
    271262 
    272263                $output = $this->acl->getUserGroupPermissions($type, $uid); 
     
    346337        function getUserInstances($users, $activities = null, $status = null) 
    347338        { 
    348                 require_once 'class.wf_instance.php'; 
    349                 $WFInstance = new wf_instance(); 
     339                $WFInstance = &Factory::getInstance('wf_instance'); 
    350340                return $WFInstance->getByUser($users, $activities, $status); 
    351341        } 
     
    360350        function setInstanceProperty($instanceID, $nameProperty, $value) 
    361351        { 
    362                 require_once 'class.wf_instance.php'; 
    363                 $WFInstance = new wf_instance(); 
     352                $WFInstance = &Factory::getInstance('wf_instance'); 
    364353                return $WFInstance->setProperty($instanceID, $nameProperty, $value); 
    365354        } 
     
    377366        function checkUserAccessToInstance($userID, $instanceID, $activityID, $writeAccess = true) 
    378367        { 
    379                 require_once 'class.wf_instance.php'; 
    380                 $WFInstance = new wf_instance(); 
     368                $WFInstance = &Factory::getInstance('wf_instance'); 
    381369                return $WFInstance->checkUserAccess($userID, $instanceID, $activityID, $writeAccess); 
    382370        } 
  • sandbox/workflow/trunk/inc/local/classes/class.wf_instance.php

    r1385 r2372  
    7777        { 
    7878                $instanceID = (int) $instanceID; 
    79                 $instance = CreateObject('workflow.workflow_instance'); 
     79                $instance = Factory::getInstance('workflow_instance'); 
    8080                if (!$instance->getInstance($instanceID)) 
    8181                        return false; 
     
    118118                $instance = $this->getInstanceObject($instanceID); 
    119119 
    120                 $runActivity = CreateObject('workflow.run_activity'); 
     120                $runActivity = Factory::getInstance('run_activity'); 
    121121 
    122122                ob_start(); 
     
    423423 
    424424                /* load the required instance (for the required user) */ 
    425                 require_once GALAXIA_LIBRARY . SEP . 'src' . SEP . 'GUI' . SEP . 'GUI.php'; 
    426                 $GUI = new GUI($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     425                $GUI = &Factory::newInstance('GUI'); 
    427426                $userInstance = $GUI->gui_list_user_instances($userID, 0, -1, '', '', "(ga.wf_is_interactive = 'y') AND (gia.wf_activity_id = {$activityID}) AND (gia.wf_instance_id = {$instanceID})", false, $this->processID, true, false, true, false, false, false); 
    428427                $userInstance = $userInstance['data']; 
     
    456455                if ($userID !== '*') 
    457456                { 
    458                         require_once dirname(__FILE__) . '/class.wf_role.php'; 
    459                         require_once dirname(__FILE__) . '/class.wf_engine.php'; 
    460  
    461                         $wfRole = new wf_role(); 
    462                         $engine = new wf_engine(); 
     457                        $wfRole = Factory::getInstance('wf_role'); 
     458                        $engine = Factory::getInstance('wf_engine'); 
    463459                        /* get information about the activity */ 
    464460                        if (($activityInfo = $engine->getActivityInformationByID($activityID)) === false) 
     
    529525 
    530526                /* try to get the role id */ 
    531                 require_once dirname(__FILE__) . '/class.wf_role.php'; 
    532                 $wfRole = new wf_role(); 
     527                $wfRole = Factory::getInstance('wf_role'); 
    533528                if (($roleID = $wfRole->getRoleIdByName($roleName)) === false) 
    534529                        return false; 
  • sandbox/workflow/trunk/inc/local/classes/class.wf_ldap.php

    r1067 r2372  
    11<?php 
    2 require_once PHPGW_SERVER_ROOT . SEP . 'workflow' . SEP . 'inc' . SEP . 'local' . SEP . 'classes' . SEP . 'class.wf_cached_ldap.php'; 
    32 
    43/** 
     
    4140        function wf_ldap() 
    4241        { 
    43                 $tmpLDAP = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     42                $tmpLDAP = Factory::getInstance('WorkflowLDAP'); 
    4443                $this->user_context  = $tmpLDAP->getUserContext(); 
    4544                $this->group_context = $tmpLDAP->getGroupContext(); 
     
    4746                $this->ds = &$GLOBALS['workflow']['workflowObjects']->getLDAP(); 
    4847 
    49                 $this->cachedLDAP = new wf_cached_ldap(); 
     48                $this->cachedLDAP = &Factory::getInstance('wf_cached_ldap'); 
    5049                $this->cachedLDAP->setOperationMode($this->cachedLDAP->OPERATION_MODE_LDAP); 
    5150        } 
  • sandbox/workflow/trunk/inc/local/classes/class.wf_mail.php

    r795 r2372  
    3939                $requiredConfiguration = array('mail_smtp_profile' => false); 
    4040                $configuration = $GLOBALS['workflow']['wf_runtime']->process->getConfigValues($requiredConfiguration); 
    41                 $bo_emailadmin = CreateObject('emailadmin.bo'); 
     41                $bo_emailadmin = Factory::getInstance('bo'); 
    4242                $profileData = $bo_emailadmin->getProfile($configuration['mail_smtp_profile']); 
    4343 
  • sandbox/workflow/trunk/inc/local/classes/class.wf_role.php

    r1048 r2372  
    5858 
    5959                $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
    60                 $this->roleManager = CreateObject('workflow.workflow_rolemanager'); 
    61                 $this->activityManager = CreateObject('workflow.workflow_activitymanager'); 
     60                $this->roleManager = Factory::getInstance('workflow_rolemanager'); 
     61                $this->activityManager = Factory::getInstance('workflow_activitymanager'); 
    6262        } 
    6363 
     
    186186                        $users = array((int) $users); 
    187187                $roleID = $this->roleManager->get_role_id($this->processID, $roleName); 
    188                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     188                $ldap = Factory::getInstance('WorkflowLDAP'); 
    189189                foreach ($users as $user) 
    190190                { 
     
    212212                $users = $this->roleManager->list_mapped_users($this->processID, false, array('wf_role_name' => $roleName)); 
    213213 
    214                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     214                $ldap = Factory::getInstance('WorkflowLDAP'); 
    215215                $output = array(); 
    216216                foreach ($users as $id => $login) 
     
    367367 
    368368                /* get the roles */ 
    369                 $userGroups = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserGroups($userID); 
     369                $userGroups = Factory::getInstance('WorkflowLDAP')->getUserGroups($userID); 
    370370                $query = 'SELECT DISTINCT role.wf_role_id, role.wf_name, role.wf_description FROM egw_wf_roles role, egw_wf_user_roles user_role WHERE (user_role.wf_role_id = role.wf_role_id) AND (role.wf_p_id = ?) AND (role.wf_role_id = ANY (?))'; 
    371371                $query .= ' AND (((user_role.wf_user = ?) AND (user_role.wf_account_type = ?))'; 
  • sandbox/workflow/trunk/inc/nano/NanoController.class.php

    r795 r2372  
    5959    function __construct() 
    6060    { 
    61         $this->_mObjJsonConverter = new NanoJsonConverter(); 
    62         $this->_mObjJson          = new Services_JSON(); 
     61        $this->_mObjJsonConverter = &Factory::newInstance('NanoJsonConverter'); 
     62        $this->_mObjJson          = &Factory::newInstance('Services_JSON'); 
    6363    } 
    6464 
     
    130130    public function iterateOverVirtualRequests() 
    131131    { 
    132         $this->_mObjNanoRequest = new NanoRequest( $this->_mStrClassPath, $this->_mStrClassSuffix, $this->_mStrClassPreffix ); 
     132        $this->_mObjNanoRequest = &Factory::newInstance('NanoRequest', $this->_mStrClassPath, $this->_mStrClassSuffix, $this->_mStrClassPreffix ); 
    133133        $return_data            = array(); 
    134134 
  • sandbox/workflow/trunk/inc/nano/NanoGuardian.class.php

    r795 r2372  
    3232    public function __construct() 
    3333    { 
    34         $this->_mObjNanoSanitizer = new NanoSanitizer(new DummyLogger); 
     34        $this->_mObjNanoSanitizer = &Factory::newInstance('NanoSanitizer', new DummyLogger); 
    3535    } 
    3636 
  • sandbox/workflow/trunk/inc/nano/NanoJsonConverter.class.php

    r795 r2372  
    118118        // initialize JSON object 
    119119        $this->_mObjJson = ( strtolower($return_type) != 'object' ) 
    120                                 ? new Services_JSON( SERVICES_JSON_LOOSE_TYPE ) 
    121                                 : new Services_JSON(); 
     120                                ? Factory::getInstance('Services_JSON', SERVICES_JSON_LOOSE_TYPE ) 
     121                                : Factory::getInstance('Services_JSON'); 
    122122    } 
    123123 
  • sandbox/workflow/trunk/inc/smarty/wf_plugins/function.wf_generic_select.php

    r795 r2372  
    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/trunk/inc/smarty/wf_plugins/function.wf_redir_menu.php

    r795 r2372  
    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']); 
     55        $user_is_admin = Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']); 
    5656        if ($user_is_admin || ($GLOBALS['phpgw']->acl->check('admin_workflow',1,'workflow'))) { 
    5757                $select_tag .= "<option value=\"ad\">Administração</option>"; 
  • sandbox/workflow/trunk/inc/smarty/wf_plugins/function.wf_select_city.php

    r795 r2372  
    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/trunk/inc/smarty/wf_plugins/function.wf_select_ldap_users.php

    r795 r2372  
    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/trunk/inc/smarty/wf_plugins/function.wf_select_state.php

    r795 r2372  
    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/trunk/inc/smarty/wf_plugins/function.wf_select_user.php

    r795 r2372  
    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/trunk/inc/smarty/wf_plugins/function.wf_select_users.php

    r795 r2372  
    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/trunk/inc/smarty/wf_plugins/prefilter.wf_default_template.php

    r795 r2372  
    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/trunk/index.php

    r2193 r2372  
    2121                        require_once dirname(__FILE__) . '/inc/nano/JSON.php'; 
    2222                        require_once dirname(__FILE__) . '/inc/nano/NanoJsonConverter.class.php'; 
    23                         require_once dirname(__FILE__) . '/inc/nano/NanoController.class.php'; 
    24                         $nanoController = new NanoController(); 
     23                        $nanoController = &Factory::newInstance('NanoController'); 
    2524                        $nanoController->throwErrorOnAllVirtualRequests('__NANOAJAX_SESSION_EXPIRED__'); 
    2625                        exit; 
  • sandbox/workflow/trunk/redirect.php

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

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

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