Ignore:
Timestamp:
08/17/10 16:17:12 (14 years ago)
Author:
viani
Message:

Ticket #1135 - Merged r1990:3166 from /trunk/workflow into /branches/2.2/workflow

Location:
branches/2.2/workflow/inc/local
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/workflow/inc/local/classes/class.JobBase.php

    r1437 r3167  
    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 
  • branches/2.2/workflow/inc/local/classes/class.wf_engine.php

    r795 r3167  
    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(); 
     
    8686        * @return bool true caso a instância tenha sido continuada e false caso contrário. 
    8787        * @access public 
    88         * @deprecated 1.7.00.000 
     88        * @deprecated 2.2.00.000 
    8989        */ 
    9090        function continueInstance($activityID, $instanceID) 
    9191        { 
    92                 require_once 'class.wf_instance.php'; 
    93                 $WFInstance = new wf_instance(); 
     92                wf_warn_deprecated_method('wf_instance', 'continueInstance'); 
     93                $WFInstance = &Factory::getInstance('wf_instance'); 
    9494                return $WFInstance->continueInstance($activityID, $instanceID); 
    9595        } 
     
    100100        * @return boolean true se foi possível abortar a instância e false caso contrário. 
    101101        * @access public 
    102         * @deprecated 1.7.00.000 
     102        * @deprecated 2.2.00.000 
    103103        */ 
    104104        function abortInstance($instanceID) 
    105105        { 
    106                 require_once 'class.wf_instance.php'; 
    107                 $WFInstance = new wf_instance(); 
     106                wf_warn_deprecated_method('wf_instance', 'abort'); 
     107                $WFInstance = &Factory::getInstance('wf_instance'); 
    108108                return $WFInstance->abort($instanceID); 
    109109        } 
     
    115115        * @return boolean true se foi possível mudar o nome da instância e false caso contrário. 
    116116        * @access public 
    117         * @deprecated 1.7.00.000 
     117        * @deprecated 2.2.00.000 
    118118        */ 
    119119        function setInstanceName($instanceID, $name) 
    120120        { 
    121                 require_once 'class.wf_instance.php'; 
    122                 $WFInstance = new wf_instance(); 
     121                wf_warn_deprecated_method('wf_instance', 'setName'); 
     122                $WFInstance = &Factory::getInstance('wf_instance'); 
    123123                return $WFInstance->setName($instanceID, $name); 
    124124        } 
     
    130130        * @return boolean true se foi possível mudar a prioridade da instância e false caso contrário. 
    131131        * @access public 
    132         * @deprecated 1.7.00.000 
     132        * @deprecated 2.2.00.000 
    133133        */ 
    134134        function setInstancePriority($instanceID, $priority) 
    135135        { 
    136                 require_once 'class.wf_instance.php'; 
    137                 $WFInstance = new wf_instance(); 
     136                wf_warn_deprecated_method('wf_instance', 'setPriority'); 
     137                $WFInstance = &Factory::getInstance('wf_instance'); 
    138138                return $WFInstance->setPriority($instanceID, $priority); 
    139139        } 
     
    145145        * @return array As instâncias que satisfazem o critério de seleção. 
    146146        * @access public 
    147         * @deprecated 1.7.00.000 
     147        * @deprecated 2.2.00.000 
    148148        */ 
    149149        function getIdleInstances($numberOfDays, $activities = null) 
    150150        { 
    151                 require_once 'class.wf_instance.php'; 
    152                 $WFInstance = new wf_instance(); 
     151                wf_warn_deprecated_method('wf_instance', 'getIdle'); 
     152                $WFInstance = &Factory::getInstance('wf_instance'); 
    153153                return $WFInstance->getIdle($numberOfDays, $activities); 
    154154        } 
     
    159159        * @return array As instâncias que satisfazem o critério de seleção. 
    160160        * @access public 
    161         * @deprecated 1.7.00.000 
     161        * @deprecated 2.2.00.000 
    162162        */ 
    163163        function getInstances($activities = null) 
    164164        { 
     165                wf_warn_deprecated_method('wf_instance', 'getIdle'); 
    165166                return $this->getIdleInstances(0, $activities); 
    166167        } 
     
    171172        * @return array As instâncias que satisfazem o critério de seleção. 
    172173        * @access public 
    173         * @deprecated 1.7.00.000 
     174        * @deprecated 2.2.00.000 
    174175        */ 
    175176        function getInstancesByName($name) 
    176177        { 
    177                 require_once 'class.wf_instance.php'; 
    178                 $WFInstance = new wf_instance(); 
     178                wf_warn_deprecated_method('wf_instance', 'getByName'); 
     179                $WFInstance = &Factory::getInstance('wf_instance'); 
    179180                $preOutput = $WFInstance->getByName($name); 
    180181                $output = array(); 
     
    193194        * @return array As instâncias filhas do par instância/atividade atual 
    194195        * @access public 
    195         * @deprecated 1.7.00.000 
     196        * @deprecated 2.2.00.000 
    196197        */ 
    197198        function getChildInstances($instanceID = null, $activityID = null) 
    198199        { 
    199                 require_once 'class.wf_instance.php'; 
    200                 $WFInstance = new wf_instance(); 
    201                 $preOutput = $WFInstance->getChildren($instanceID, $activityID); 
     200                wf_warn_deprecated_method('wf_instance', 'getChildren'); 
     201                $WFInstance = &Factory::getInstance('wf_instance'); 
     202                $preOutput = $WFInstance->getChildren($instanceID); 
    202203                $output = array(); 
    203204                foreach ($preOutput as $childInstance) 
     
    213214        * @return mixed Uma array contento as propriedades da instância (no formato "nome_da_propriedade" => "valor"). Ou false em caso de erro. 
    214215        * @access public 
    215         * @deprecated 1.7.00.000 
     216        * @deprecated 2.2.00.000 
    216217        */ 
    217218        function getInstanceProperties($instanceID) 
    218219        { 
    219                 require_once 'class.wf_instance.php'; 
    220                 $WFInstance = new wf_instance(); 
     220                wf_warn_deprecated_method('wf_instance', 'getProperties'); 
     221                $WFInstance = &Factory::getInstance('wf_instance'); 
    221222                return $WFInstance->getProperties($instanceID); 
    222223        } 
     
    227228        * @return array Propriedades da instância filha. Array no formato "nome_da_propriedade" => "valor". 
    228229        * @access public 
    229         * @deprecated 1.7.00.000 
     230        * @deprecated 2.2.00.000 
    230231        */ 
    231232        function getChildInstanceProperties($instanceID) 
    232233        { 
    233                 require_once 'class.wf_instance.php'; 
    234                 $WFInstance = new wf_instance(); 
     234                wf_warn_deprecated_method('wf_instance', 'getProperties'); 
     235                $WFInstance = &Factory::getInstance('wf_instance'); 
    235236                return $WFInstance->getProperties($instanceID); 
    236237        } 
     
    247248                $flagObject[0] = is_null($this->acl); 
    248249                if ($flagObject[0]) 
    249                         $this->acl = CreateObject('workflow.workflow_acl'); 
     250                        $this->acl = Factory::getInstance('workflow_acl'); 
    250251 
    251252                $output = $this->acl->getUserPermissions($type, $uid); 
     
    268269                $flagObject[0] = is_null($this->acl); 
    269270                if ($flagObject[0]) 
    270                         $this->acl = CreateObject('workflow.workflow_acl'); 
     271                        $this->acl = Factory::getInstance('workflow_acl'); 
    271272 
    272273                $output = $this->acl->getUserGroupPermissions($type, $uid); 
     
    291292                /* build the SQL query */ 
    292293                $query = "SELECT wf_activity_id, wf_name, wf_normalized_name, wf_type, wf_description FROM egw_wf_activities WHERE (wf_activity_id = ?) AND (wf_p_id = ?)"; 
    293                 $db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     294                $db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    294295                $resultSet = $db->query($query, array($activityID, $processID)); 
    295296 
     
    319320                /* build the SQL query */ 
    320321                $query = "SELECT wf_activity_id, wf_name, wf_normalized_name, wf_type, wf_description FROM egw_wf_activities WHERE (wf_name = ?) AND (wf_p_id = ?)"; 
    321                 $db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     322                $db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    322323                $resultSet = $db->query($query, array($activityName, $processID)); 
    323324 
     
    342343        * @return array As instâncias que satisfazem o critério de seleção. 
    343344        * @access public 
    344         * @deprecated 1.7.00.000 
     345        * @deprecated 2.2.00.000 
    345346        */ 
    346347        function getUserInstances($users, $activities = null, $status = null) 
    347348        { 
    348                 require_once 'class.wf_instance.php'; 
    349                 $WFInstance = new wf_instance(); 
     349                wf_warn_deprecated_method('wf_instance', 'getByUser'); 
     350                $WFInstance = &Factory::getInstance('wf_instance'); 
    350351                return $WFInstance->getByUser($users, $activities, $status); 
    351352        } 
     
    356357        * @return bool true caso a propriedade tenha sido alterada com sucesso 
    357358        * @access public 
    358         * @deprecated 1.7.00.000 
     359        * @deprecated 2.2.00.000 
    359360        */ 
    360361        function setInstanceProperty($instanceID, $nameProperty, $value) 
    361362        { 
    362                 require_once 'class.wf_instance.php'; 
    363                 $WFInstance = new wf_instance(); 
     363                wf_warn_deprecated_method('wf_instance', 'setProperty'); 
     364                $WFInstance = &Factory::getInstance('wf_instance'); 
    364365                return $WFInstance->setProperty($instanceID, $nameProperty, $value); 
    365366        } 
     
    373374        * @return bool true se o usuário tiver acesso à instância (levando em consideração $writeAccess) ou false caso contrário 
    374375        * @access public 
    375         * @deprecated 1.7.00.000 
     376        * @deprecated 2.2.00.000 
    376377        */ 
    377378        function checkUserAccessToInstance($userID, $instanceID, $activityID, $writeAccess = true) 
    378379        { 
    379                 require_once 'class.wf_instance.php'; 
    380                 $WFInstance = new wf_instance(); 
     380                wf_warn_deprecated_method('wf_instance', 'checkUserAccess'); 
     381                $WFInstance = &Factory::getInstance('wf_instance'); 
    381382                return $WFInstance->checkUserAccess($userID, $instanceID, $activityID, $writeAccess); 
    382383        } 
  • branches/2.2/workflow/inc/local/classes/class.wf_instance.php

    r1385 r3167  
    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; 
     
    9292        { 
    9393                /* load the DB */ 
    94                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     94                $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    9595 
    9696                /* load the process ID from the runtime */ 
     
    118118                $instance = $this->getInstanceObject($instanceID); 
    119119 
    120                 $runActivity = CreateObject('workflow.run_activity'); 
     120                $runActivity = Factory::getInstance('run_activity'); 
    121121 
    122122                ob_start(); 
     
    250250 
    251251        /** 
    252         * Busca as instâncias filhas de uma instância 
    253         * Se os parâmetros não forem informados, retorna instâncias filhas das instância atual. 
    254         * @param int $instanceID O ID da instância pai (não obrigatório). 
    255         * @param int $activityID O ID da atividade corrente da instância pai 
    256         * @return array As instâncias filhas do par instância/atividade atual 
    257         * @access public 
    258         */ 
    259         public function getChildren($instanceID = null, $activityID = null) 
     252        * This method gets all children instances of the given instance. 
     253        * If there is no parameter, it gets the children instances of the current instance 
     254        * @param int $instanceID Dad instance's identification. 
     255        * @return array Array with the children instances, or false 
     256        * @access public 
     257        */ 
     258        public function getChildren($instanceID = null) 
    260259        { 
    261260                $output = array(); 
    262261                if (is_null($instanceID)) 
    263262                        $instanceID = $GLOBALS['workflow']['wf_runtime']->instance_id; 
    264                 if (is_null($activityID)) 
    265                         $activityID = $GLOBALS['workflow']['wf_runtime']->activity_id; 
    266  
    267                 /* check instanceID */ 
    268                 if (!$this->checkInstanceAccess($instanceID, $activityID)) 
     263 
     264                /* check instanceID */ 
     265                if (!$this->checkInstanceAccess($instanceID)) 
    269266                        return $output; 
    270267 
    271268                /* build the SQL query */ 
    272                 $query = 'SELECT i.wf_instance_id AS wf_instance_id, ia.wf_activity_id AS wf_activity_id, ia.wf_started AS wf_started, i.wf_name AS wf_name, i.wf_status AS wf_status, ia.wf_user AS wf_user, ir.wf_parent_lock AS wf_parent_lock '; 
    273                 $query .= 'FROM egw_wf_interinstance_relations ir, egw_wf_instances i LEFT JOIN egw_wf_instance_activities ia ON (ia.wf_instance_id = i.wf_instance_id)'; 
    274                 $query .= 'WHERE (ir.wf_child_instance_id = i.wf_instance_id) AND (ir.wf_parent_instance_id = ?) AND (ir.wf_parent_activity_id = ?)'; 
    275  
    276                 $result = $this->db->query($query, array($instanceID, $activityID)); 
     269                $query = " 
     270                        SELECT 
     271                                i.wf_instance_id AS wf_instance_id, 
     272                                ia.wf_activity_id AS wf_activity_id, 
     273                                i.wf_started AS wf_started, 
     274                                i.wf_name AS wf_name, 
     275                                i.wf_status AS wf_status, 
     276                                ia.wf_user AS wf_user, 
     277                                ir.wf_parent_lock AS wf_parent_lock 
     278                        FROM 
     279                            egw_wf_interinstance_relations as ir 
     280                        LEFT JOIN 
     281                            egw_wf_instances as i 
     282                        ON 
     283                            i.wf_instance_id = ir.wf_child_instance_id 
     284                        LEFT JOIN 
     285                            egw_wf_instance_activities as ia 
     286                        ON 
     287                            i.wf_instance_id = ia.wf_instance_id 
     288                        WHERE 
     289                            ir.wf_parent_instance_id = ?"; 
     290 
     291                $result = $this->db->query($query, array($instanceID)); 
    277292                $output = $result->GetArray(-1); 
    278293 
     
    423438 
    424439                /* 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); 
     440                $GUI = &Factory::newInstance('GUI'); 
    427441                $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); 
    428442                $userInstance = $userInstance['data']; 
     
    456470                if ($userID !== '*') 
    457471                { 
    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(); 
     472                        $wfRole = Factory::getInstance('wf_role'); 
     473                        $engine = Factory::getInstance('wf_engine'); 
    463474                        /* get information about the activity */ 
    464475                        if (($activityInfo = $engine->getActivityInformationByID($activityID)) === false) 
     
    529540 
    530541                /* try to get the role id */ 
    531                 require_once dirname(__FILE__) . '/class.wf_role.php'; 
    532                 $wfRole = new wf_role(); 
     542                $wfRole = Factory::getInstance('wf_role'); 
    533543                if (($roleID = $wfRole->getRoleIdByName($roleName)) === false) 
    534544                        return false; 
  • branches/2.2/workflow/inc/local/classes/class.wf_ldap.php

    r1067 r3167  
    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(); 
    4645 
    47                 $this->ds = &$GLOBALS['workflow']['workflowObjects']->getLDAP(); 
     46                $this->ds = &Factory::getInstance('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        } 
  • branches/2.2/workflow/inc/local/classes/class.wf_location.php

    r795 r3167  
    3636        function initialize() 
    3737        { 
    38                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID; 
     38                $this->db = &Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID; 
    3939                $this->db->setFetchMode(ADODB_FETCH_ASSOC); 
    4040                $this->cityInfo = array(); 
     
    6767                if (isset($this->cityInfo[$city_id])) 
    6868                        return $this->cityInfo[$city_id]; 
     69 
     70                $sql = 
     71                "SELECT 
     72                        c.id_city AS id_city, 
     73                        c.city_name AS city_name, 
     74                        c.is_district, 
     75                        s.id_state AS id_state, 
     76                        s.state_name AS state_name, 
     77                        s.state_symbol AS state_symbol 
     78                FROM 
     79                        phpgw_cc_state s, 
     80                        phpgw_cc_city c 
     81                WHERE 
     82                        c.id_state = s.id_state AND 
     83                        s.id_country = 'BR' AND 
     84                        c.id_city = ?"; 
     85 
     86                $result = $this->db->query($sql, array($city_id)); 
     87                $output = $result->fetchRow(); 
     88 
     89                $this->cityInfo[$city_id] = $output; 
     90                return $output; 
     91        } 
     92 
     93   /** 
     94        * Busca as informações do estado pelo id passado 
     95        * @param int $state_id Numero ID do estado 
     96        * @return mixed (array ou boolean) 
     97        * @access public 
     98        */ 
     99        function getStateById($state_id) 
     100        { 
     101                if (!is_numeric($state_id)) 
     102                        return false; 
     103 
     104                $state_id = (int) $state_id; 
     105                if (isset($this->stateInfo[$state_id])) 
     106                        return $this->stateInfo[$state_id]; 
     107 
     108                $sql = 
     109                "SELECT 
     110                        id_state, 
     111                        state_name, 
     112                        state_symbol 
     113                FROM 
     114                        phpgw_cc_state 
     115                WHERE 
     116                        id_country = 'BR' AND 
     117                        id_state = ?"; 
     118 
     119                $result = $this->db->query($sql, array($state_id)); 
     120                $output = $result->fetchRow(); 
     121 
     122                $this->stateInfo[$city_id] = $output; 
     123                return $output; 
     124        } 
     125    /** 
     126         * Busca as cidades de um estado 
     127         * @param int $state_id Numero ID do estado 
     128         * @param bool $include_districts True, busca cidades e distritos. False, busca apenas cidades. 
     129         * @return mixed (array ou boolean) 
     130         * @access public 
     131         */ 
     132        function getCitiesFromState($state_id, $include_districts = true) 
     133        { 
     134                if (!is_numeric($state_id) || !is_bool($include_districts)) 
     135                        return false; 
     136 
     137                $state_id = (int) $state_id; 
     138                if (isset($this->citiesFromState[$state_id])) 
     139                        return $this->citiesFromState[$state_id]; 
     140 
     141                $where = ""; 
     142                if(!$include_districts){ 
     143                        $where = " AND c.is_district = 'F' "; 
     144                } 
     145 
     146                $sql = 
     147                "SELECT 
     148                        c.id_city AS id_city, 
     149                        c.city_name AS city_name, 
     150                        c.is_district 
     151                FROM 
     152                        phpgw_cc_state s, 
     153                        phpgw_cc_city c 
     154                WHERE 
     155                        c.id_state = s.id_state AND 
     156                        s.id_country = 'BR' AND 
     157                        c.id_state = ? " . $where . " 
     158                ORDER BY 
     159                        city_name"; 
     160 
     161                $result = $this->db->query($sql, array($state_id)); 
     162                $output = array(); 
     163                while ($row = $result->fetchRow()) 
     164                        $output[] = $row; 
     165 
     166                $this->citiesFromState[$state_id] = $output; 
     167                return $output; 
     168        } 
     169    /** 
     170         * Busca as cidades por parte do nome, sem considerar maiúsculas e/ou minúsculas e nem acentuação (retorna 10 resultados) 
     171         * @param string Parte do nome da cidade 
     172         * @param int $state_id Numero ID do estado 
     173         * @param bool $include_districts True, busca cidades e distritos. False, busca apenas cidades. 
     174         * @return mixed (array ou boolean) 
     175         * @access public 
     176         */ 
     177        function getCitiesByKey($key, $state_id = 0, $include_districts = true) 
     178        { 
     179                if (!is_string($key) || !is_numeric($state_id) || !is_bool($include_districts)) 
     180                        return false; 
     181 
     182                $where = ""; 
     183                if($state_id > 0){ 
     184                        $where = " AND c.id_state = " . $state_id; 
     185                } 
     186 
     187                if(!$include_districts){ 
     188                        $where = " AND c.is_district = 'F' "; 
     189                } 
    69190 
    70191                $sql = 
     
    81202                        c.id_state = s.id_state AND 
    82203                        s.id_country = 'BR' AND 
    83                         c.id_city = ?"; 
    84  
    85                 $result = $this->db->query($sql, array($city_id)); 
    86                 $output = $result->fetchRow(); 
    87  
    88                 $this->cityInfo[$city_id] = $output; 
    89                 return $output; 
    90         } 
    91  
    92    /** 
    93         * Busca as informações do estado pelo id passado 
    94         * @param int $state_id Numero ID do estado 
    95         * @return mixed (array ou boolean) 
    96         * @access public 
    97         */ 
    98         function getStateById($state_id) 
    99         { 
    100                 if (!is_numeric($state_id)) 
    101                         return false; 
    102  
    103                 $state_id = (int) $state_id; 
    104                 if (isset($this->stateInfo[$state_id])) 
    105                         return $this->stateInfo[$state_id]; 
    106  
    107                 $sql = 
    108                 "SELECT 
    109                         id_state, 
    110                         state_name, 
    111                         state_symbol 
    112                 FROM 
    113                         phpgw_cc_state 
    114                 WHERE 
    115                         id_country = 'BR' AND 
    116                         id_state = ?"; 
    117  
    118                 $result = $this->db->query($sql, array($state_id)); 
    119                 $output = $result->fetchRow(); 
    120  
    121                 $this->stateInfo[$city_id] = $output; 
    122                 return $output; 
    123         } 
    124     /** 
    125          * Busca as cidades de um estado 
    126          * @param int $state_id Numero ID do estado 
    127          * @return mixed (array ou boolean) 
    128          * @access public 
    129          */ 
    130         function getCitiesFromState($state_id) 
    131         { 
    132                 if (!is_numeric($state_id)) 
    133                         return false; 
    134  
    135                 $state_id = (int) $state_id; 
    136                 if (isset($this->citiesFromState[$state_id])) 
    137                         return $this->citiesFromState[$state_id]; 
    138  
    139                 $sql = 
    140                 "SELECT 
    141                         c.id_city AS id_city, 
    142                         c.city_name AS city_name 
    143                 FROM 
    144                         phpgw_cc_state s, 
    145                         phpgw_cc_city c 
    146                 WHERE 
    147                         c.id_state = s.id_state AND 
    148                         s.id_country = 'BR' AND 
    149                         c.id_state = ? 
     204                        TO_ASCII(c.city_name) ILIKE TO_ASCII('" . $key . "%') 
     205                        " . $where . " 
    150206                ORDER BY 
    151                         city_name"; 
    152  
    153                 $result = $this->db->query($sql, array($state_id)); 
    154                 $output = array(); 
    155                 while ($row = $result->fetchRow()) 
    156                         $output[] = $row; 
    157  
    158                 $this->citiesFromState[$state_id] = $output; 
    159                 return $output; 
    160         } 
    161     /** 
    162          * Busca os estados brasileiros 
    163          * @return mixed (array ou boolean) 
    164          * @access public 
    165          */ 
    166         function getStates() 
    167         { 
    168                 $sql = 
    169                 "SELECT 
    170                         id_state, 
    171                         state_name 
    172                 FROM 
    173                         phpgw_cc_state 
    174                 WHERE 
    175                         id_country = 'BR' 
    176                 ORDER BY 
    177                         state_name"; 
     207                        city_name 
     208                LIMIT 10"; 
    178209 
    179210                $result = $this->db->query($sql); 
     
    184215                return $output; 
    185216        } 
     217        /** 
     218         * Busca os estados brasileiros 
     219         * @return mixed (array ou boolean) 
     220         * @access public 
     221         */ 
     222        function getStates() 
     223        { 
     224                $sql = 
     225                "SELECT 
     226                        id_state, 
     227                        state_name 
     228                FROM 
     229                        phpgw_cc_state 
     230                WHERE 
     231                        id_country = 'BR' 
     232                ORDER BY 
     233                        state_name"; 
     234 
     235                $result = $this->db->query($sql); 
     236                $output = array(); 
     237                while ($row = $result->fetchRow()) 
     238                        $output[] = $row; 
     239 
     240                return $output; 
     241        } 
    186242} 
    187243?> 
  • branches/2.2/workflow/inc/local/classes/class.wf_mail.php

    r795 r3167  
    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 
  • branches/2.2/workflow/inc/local/classes/class.wf_natural.php

    r795 r3167  
    11<?php 
    2         require_once(PHPGW_SERVER_ROOT.SEP.'workflow'.SEP.'inc'.SEP.'natural'.SEP.'class.natural.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 
     12require_once(PHPGW_SERVER_ROOT.SEP.'workflow'.SEP.'inc'.SEP.'natural'.SEP.'class.natural.php'); 
     13 
     14/** 
     15 * Mainframe connection to workflow 
     16 * 
     17 * TODO - This class should be removed from here. Its based on a not 
     18 * public protocol, thus cannot be used for everybody. 
     19 * 
     20 * @package Workflow 
     21 * @subpackage local 
     22 * @license http://www.gnu.org/copyleft/gpl.html GPL 
     23 * @author Everton Flávio Rufino Seára 
     24 */ 
     25class wf_natural extends Natural 
     26{ 
    327 
    428        /** 
    5         * Mainframe connection to workflow 
    6         * @author Everton Flávio Rufino Seára 
    7         * @package Workflow 
    8         * @subpackage local 
    9         * @license http://www.gnu.org/copyleft/gpl.html GPL 
    10         **/ 
     29         * @var object Log Object 
     30         * @access private 
     31         */ 
     32        private $logger = null; 
    1133 
    12         class wf_natural extends Natural 
     34        function __construct() 
    1335        { 
     36                parent::Natural(); 
    1437 
    15                 function __construct() 
    16                 { 
    17                         parent::Natural(); 
     38                $natconf = array( 
     39                                        'mainframe_ip'                  => '', 
     40                                        'mainframe_port'                => '', 
     41                                        'mainframe_key'                 => '', 
     42                                        'mainframe_password'    => '', 
     43                                        'mainframe_environment' => '' 
     44                ); 
    1845 
    19                         $natconf = array( 
    20                                                 'mainframe_ip'                  => '', 
    21                                                 'mainframe_port'                => '', 
    22                                                 'mainframe_key'                 => '', 
    23                                                 'mainframe_password'    => '', 
    24                                                 'mainframe_environment' => '' 
    25                         ); 
     46                $nat_conf_values = &Factory::getInstance('workflow_wfruntime')->getConfigValues($natconf); 
    2647 
    27                         $nat_conf_values = $GLOBALS['workflow']['wf_runtime']->getConfigValues($natconf); 
     48                $this->setIPAddress($nat_conf_values['mainframe_ip']); 
     49                $this->setServerPort($nat_conf_values['mainframe_port']); 
     50                $this->setKey($nat_conf_values['mainframe_key']); 
     51                $this->setPassword($nat_conf_values['mainframe_password']); 
     52                $this->setApplication($nat_conf_values['mainframe_environment']); 
    2853 
    29                         $this->setIPAddress($nat_conf_values['mainframe_ip']); 
    30                         $this->setServerPort($nat_conf_values['mainframe_port']); 
    31                         $this->setKey($nat_conf_values['mainframe_key']); 
    32                         $this->setPassword($nat_conf_values['mainframe_password']); 
    33                         $this->setApplication($nat_conf_values['mainframe_environment']); 
     54                $this->logger = &Factory::getInstance('Logger', array('file')); 
     55        } 
     56 
     57        /** 
     58         * This method MUST be called before using execute method 
     59         * It specifies the natural sub-program to be accessed. 
     60         * 
     61         * @param Object $obj Object that specifies natural sub-program properties 
     62         * @return void 
     63         */ 
     64        public function configure($obj) 
     65        { 
     66                $this->obj = $obj; 
     67 
     68                $this->initialize($obj->name); 
     69 
     70                if ($obj->server != NULL){ 
     71                        $this->setIPAddress($obj->server); 
    3472                } 
    35  
    36                 /** 
    37                  * Method to configure the access to mainframe 
    38                  * This method MUST be called before using execute method, else 'false' will be returned 
    39                  * 
    40                  * Only the first and second param are mandatory. 
    41                  * 
    42                  * @param String $subProgram - Name of sub-program 
    43                  * @param String $inputParameter - Input parameters to sub-program 
    44                  * 
    45                  * @param String $ip - IP Address of Mainfram 
    46                  * @param int $port - ServerPort to access the mainframe 
    47                  * @param String $key - Access key (user) 
    48                  * @param String $password - Key (user) password 
    49                  * @param char $environment - Application environment access 'D' (development) or 'P' (production) 
    50  
    51                  */ 
    52  
    53                 public function configure($obj) 
    54                 { 
    55                         $this->obj = $obj; 
    56  
    57                         $this->initialize($obj->name); 
    58  
    59                         if ($obj->server != NULL){ 
    60                                 $this->setIPAddress($obj->server); 
    61                         } 
    62                         if ($obj->port != NULL){ 
    63                                 $this->setServerPort($obj->port); 
    64                         } 
    65                         if ($obj->key != NULL){ 
    66                                 $this->setKey($obj->key); 
    67                         } 
    68                         if ($obj->password != NULL){ 
    69                                 $this->setPassword($obj->password); 
    70                         } 
    71                         if ($obj->environment != NULL){ 
    72                                 $this->setApplication($obj->environment); 
    73                         } 
    74                         if ($obj->logon != NULL){ 
    75                                 $this->setLogon($obj->logon); 
    76                         } 
    77                         if ($obj->system != NULL){ 
    78                                 $this->setSystem($obj->system); 
    79                         } 
    80                         if ($obj->rc != NULL){ 
    81                                 $this->setRC($obj->rc); 
    82                         } 
     73                if ($obj->port != NULL){ 
     74                        $this->setServerPort($obj->port); 
    8375                } 
    84  
    85                 /* 
    86  
    87                 public function configure($subProgram, $inputParameter, $ip = NULL, $port = NULL, 
    88                                                                                 $key = NULL, $password = NULL, $environment = NULL, $logon = NULL, $system = NULL, $rc = NULL) 
    89                 { 
    90                         $this->initialize($subProgram, $inputParameter); 
    91  
    92                         if ($ip != NULL){ 
    93                                 $this->setIPAddress($ip); 
    94                         } 
    95                         if ($port != NULL){ 
    96                                 $this->setServerPort($port); 
    97                         } 
    98                         if ($key != NULL){ 
    99                                 $this->setKey($key); 
    100                         } 
    101                         if ($password != NULL){ 
    102                                 $this->setPassword($password); 
    103                         } 
    104                         if ($environment != NULL){ 
    105                                 $this->setApplication($environment); 
    106                         } 
    107                         if ($logon != NULL){ 
    108                                 $this->setLogon($logon); 
    109                         } 
    110                         if ($system != NULL){ 
    111                                 $this->setSystem($system); 
    112                         } 
    113                         if ($rc != NULL){ 
    114                                 $this->setRC($rc); 
    115                         } 
    116  
     76                if ($obj->key != NULL){ 
     77                        $this->setKey($obj->key); 
    11778                } 
    118  
    119                  */ 
    120  
    121                 /** 
    122                  * Access and retrieve data from mainframe 
    123                  * @return bool 
    124                  */ 
    125                 public function execute($inputParams = "") 
    126                 { 
    127                         return parent::execute($inputParams); 
     79                if ($obj->password != NULL){ 
     80                        $this->setPassword($obj->password); 
     81                } 
     82                if ($obj->environment != NULL){ 
     83                        $this->setApplication($obj->environment); 
     84                } 
     85                if ($obj->logon != NULL){ 
     86                        $this->setLogon($obj->logon); 
     87                } 
     88                if ($obj->system != NULL){ 
     89                        $this->setSystem($obj->system); 
     90                } 
     91                if ($obj->rc != NULL){ 
     92                        $this->setRC($obj->rc); 
    12893                } 
    12994        } 
     95 
     96        /** 
     97         * Method for accessing and retrieving data from mainframe 
     98         * @return bool 
     99         */ 
     100        public function execute($inputParams = "") 
     101        { 
     102                // execute action and log wasted time 
     103                $totalTime = microtime(true); 
     104                $result = parent::execute($inputParams); 
     105                $totalTime = microtime(time) - $totalTime; 
     106                $log = sprintf("WF_NATURAL [subprogram=%s] [time=%ss]", 
     107                                        $this->obj->name, 
     108                                        number_format($totalTime,3) 
     109                                        ); 
     110                $this->logger->debug($log); 
     111                return $result; 
     112        } 
     113} 
    130114?> 
  • branches/2.2/workflow/inc/local/classes/class.wf_orgchart.php

    r1320 r3167  
    2424        function wf_orgchart() 
    2525        { 
    26                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBWorkflow()->Link_ID; 
     26                $this->db = &Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Link_ID; 
    2727                $this->db->setFetchMode(ADODB_FETCH_ASSOC); 
    2828        } 
     
    117117         * Este método irá buscar na tabela de áreas, todas as áreas que pertencem à organização solicitada. 
    118118         * @param int $organizationID O ID da organização. 
     119         * @param int $onlyActiveAreas false= recupera todas as áreas; true= recupera somente as áreas ativas. 
    119120         * @return array Uma array seqüencial contendo as áreas de uma organização. Cada linha do array conterá: 
    120121         * - organizacao_id 
     
    131132         * @access public 
    132133         */ 
    133         function getOrganizationAreas($organizationID) 
    134         { 
    135                 $query = "SELECT organizacao_id, area_id, area_status_id, " . 
    136                                  "       superior_area_id, centro_custo_id, titular_funcionario_id," . 
    137                                  "       substituto_funcionario_id, sigla, descricao, ativa, auxiliar_funcionario_id" . 
    138                                  "  FROM area" . 
    139                                  " WHERE (organizacao_id = ?)" . 
    140                                  " ORDER BY sigla, descricao"; 
     134        function getOrganizationAreas($organizationID, $onlyActiveAreas = false) 
     135        { 
     136                $query = "SELECT a.organizacao_id, a.area_id, a.area_status_id, " . 
     137                                 "       a.superior_area_id, a.centro_custo_id, a.titular_funcionario_id, " . 
     138                                 "       a.sigla, a.descricao, a.ativa, a.auxiliar_funcionario_id, " . 
     139                                 "               s.funcionario_id as substituto_funcionario_id " . 
     140                                 " FROM area a " . 
     141                                 "  LEFT OUTER JOIN substituicao s " . 
     142                                 "  ON ((a.area_id = s.area_id) AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) " . 
     143                                 " WHERE " . 
     144                                 "      (a.organizacao_id = ?) "; 
     145                // Se desejar somente retornar as áreas que estão ativas 
     146                if($onlyActiveAreas) 
     147                        $query .=" AND a.ativa = 'S' "; 
     148 
     149                $query .= " ORDER BY a.sigla, a.descricao"; 
    141150 
    142151                $result = $this->db->query($query, array($organizationID)); 
     
    320329        function getArea($areaID) 
    321330        { 
    322                 $query = "SELECT organizacao_id, area_id, area_status_id, " . 
    323                                  "       superior_area_id, centro_custo_id, titular_funcionario_id," . 
    324                                  "       substituto_funcionario_id, sigla, descricao, ativa, auxiliar_funcionario_id" . 
    325                                  "  FROM area" . 
    326                                  " WHERE (area_id = ?)"; 
     331                $query = "SELECT a.organizacao_id, a.area_id, a.area_status_id, " . 
     332                                 "       a.superior_area_id, a.centro_custo_id, a.titular_funcionario_id, " . 
     333                                 "       a.sigla, a.descricao, a.ativa, a.auxiliar_funcionario_id, " . 
     334                                 "               s.funcionario_id as substituto_funcionario_id " . 
     335                                 " FROM area a " . 
     336                                 "  LEFT OUTER JOIN substituicao s " . 
     337                                 "  ON ((a.area_id = s.area_id) AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) " . 
     338                                 " WHERE " . 
     339                                 "      (a.area_id = ?) " . 
     340                                 " ORDER BY a.sigla, a.descricao"; 
     341 
    327342 
    328343                $result = $this->db->query($query, array($areaID)); 
     
    357372        function getAreaByName($acronym, $organizationID = 1) 
    358373        { 
    359                 $query = "SELECT organizacao_id, area_id, area_status_id, " . 
    360                                  "       superior_area_id, centro_custo_id, titular_funcionario_id," . 
    361                                  "       substituto_funcionario_id, sigla, descricao, ativa, auxiliar_funcionario_id" . 
    362                                  "  FROM area" . 
    363                                  " WHERE (UPPER(sigla) = UPPER(?) and (organizacao_id = ?))"; 
     374                $query = "SELECT a.organizacao_id, a.area_id, a.area_status_id, " . 
     375                                 "       a.superior_area_id, a.centro_custo_id, a.titular_funcionario_id, " . 
     376                                 "       a.sigla, a.descricao, a.ativa, a.auxiliar_funcionario_id, " . 
     377                                 "               s.funcionario_id as substituto_funcionario_id " . 
     378                                 " FROM area a " . 
     379                                 "  LEFT OUTER JOIN substituicao s " . 
     380                                 "  ON ((a.area_id = s.area_id) AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) " . 
     381                                 " WHERE " . 
     382                                 "      (UPPER(a.sigla) = UPPER(?)) " . 
     383                                 " AND " . 
     384                                 "      (a.organizacao_id = ?) " . 
     385                                 " ORDER BY a.sigla, a.descricao"; 
     386 
    364387 
    365388                $result = $this->db->query($query, array($acronym, (int) $organizationID)); 
     
    395418                $result = array(); 
    396419 
    397                 $query = "SELECT organizacao_id, area_id, area_status_id, " . 
    398                                  "       superior_area_id, centro_custo_id, titular_funcionario_id," . 
    399                                  "       substituto_funcionario_id, sigla, descricao, ativa, auxiliar_funcionario_id" . 
    400                                  "  FROM area" . 
    401                                  " WHERE (area_status_id = ?)"; 
     420                $query = "SELECT a.organizacao_id, a.area_id, a.area_status_id, " . 
     421                                 "       a.superior_area_id, a.centro_custo_id, a.titular_funcionario_id, " . 
     422                                 "       a.sigla, a.descricao, a.ativa, a.auxiliar_funcionario_id, " . 
     423                                 "               s.funcionario_id as substituto_funcionario_id " . 
     424                                 " FROM area a " . 
     425                                 "  LEFT OUTER JOIN substituicao s " . 
     426                                 "  ON ((a.area_id = s.area_id) AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) " . 
     427                                 " WHERE " . 
     428                                 "      (a.area_status_id = ?) " . 
     429                                 " ORDER BY a.sigla, a.descricao"; 
     430 
     431 
    402432 
    403433                $result = $this->db->query($query, array($areaStatusID)); 
     
    436466                $areas = implode(', ', $areaIDs); 
    437467 
    438                 $query = "SELECT organizacao_id, area_id, area_status_id, " . 
    439                                  "       superior_area_id, centro_custo_id, titular_funcionario_id," . 
    440                                  "       substituto_funcionario_id, sigla, descricao, ativa, auxiliar_funcionario_id" . 
    441                                  "  FROM area" . 
    442                                  " WHERE area_id IN ($areas)" . 
    443                                  " ORDER BY sigla, descricao"; 
     468                $query = "SELECT a.organizacao_id, a.area_id, a.area_status_id, " . 
     469                                 "       a.superior_area_id, a.centro_custo_id, a.titular_funcionario_id, " . 
     470                                 "       a.sigla, a.descricao, a.ativa, a.auxiliar_funcionario_id, " . 
     471                                 "               s.funcionario_id as substituto_funcionario_id " . 
     472                                 " FROM area a " . 
     473                                 "  LEFT OUTER JOIN substituicao s " . 
     474                                 "  ON ((a.area_id = s.area_id) AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) " . 
     475                                 " WHERE " . 
     476                                 "      (a.area_id IN ($areas)) " . 
     477                                 " ORDER BY a.sigla, a.descricao"; 
    444478 
    445479                // A execução é realizada sem o segundo parâmetro pois este não pode estar entre aspas 
     
    448482                        return false; 
    449483 
     484                $output = $result->GetArray(-1); 
     485                return $output; 
     486        } 
     487         
     488        /** 
     489         * Return all areas that the employee is a supervisor. 
     490         *  
     491         * Search in the organization for all areas that the employee is a supervisor. 
     492         * @param int $employeeID The ID of employee 
     493         * @return array Array containing all the areas that the employeee is a supervisor. 
     494         * @access public 
     495         */ 
     496        function getSupervisorAreas($employeeID) { 
     497 
     498                if (!$employeeID) { 
     499                        return false; 
     500                } 
     501 
     502                $query = "SELECT  
     503                                                a.area_id 
     504                                        FROM  
     505                                                area a  
     506                                                LEFT OUTER JOIN substituicao s ON ((a.area_id = s.area_id)  
     507                                                AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim))  
     508                                        WHERE  
     509                                                a.titular_funcionario_id = ? OR  
     510                                                s.funcionario_id = ? 
     511                                        GROUP BY 
     512                                                a.area_id"; 
     513                 
     514                $result = $this->db->query($query, array($employeeID,$employeeID)); 
     515                if (!$result) 
     516                        return false; 
     517                 
    450518                $output = $result->GetArray(-1); 
    451519                return $output; 
     
    506574        function getSubAreasByParentAreaID($parentAreaID, $onlyActiveAreas = false) 
    507575        { 
    508                 $query = "SELECT organizacao_id, area_id, area_status_id, " . 
    509                                  "       superior_area_id, centro_custo_id, titular_funcionario_id," . 
    510                                  "       substituto_funcionario_id, sigla, descricao, ativa, auxiliar_funcionario_id" . 
    511                                  "  FROM area" . 
    512                                  " WHERE superior_area_id = ?"; 
     576                $query = "SELECT a.organizacao_id, a.area_id, a.area_status_id, " . 
     577                                 "       a.superior_area_id, a.centro_custo_id, a.titular_funcionario_id, " . 
     578                                 "       a.sigla, a.descricao, a.ativa, a.auxiliar_funcionario_id, " . 
     579                                 "               s.funcionario_id as substituto_funcionario_id " . 
     580                                 " FROM area a " . 
     581                                 "  LEFT OUTER JOIN substituicao s " . 
     582                                 "  ON ((a.area_id = s.area_id) AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) " . 
     583                                 " WHERE " . 
     584                                 "      (a.superior_area_id = ?) "; 
     585 
    513586 
    514587                if ($onlyActiveAreas){ 
    515588                        $query .= " AND ativa = 'S'"; 
    516589                } 
    517                 $query .= " ORDER BY sigla, descricao"; 
     590                $query .= " ORDER BY a.sigla, a.descricao"; 
    518591 
    519592                $result = $this->db->query($query, array($parentAreaID)); 
     
    11681241                        return false; 
    11691242 
    1170                 return $employee['centro_custo_id']; 
     1243                $costCenterID = $employee['centro_custo_id']; 
     1244                if(!empty($costCenterID)){ 
     1245                        return $costCenterID; 
     1246                } else { 
     1247                        $employeeArea = $this->getArea($employee['area_id']); 
     1248                        return $employeeArea['centro_custo_id']; 
     1249                } 
    11711250        } 
    11721251 
  • branches/2.2/workflow/inc/local/classes/class.wf_role.php

    r1048 r3167  
    5757                        $this->processID = (int) $GLOBALS['workflow']['job']['processID']; 
    5858 
    59                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
    60                 $this->roleManager = CreateObject('workflow.workflow_rolemanager'); 
    61                 $this->activityManager = CreateObject('workflow.workflow_activitymanager'); 
     59                $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
     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 = ?))'; 
  • branches/2.2/workflow/inc/local/classes/class.wf_workitem.php

    r795 r3167  
    2929        public function wf_workitem() 
    3030        { 
    31                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     31                $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    3232                $this->processID = (int) $GLOBALS['workflow']['wf_runtime']->activity->getProcessId(); 
    3333        } 
  • branches/2.2/workflow/inc/local/functions/function.wf_create_object.php

    r795 r3167  
    55 * @return mixed 
    66 * @license http://www.gnu.org/copyleft/gpl.html GPL 
    7  * @deprecated 1.4.00.000 - 08/03/2007 
     7 * @deprecated 2.2.00.000 
    88 * @package Workflow  
    99 * @subpackage local  
     
    1212function wf_create_object($class_name) 
    1313{ 
     14        wf_warn_deprecated_method('Factory', 'getInstance'); 
    1415        $obj = null; 
    1516        $file_name = PHPGW_SERVER_ROOT.SEP.'workflow'.SEP.'inc'.SEP.'local'.SEP.'classes'.SEP.'class.'.$class_name.'.php'; 
Note: See TracChangeset for help on using the changeset viewer.