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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/workflow/2.0/inc/class.run_activity.inc.php

    r795 r1293  
    1010        \**************************************************************************/ 
    1111 
     12        require_once PHPGW_SERVER_ROOT . SEP . 'workflow/inc/common.inc.php'; 
     13 
    1214        require_once(dirname(__FILE__) . SEP . 'class.WorkflowUtils.inc.php'  ); /* superclass source code       */ 
    1315        require_once(dirname(__FILE__) . SEP . 'class.basecontroller.inc.php' ); /* module controller            */ 
    1416        require_once(dirname(__FILE__) . SEP . 'class.basemodel.inc.php'      ); /* module logic                 */ 
    15         require_once(dirname(__FILE__) . SEP . 'class.process_factory.inc.php'); /* module process factory class */ 
     17        require_once WF_PROC_LIB . SEP . 'ProcessFactory.php'; /* module process factory class */ 
    1618        require_once(dirname(__FILE__) . SEP . 'class.utils.security.php'     ); /* sanitizes input data         */ 
    1719 
     
    2527     */ 
    2628        class run_activity extends WorkflowUtils 
    27         {        
     29        { 
    2830                /** 
    2931                 * @var array  $public_functions func 
     
    5153                 * @access public 
    5254                 */ 
    53                 var $process;    
     55                var $process; 
    5456                /** 
    5557                 * @var object $GUI  GUI engine object. Act carefully with it. 
     
    6365                var $message = Array(); 
    6466                /** 
    65                  * @var object $categories categorie object for categories  
     67                 * @var object $categories categorie object for categories 
    6668                 * @access public 
    6769                 */ 
    6870                var $categories; 
    6971                /** 
    70                  * @var array $conf  
    71                  * @access public 
    72                  */ 
    73                 var $conf = array();     
     72                 * @var array $conf 
     73                 * @access public 
     74                 */ 
     75                var $conf = array(); 
    7476                /** 
    7577                 * @var $wf_template local activity template 
     
    7779                 */ 
    7880                var $wf_template; 
    79                 /**  
     81                /** 
    8082                 * @var object $instance 
    8183                 * @access public 
    8284                 */ 
    8385                var $instance; 
    84                 /**  
     86                /** 
    8587                 * @var object $activity_type The type of activity 
    8688                 * @access public 
     
    8991                // then we retain all usefull vars as members, to make them avaible in user's source code 
    9092                // theses are data which can be set before the user code and which are not likely to change because of the user code 
    91                 /**  
    92                  * @var int $process_id The process id  
     93                /** 
     94                 * @var int $process_id The process id 
    9395                 * @access public 
    9496                 */ 
    9597                var $process_id; 
    96                 /**  
    97                  * @var int $activity_id The activity id  
     98                /** 
     99                 * @var int $activity_id The activity id 
    98100                 * @access public 
    99101                 */ 
    100102                var $activity_id; 
    101                 /**  
     103                /** 
    102104                 * @var int $process_name The process name 
    103105                 * @access public 
    104106                 */ 
    105107                var $process_name; 
    106                 /**  
    107                  * @var int $process_version The process_version  
     108                /** 
     109                 * @var int $process_version The process_version 
    108110                 * @access public 
    109111                 */ 
    110112                var $process_version; 
    111                 /**  
    112                  * @var int $activity_name The process id  
     113                /** 
     114                 * @var int $activity_name The process id 
    113115                 * @access public 
    114116                 */ 
    115117                var $activity_name; 
    116                 /**  
    117                  * @var int $user_name The user name  
     118                /** 
     119                 * @var int $user_name The user name 
    118120                 * @access public 
    119121                 */ 
    120122                var $user_name; 
    121                 /**  
    122                  * @var int $view_activity activity id of the view activity avaible for this process  
     123                /** 
     124                 * @var int $view_activity activity id of the view activity avaible for this process 
    123125                 * @access public 
    124126                 */ 
    125127                var $view_activity; 
    126                 // theses 4 vars aren't avaible for the user code, they're set only after this user code was executed            
    127                 /**  
    128                  * @var int $instance_id Instance id  
     128                // theses 4 vars aren't avaible for the user code, they're set only after this user code was executed 
     129                /** 
     130                 * @var int $instance_id Instance id 
    129131                 * @access public 
    130132                 */ 
    131133                var $instance_id=0; 
    132                 /**  
    133                  * @var string $instance_name Instance name  
     134                /** 
     135                 * @var string $instance_name Instance name 
    134136                 * @access public 
    135137                 */ 
    136138                var $instance_name=''; 
    137                 /**  
    138                  * @var int $instance_owner Instance owner id  
     139                /** 
     140                 * @var int $instance_owner Instance owner id 
    139141                 * @access public 
    140142                 */ 
    141143                var $instance_owner=0; 
    142                 /**  
    143                  * @var string $owner_name Owner name  
     144                /** 
     145                 * @var string $owner_name Owner name 
    144146                 * @access public 
    145147                 */ 
    146148                var $owner_name=''; 
    147                  
     149 
    148150                /** 
    149151                 * @var bool $print_mode print mode 
     
    156158                 */ 
    157159                var $enable_print_mode = false; 
    158                  
     160 
    159161                /** 
    160162                 * @var array $act_role_names of roles associated with the activity, usefull for lists of users associated with theses roles 
    161                  * @access public        
     163                 * @access public 
    162164                 */ 
    163165                var $act_role_names= Array(); 
    164                  
     166 
    165167                /** 
    166168                 * @var array $agents Array of ui_agent objects 
     
    174176                 * @access public 
    175177                 */ 
    176                 var $smarty;                 
     178                var $smarty; 
    177179                /** 
    178180                 * @var array $wf holds a global environment vector 
    179181                 * @access public 
    180182                 */ 
    181                 var $wf;                     
     183                var $wf; 
    182184                /** 
    183185                 * @var $download_mode activates download mode 
    184186                 * @access public 
    185187                 */ 
    186                 var $download_mode;         
     188                var $download_mode; 
    187189                /** 
    188190                 * @var string $_template_name holds the template's file name 
    189191                 * @access public 
    190192                 */ 
    191                 var $_template_name = null;  
     193                var $_template_name = null; 
    192194                /** 
    193195                 * @var bool Indicates wether the current instance is a child instance or not 
     
    200202                /** 
    201203                 * Constructor 
    202                  *  
    203                  * @access public  
     204                 * 
     205                 * @access public 
    204206                 */ 
    205207                function run_activity() 
     
    301303                        $this->process_version  = $this->process->getVersion(); 
    302304                        $this->activity_name    = $activity->getName(); 
    303                         $this->user_name        = $GLOBALS['phpgw']->accounts->id2name($GLOBALS['user']); 
     305                        $this->user_name        = Factory::getForeignInstance('phpgwapi', 'phpgw')->accounts->id2name($GLOBALS['user']); 
    304306                        $this->view_activity    = $this->GUI->gui_get_process_view_activity($this->process_id); 
    305307 
     
    317319                        $GLOBALS['workflow']['wf_workflow_path']                        = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'; 
    318320                        $GLOBALS['workflow']['wf_resources_path']                       = $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'workflow/redirect.php?pid=' . $this->process_id . '&file='; 
    319                         $GLOBALS['workflow']['wf_default_resources_path']       = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink('processes'); 
    320                         $GLOBALS['workflow']['wf_workflow_resources_path']      = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink(''); 
     321                        $GLOBALS['workflow']['wf_default_resources_path']       = Factory::getInstance('TemplateServer')->generateLink('processes'); 
     322                        $GLOBALS['workflow']['wf_workflow_resources_path']      = Factory::getInstance('TemplateServer')->generateLink(''); 
    321323                        $GLOBALS['workflow']['wf_activity_url']                         = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id; 
    322                         $GLOBALS['workflow']['wf_user_cnname']                          = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 
     324                        $GLOBALS['workflow']['wf_user_cnname']                          = Factory::getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 
    323325                        $GLOBALS['workflow']['wf_back_link']                            = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1'; 
    324326                        $GLOBALS['workflow']['wf_js_path']                                      = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode'; 
     
    375377 
    376378                                /* check some permissions */ 
    377                                 if (($newUser == '*') || (!$this->runtime->checkUserRun($newUser)) || ($GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($newUser) === false)) 
     379                                if (($newUser == '*') || (!$this->runtime->checkUserRun($newUser)) || (Factory::getInstance('WorkflowLDAP')->getName($newUser) === false)) 
    378380                                { 
    379381                                        $_SESSION['phpgw_info']['workflow']['user_groups'] = $actualUserGroups; 
     
    406408                                $smarty->plugins_dir[] = PHPGW_SERVER_ROOT.SEP.'workflow'.SEP.'inc'.SEP.'smarty'.SEP.'wf_plugins'; 
    407409 
    408                                 $GLOBALS['phpgw']->template =& $smarty; 
     410                                Factory::getForeignInstance('phpgwapi', 'phpgw')->template =& $smarty; 
    409411                                $this->wf_template =& $smarty; 
    410412                                $_template_name = null; 
     
    418420                                $smarty->assign('wf_back_link',$GLOBALS['workflow']['wf_back_link']); 
    419421                                $smarty->assign('wf_activity_url',$GLOBALS['workflow']['wf_activity_url']); 
    420                                  
     422 
    421423                                /* register the prefilter smarty plugin wf_default_template */ 
    422424                                $smarty->load_filter('pre', 'wf_default_template'); 
     
    444446 
    445447                        $GLOBALS['workflow_env'] = &$env; 
     448 
    446449                        //echo "<br><br><br><br><br>Including $source <br>In request: <pre>";print_r($_REQUEST);echo "</pre>"; 
    447450                        //[__leave_activity] is setted if needed in the xxx_pre code or by the user in his code 
     
    471474 
    472475                        /* activate the security policy */ 
    473                         $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     476                        Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
    474477 
    475478                        /* include the files */ 
     
    497500                        $this->instance_name    = $instance->getName(); 
    498501                        $this->instance_owner   = $instance->getOwner(); 
    499                         $this->owner_name       = $GLOBALS['phpgw']->accounts->id2name($this->instance_owner); 
     502                        $this->owner_name       = Factory::getForeignInstance('phpgwapi', 'phpgw')->accounts->id2name($this->instance_owner); 
    500503                        if ($this->owner_name == '') 
    501504                        { 
     
    644647                        $this->process_version  = $this->process->getVersion(); 
    645648                        $this->activity_name    = $activity->getName(); 
    646                         $this->user_name        = $GLOBALS['phpgw']->accounts->id2name($GLOBALS['user']); 
     649                        $this->user_name        = Factory::getForeignInstance('phpgwapi', 'phpgw')->accounts->id2name($GLOBALS['user']); 
    647650                        $this->view_activity    = $this->GUI->gui_get_process_view_activity($this->process_id); 
    648651 
     
    660663                        $GLOBALS['workflow']['wf_workflow_path']                        = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'; 
    661664                        $GLOBALS['workflow']['wf_resources_path']                       = $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'workflow/redirect.php?pid=' . $this->process_id . '&file='; 
    662                         $GLOBALS['workflow']['wf_default_resources_path']       = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink('processes'); 
    663                         $GLOBALS['workflow']['wf_workflow_resources_path']      = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink(''); 
     665                        $GLOBALS['workflow']['wf_default_resources_path']       = Factory::getInstance('TemplateServer')->generateLink('processes'); 
     666                        $GLOBALS['workflow']['wf_workflow_resources_path']      = Factory::getInstance('TemplateServer')->generateLink(''); 
    664667                        $GLOBALS['workflow']['wf_activity_url']                         = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id; 
    665                         $GLOBALS['workflow']['wf_user_cnname']                          = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 
     668                        $GLOBALS['workflow']['wf_user_cnname']                          = Factory::getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 
    666669                        $GLOBALS['workflow']['wf_back_link']                            = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1'; 
    667670                        $GLOBALS['workflow']['wf_js_path']                                      = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode'; 
     
    711714 
    712715                        /* activate the security policy */ 
    713                         $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     716                        Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
    714717 
    715718                        $GLOBALS['workflow_env'] = &$env; 
Note: See TracChangeset for help on using the changeset viewer.