Changeset 3167 for branches/2.2/workflow/inc/class.bo_monitors.inc.php
- Timestamp:
- 08/17/10 16:17:12 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/workflow/inc/class.bo_monitors.inc.php
r795 r3167 12 12 require_once('class.bo_ajaxinterface.inc.php'); 13 13 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 */ 18 require_once(PHPGW_API_INC . SEP . 'common_functions.inc.php'); 19 24 20 25 21 /** … … 134 130 { 135 131 parent::bo_ajaxinterface(); 136 $GLOBALS['ajax']->gui = new GUI($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);132 $GLOBALS['ajax']->gui = &Factory::newInstance('GUI'); 137 133 $this->userID = $_SESSION['phpgw_info']['workflow']['account_id']; 138 134 $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'); 144 140 } 145 141 … … 169 165 private function convertFiltersToSQL($filters) 170 166 { 171 require_once 'nano/JSON.php';172 167 173 168 /* desserializa os dados */ 174 $JSON = new Services_JSON();169 $JSON = &Factory::newInstance('Services_JSON'); 175 170 /* 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 */ 176 171 $filters = array_map('get_object_vars', array_map(array($JSON, 'decode'), $JSON->decode($filters))); … … 335 330 $filters[] = '(gia.wf_user IS NOT NULL)'; 336 331 337 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');332 $ldap = &Factory::getInstance('WorkflowLDAP'); 338 333 if (!$completeData) 339 334 { 340 $paging = $GLOBALS['workflow']['factory']->newInstance('Paging', 500, $_POST);335 $paging = Factory::newInstance('Paging', 500, $_POST); 341 336 $tmp = $this->processMonitor->monitor_list_instances($paging->nextItem, $paging->itemsPerPage, $order, '', implode(' AND ', $filters)); 342 337 $output['data'] = $paging->restrictItems(array_values($tmp['data']), $tmp['cant']); … … 353 348 $activityMapping = array(); 354 349 $instanceCount = count($output['data']); 355 $cachedLDAP = & $GLOBALS['workflow']['factory']->getInstance('CachedLDAP');350 $cachedLDAP = &Factory::getInstance('CachedLDAP'); 356 351 for ($i = 0; $i < $instanceCount; $i++) 357 352 { … … 476 471 /* load the data */ 477 472 $filters[] = '(gp.wf_p_id = ' . $params['pid'] . ')'; 478 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');473 $ldap = &Factory::getInstance('WorkflowLDAP'); 479 474 if (!$completeData) 480 475 { 481 $paging = $GLOBALS['workflow']['factory']->newInstance('Paging', 500, $_POST);476 $paging = Factory::newInstance('Paging', 500, $_POST); 482 477 $tmp = $this->processMonitor->monitor_list_completed_instances($paging->nextItem, $paging->itemsPerPage, $order, '', implode(' AND ', $filters)); 483 478 $output['data'] = $paging->restrictItems(array_values($tmp['data']), $tmp['cant']); … … 491 486 } 492 487 493 $cachedLDAP = & $GLOBALS['workflow']['factory']->getInstance('CachedLDAP');488 $cachedLDAP = &Factory::getInstance('CachedLDAP'); 494 489 $userMapping = array(); 495 490 $instanceCount = count($output['data']); … … 627 622 } 628 623 else 629 $output['fullname'] = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($user);624 $output['fullname'] = Factory::getInstance('WorkflowLDAP')->getName($user); 630 625 631 626 $this->instanceManager->set_instance_user($params['iid'], $params['aid'], $user); … … 648 643 if ($params['ns'] == 'aborted') 649 644 { 650 $realInstance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);645 $realInstance = &Factory::newInstance('Instance'); 651 646 $realInstance->getInstance($params['iid']); 652 647 if (!empty($realInstance->instanceId)) … … 684 679 685 680 /* use next user or * for the new instance */ 686 $realInstance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);681 $realInstance = &Factory::newInstance('Instance'); 687 682 $realInstance->getInstance($params['iid'], false, false); 688 683 $user = $realInstance->getNextUser($params['aid']); … … 751 746 752 747 $maximumDisplaySize = 100; 753 $instance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);748 $instance = &Factory::newInstance('Instance'); 754 749 $instance->getInstance($params['iid']); 755 750 … … 783 778 return "Você não tem permissão para executar este procedimento!"; 784 779 785 $instance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);780 $instance = &Factory::newInstance('Instance'); 786 781 $instance->getInstance($params['iid']); 787 782 $output = $params; … … 804 799 $maximumDisplaySize = 100; 805 800 806 $instance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);801 $instance = &Factory::newInstance('Instance'); 807 802 $instance->getInstance($params['iid']); 808 803 $instance->set($params['name'], $params['value']); … … 835 830 return "Você não tem permissão para executar este procedimento!"; 836 831 837 $instance = new Instance($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID);832 $instance = &Factory::newInstance('Instance'); 838 833 $instance->getInstance($params['iid']); 839 834 $instance->clear($params['name']); … … 858 853 $output = array(); 859 854 $urlPrefix = 'workflow/inc/class.powergraphic.inc.php?'; 860 $powergraphic = new powergraphic;855 $powergraphic = &Factory::getInstance('powergraphic'); 861 856 $powergraphic->graphic_1 = $params['pid']; 862 857 $powergraphic->skin = 1; … … 904 899 /* prepare the data */ 905 900 $aux2 = array(); 906 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');901 $ldap = &Factory::getInstance('WorkflowLDAP'); 907 902 foreach ($aux as $user => $count) 908 903 $aux2[] = array( … … 984 979 985 980 /* load LDAP info and sort the result */ 986 $foundUsers = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getNames($users);981 $foundUsers = Factory::getInstance('WorkflowLDAP')->getNames($users); 987 982 usort($foundUsers, create_function('$a,$b', 'return strcasecmp($a[\'name\'],$b[\'name\']);')); 988 983 … … 991 986 if (count($users) > count($foundUsers)) 992 987 { 993 $cachedLDAP = & $GLOBALS['workflow']['factory']->getInstance('CachedLDAP');988 $cachedLDAP = &Factory::getInstance('CachedLDAP'); 994 989 $foundUsersID = array_map(create_function('$a', 'return $a[\'id\'];'), $foundUsers); 995 990 $missingUsers = array_diff($users, $foundUsersID); … … 1242 1237 return $output; 1243 1238 1244 $BOUserInterface = & $GLOBALS['workflow']['factory']->getInstance('bo_userinterface');1239 $BOUserInterface = &Factory::getInstance('bo_userinterface'); 1245 1240 1246 1241 /* initialize some variables */ … … 1344 1339 1345 1340 /* load the recipient e-mail */ 1346 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');1341 $ldap = &Factory::getInstance('WorkflowLDAP'); 1347 1342 foreach ($output as $key => $value) 1348 1343 { … … 1396 1391 1397 1392 /* 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'); 1401 1396 function lang($a){return $a;}; 1402 1397 1403 1398 /* get the required configuration */ 1404 $BOEmailAdmin = $GLOBALS['workflow']['factory']->newForeignInstance('emailadmin','bo');1399 $BOEmailAdmin = Factory::getInstance('bo'); 1405 1400 $profileList = $BOEmailAdmin->getProfileList(); 1406 1401 $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 */ 1407 1412 1408 1413 /* configure the PHPMailer class to send the e-mails */ … … 1494 1499 { 1495 1500 $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'); 1498 1503 foreach ($userIDs as $userID) 1499 1504 { … … 1542 1547 $filters[] = '(gia.wf_user IS NOT NULL)'; 1543 1548 1544 $cachedLDAP = & $GLOBALS['workflow']['factory']->newInstance('CachedLDAP');1549 $cachedLDAP = &Factory::newInstance('CachedLDAP'); 1545 1550 $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP); 1546 1551 $output = array(); … … 1559 1564 } 1560 1565 1561 $validUsers = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getNames(array_keys($userIDs));1566 $validUsers = Factory::getInstance('WorkflowLDAP')->getNames(array_keys($userIDs)); 1562 1567 array_walk($validUsers, create_function('&$a', '$a = $a[\'id\'];')); 1563 1568
Note: See TracChangeset
for help on using the changeset viewer.