- Timestamp:
- 07/15/10 17:50:39 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/workflow/branches/1015/inc/class.run_activity.inc.php
r2588 r3061 24 24 */ 25 25 class run_activity extends WorkflowUtils 26 { 26 { 27 27 /** 28 28 * @var array $public_functions func … … 50 50 * @access public 51 51 */ 52 var $process; 52 var $process; 53 53 /** 54 54 * @var object $GUI GUI engine object. Act carefully with it. … … 62 62 var $message = Array(); 63 63 /** 64 * @var object $categories categorie object for categories 64 * @var object $categories categorie object for categories 65 65 * @access public 66 66 */ 67 67 var $categories; 68 68 /** 69 * @var array $conf 70 * @access public 71 */ 72 var $conf = array(); 69 * @var array $conf 70 * @access public 71 */ 72 var $conf = array(); 73 73 /** 74 74 * @var $wf_template local activity template … … 76 76 */ 77 77 var $wf_template; 78 /** 78 /** 79 79 * @var object $instance 80 80 * @access public 81 81 */ 82 82 var $instance; 83 /** 83 /** 84 84 * @var object $activity_type The type of activity 85 85 * @access public … … 88 88 // then we retain all usefull vars as members, to make them avaible in user's source code 89 89 // theses are data which can be set before the user code and which are not likely to change because of the user code 90 /** 91 * @var int $process_id The process id 90 /** 91 * @var int $process_id The process id 92 92 * @access public 93 93 */ 94 94 var $process_id; 95 /** 96 * @var int $activity_id The activity id 95 /** 96 * @var int $activity_id The activity id 97 97 * @access public 98 98 */ 99 99 var $activity_id; 100 /** 100 /** 101 101 * @var int $process_name The process name 102 102 * @access public 103 103 */ 104 104 var $process_name; 105 /** 106 * @var int $process_version The process_version 105 /** 106 * @var int $process_version The process_version 107 107 * @access public 108 108 */ 109 109 var $process_version; 110 /** 111 * @var int $activity_name The process id 110 /** 111 * @var int $activity_name The process id 112 112 * @access public 113 113 */ 114 114 var $activity_name; 115 /** 116 * @var int $user_name The user name 115 /** 116 * @var int $user_name The user name 117 117 * @access public 118 118 */ 119 119 var $user_name; 120 /** 121 * @var int $view_activity activity id of the view activity avaible for this process 120 /** 121 * @var int $view_activity activity id of the view activity avaible for this process 122 122 * @access public 123 123 */ 124 124 var $view_activity; 125 // theses 4 vars aren't avaible for the user code, they're set only after this user code was executed 126 /** 127 * @var int $instance_id Instance id 125 // theses 4 vars aren't avaible for the user code, they're set only after this user code was executed 126 /** 127 * @var int $instance_id Instance id 128 128 * @access public 129 129 */ 130 130 var $instance_id=0; 131 /** 132 * @var string $instance_name Instance name 131 /** 132 * @var string $instance_name Instance name 133 133 * @access public 134 134 */ 135 135 var $instance_name=''; 136 /** 137 * @var int $instance_owner Instance owner id 136 /** 137 * @var int $instance_owner Instance owner id 138 138 * @access public 139 139 */ 140 140 var $instance_owner=0; 141 /** 142 * @var string $owner_name Owner name 141 /** 142 * @var string $owner_name Owner name 143 143 * @access public 144 144 */ 145 145 var $owner_name=''; 146 146 147 147 /** 148 148 * @var bool $print_mode print mode … … 155 155 */ 156 156 var $enable_print_mode = false; 157 157 158 158 /** 159 159 * @var array $act_role_names of roles associated with the activity, usefull for lists of users associated with theses roles 160 * @access public 160 * @access public 161 161 */ 162 162 var $act_role_names= Array(); 163 163 164 164 /** 165 165 * @var array $agents Array of ui_agent objects … … 172 172 * @access public 173 173 */ 174 var $smarty; 174 var $smarty; 175 175 /** 176 176 * @var array $wf holds a global environment vector 177 177 * @access public 178 178 */ 179 var $wf; 179 var $wf; 180 180 /** 181 181 * @var $download_mode activates download mode 182 182 * @access public 183 183 */ 184 var $download_mode; 184 var $download_mode; 185 185 /** 186 186 * @var string $_template_name holds the template's file name 187 187 * @access public 188 188 */ 189 var $_template_name = null; 189 var $_template_name = null; 190 190 /** 191 191 * @var bool Indicates wether the current instance is a child instance or not … … 193 193 */ 194 194 var $isChildInstance = false; 195 195 196 /** 196 197 * @var object Stores a 'workflow_smarty' object … … 200 201 201 202 /** 203 * @var object Log Object 204 * @access private 205 */ 206 private $logger = null; 207 208 /** 202 209 * Constructor 203 * 204 * @access public 210 * 211 * @access public 205 212 */ 206 213 function run_activity() … … 218 225 219 226 $this->workflowSmarty = &Factory::getInstance('workflow_smarty', false); 227 228 // never configure a log of type "firebug" here. This will make goAjax stop running well =( 229 $this->logger = &Factory::getInstance('Logger', array('file')); 220 230 221 231 // TODO: open a new connection to the database under a different username to allow privilege handling on tables … … 236 246 function go($activity_id=0, $iid=0, $auto=0) 237 247 { 248 $totalTime = microtime(true); 249 238 250 $result=Array(); 239 251 … … 431 443 432 444 /* BEGIN WORKFLOW MVC SETTINGS */ 433 $env = array( );//create settings vector445 $env = array(); //create settings vector 434 446 $env['view'] =& $smarty; //view layer instance 435 447 $env['template_file'] =& $_template_name; //template file to be shown 436 $env['dao'] =& wf_create_object('wf_db');//data access object instance448 $env['dao'] =& Factory::newInstance('wf_db'); //data access object instance 437 449 $env['workflow'] =& $GLOBALS['workflow']; //workflow environment information 438 450 $env['instance'] =& $instance; //process manager instance … … 441 453 $env['request'] =& $security->process($_REQUEST); //sanitizes input data from client 442 454 $env['factory'] =& Factory::getInstance('ProcessWrapperFactory'); //instantiation controller class 443 $env['natural'] =& wf_create_object('wf_natural'); //data access object instance for mainframe455 $env['natural'] =& Factory::newInstance('wf_natural'); //data access object instance for mainframe 444 456 /* END WORKFLOW MVC SETTINGS */ 445 457 … … 485 497 486 498 /* include the files */ 499 $processTime = microtime(true); 500 487 501 foreach ($_engineFiles as $_engineFile) 488 502 require $_engineFile; 503 504 $processTime = (microtime(true) - $processTime); 489 505 490 506 unset($GLOBALS['workflow_env']); … … 528 544 } 529 545 546 $totalTime = (microtime(true) - $totalTime); 547 548 $logTime = sprintf("GO [pid=%s,iid=%s,uid=%s,aid=%s] [eng=%ss,proc=%ss]", 549 $this->process_id, 550 $this->instance_id, 551 $GLOBALS['user'], 552 $this->activity_id, 553 number_format(($totalTime - $processTime),3), 554 number_format($processTime,3) ); 555 556 $this->logger->debug($logTime); 557 530 558 // TODO: process instance comments 531 532 559 $instructions = $this->runtime->handle_postUserCode(_DEBUG); 533 560 switch($instructions['action']) … … 593 620 function goAjax($activity_id=0, $iid=0, $auto=0) 594 621 { 622 $totalTime = microtime(true); 623 595 624 $result=Array(); 596 625 … … 702 731 703 732 /* BEGIN WORKFLOW MVC SETTINGS */ 704 $env = array( );//create settings vector705 $env['dao'] =& wf_create_object('wf_db');//data access object instance733 $env = array(); //create settings vector 734 $env['dao'] =& Factory::newInstance('wf_db'); //data access object instance 706 735 $env['workflow'] =& $GLOBALS['workflow']; //workflow environment information 707 736 $env['instance'] =& $instance; //process manager instance … … 710 739 $env['request'] =& $security->process($_REQUEST); //sanitizes input data from client 711 740 $env['factory'] =& Factory::newInstance('ProcessWrapperFactory'); //instantiation controller class 712 $env['natural'] =& wf_create_object('wf_natural'); //data access object instance for mainframe741 $env['natural'] =& Factory::newInstance('wf_natural'); //data access object instance for mainframe 713 742 /* END WORKFLOW MVC SETTINGS */ 714 743 … … 727 756 * the messages for the process factory instead of Workflow 728 757 * factory. Note that this is the same comment as the previous 729 * function... boooring.. =}758 * function... boooring.. 730 759 */ 731 760 Security::enable(); … … 734 763 $nc = &Factory::newInstance('NanoController'); 735 764 $nc->setClassPath(GALAXIA_PROCESSES . SEP . $this->process->getNormalizedName(). SEP . 'code'); 765 766 $processTime = microtime(true); 736 767 $nc->iterateOverVirtualRequests(); 768 $processTime = microtime(true) - $processTime; 769 737 770 $nc->outputResultData(); 738 771 unset($GLOBALS['workflow_env']); … … 740 773 if (!is_null($iid)) 741 774 $instance->instance->sync(); 775 776 $totalTime = microtime(true) - $totalTime; 777 778 $logTime = sprintf("GOAJAX [pid=%s,iid=%s,uid=%s,aid=%s] [eng=%ss,proc=%ss]", 779 $this->process_id, 780 $this->instance_id, 781 $GLOBALS['user'], 782 $this->activity_id, 783 number_format(($totalTime - $processTime),3), 784 number_format($processTime,3) ); 785 786 $this->logger->debug($logTime); 742 787 } 743 788
Note: See TracChangeset
for help on using the changeset viewer.