11<?php
22/**
3- * TestLink Open Source Project - http://testlink.sourceforge.net/
3+ * TestLink Open Source Project - http://testlink.sourceforge.net/
44 *
55 * @filesource execDashboard.php
6- *
6+ *
77 *
88**/
99require_once '../../config.inc.php ' ;
2121$ tree_mgr = new tree ($ db );
2222$ attachmentRepository = tlAttachmentRepository::create ($ db );
2323
24- list ($ args ,$ tplan_mgr ) = init_args ($ db, $ cfg );
24+ list ($ args ,$ tplan_mgr ) = init_args ($ db );
2525$ gui = initializeGui ($ db ,$ args ,$ cfg ,$ tplan_mgr );
2626
2727$ smarty ->assign ('gui ' ,$ gui );
2828$ smarty ->display ($ templateCfg ->template_dir . $ templateCfg ->default_template );
2929
3030
3131/*
32- function:
32+ function:
3333
3434 args:
3535
36- returns:
36+ returns:
3737*/
38- function init_args (&$ dbHandler, $ cfgObj ) {
38+ function init_args (&$ dbHandler ) {
3939
4040 $ args = new stdClass ();
4141 $ _REQUEST = strings_stripSlashes ($ _REQUEST );
4242 $ tplan_mgr = new testplan ($ dbHandler );
4343
4444
45- // Settings we put on session to create some sort of persistent scope,
45+ // Settings we put on session to create some sort of persistent scope,
4646 // because we have had issues when passing this info using GET mode (size limits)
4747 //
4848 // we get info about build_id, platform_id, etc ...
@@ -58,26 +58,26 @@ function init_args(&$dbHandler,$cfgObj) {
5858 if ($ args ->tproject_id <= 0 ) {
5959 $ tree_mgr = new tree ($ dbHandler );
6060 $ dm = $ tree_mgr ->get_node_hierarchy_info ($ args ->tplan_id );
61- $ args ->tproject_id = $ dm ['parent_id ' ];
61+ $ args ->tproject_id = $ dm ['parent_id ' ];
6262 }
6363
6464 if (is_null ($ args ->build_id ) || ($ args ->build_id == 0 ) ) {
6565 // Go for the build
6666 // this info can be present in session, then we will try different ways
67- // ATTENTION:
67+ // ATTENTION:
6868 // give a look to tlTestCaseFilterControl.class.php method init_setting_build()
6969 //
7070 $ key = $ args ->tplan_id . '_stored_setting_build ' ;
7171 $ args ->build_id = isset ($ _SESSION [$ key ]) ? intval ($ _SESSION [$ key ]) : null ;
7272 if ( is_null ($ args ->build_id ) ) {
7373 $ args ->build_id = $ tplan_mgr ->get_max_build_id ($ args ->tplan_id ,1 ,1 );
74- }
75- }
74+ }
75+ }
7676
7777 if (is_null ($ args ->platform_id ) || ($ args ->platform_id <= 0 ) ) {
7878 // Go for the platform (if any exists)
7979 // this info can be present in session, then we will try different ways
80- // ATTENTION:
80+ // ATTENTION:
8181 // give a look to tlTestCaseFilterControl.class.php method init_setting_platform()
8282 //
8383 $ itemSet = $ tplan_mgr ->getPlatforms ($ args ->tplan_id );
@@ -86,17 +86,17 @@ function init_args(&$dbHandler,$cfgObj) {
8686 $ args ->platform_id = isset ($ _SESSION [$ key ]) ? intval ($ _SESSION [$ key ]) : null ;
8787 if ( is_null ($ args ->platform_id ) || ($ args ->platform_id <= 0 ) ) {
8888 $ args ->platform_id = $ itemSet [0 ]['id ' ];
89- }
90- }
91- }
89+ }
90+ }
91+ }
9292 return array ($ args ,$ tplan_mgr );
9393}
9494
9595
9696
9797/*
98- function: initializeRights
99- create object with rights useful for this feature
98+ function: initializeRights
99+ create object with rights useful for this feature
100100
101101 args:
102102 dbHandler: reference to db object
@@ -108,12 +108,11 @@ function: initializeRights
108108 has_rights() can works in a mode (that i consider a dirty one)
109109 using SESSION to achieve global coupling.
110110
111- returns:
111+ returns:
112112
113113*/
114114function initializeRights (&$ dbHandler ,&$ userObj ,$ tproject_id ,$ tplan_id )
115115{
116- $ exec_cfg = config_get ('exec_cfg ' );
117116 $ grants = new stdClass ();
118117
119118 $ grants ->execute = $ userObj ->hasRight ($ dbHandler ,"testplan_execute " ,$ tproject_id ,$ tplan_id );
@@ -123,7 +122,7 @@ function initializeRights(&$dbHandler,&$userObj,$tproject_id,$tplan_id)
123122 // If is TRUE we will need also to analize, test case by test case
124123 // these settings:
125124 // $tlCfg->exec_cfg->exec_mode->tester
126- // $tlCfg->exec_cfg->simple_tester_roles
125+ // $tlCfg->exec_cfg->simple_tester_roles
127126 //
128127 // Why ?
129128 // Because if a tester can execute ONLY test cases assigned to him, this also
@@ -141,8 +140,7 @@ function initializeRights(&$dbHandler,&$userObj,$tproject_id,$tplan_id)
141140 // Important:
142141 // Execution right must be present to consider this configuration option.
143142 // $grants->edit_exec_notes = $grants->execute && $exec_cfg->edit_notes;
144- $ grants ->edit_exec_notes = $ grants ->execute &&
145- $ userObj ->hasRight ($ dbHandler ,"exec_edit_notes " ,$ tproject_id ,$ tplan_id );
143+ $ grants ->edit_exec_notes = $ grants ->execute && $ userObj ->hasRight ($ dbHandler ,"exec_edit_notes " ,$ tproject_id ,$ tplan_id );
146144
147145
148146 $ grants ->edit_testcase = $ userObj ->hasRight ($ dbHandler ,"mgt_modify_tc " ,$ tproject_id ,$ tplan_id );
@@ -156,7 +154,7 @@ function: initializeGui
156154
157155 args :
158156
159- returns:
157+ returns:
160158
161159*/
162160function initializeGui (&$ dbHandler ,&$ argsObj ,&$ cfgObj ,&$ tplanMgr ) {
@@ -182,10 +180,10 @@ function initializeGui(&$dbHandler,&$argsObj,&$cfgObj,&$tplanMgr) {
182180 $ cfgBuild = getWebEditorCfg ('build ' );
183181 $ gui ->buildEditorType = $ cfgBuild ['type ' ];
184182
185- // Just for the records:
183+ // Just for the records:
186184 // doing this here, we avoid to do on processTestSuite() and processTestCase(),
187185 // but absolutely this will not improve in ANY WAY perfomance, because we do not loop
188- // over these two functions.
186+ // over these two functions.
189187 $ tprojectMgr = new testproject ($ dbHandler );
190188 $ gui ->tcasePrefix = $ tprojectMgr ->getTestCasePrefix ($ argsObj ->tproject_id );
191189 $ build_info = $ buildMgr ->get_by_id ($ argsObj ->build_id );
@@ -198,8 +196,8 @@ function initializeGui(&$dbHandler,&$argsObj,&$cfgObj,&$tplanMgr) {
198196 $ gui ->testplan_notes = $ rs ['notes ' ];
199197 $ gui ->testplan_name = $ rs ['name ' ];
200198
201- // Important note:
202- // custom fields for test plan can be edited ONLY on design, that's reason why we are using
199+ // Important note:
200+ // custom fields for test plan can be edited ONLY on design, that's reason why we are using
203201 // scope = 'design' instead of 'execution'
204202 $ gui ->testplan_cfields = $ tplanMgr ->html_table_of_custom_field_values ($ argsObj ->tplan_id ,'design ' ,
205203 array ('show_on_execution ' => 1 ));
@@ -213,7 +211,7 @@ function initializeGui(&$dbHandler,&$argsObj,&$cfgObj,&$tplanMgr) {
213211
214212 $ gui ->platform_info ['id ' ]=0 ;
215213 $ gui ->platform_info ['name ' ]='' ;
216- if (!is_null ($ argsObj ->platform_id ) && $ argsObj ->platform_id > 0 ) {
214+ if (!is_null ($ argsObj ->platform_id ) && $ argsObj ->platform_id > 0 ) {
217215 $ gui ->platform_info = $ platformMgr ->getByID ($ argsObj ->platform_id );
218216 }
219217
@@ -233,41 +231,41 @@ function initializeGui(&$dbHandler,&$argsObj,&$cfgObj,&$tplanMgr) {
233231
234232
235233/**
236- * get info from ...
234+ * get info from ...
237235 *
238236 */
239237function getContextFromGlobalScope (&$ argsObj )
240238{
241- $ mode = 'execution_mode ' ;
239+ // $mode = 'execution_mode';
242240 $ settings = array ('build_id ' => 'setting_build ' , 'platform_id ' => 'setting_platform ' );
243241 $ isNumeric = array ('build_id ' => 0 , 'platform_id ' => 0 );
244242
245243 $ argsObj ->form_token = isset ($ _REQUEST ['form_token ' ]) ? $ _REQUEST ['form_token ' ] : 0 ;
246- $ sf = isset ($ _SESSION ['execution_mode ' ]) && isset ($ _SESSION ['execution_mode ' ][$ argsObj ->form_token ]) ?
244+ $ sf = isset ($ _SESSION ['execution_mode ' ]) && isset ($ _SESSION ['execution_mode ' ][$ argsObj ->form_token ]) ?
247245 $ _SESSION ['execution_mode ' ][$ argsObj ->form_token ] : null ;
248246
249247 if (is_null ($ sf ))
250248 {
251249 foreach ($ settings as $ key => $ sfKey )
252250 {
253251 $ argsObj ->$ key = null ;
254- }
252+ }
255253 return ;
256- }
254+ }
257255
258256 foreach ($ settings as $ key => $ sfKey )
259257 {
260258 $ argsObj ->$ key = isset ($ sf [$ sfKey ]) ? $ sf [$ sfKey ] : null ;
261- if (is_null ($ argsObj ->$ key ))
259+ if (is_null ($ argsObj ->$ key ))
262260 {
263- // let's this page be functional withouth a form token too
261+ // let's this page be functional withouth a form token too
264262 // (when called from testcases assigned to me)
265263 $ argsObj ->$ key = isset ($ _REQUEST [$ sfKey ]) ? $ _REQUEST [$ sfKey ] : null ;
266264 }
267265 if (isset ($ isNumeric [$ key ]))
268266 {
269- $ argsObj ->$ key = intval ($ argsObj ->$ key );
270- }
267+ $ argsObj ->$ key = intval ($ argsObj ->$ key );
268+ }
271269 }
272270
273271}
0 commit comments