function initializeGui(&$dbHandler, $argsObj, &$tplanMgr, &$tcaseMgr) { $tcase_cfg = config_get('testcase_cfg'); $title_separator = config_get('gui_title_separator_1'); $gui = new stdClass(); $gui->tproject_id = $argsObj->tproject_id; $gui->tplan_id = $argsObj->tplan_id; $gui->testCasePrefix = $tcaseMgr->tproject_mgr->getTestCasePrefix($argsObj->tproject_id); $gui->testCasePrefix .= $tcase_cfg->glue_character; $gui->can_remove_executed_testcases = $argsObj->user->hasRight($dbHandler, "testplan_unlink_executed_testcases", $argsObj->tproject_id); $gui->can_remove_executed_testcases = $gui->can_remove_executed_testcases == 'yes'; $tprojectInfo = $tcaseMgr->tproject_mgr->get_by_id($argsObj->tproject_id); $gui->priorityEnabled = $tprojectInfo['opt']->testPriorityEnabled; $gui->keywordsFilterType = $argsObj->keywordsFilterType; $gui->keywords_filter = ''; $gui->has_tc = 0; $gui->items = null; $gui->has_linked_items = false; $gui->keywordsFilterType = new stdClass(); $gui->keywordsFilterType->options = array('OR' => 'Or', 'AND' => 'And'); $gui->keywordsFilterType->selected = $argsObj->keywordsFilterType; // full_control, controls the operations planAddTC_m1.tpl will allow // 1 => add/remove // 0 => just remove $gui->full_control = 1; $tplan_info = $tplanMgr->get_by_id($argsObj->tplan_id); $gui->testPlanName = $tplan_info['name']; $gui->pageTitle = lang_get('test_plan') . $title_separator . $gui->testPlanName; $gui->refreshTree = $argsObj->refreshTree; $tproject_mgr = new testproject($dbHandler); $tproject_info = $tproject_mgr->get_by_id($argsObj->tproject_id); $userSet = $argsObj->user->getAll($dbHandler); $gui->testers = tlUser::getTestersForHtmlOptions($tplan_info, $tproject_info, $userSet); $gui->testerID = $argsObj->testerID; $gui->send_mail = $argsObj->send_mail; $gui->send_mail_checked = ''; if ($gui->send_mail) { $gui->send_mail_checked = ' checked="checked" '; } $platform_mgr = new tlPlatform($dbHandler, $argsObj->tproject_id); $gui->platforms = $platform_mgr->getLinkedToTestplan($argsObj->tplan_id); $gui->platformsForHtmlOptions = null; $gui->usePlatforms = $platform_mgr->platformsActiveForTestplan($argsObj->tplan_id); if ($gui->usePlatforms) { // Create options for two different select boxes. $bulk_platforms // has "All platforms" on top and "$platformsForHtmlOptions" has an // empty item $gui->platformsForHtmlOptions[0] = ''; foreach ($gui->platforms as $elem) { $gui->platformsForHtmlOptions[$elem['id']] = $elem['name']; } $gui->bulk_platforms = $platform_mgr->getLinkedToTestplanAsMap($argsObj->tplan_id); $gui->bulk_platforms[0] = lang_get("all_platforms"); ksort($gui->bulk_platforms); } // $gui->warning_msg = new stdClass(); $gui->warning_msg->executed = lang_get('executed_can_not_be_removed'); if ($gui->can_remove_executed_testcases) { $gui->warning_msg->executed = lang_get('has_been_executed'); } // BUGID 3406 $gui->build = init_build_selector($tplanMgr, $argsObj); return $gui; }
private function init_filter_assigned_user() { if (!$this->testproject_mgr) { $this->testproject_mgr = new testproject($this->db); } if (!$this->testplan_mgr) { $this->testplan_mgr = new testplan($this->db); } $key = 'filter_assigned_user'; $tplan_id = $this->settings['setting_testplan']['selected']; // set selection to default (any), only change if value is sent by user and reset is not requested $selection = $this->args->{$key}; if (!$selection || $this->args->reset_filters) { $selection = null; } else { $this->do_filtering = true; } $tproject_info = $this->testproject_mgr->get_by_id($this->args->testproject_id); $tplan_info = $this->testplan_mgr->get_by_id($tplan_id); $all_testers = tlUser::getTestersForHtmlOptions($this->db, $tplan_info, $tproject_info, null, array(TL_USER_ANYBODY => $this->option_strings['any'], TL_USER_NOBODY => $this->option_strings['none'], TL_USER_SOMEBODY => $this->option_strings['somebody']), 'any'); $visible_testers = $all_testers; // in execution mode the rights of the user have to be considered if ($this->mode == 'execution_mode') { $role = $this->user->getEffectiveRole($this->db, $this->args->testproject_id, $tplan_id); $simple_tester_roles = array_flip($this->cfg->exec_cfg->simple_tester_roles); $right_to_execute = $role->hasRight('testplan_execute'); $right_to_manage = $role->hasRight('testplan_planning'); $simple = isset($simple_tester_roles[$role->dbID]) || $right_to_execute && !$right_to_manage; $view_mode = $simple ? $this->cfg->exec_cfg->view_mode->tester : 'all'; if ($view_mode != 'all') { $visible_testers = (array) $this->user->getDisplayName(); $selection = (array) $this->user->dbID; } // re-enable option "user_filter_default" if (!$selection && $this->cfg->exec_cfg->user_filter_default == 'logged_user') { $selection = (array) $this->user->dbID; } } $unaKey = 'filter_assigned_user_include_unassigned'; $this->filters[$key] = array('items' => $visible_testers, 'selected' => $selection, $unaKey => $this->args->{$unaKey}); // which value shall be passed to tree generation class? if (is_array($selection) && in_array(TL_USER_ANYBODY, $selection) || $selection == TL_USER_ANYBODY) { // delete user assignment filter if "any user" is part of the selection $this->active_filters[$key] = null; $this->active_filters[$unaKey] = 0; } if (is_array($selection)) { // get keys of the array as values $this->active_filters[$key] = array_flip($selection); foreach ($this->active_filters[$key] as $user_key => $user_value) { $this->active_filters[$key][$user_key] = $user_key; } $this->active_filters[$unaKey] = $this->filters[$key][$unaKey]; } }