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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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; 
Note: See TracChangeset for help on using the changeset viewer.