Changeset 1293 for sandbox/workflow/2.0/inc/engine
- Timestamp:
- 08/07/09 16:06:07 (15 years ago)
- Location:
- sandbox/workflow/2.0/inc/engine
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/workflow/2.0/inc/engine/class.ajax_config.inc.php
r795 r1293 1 1 <?php 2 2 /** 3 * Realiza operações com os dados de configuração do workflow 4 * 3 * Realiza operações com os dados de configuração do workflow 4 * 5 5 * @author viani 6 6 * @version 1.0 7 7 * @license http://www.gnu.org/copyleft/gpl.html GPL 8 8 * @package Galaxia 9 */ 9 */ 10 10 class ajax_config 11 { 12 /** 11 { 12 /** 13 13 * @var object $db database 14 14 * @access public 15 15 */ 16 16 var $db; 17 /** 17 /** 18 18 * @var string $appname Application (module) to config 19 19 * @access public 20 20 */ 21 21 var $appname; 22 /** 22 /** 23 23 * @var array $config_data Actual config-data 24 24 * @access public 25 25 */ 26 var $config_data; 27 /** 26 var $config_data; 27 /** 28 28 * @var array $read_data Config-data as read from db 29 29 * @access public 30 30 */ 31 var $read_data; 31 var $read_data; 32 32 33 33 /** 34 34 * Set appname and db for ajax config 35 * 35 * 36 36 * @param string $appname Which application to config. Default workflow. 37 37 * @return void … … 45 45 } 46 46 47 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso();47 $this->db =& Factory::getInstance('WorkflowObjects')->getDBExpresso(); 48 48 $this->appname = $appname; 49 49 } … … 51 51 /** 52 52 * Reads the whole repository for $this->appname, appname has to be set via the constructor 53 * 53 * 54 54 * @return array the whole config-array for that app 55 55 * @access public … … 60 60 61 61 $this->db->query("select * from phpgw_config where config_app='" . $this->appname . "'",__LINE__,__FILE__); 62 while ($this->db->next_record()) 62 while ($this->db->next_record()) 63 63 { 64 64 $test = @unserialize($this->db->f('config_value')); … … 75 75 } 76 76 77 /** 77 /** 78 78 * Updates the whole repository for $this->appname, you have to call read_repository() before (!) 79 * @access public 79 * @access public 80 80 * @return void 81 81 */ … … 107 107 /** 108 108 * Updates or insert a single config-value 109 * 109 * 110 110 * @param string $name name of the config-value 111 111 * @param mixed $value content … … 158 158 /** 159 159 * Deletes the whole repository for $this->appname, appname has to be set via the constructor 160 * 160 * 161 161 * @access public 162 * @return void 163 */ 162 * @return void 163 */ 164 164 function delete_repository() 165 165 { … … 169 169 /** 170 170 * Deletes a single value from the repository, you need to call save_repository after 171 * 171 * 172 172 * @param string $variable_name name of the config 173 173 * @return void … … 180 180 /** 181 181 * Sets a single value in the repository, you need to call save_repository after 182 * 182 * 183 183 * @param string $variable_name name of the config 184 184 * @param mixed $variable_data the content … … 190 190 $this->config_data[$variable_name] = $variable_data; 191 191 } 192 192 193 193 } 194 194 ?> -
sandbox/workflow/2.0/inc/engine/class.ajax_ldap.inc.php
r795 r1293 29 29 function ajax_ldap() 30 30 { 31 $tmpLDAP = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');31 $tmpLDAP = &Factory::getInstance('WorkflowLDAP'); 32 32 $this->user_context = $tmpLDAP->getUserContext(); 33 33 $this->group_context = $tmpLDAP->getGroupContext(); 34 34 35 $this->ds = &$GLOBALS['workflow']['workflowObjects']->getLDAP();35 $this->ds =& Factory::getInstance('WorkflowObjects')->getLDAP(); 36 36 } 37 37 … … 83 83 function id2fullname($account_id) 84 84 { 85 return $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($account_id);85 return Factory::getInstance('WorkflowLDAP')->getName($account_id); 86 86 } 87 87 … … 107 107 $accountID = $_SESSION['phpgw_info']['workflow']['account_id']; 108 108 109 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');109 $ldap =& Factory::getInstance('WorkflowLDAP'); 110 110 if (count($output = $ldap->getUserGroups($accountID)) == 0) 111 111 return false; -
sandbox/workflow/2.0/inc/engine/config.ajax.inc.php
r795 r1293 170 170 if ($loadGroups) 171 171 { 172 $memberships = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserGroups($user);172 $memberships = Factory::getInstance('WorkflowLDAP')->getUserGroups($user); 173 173 if ($user == $_SESSION['phpgw_info']['workflow']['account_id']) 174 174 $_SESSION['phpgw_info']['workflow']['user_groups'] = $memberships; … … 196 196 { 197 197 /* get information regarding the members of the group */ 198 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');198 $ldap = &Factory::getInstance('WorkflowLDAP'); 199 199 $members = $ldap->getGroupUsers($group); 200 200 -
sandbox/workflow/2.0/inc/engine/config.egw.inc.php
r795 r1293 151 151 function galaxia_user_can_admin_process() 152 152 { 153 return ( $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('admin_workflow', 1, 'workflow'));153 return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('admin_workflow', 1, 'workflow')); 154 154 } 155 155 } … … 165 165 function galaxia_user_can_admin_instance() 166 166 { 167 return ( $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('admin_instance_workflow', 1, 'workflow'));167 return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('admin_instance_workflow', 1, 'workflow')); 168 168 } 169 169 } … … 179 179 function galaxia_user_can_clean_instances() 180 180 { 181 return ( $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('cleanup_workflow', 1, 'workflow'));181 return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('cleanup_workflow', 1, 'workflow')); 182 182 } 183 183 } … … 191 191 function galaxia_user_can_clean_aborted_instances() 192 192 { 193 return ( $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('cleanup_aborted_workflow', 1, 'workflow'));193 return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('cleanup_aborted_workflow', 1, 'workflow')); 194 194 } 195 195 } … … 203 203 function galaxia_user_can_monitor() 204 204 { 205 return ( $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('monitor_workflow', 1, 'workflow'));205 return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('monitor_workflow', 1, 'workflow')); 206 206 } 207 207 } … … 221 221 $user = $GLOBALS['phpgw_info']['user']['account_id']; 222 222 223 $memberships = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserGroups($user);223 $memberships = Factory::getInstance('WorkflowLDAP')->getUserGroups($user); 224 224 225 225 if ($memberships === false) … … 245 245 { 246 246 /* get information regarding the members of the group */ 247 $members = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getGroupUsers($group);247 $members = &Factory::getInstance('WorkflowLDAP')->getGroupUsers($group); 248 248 249 249 /* checl for error in the LDAP query */ -
sandbox/workflow/2.0/inc/engine/src/ProcessManager/RoleManager.php
r795 r1293 247 247 $result = $this->query($query,$bindvars); 248 248 $ret = Array(); 249 $ldap = & $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');249 $ldap = &Factory::getInstance('WorkflowLDAP'); 250 250 if (!(empty($result))) 251 251 { -
sandbox/workflow/2.0/inc/engine/src/common/WfRuntime.php
r795 r1293 6 6 * as it handle concurrency and part of the core execution of the instance while avoiding 7 7 * bad manipulation of the instance 8 * 8 * 9 9 * @package Galaxia 10 * @license http://www.gnu.org/copyleft/gpl.html GPL 10 * @license http://www.gnu.org/copyleft/gpl.html GPL 11 11 */ 12 class WfRuntime extends Base 13 { 12 class WfRuntime extends Base 13 { 14 14 /** 15 15 * @var array processes config values cached for this object life duration, init is done at first use for the only process associated with this runtime object 16 16 * @access public 17 17 */ 18 var $conf= Array(); 18 var $conf= Array(); 19 19 /** 20 20 * @var object $activity 21 * @access public 21 * @access public 22 22 */ 23 23 var $activity = null; 24 24 /** 25 25 * @var object $instance 26 * @access public 26 * @access public 27 27 */ 28 28 var $instance = null; 29 29 /** 30 30 * @var int $instance_id 31 * @access public 32 */ 33 var $instance_id = 0; 31 * @access public 32 */ 33 var $instance_id = 0; 34 34 /** 35 35 * @var int $activity_id 36 * @access public 36 * @access public 37 37 */ 38 38 var $activity_id = 0; 39 39 /** 40 40 * @var object $process Retrieve process information 41 * @access public 41 * @access public 42 42 */ 43 43 var $process = null; 44 44 /** 45 45 * @var object $workitems Reference to $instance->workitems 46 * @access public 46 * @access public 47 47 */ 48 48 var $workitems = null; 49 49 /** 50 50 * @var object $activities Reference to $instance->activities 51 * @access public 52 */ 51 * @access public 52 */ 53 53 var $activities = null; 54 54 /** 55 55 * @var object $security Security object 56 * @access public 57 */ 56 * @access public 57 */ 58 58 var $security = null; 59 59 /** 60 60 * @var bool $transaction_in_progress Transaction state 61 * @access public 62 */ 63 var $transaction_in_progress = false; 61 * @access public 62 */ 63 var $transaction_in_progress = false; 64 64 /** 65 65 * @var bool $debug Debug state 66 * @access public 67 */ 66 * @access public 67 */ 68 68 var $debug=false; 69 69 /** 70 70 * @var bool $auto_mode Automatic mode state, non-interactive for instance, big impact on error handling 71 * @access public 72 */ 71 * @access public 72 */ 73 73 var $auto_mode=false; 74 74 … … 81 81 /** 82 82 * Constructor 83 * 83 * 84 84 * @param object &$db ADOdb 85 85 * @return object WfRuntime instance 86 86 * @access public 87 87 */ 88 function WfRuntime(&$db) 88 function WfRuntime(&$db) 89 89 { 90 90 $this->child_name = 'WfRuntime'; … … 94 94 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Instance.php'); 95 95 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'common'.SEP.'WfSecurity.php'); 96 96 97 97 //first the activity is not set 98 98 $this->activity = null; 99 99 $this->instance = new Instance($this->db); 100 100 $this->process = new Process($this->db); 101 $this->security = new WfSecurity($this->db); 101 $this->security = new WfSecurity($this->db); 102 102 } 103 103 … … 105 105 * Collect errors from all linked objects which could have been used by this object 106 106 * Each child class should instantiate this function with her linked objetcs, calling get_error(true) 107 * 107 * 108 108 * @param bool $debug false by default, if true debug messages can be added to 'normal' messages 109 109 * @param string $prefix appended to the debug message 110 * @return void 110 * @return void 111 111 * @access private 112 112 */ … … 122 122 /** 123 123 * Ends-up dying and giving a last message 124 * 124 * 125 125 * @param string $last_message last sentence 126 126 * @param bool $include_errors false by default, if true we'll include error messages … … 138 138 if ($this->debug) $debug = true; 139 139 if ($this->auto_mode) $dying = false; 140 140 141 141 if ($include_errors) 142 142 { … … 165 165 * Loads the config values for the process associated with the runtime 166 166 * config values are cached while this WfRuntime object stays alive 167 * 167 * 168 168 * @param array $arrayconf Config array with default value, where key is config option name and value is default value 169 * @access private 169 * @access private 170 170 * @return array Values associated with the current process for the asked config options and as well for som WfRuntime internal config options 171 171 */ … … 176 176 $this->loadProcess(); 177 177 } 178 $arrayconf['auto-release_on_leaving_activity'] = 1; 178 $arrayconf['auto-release_on_leaving_activity'] = 1; 179 179 $this->conf = $this->process->getConfigValues($arrayconf); 180 180 return $this->conf; … … 183 183 /** 184 184 * Loads instance, the activity and the process, needed by the runtime engine to 'execute' the activity 185 * 185 * 186 186 * @param int $activityId activity id, the activity we will run 187 187 * @param int $instanceId instance Id, can be empty for a start or standalone activity 188 * @return bool 188 * @return bool 189 189 * @access public 190 190 */ … … 208 208 return false; 209 209 } 210 210 211 211 //ensure the activity is not completed 212 212 $this->instance->setActivityCompleted(false); 213 213 $this->instance->activityID = $activityId; 214 214 215 215 //set the workitems and activities links 216 216 $this->workitems =& $this->instance->workitems; … … 218 218 return true; 219 219 } 220 220 221 221 /** 222 222 * Retrieves the process object associated with the activity 223 * 223 * 224 224 * @param int $pId Process id of the process you want, if you do not give it we will try to take it from the activity 225 225 * @return mixed Process object of the right type or false … … 246 246 return true; 247 247 } 248 248 249 249 /** 250 250 * Gets current process instance 251 * 251 * 252 252 * @return object Process instance 253 253 * @access public … … 260 260 /** 261 261 * Retrieves the activity of the right type from a baseActivity Object 262 * 262 * 263 263 * @param int $activity_id activity_id you want 264 264 * @param bool $with_roles will load the roles links on the object … … 289 289 return true; 290 290 } 291 291 292 292 /** 293 293 * Gets current activity instance 294 * 294 * 295 295 * @return object Activity instance 296 296 * @access public 297 */ 297 */ 298 298 function &getActivity() 299 299 { 300 300 return $this->activity; 301 301 } 302 302 303 303 /** 304 304 * Gets the instance which could be an empty object 305 * 305 * 306 306 * @param int $instanceId is the instance id 307 307 * @return mixed Instance object which can be empty or string if something was turning bad … … 312 312 $this->instance_id = $instanceId; 313 313 $this->instance->getInstance($instanceId); 314 if ( ($this->instance->getInstanceId()==0) 314 if ( ($this->instance->getInstanceId()==0) 315 315 && (! (($this->activity->getType()=='standalone') || ($this->activity->getType()=='start') )) ) 316 316 { … … 323 323 return true; 324 324 } 325 325 326 326 /** 327 327 * Perform necessary security checks at runtime before running an activity 328 328 * This will as well lock the tables via the security object 329 329 * It should be launched in a transaction 330 * 330 * 331 331 * @return bool true if ok, false if the user has no runtime access 332 332 * @access public … … 360 360 * This will as well lock the tables via the security object 361 361 * It should be launched in a transaction 362 * 362 * 363 363 * @return bool true if ok, false if the user has no runtime access instance and activity are unsetted in case of false check 364 364 * @access public … … 376 376 //we are granted an access to release but there is a special bad case where 377 377 //we are a user authorized at releasing instances owned by others and where 378 //this instance is owned by another (for some quite complex reasons). 378 //this instance is owned by another (for some quite complex reasons). 379 379 //we should not release this new user!! 380 //Then this is auto-release, not a conscious act and so we will release only 380 //Then this is auto-release, not a conscious act and so we will release only 381 381 //if we can still grab this instance (avoiding the bad case) 382 382 383 383 //test grab before release 384 384 if ($this->checkUserRun()) … … 390 390 return false; 391 391 } 392 392 393 393 /** 394 394 * Sets/unsets the WfRuntime in debug mode 395 * 395 * 396 396 * @param bool $debug_mode true by default, set it to false to disable debug mode 397 397 * @access public 398 * @return void 398 * @return void 399 399 */ 400 400 function setDebug($debug_mode=true) … … 402 402 $this->debug = $debug_mode; 403 403 } 404 404 405 405 /** 406 406 * Sets/unsets the WfRuntime in automatic mode. i.e : executing 407 407 * non-interactive or interactive activities. Automatic mode have big impacts 408 408 * on error handling and on the way activities are executed 409 * 409 * 410 410 * @param bool $auto_mode true by default, set it to false to disable automatic mode 411 411 * @access public 412 * @return void 412 * @return void 413 413 */ 414 414 function setAuto($auto_mode=true) … … 416 416 $this->auto_mode = $auto_mode; 417 417 } 418 418 419 419 /** 420 420 * This function will start a transaction, call it before setActivityUser() 421 * 422 * @access public 423 * @return void 421 * 422 * @access public 423 * @return void 424 424 */ 425 425 function StartRun() … … 428 428 $this->db->StartTrans(); 429 429 } 430 430 431 431 /** 432 432 * This function ends the transactions started in StartRun() 433 * 433 * 434 434 * @access public 435 435 * @return void … … 437 437 function EndStartRun() 438 438 { 439 if ($this->transaction_in_progress) 439 if ($this->transaction_in_progress) 440 440 { 441 441 $this->db->CompleteTrans(); … … 443 443 } 444 444 } 445 446 /** 447 * For interactive activities this function will set the current user on the instance-activities table. 445 446 /** 447 * For interactive activities this function will set the current user on the instance-activities table. 448 448 * This will prevent having several user using the same activity on the same intsance at the same time 449 449 * But if you want this function to behave well you should call it after a checkUserRun or a checkUserRelease 450 450 * and inside a transaction. Theses others function will ensure the table will be locked and the user 451 451 * is really granted the action 452 * 452 * 453 453 * @param bool $grab true by default, if false the user will be set to '*', releasing the instance-activity record 454 454 * @access public 455 * @return bool 455 * @return bool 456 456 */ 457 457 function setActivityUser($grab=true) 458 458 { 459 if(isset($GLOBALS['user']) && !empty($this->instance->instanceId) && !empty($this->activity_id)) 459 if(isset($GLOBALS['user']) && !empty($this->instance->instanceId) && !empty($this->activity_id)) 460 460 { 461 461 if ($this->activity->isInteractive()) … … 484 484 $this->error[] = $errors; 485 485 return false; 486 } 487 } 488 486 } 487 } 488 489 489 /** 490 490 * Tries to give some usefull info about the current runtime 491 * 491 * 492 492 * @return array associative arrays with keys/values which could be usefull 493 493 * @access public … … 514 514 * This part of the runtime will be runned just after the activity code inclusion. 515 515 * We are in fact after all the "user code" part. We should decide what to do next 516 * 516 * 517 517 * @param bool $debug false by default 518 518 * @return array an array which must be analysed by the application run class. It contains 2 keys … … 529 529 { 530 530 $result = Array(); 531 531 532 532 // re-retrieve instance id which could have been modified by a complete 533 533 $this->instance_id = $this->instance->getInstanceId(); 534 534 535 535 //synchronised instance object with the database 536 536 $this->instance->sync(); … … 541 541 if ($this->instance->getActivityCompleted()) 542 542 { 543 // activity is interactive and completed, 543 // activity is interactive and completed, 544 544 // we have to continue the workflow 545 545 // and send any autorouted activity which could be after this one … … 558 558 if ($GLOBALS['workflow']['__leave_activity']) 559 559 { 560 // activity is interactive and the activity source set the 560 // activity is interactive and the activity source set the 561 561 // $GLOBALS[workflow][__leave_activity] it's a 'cancel' mode. 562 562 // we redirect the user to the leave activity page … … 565 565 } 566 566 else 567 { 567 { 568 568 //the activity is not completed and the user doesn't want to leave 569 569 // we loop on the form … … 574 574 } 575 575 else 576 { 576 { 577 577 // in auto mode or with non interactive activities we return engine info 578 578 // and we collect our errors, we do not let them for other objects … … 587 587 /** 588 588 * Gets the the 'Activity Completed' status 589 * 590 * @access public 591 * @return string 589 * 590 * @access public 591 * @return string 592 592 */ 593 593 function getActivityCompleted() … … 596 596 } 597 597 598 598 599 599 //----------- Instance public function mapping ------------------------------------------- 600 600 601 601 /** 602 602 * Sets the next activity to be executed, if the current activity is 603 603 * a switch activity the complete() method will use the activity setted 604 * in this method as the next activity for the instance. 604 * in this method as the next activity for the instance. 605 605 * Note that this method receives an activity name as argument (Not an Id) 606 606 * and that it does not need the activityId like the instance method 607 * 607 * 608 608 * @param string $actname name of the next activity 609 609 * @return bool 610 610 * @access public 611 611 */ 612 function setNextActivity($actname) 612 function setNextActivity($actname) 613 613 { 614 614 return $this->instance->setNextActivity($this->activity_id,$actname); … … 616 616 617 617 /** 618 * Sets the user that must perform the next 618 * Sets the user that must perform the next 619 619 * activity of the process. this effectively "assigns" the instance to 620 620 * some user 621 * 621 * 622 622 * @param int $user the next user id 623 623 * @param string $activityName The name of the activity that the user will be able to executed. '*' means the next activity. 624 * @return bool 624 * @return bool 625 625 * @access public 626 626 */ … … 635 635 636 636 /** 637 * Sets the user role that must perform the next 637 * Sets the user role that must perform the next 638 638 * activity of the process. this effectively "assigns" the instance to 639 639 * some user 640 * 640 * 641 641 * @param string $roleName the next activity role 642 642 * @param string $activityName The name of the activity that the role will be able to executed. '*' means the next activity. … … 659 659 660 660 /** 661 * Gets the user that must perform the next activity of the process. 661 * Gets the user that must perform the next activity of the process. 662 662 * This can be empty if no setNextUser() was done before. 663 663 * It wont return the default user but only the user which was assigned by a setNextUser 664 * 665 * @return int 666 * @access public 667 */ 668 function getNextUser() 664 * 665 * @return int 666 * @access public 667 */ 668 function getNextUser() 669 669 { 670 670 return $this->instance->getNextUser(); 671 671 } 672 672 673 673 /** 674 674 * Sets the name of this instance. 675 * 675 * 676 676 * @param string $value new name of the instance 677 * @return bool 678 * @access public 679 */ 680 function setName($value) 677 * @return bool 678 * @access public 679 */ 680 function setName($value) 681 681 { 682 682 return $this->instance->setName($value); … … 685 685 /** 686 686 * Gets the name of this instance 687 * 688 * @return string 687 * 688 * @return string 689 689 * @access public 690 690 */ … … 695 695 /** 696 696 * Sets the category of this instance 697 * 697 * 698 698 * @param string $value 699 699 * @return bool 700 700 * @access public 701 701 */ 702 function setCategory($value) 702 function setCategory($value) 703 703 { 704 704 return $this->instance->setcategory($value); … … 707 707 /** 708 708 * Gets category of this instance 709 * 710 * @return string 711 * @access public 712 */ 713 function getCategory() 709 * 710 * @return string 711 * @access public 712 */ 713 function getCategory() 714 714 { 715 715 return $this->instance->getCategory(); 716 716 } 717 717 718 718 /** 719 719 * Sets a property in this instance. This method is used in activities to … … 722 722 * problems (A->z, digits and _ for spaces). If you have several set to call look 723 723 * at the setProperties function. Each call to this function has an impact on database 724 * 724 * 725 725 * @param string $name property name (it will be normalized) 726 726 * @param mixed $value value for this property 727 * @return bool 728 * @access public 729 */ 730 function set($name,$value) 727 * @return bool 728 * @access public 729 */ 730 function set($name,$value) 731 731 { 732 732 return $this->instance->set($name,$value); 733 733 } 734 734 735 735 /** 736 736 * Unsets a property in this instance. This method is used in activities to … … 738 738 * All property names are normalized for security reasons and to avoid localisation 739 739 * problems (A->z, digits and _ for spaces). Each call to this function has an impact on database 740 * 740 * 741 741 * @param string $name property name (it will be normalized) 742 742 * @return bool true if it was ok 743 743 * @access public 744 744 */ 745 function clear($name) 745 function clear($name) 746 746 { 747 747 return $this->instance->clear($name); … … 753 753 * All property names are normalized for security reasons and to avoid localisation 754 754 * problems (A->z, digits and _ for spaces) 755 * 755 * 756 756 * @param string $name property name (it will be normalized) 757 757 * @return bool true if it exists and false otherwise … … 770 770 * problems (A->z, digits and _ for spaces). If you have several set to call look 771 771 * at the setProperties function. Each call to this function has an impact on database 772 * 772 * 773 773 * @param array $properties_array associative array containing for each record the 774 774 * property name as the key and the property value as the value. You do not need the complete … … 784 784 /** 785 785 * Gets the value of an instance property 786 * 786 * 787 787 * @param string $name name of the instance 788 788 * @param string $defaultValue … … 797 797 /** 798 798 * Describes the activities where the instance is present, can be more than one activity if the instance was "splitted" 799 * 799 * 800 800 * @access public 801 801 * @return array Vector of assocs 802 802 */ 803 function getActivities() 803 function getActivities() 804 804 { 805 805 return $this->instance->getActivities(); 806 806 } 807 807 808 808 /** 809 809 * Gets the instance status can be 'completed', 'active', 'aborted' or 'exception' 810 * 810 * 811 811 * @access public 812 812 * @return string Instance status 813 813 */ 814 function getStatus() 814 function getStatus() 815 815 { 816 816 return $this->instance->getStatus(); 817 817 } 818 818 819 819 /** 820 820 * Sets the instance status 821 * 821 * 822 822 * @param $status Desired status, it can be: 'completed', 'active', 'aborted' or 'exception' 823 823 * @return bool 824 824 * @access public 825 825 */ 826 function setStatus($status) 826 function setStatus($status) 827 827 { 828 828 return $this->instance->setStatus($status); 829 829 } 830 830 831 831 /** 832 832 * Gets the instance priority 833 * 834 * @access public 835 * @return int 833 * 834 * @access public 835 * @return int 836 836 */ 837 837 function getPriority() 838 838 { 839 839 return $this->instance->getPriority(); 840 } 840 } 841 841 842 842 /** 843 843 * Sets the instance priority 844 * 844 * 845 845 * @param int $priority 846 846 * @access public 847 * @return bool 847 * @return bool 848 848 */ 849 849 function setPriority($priority) … … 851 851 return $this->instance->setPriority($priority); 852 852 } 853 853 854 854 /** 855 855 * Returns the instance id 856 * 857 * @return int 858 * @access public 859 */ 860 function getInstanceId() 856 * 857 * @return int 858 * @access public 859 */ 860 function getInstanceId() 861 861 { 862 862 return $this->instance->getInstanceId(); 863 863 } 864 864 865 865 /** 866 866 * Returns the process id for this instance 867 * 868 * @return int 869 * @access public 867 * 868 * @return int 869 * @access public 870 870 */ 871 871 function getProcessId() { 872 872 return $this->instance->getProcessId(); 873 873 } 874 874 875 875 /** 876 876 * Returns the owner of the instance 877 * 878 * @return string 879 * @access public 880 */ 881 function getOwner() 877 * 878 * @return string 879 * @access public 880 */ 881 function getOwner() 882 882 { 883 883 return $this->instance->getOwner(); 884 884 } 885 885 886 886 /** 887 887 * Sets the instance owner 888 * 889 * @param string $user 890 * @access public 891 * @return bool 892 */ 893 function setOwner($user) 888 * 889 * @param string $user 890 * @access public 891 * @return bool 892 */ 893 function setOwner($user) 894 894 { 895 895 return $this->instance->setOwner($user); 896 896 } 897 897 898 898 /** 899 899 * Returns the user that must execute or is already executing an activity where the instance is present 900 * 900 * 901 901 * @param int $activityId 902 902 * @return bool False if the activity was not found for the instance, else return the user id or '*' if no user is defined yet 903 903 * @access public 904 */ 905 function getActivityUser($activityId) 904 */ 905 function getActivityUser($activityId) 906 906 { 907 907 return $this->instance->getActivityUser($activityId); 908 908 } 909 909 910 910 /** 911 911 * Sets the status of the instance in some activity 912 * 912 * 913 913 * @param int $activityId Activity id 914 914 * @param string $status New status, it can be 'running' or 'completed' 915 915 * @return bool False if no activity was found for the instance 916 916 * @access public 917 */ 918 function setActivityStatus($activityId,$status) 917 */ 918 function setActivityStatus($activityId,$status) 919 919 { 920 920 return $this->instance->setActivityStatus($activityId,$status); 921 921 } 922 923 924 /** 925 * Gets the status of the instance in some activity 926 * 927 * @param int $activityId 922 923 924 /** 925 * Gets the status of the instance in some activity 926 * 927 * @param int $activityId 928 928 * @return string 'running' or 'completed' 929 929 * @access public 930 930 */ 931 function getActivityStatus($activityId) 931 function getActivityStatus($activityId) 932 932 { 933 933 return $this->instance->getActivityStatus($activityId); 934 934 } 935 935 936 936 /** 937 937 * Resets the start time of the activity indicated to the current time 938 * 938 * 939 939 * @param int $activityId 940 * @return bool 941 * @access public 942 */ 943 function setActivityStarted($activityId) 940 * @return bool 941 * @access public 942 */ 943 function setActivityStarted($activityId) 944 944 { 945 945 return $this->instance->setActivityStarted($activityId); 946 946 } 947 947 948 948 /** 949 949 * Gets the Unix timstamp of the starting time for the given activity 950 * 950 * 951 951 * @param int $activityId 952 * @return int 953 * @access public 954 */ 955 function getActivityStarted($activityId) 952 * @return int 953 * @access public 954 */ 955 function getActivityStarted($activityId) 956 956 { 957 957 return $this->instance->getActivityStarted($activityId); 958 958 } 959 959 960 960 /** 961 961 * Gets the time where the instance was started 962 * 963 * @return int 964 * @access public 965 */ 966 function getStarted() 962 * 963 * @return int 964 * @access public 965 */ 966 function getStarted() 967 967 { 968 968 return $this->instance->getStarted(); 969 969 } 970 970 971 971 /** 972 972 * Gets the end time of the instance (when the process was completed) 973 * 974 * @return int 975 * @access public 976 */ 977 function getEnded() 973 * 974 * @return int 975 * @access public 976 */ 977 function getEnded() 978 978 { 979 979 return $this->instance->getEnded(); 980 980 } 981 982 981 982 983 983 /** 984 984 * Completes an activity. … … 986 986 * the engine does automatically complete automatic activities after 987 987 * executing them 988 * 988 * 989 989 * @return bool True or false, if false it means the complete was not done for some internal reason 990 990 * consult get_error() for more informations 991 991 * @access public 992 992 */ 993 function complete() 993 function complete() 994 994 { 995 995 if (!($this->activity->isInteractive())) … … 998 998 return false; 999 999 } 1000 1000 1001 1001 return $this->instance->complete($this->activity_id); 1002 1002 } … … 1005 1005 * Aborts an activity and terminates the whole instance. We still create a workitem to keep track 1006 1006 * of where in the process the instance was aborted 1007 * 1008 * @return bool 1009 * @access public 1010 */ 1011 function abort() 1007 * 1008 * @return bool 1009 * @access public 1010 */ 1011 function abort() 1012 1012 { 1013 1013 return $this->instance->abort(); 1014 1014 } 1015 1015 1016 1016 /** 1017 1017 * Gets a comment for this instance 1018 * 1018 * 1019 1019 * @param int $cId Comment id 1020 * @return string 1021 * @access public 1022 */ 1023 function get_instance_comment($cId) 1020 * @return string 1021 * @access public 1022 */ 1023 function get_instance_comment($cId) 1024 1024 { 1025 1025 return $this->instance->get_instance_comment($cId); 1026 1026 } 1027 1027 1028 1028 /** 1029 1029 * Inserts or updates an instance comment 1030 * 1030 * 1031 1031 * @param int $cId Commend id 1032 * @param int $activityId 1033 * @param object $activity 1032 * @param int $activityId 1033 * @param object $activity 1034 1034 * @param int $user User id 1035 1035 * @param string $title Comment's title 1036 1036 * @param string $comment Comment's contents 1037 * @return bool 1038 * @access public 1039 */ 1040 function replace_instance_comment($cId, $activityId, $activity, $user, $title, $comment) 1037 * @return bool 1038 * @access public 1039 */ 1040 function replace_instance_comment($cId, $activityId, $activity, $user, $title, $comment) 1041 1041 { 1042 1042 return $this->instance->replace_instance_comment($cId, $activityId, $activity, $user, $title, $comment); 1043 1043 } 1044 1044 1045 1045 /** 1046 1046 * Removes an instance comment 1047 * 1047 * 1048 1048 * @param int $cId Comment id 1049 * @return bool 1050 * @access public 1051 */ 1052 function remove_instance_comment($cId) 1049 * @return bool 1050 * @access public 1051 */ 1052 function remove_instance_comment($cId) 1053 1053 { 1054 1054 return $this->instance->remove_instance_comment($cId); 1055 1055 } 1056 1056 1057 1057 /** 1058 1058 * Lists instance comments 1059 * 1060 * @return array 1061 * @access public 1062 */ 1063 function get_instance_comments() 1059 * 1060 * @return array 1061 * @access public 1062 */ 1063 function get_instance_comments() 1064 1064 { 1065 1065 return $this->instance->get_instance_comments();
Note: See TracChangeset
for help on using the changeset viewer.