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/class.bo_monitors.inc.php

    r795 r3167  
    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 
Note: See TracChangeset for help on using the changeset viewer.