Changeset 2591 for trunk/workflow/inc/engine/src/common
- Timestamp:
- 04/19/10 18:18:22 (14 years ago)
- Location:
- trunk/workflow/inc/engine/src/common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/workflow/inc/engine/src/common/Base.php
r2195 r2591 39 39 var $child_name = 'Base'; 40 40 41 /** 42 * @var object $db_shared_obj The database abstraction object shared between 43 * all instances of this class. 44 * @acess private 45 * @static 46 */ 47 private static $db_shared_obj = null; 48 41 49 /** 42 50 * Constructor receiving a database abstraction object … … 46 54 * @access public 47 55 */ 48 function Base( &$db)56 function Base() 49 57 { 50 if(!$db) { 58 /** 59 * New Stuff! 60 * We decided to get here the database object. In a recent past, 61 * all the classes that specialize this one passed a db object. 62 * Now, to simplify and save memory, we store the database object 63 * into a single and static atribute shared among each instance 64 * of this class. 65 * 66 * To prevent to modify all sub-classes to use "self::$db" instead 67 * of "this->db", we made a very tiny workaround here. In the first 68 * instantiation of this class, we instantiate the database object 69 * and store it into 'self::$db_shared_obj'. Any subsequent 70 * instantiations will just point to the static one. 71 */ 72 if (!self::$db_shared_obj) 73 self::$db_shared_obj = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 74 75 $this->db = &self::$db_shared_obj; 76 77 78 if(!$this->db) { 51 79 die('Invalid db object passed to '.$this->child_name.' constructor'); 52 80 } 53 81 //Force transactionnal mysql (Innodb) -> mysqlt 54 if ($ db->databaseType=='mysql')82 if ($this->db->databaseType=='mysql') 55 83 { 56 84 $GLOBALS['phpgw']->db->disconnect(); 57 $ db = $GLOBALS['phpgw']->db->connect(85 $this->db = $GLOBALS['phpgw']->db->connect( 58 86 $GLOBALS['phpgw_info']['server']['db_name'], 59 87 $GLOBALS['phpgw_info']['server']['db_host'], … … 64 92 ); 65 93 } 66 $this->db = &$db;67 94 } 68 95 -
trunk/workflow/inc/engine/src/common/WfRuntime.php
r795 r2591 86 86 * @access public 87 87 */ 88 function WfRuntime( &$db)88 function WfRuntime() 89 89 { 90 90 $this->child_name = 'WfRuntime'; 91 parent::Base($db); 92 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'BaseActivity.php'); 93 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Process.php'); 94 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Instance.php'); 95 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'common'.SEP.'WfSecurity.php'); 96 91 parent::Base(); 92 97 93 //first the activity is not set 98 94 $this->activity = null; 99 $this->instance = new Instance($this->db);100 $this->process = new Process($this->db);101 $this->security = new WfSecurity($this->db);95 $this->instance = &Factory::newInstance('Instance'); 96 $this->process = &Factory::newInstance('Process'); 97 $this->security = &Factory::getInstance('WfSecurity'); 102 98 } 103 99 … … 276 272 return false; 277 273 } 278 $base_activity = new BaseActivity($this->db);274 $base_activity = &Factory::newInstance('BaseActivity'); 279 275 $this->activity =& $base_activity->getActivity($activity_id, $with_roles, $with_agents); 280 276 if (!$this->activity) … … 1091 1087 $workflow = $GLOBALS['workflow']; 1092 1088 unset($_REQUEST['iid']); 1093 $run_activity = CreateObject('workflow.run_activity');1089 $run_activity = Factory::getInstance('run_activity'); 1094 1090 $run_activity->runtime->instance->parentInstanceId = $this->instance_id; 1095 1091 $run_activity->runtime->instance->parentActivityId = $this->activity_id; -
trunk/workflow/inc/engine/src/common/WfSecurity.php
r795 r2591 23 23 * @access public 24 24 */ 25 function WfSecurity( &$db)25 function WfSecurity() 26 26 { 27 27 $this->child_name = 'WfSecurity'; 28 parent::Base($db); 29 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Instance.php'); 30 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Process.php'); 31 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'BaseActivity.php'); 28 parent::Base(); 32 29 } 33 30 … … 58 55 ); 59 56 //check theses values for this process and store the result for this object life duration 60 $myProcess = new Process($this->db);57 $myProcess = &Factory::newInstance('Process'); 61 58 $myProcess->getProcess($pId); 62 59 $this->processesConfig[$pId] = $myProcess->getConfigValues($arrayConf); … … 78 75 function checkUserAccess($user, $activity_id, $readonly=false) 79 76 { 77 /* if activity is non-interactive is not necessary checking user access */ 78 $activity = &Factory::getInstance('BaseActivity')->getActivity($activity_id); 79 if (!$activity->isInteractive()) 80 return true; 81 80 82 //group mapping, warning groups and user can have the same id 81 83 if ($user[0] != 'p') … … 577 579 if (!(isset($this->pm))) 578 580 { 579 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'ProcessManager'.SEP.'ProcessManager.php'); 580 $this->pm = new ProcessManager($this->db); 581 $this->pm = &Factory::newInstance('ProcessManager'); 581 582 } 582 583 //$this->error[] = 'DEBUG: checking to see if there is no view activities on process :'.$pId.':'.$this->pm->get_process_view_activity($pId);
Note: See TracChangeset
for help on using the changeset viewer.