Ignore:
Timestamp:
08/07/09 16:06:07 (15 years ago)
Author:
gbisotto
Message:

Ticket #609 - Modificada a classe Factory e ProcessFactory? para automatizaro acesso ao objetos

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  
    11<?php 
    22  /** 
    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   * 
    55   * @author  viani 
    66   * @version 1.0 
    77   * @license http://www.gnu.org/copyleft/gpl.html GPL 
    88   * @package Galaxia 
    9    */  
     9   */ 
    1010class ajax_config 
    11 {        
    12         /**              
     11{ 
     12        /** 
    1313        * @var object $db database 
    1414        * @access public 
    1515        */ 
    1616        var $db; 
    17         /**              
     17        /** 
    1818        * @var string $appname Application (module) to config 
    1919        * @access public 
    2020        */ 
    2121        var $appname; 
    22         /**              
     22        /** 
    2323        * @var array $config_data Actual config-data 
    2424        * @access public 
    2525        */ 
    26         var $config_data;        
    27         /**              
     26        var $config_data; 
     27        /** 
    2828        * @var array $read_data Config-data as read from db 
    2929        * @access public 
    3030        */ 
    31         var $read_data;          
     31        var $read_data; 
    3232 
    3333        /** 
    3434        * Set appname and db for ajax config 
    35         *  
     35        * 
    3636        * @param string $appname Which application to config. Default workflow. 
    3737        * @return void 
     
    4545                } 
    4646 
    47                 $this->db      = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso(); 
     47                $this->db      =& Factory::getInstance('WorkflowObjects')->getDBExpresso(); 
    4848                $this->appname = $appname; 
    4949        } 
     
    5151        /** 
    5252        * Reads the whole repository for $this->appname, appname has to be set via the constructor 
    53         *  
     53        * 
    5454        * @return array the whole config-array for that app 
    5555        * @access public 
     
    6060 
    6161                $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()) 
    6363                { 
    6464                        $test = @unserialize($this->db->f('config_value')); 
     
    7575        } 
    7676 
    77         /**  
     77        /** 
    7878        * Updates the whole repository for $this->appname, you have to call read_repository() before (!) 
    79         * @access public         
     79        * @access public 
    8080        * @return void 
    8181        */ 
     
    107107        /** 
    108108        * Updates or insert a single config-value 
    109         *  
     109        * 
    110110        * @param string $name name of the config-value 
    111111        * @param mixed $value content 
     
    158158        /** 
    159159        * Deletes the whole repository for $this->appname, appname has to be set via the constructor 
    160         *  
     160        * 
    161161        * @access public 
    162         * @return void           
    163         */       
     162        * @return void 
     163        */ 
    164164        function delete_repository() 
    165165        { 
     
    169169        /** 
    170170        * Deletes a single value from the repository, you need to call save_repository after 
    171         *  
     171        * 
    172172        * @param string $variable_name name of the config 
    173173        * @return void 
     
    180180        /** 
    181181        * Sets a single value in the repository, you need to call save_repository after 
    182         *  
     182        * 
    183183        * @param string $variable_name name of the config 
    184184        * @param mixed $variable_data the content 
     
    190190                $this->config_data[$variable_name] = $variable_data; 
    191191        } 
    192          
     192 
    193193} 
    194194?> 
  • sandbox/workflow/2.0/inc/engine/class.ajax_ldap.inc.php

    r795 r1293  
    2929        function ajax_ldap() 
    3030        { 
    31                 $tmpLDAP = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     31                $tmpLDAP = &Factory::getInstance('WorkflowLDAP'); 
    3232                $this->user_context  = $tmpLDAP->getUserContext(); 
    3333                $this->group_context = $tmpLDAP->getGroupContext(); 
    3434 
    35                 $this->ds = &$GLOBALS['workflow']['workflowObjects']->getLDAP(); 
     35                $this->ds =& Factory::getInstance('WorkflowObjects')->getLDAP(); 
    3636        } 
    3737 
     
    8383        function id2fullname($account_id) 
    8484    { 
    85                 return $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($account_id); 
     85                return Factory::getInstance('WorkflowLDAP')->getName($account_id); 
    8686    } 
    8787 
     
    107107                        $accountID = $_SESSION['phpgw_info']['workflow']['account_id']; 
    108108 
    109                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     109                $ldap =& Factory::getInstance('WorkflowLDAP'); 
    110110                if (count($output = $ldap->getUserGroups($accountID)) == 0) 
    111111                        return false; 
  • sandbox/workflow/2.0/inc/engine/config.ajax.inc.php

    r795 r1293  
    170170                if ($loadGroups) 
    171171                { 
    172                         $memberships = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserGroups($user); 
     172                        $memberships = Factory::getInstance('WorkflowLDAP')->getUserGroups($user); 
    173173                        if ($user == $_SESSION['phpgw_info']['workflow']['account_id']) 
    174174                                $_SESSION['phpgw_info']['workflow']['user_groups'] = $memberships; 
     
    196196                { 
    197197                        /* get information regarding the members of the group */ 
    198                         $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     198                        $ldap = &Factory::getInstance('WorkflowLDAP'); 
    199199                        $members = $ldap->getGroupUsers($group); 
    200200 
  • sandbox/workflow/2.0/inc/engine/config.egw.inc.php

    r795 r1293  
    151151        function galaxia_user_can_admin_process() 
    152152        { 
    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')); 
    154154        } 
    155155} 
     
    165165        function galaxia_user_can_admin_instance() 
    166166        { 
    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')); 
    168168        } 
    169169} 
     
    179179        function galaxia_user_can_clean_instances() 
    180180        { 
    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')); 
    182182        } 
    183183} 
     
    191191        function galaxia_user_can_clean_aborted_instances() 
    192192        { 
    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')); 
    194194        } 
    195195} 
     
    203203        function galaxia_user_can_monitor() 
    204204        { 
    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')); 
    206206        } 
    207207} 
     
    221221                                $user = $GLOBALS['phpgw_info']['user']['account_id']; 
    222222 
    223                         $memberships = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserGroups($user); 
     223                        $memberships = Factory::getInstance('WorkflowLDAP')->getUserGroups($user); 
    224224 
    225225                        if ($memberships === false) 
     
    245245                { 
    246246                        /* get information regarding the members of the group */ 
    247                         $members = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getGroupUsers($group); 
     247                        $members = &Factory::getInstance('WorkflowLDAP')->getGroupUsers($group); 
    248248 
    249249                        /* checl for error in the LDAP query */ 
  • sandbox/workflow/2.0/inc/engine/src/ProcessManager/RoleManager.php

    r795 r1293  
    247247    $result = $this->query($query,$bindvars); 
    248248    $ret = Array(); 
    249     $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     249    $ldap = &Factory::getInstance('WorkflowLDAP'); 
    250250    if (!(empty($result))) 
    251251    { 
  • sandbox/workflow/2.0/inc/engine/src/common/WfRuntime.php

    r795 r1293  
    66 * as it handle concurrency and part of the core execution of the instance while avoiding 
    77 * bad manipulation of the instance 
    8  *  
     8 * 
    99 * @package Galaxia 
    10  * @license http://www.gnu.org/copyleft/gpl.html GPL  
     10 * @license http://www.gnu.org/copyleft/gpl.html GPL 
    1111 */ 
    12 class WfRuntime extends Base  
    13 {   
     12class WfRuntime extends Base 
     13{ 
    1414  /** 
    1515   * @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 
    1616   * @access public 
    1717   */ 
    18   var $conf= Array();   
     18  var $conf= Array(); 
    1919  /** 
    2020   * @var object $activity 
    21    * @access public  
     21   * @access public 
    2222   */ 
    2323  var $activity = null; 
    2424  /** 
    2525   * @var object $instance 
    26    * @access public  
     26   * @access public 
    2727   */ 
    2828  var $instance = null; 
    2929  /** 
    3030   * @var int $instance_id 
    31    * @access public  
    32    */ 
    33   var $instance_id = 0;   
     31   * @access public 
     32   */ 
     33  var $instance_id = 0; 
    3434  /** 
    3535   * @var int $activity_id 
    36    * @access public  
     36   * @access public 
    3737   */ 
    3838  var $activity_id = 0; 
    3939  /** 
    4040   * @var object $process Retrieve process information 
    41    * @access public  
     41   * @access public 
    4242   */ 
    4343  var $process = null; 
    4444  /** 
    4545   * @var object $workitems  Reference to $instance->workitems 
    46    * @access public  
     46   * @access public 
    4747   */ 
    4848  var $workitems = null; 
    4949  /** 
    5050   * @var object $activities Reference to $instance->activities 
    51    * @access public  
    52    */   
     51   * @access public 
     52   */ 
    5353  var $activities = null; 
    5454  /** 
    5555   * @var object $security Security object 
    56    * @access public  
    57    */   
     56   * @access public 
     57   */ 
    5858  var $security = null; 
    5959  /** 
    6060   * @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; 
    6464  /** 
    6565   * @var bool $debug Debug state 
    66    * @access public  
    67    */    
     66   * @access public 
     67   */ 
    6868  var $debug=false; 
    6969  /** 
    7070   * @var bool $auto_mode Automatic mode state, non-interactive for instance, big impact on error handling 
    71    * @access public  
    72    */   
     71   * @access public 
     72   */ 
    7373  var $auto_mode=false; 
    7474 
     
    8181  /** 
    8282   * Constructor 
    83    *  
     83   * 
    8484   * @param object &$db ADOdb 
    8585   * @return object WfRuntime instance 
    8686   * @access public 
    8787   */ 
    88   function WfRuntime(&$db)  
     88  function WfRuntime(&$db) 
    8989  { 
    9090    $this->child_name = 'WfRuntime'; 
     
    9494    require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Instance.php'); 
    9595    require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'common'.SEP.'WfSecurity.php'); 
    96      
     96 
    9797    //first the activity is not set 
    9898    $this->activity = null; 
    9999    $this->instance = new Instance($this->db); 
    100100    $this->process = new Process($this->db); 
    101     $this->security = new WfSecurity($this->db);  
     101    $this->security = new WfSecurity($this->db); 
    102102  } 
    103103 
     
    105105   * Collect errors from all linked objects which could have been used by this object 
    106106   * Each child class should instantiate this function with her linked objetcs, calling get_error(true) 
    107    *  
     107   * 
    108108   * @param bool $debug false by default, if true debug messages can be added to 'normal' messages 
    109109   * @param string $prefix appended to the debug message 
    110    * @return void  
     110   * @return void 
    111111   * @access private 
    112112   */ 
     
    122122  /** 
    123123   * Ends-up dying and giving a last message 
    124    *  
     124   * 
    125125   * @param string $last_message last sentence 
    126126   * @param bool $include_errors false by default, if true we'll include error messages 
     
    138138    if ($this->debug) $debug = true; 
    139139    if ($this->auto_mode) $dying = false; 
    140      
     140 
    141141    if ($include_errors) 
    142142    { 
     
    165165   * Loads the config values for the process associated with the runtime 
    166166   * config values are cached while this WfRuntime object stays alive 
    167    *  
     167   * 
    168168   * @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 
    170170   * @return array Values associated with the current process for the asked config options and as well for som WfRuntime internal config options 
    171171   */ 
     
    176176      $this->loadProcess(); 
    177177    } 
    178     $arrayconf['auto-release_on_leaving_activity'] = 1;   
     178    $arrayconf['auto-release_on_leaving_activity'] = 1; 
    179179    $this->conf =  $this->process->getConfigValues($arrayconf); 
    180180    return $this->conf; 
     
    183183  /** 
    184184   * Loads instance, the activity and the process, needed by the runtime engine to 'execute' the activity 
    185    *  
     185   * 
    186186   * @param int $activityId activity id, the activity we will run 
    187187   * @param int $instanceId instance Id, can be empty for a start or standalone activity 
    188    * @return bool  
     188   * @return bool 
    189189   * @access public 
    190190   */ 
     
    208208      return false; 
    209209    } 
    210      
     210 
    211211    //ensure the activity is not completed 
    212212    $this->instance->setActivityCompleted(false); 
    213213        $this->instance->activityID = $activityId; 
    214      
     214 
    215215    //set the workitems and activities links 
    216216    $this->workitems =& $this->instance->workitems; 
     
    218218    return true; 
    219219  } 
    220    
     220 
    221221  /** 
    222222   * Retrieves the process object associated with the activity 
    223    *  
     223   * 
    224224   * @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 
    225225   * @return mixed Process object of the right type or false 
     
    246246    return true; 
    247247  } 
    248    
     248 
    249249  /** 
    250250   * Gets current process instance 
    251    *  
     251   * 
    252252   * @return object Process instance 
    253253   * @access public 
     
    260260  /** 
    261261   * Retrieves the activity of the right type from a baseActivity Object 
    262    *  
     262   * 
    263263   * @param int $activity_id activity_id you want 
    264264   * @param bool $with_roles will load the roles links on the object 
     
    289289    return true; 
    290290  } 
    291    
     291 
    292292  /** 
    293293   * Gets current activity instance 
    294    *  
     294   * 
    295295   * @return object Activity instance 
    296296   * @access public 
    297    */   
     297   */ 
    298298  function &getActivity() 
    299299  { 
    300300    return $this->activity; 
    301301  } 
    302    
     302 
    303303  /** 
    304304   * Gets the instance which could be an empty object 
    305    *  
     305   * 
    306306   * @param int $instanceId is the instance id 
    307307   * @return mixed Instance object which can be empty or string if something was turning bad 
     
    312312    $this->instance_id = $instanceId; 
    313313    $this->instance->getInstance($instanceId); 
    314     if ( ($this->instance->getInstanceId()==0)  
     314    if ( ($this->instance->getInstanceId()==0) 
    315315      && (! (($this->activity->getType()=='standalone') || ($this->activity->getType()=='start') )) ) 
    316316    { 
     
    323323    return true; 
    324324  } 
    325    
     325 
    326326  /** 
    327327   * Perform necessary security checks at runtime before running an activity 
    328328   * This will as well lock the tables via the security object 
    329329   * It should be launched in a transaction 
    330    *  
     330   * 
    331331   * @return bool true if ok, false if the user has no runtime access 
    332332   * @access public 
     
    360360   * This will as well lock the tables via the security object 
    361361   * It should be launched in a transaction 
    362    *  
     362   * 
    363363   * @return bool true if ok, false if the user has no runtime access instance and activity are unsetted in case of false check 
    364364   * @access public 
     
    376376        //we are granted an access to release but there is a special bad case where 
    377377        //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). 
    379379        //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 
    381381        //if we can still grab this instance (avoiding the bad case) 
    382          
     382 
    383383        //test grab before release 
    384384        if ($this->checkUserRun()) 
     
    390390    return false; 
    391391  } 
    392    
     392 
    393393  /** 
    394394   * Sets/unsets the WfRuntime in debug mode 
    395    *  
     395   * 
    396396   * @param bool $debug_mode true by default, set it to false to disable debug mode 
    397397   * @access public 
    398    * @return void  
     398   * @return void 
    399399   */ 
    400400  function setDebug($debug_mode=true) 
     
    402402    $this->debug = $debug_mode; 
    403403  } 
    404    
     404 
    405405  /** 
    406406   * Sets/unsets the WfRuntime in automatic mode. i.e : executing 
    407407   * non-interactive or interactive activities. Automatic mode have big impacts 
    408408   * on error handling and on the way activities are executed 
    409    *  
     409   * 
    410410   * @param bool $auto_mode true by default, set it to false to disable automatic mode 
    411411   * @access public 
    412    * @return void  
     412   * @return void 
    413413   */ 
    414414  function setAuto($auto_mode=true) 
     
    416416    $this->auto_mode = $auto_mode; 
    417417  } 
    418    
     418 
    419419  /** 
    420420   * This function will start a transaction, call it before setActivityUser() 
    421    *  
    422    * @access public 
    423    * @return void  
     421   * 
     422   * @access public 
     423   * @return void 
    424424   */ 
    425425  function StartRun() 
     
    428428    $this->db->StartTrans(); 
    429429  } 
    430    
     430 
    431431  /** 
    432432   * This function ends the transactions started in StartRun() 
    433    *  
     433   * 
    434434   * @access public 
    435435   * @return void 
     
    437437  function EndStartRun() 
    438438  { 
    439     if ($this->transaction_in_progress)  
     439    if ($this->transaction_in_progress) 
    440440    { 
    441441      $this->db->CompleteTrans(); 
     
    443443    } 
    444444  } 
    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. 
    448448   * This will prevent having several user using the same activity on the same intsance at the same time 
    449449   * But if you want this function to behave well you should call it after a checkUserRun or a checkUserRelease 
    450450   * and inside a transaction. Theses others function will ensure the table will be locked and the user 
    451451   * is really granted the action 
    452    *  
     452   * 
    453453   * @param bool $grab true by default, if false the user will be set to '*', releasing the instance-activity record 
    454454   * @access public 
    455    * @return bool  
     455   * @return bool 
    456456   */ 
    457457  function setActivityUser($grab=true) 
    458458  { 
    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)) 
    460460    { 
    461461      if ($this->activity->isInteractive()) 
     
    484484      $this->error[] = $errors; 
    485485      return false; 
    486     }     
    487   } 
    488    
     486    } 
     487  } 
     488 
    489489  /** 
    490490   * Tries to give some usefull info about the current runtime 
    491    *  
     491   * 
    492492   * @return array associative arrays with keys/values which could be usefull 
    493493   * @access public 
     
    514514   * This part of the runtime will be runned just after the activity code inclusion. 
    515515   * We are in fact after all the "user code" part. We should decide what to do next 
    516    *  
     516   * 
    517517   * @param bool $debug false by default 
    518518   * @return array an array which must be analysed by the application run class. It contains 2 keys 
     
    529529  { 
    530530    $result = Array(); 
    531      
     531 
    532532     // re-retrieve instance id which could have been modified by a complete 
    533533     $this->instance_id = $this->instance->getInstanceId(); 
    534       
     534 
    535535     //synchronised instance object with the database 
    536536     $this->instance->sync(); 
     
    541541      if ($this->instance->getActivityCompleted()) 
    542542      { 
    543         // activity is interactive and completed,  
     543        // activity is interactive and completed, 
    544544        // we have to continue the workflow 
    545545        // and send any autorouted activity which could be after this one 
     
    558558        if ($GLOBALS['workflow']['__leave_activity']) 
    559559        { 
    560           // activity is interactive and the activity source set the  
     560          // activity is interactive and the activity source set the 
    561561          // $GLOBALS[workflow][__leave_activity] it's a 'cancel' mode. 
    562562          // we redirect the user to the leave activity page 
     
    565565        } 
    566566        else 
    567         {  
     567        { 
    568568          //the activity is not completed and the user doesn't want to leave 
    569569          // we loop on the form 
     
    574574    } 
    575575    else 
    576     {  
     576    { 
    577577      // in auto mode or with non interactive activities we return engine info 
    578578      // and we collect our errors, we do not let them for other objects 
     
    587587  /** 
    588588   * Gets the the 'Activity Completed' status 
    589    *  
    590    * @access public 
    591    * @return string  
     589   * 
     590   * @access public 
     591   * @return string 
    592592   */ 
    593593  function getActivityCompleted() 
     
    596596  } 
    597597 
    598    
     598 
    599599  //----------- Instance public function mapping ------------------------------------------- 
    600    
     600 
    601601  /** 
    602602   * Sets the next activity to be executed, if the current activity is 
    603603   * 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. 
    605605   * Note that this method receives an activity name as argument (Not an Id) 
    606606   * and that it does not need the activityId like the instance method 
    607    *  
     607   * 
    608608   * @param string $actname name of the next activity 
    609609   * @return bool 
    610610   * @access public 
    611611   */ 
    612   function setNextActivity($actname)  
     612  function setNextActivity($actname) 
    613613  { 
    614614    return $this->instance->setNextActivity($this->activity_id,$actname); 
     
    616616 
    617617  /** 
    618    * Sets the user that must perform the next  
     618   * Sets the user that must perform the next 
    619619   * activity of the process. this effectively "assigns" the instance to 
    620620   * some user 
    621    *  
     621   * 
    622622   * @param int $user the next user id 
    623623   * @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 
    625625   * @access public 
    626626   */ 
     
    635635 
    636636  /** 
    637    * Sets the user role that must perform the next  
     637   * Sets the user role that must perform the next 
    638638   * activity of the process. this effectively "assigns" the instance to 
    639639   * some user 
    640    *  
     640   * 
    641641   * @param string $roleName the next activity role 
    642642   * @param string $activityName The name of the activity that the role will be able to executed. '*' means the next activity. 
     
    659659 
    660660  /** 
    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. 
    662662   * This can be empty if no setNextUser() was done before. 
    663663   * 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() 
    669669  { 
    670670    return $this->instance->getNextUser(); 
    671671  } 
    672   
     672 
    673673  /** 
    674674   * Sets the name of this instance. 
    675    *  
     675   * 
    676676   * @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) 
    681681  { 
    682682    return $this->instance->setName($value); 
     
    685685  /** 
    686686   * Gets the name of this instance 
    687    *  
    688    * @return string  
     687   * 
     688   * @return string 
    689689   * @access public 
    690690   */ 
     
    695695  /** 
    696696   * Sets the category of this instance 
    697    *  
     697   * 
    698698   * @param string $value 
    699699   * @return bool 
    700700   * @access public 
    701701   */ 
    702   function setCategory($value)  
     702  function setCategory($value) 
    703703  { 
    704704    return $this->instance->setcategory($value); 
     
    707707  /** 
    708708   * 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() 
    714714  { 
    715715    return $this->instance->getCategory(); 
    716716  } 
    717    
     717 
    718718  /** 
    719719   * Sets a property in this instance. This method is used in activities to 
     
    722722   * problems (A->z, digits and _ for spaces). If you have several set to call look 
    723723   * at the setProperties function. Each call to this function has an impact on database 
    724    *  
     724   * 
    725725   * @param string $name property name (it will be normalized) 
    726726   * @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) 
    731731  { 
    732732    return $this->instance->set($name,$value); 
    733733  } 
    734    
     734 
    735735  /** 
    736736   * Unsets a property in this instance. This method is used in activities to 
     
    738738   * All property names are normalized for security reasons and to avoid localisation 
    739739   * problems (A->z, digits and _ for spaces). Each call to this function has an impact on database 
    740    *  
     740   * 
    741741   * @param string $name property name (it will be normalized) 
    742742   * @return bool true if it was ok 
    743743   * @access public 
    744744   */ 
    745   function clear($name)  
     745  function clear($name) 
    746746  { 
    747747    return $this->instance->clear($name); 
     
    753753   * All property names are normalized for security reasons and to avoid localisation 
    754754   * problems (A->z, digits and _ for spaces) 
    755    *  
     755   * 
    756756   * @param string $name property name (it will be normalized) 
    757757   * @return bool true if it exists and false otherwise 
     
    770770   * problems (A->z, digits and _ for spaces). If you have several set to call look 
    771771   * at the setProperties function. Each call to this function has an impact on database 
    772    *  
     772   * 
    773773   * @param array $properties_array associative array containing for each record the 
    774774   * property name as the key and the property value as the value. You do not need the complete 
     
    784784  /** 
    785785   * Gets the value of an instance property 
    786    *  
     786   * 
    787787   * @param string $name name of the instance 
    788788   * @param string $defaultValue 
     
    797797  /** 
    798798   * Describes the activities where the instance is present, can be more than one activity if the instance was "splitted" 
    799    *  
     799   * 
    800800   * @access public 
    801801   * @return array Vector of assocs 
    802802   */ 
    803   function getActivities()  
     803  function getActivities() 
    804804  { 
    805805    return $this->instance->getActivities(); 
    806806  } 
    807    
     807 
    808808  /** 
    809809   * Gets the instance status can be 'completed', 'active', 'aborted' or 'exception' 
    810    *  
     810   * 
    811811   * @access public 
    812812   * @return string Instance status 
    813813   */ 
    814   function getStatus()  
     814  function getStatus() 
    815815  { 
    816816    return $this->instance->getStatus(); 
    817817  } 
    818    
     818 
    819819  /** 
    820820   * Sets the instance status 
    821    *  
     821   * 
    822822   * @param $status Desired status, it can be: 'completed', 'active', 'aborted' or 'exception' 
    823823   * @return bool 
    824824   * @access public 
    825825   */ 
    826   function setStatus($status)  
     826  function setStatus($status) 
    827827  { 
    828828    return $this->instance->setStatus($status); 
    829829  } 
    830    
     830 
    831831  /** 
    832832   * Gets the instance priority 
    833    *  
    834    * @access public 
    835    * @return int  
     833   * 
     834   * @access public 
     835   * @return int 
    836836   */ 
    837837  function getPriority() 
    838838  { 
    839839    return $this->instance->getPriority(); 
    840   }  
     840  } 
    841841 
    842842  /** 
    843843   * Sets the instance priority 
    844    *  
     844   * 
    845845   * @param int $priority 
    846846   * @access public 
    847    * @return bool  
     847   * @return bool 
    848848   */ 
    849849  function setPriority($priority) 
     
    851851    return $this->instance->setPriority($priority); 
    852852  } 
    853     
     853 
    854854  /** 
    855855   * 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() 
    861861  { 
    862862    return $this->instance->getInstanceId(); 
    863863  } 
    864    
     864 
    865865  /** 
    866866   * Returns the process id for this instance 
    867    *  
    868    * @return int  
    869    * @access public  
     867   * 
     868   * @return int 
     869   * @access public 
    870870   */ 
    871871  function getProcessId() { 
    872872    return $this->instance->getProcessId(); 
    873873  } 
    874    
     874 
    875875  /** 
    876876   * 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() 
    882882  { 
    883883    return $this->instance->getOwner(); 
    884884  } 
    885    
     885 
    886886  /** 
    887887   * 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) 
    894894  { 
    895895    return $this->instance->setOwner($user); 
    896896  } 
    897    
     897 
    898898  /** 
    899899   * Returns the user that must execute or is already executing an activity where the instance is present 
    900    *  
     900   * 
    901901   * @param int $activityId 
    902902   * @return bool False if the activity was not found for the instance, else return the user id or '*' if no user is defined yet 
    903903   * @access public 
    904    */   
    905   function getActivityUser($activityId)  
     904   */ 
     905  function getActivityUser($activityId) 
    906906  { 
    907907    return $this->instance->getActivityUser($activityId); 
    908908  } 
    909    
     909 
    910910  /** 
    911911   * Sets the status of the instance in some activity 
    912    *  
     912   * 
    913913   * @param int $activityId Activity id 
    914914   * @param string $status New status, it can be 'running' or 'completed' 
    915915   * @return bool False if no activity was found for the instance 
    916916   * @access public 
    917    */   
    918   function setActivityStatus($activityId,$status)  
     917   */ 
     918  function setActivityStatus($activityId,$status) 
    919919  { 
    920920    return $this->instance->setActivityStatus($activityId,$status); 
    921921  } 
    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 
    928928   * @return string 'running' or 'completed' 
    929929   * @access public 
    930930   */ 
    931   function getActivityStatus($activityId)  
     931  function getActivityStatus($activityId) 
    932932  { 
    933933    return $this->instance->getActivityStatus($activityId); 
    934934  } 
    935    
     935 
    936936  /** 
    937937   * Resets the start time of the activity indicated to the current time 
    938    *  
     938   * 
    939939   * @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) 
    944944  { 
    945945    return $this->instance->setActivityStarted($activityId); 
    946946  } 
    947    
     947 
    948948  /** 
    949949   * Gets the Unix timstamp of the starting time for the given activity 
    950    *  
     950   * 
    951951   * @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) 
    956956  { 
    957957    return $this->instance->getActivityStarted($activityId); 
    958958  } 
    959    
     959 
    960960  /** 
    961961   * 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() 
    967967  { 
    968968    return $this->instance->getStarted(); 
    969969  } 
    970    
     970 
    971971  /** 
    972972   * 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() 
    978978  { 
    979979    return $this->instance->getEnded(); 
    980980  } 
    981    
    982    
     981 
     982 
    983983  /** 
    984984   * Completes an activity. 
     
    986986   * the engine does automatically complete automatic activities after 
    987987   * executing them 
    988    *  
     988   * 
    989989   * @return bool True or false, if false it means the complete was not done for some internal reason 
    990990   * consult get_error() for more informations 
    991991   * @access public 
    992992   */ 
    993   function complete()  
     993  function complete() 
    994994  { 
    995995    if (!($this->activity->isInteractive())) 
     
    998998      return false; 
    999999    } 
    1000      
     1000 
    10011001    return $this->instance->complete($this->activity_id); 
    10021002  } 
     
    10051005   * Aborts an activity and terminates the whole instance. We still create a workitem to keep track 
    10061006   * 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() 
    10121012  { 
    10131013    return $this->instance->abort(); 
    10141014  } 
    1015    
     1015 
    10161016  /** 
    10171017   * Gets a comment for this instance 
    1018    *  
     1018   * 
    10191019   * @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) 
    10241024  { 
    10251025    return $this->instance->get_instance_comment($cId); 
    10261026  } 
    1027    
     1027 
    10281028  /** 
    10291029   * Inserts or updates an instance comment 
    1030    *  
     1030   * 
    10311031   * @param int $cId Commend id 
    1032    * @param int $activityId  
    1033    * @param object $activity  
     1032   * @param int $activityId 
     1033   * @param object $activity 
    10341034   * @param int $user User id 
    10351035   * @param string $title Comment's title 
    10361036   * @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) 
    10411041  { 
    10421042    return $this->instance->replace_instance_comment($cId, $activityId, $activity, $user, $title, $comment); 
    10431043  } 
    1044    
     1044 
    10451045  /** 
    10461046   * Removes an instance comment 
    1047    *  
     1047   * 
    10481048   * @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) 
    10531053  { 
    10541054    return $this->instance->remove_instance_comment($cId); 
    10551055  } 
    1056   
     1056 
    10571057  /** 
    10581058   * 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() 
    10641064  { 
    10651065    return $this->instance->get_instance_comments(); 
Note: See TracChangeset for help on using the changeset viewer.