/** * */ function initializeGui(&$dbHandler, $args) { $locale = isset($_SESSION['locale']) ? $_SESSION['locale'] : 'en_GB'; $localesDateFormat = config_get('locales_date_format'); $date_format = $localesDateFormat[$locale]; $gui = new stdClass(); $tplan_mgr = new testplan($dbHandler); $tproject_mgr = new testproject($dbHandler); $gui_open = config_get('gui_separator_open'); $gui_close = config_get('gui_separator_close'); $gui->str_option_any = $gui_open . lang_get('any') . $gui_close; $gui->str_option_none = $gui_open . lang_get('nobody') . $gui_close; $gui->tplan_id = $args->tplan_id; $gui->tproject_id = $args->tproject_id; $tplan_info = $tplan_mgr->get_by_id($gui->tplan_id); unset($tplan_mgr); $gui->tplan_name = $tplan_info['name']; $tproject_info = $tproject_mgr->get_by_id($gui->tproject_id); unset($tproject_mgr); $gui->tproject_name = $tproject_info['name']; $gui->users = new stdClass(); $gui->users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any)); $gui->users->qty = count($gui->users->items); $reports_cfg = config_get('reportsCfg'); $startDate = strftime($date_format, time() - $reports_cfg->start_date_offset); $gui->selected_start_date = $startDate; $gui->selected_start_time = $reports_cfg->start_time; $gui->selected_end_date = strftime($date_format, time()); $gui->selected_end_time = null; return $gui; }
function initializeGui(&$dbHandler, $args) { $gui = new stdClass(); $tplan_mgr = new testplan($dbHandler); $gui_open = config_get('gui_separator_open'); $gui_close = config_get('gui_separator_close'); $gui->str_option_any = $gui_open . lang_get('any') . $gui_close; $gui->str_option_none = $gui_open . lang_get('nobody') . $gui_close; $gui->tplan_id = $args->tplan_id; $gui->tproject_id = $args->tproject_id; $tplan_info = $tplan_mgr->get_by_id($gui->tplan_id); $gui->tplan_name = $tplan_info['name']; unset($tplan_info); $ni = $tplan_mgr->tree_manager->get_node_hierarchy_info($gui->tproject_id); $gui->tproject_name = $ni['name']; unset($ni); $gui->assigned_users = new stdClass(); $gui->keywords = new stdClass(); $gui->builds = new stdClass(); $gui->platforms = new stdClass(); $gui->testsuites = new stdClass(); // 20090107 - franciscom // Show only users that are able to execute test cases ? // What happens if a user that has loose right to execute, but // before loosing this right has been assigned some tests, or have executed it? // // $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, ADD_BLANK_OPTION); // $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, // array(TL_USER_ANYBODY => $gui->str_option_any, // TL_USER_NOBODY => $gui->str_option_none) ); // $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any)); $gui->builds->items = $tplan_mgr->get_builds($gui->tplan_id, testplan::ACTIVE_BUILDS); $gui->platforms->items = $tplan_mgr->getPlatforms($gui->tplan_id); $gui->testsuites->items = $tplan_mgr->getRootTestSuites($gui->tplan_id, $gui->tproject_id, array('output' => 'plain')); $gui->keywords->items[0] = $gui->str_option_any; if (!is_null($tplan_keywords_map = $tplan_mgr->get_keywords_map($gui->tplan_id))) { $gui->keywords->items += $tplan_keywords_map; } $key2loop = array('keywords', 'builds', 'platforms', 'testsuites', 'assigned_users'); foreach ($key2loop as $kx) { $gui->{$kx}->qty = count($gui->{$kx}->items); } $gui->status_code_label = get_status_for_reports_html_options(); $gui->report_type = $args->format; $reports_cfg = config_get('reportsCfg'); $ldf = config_get('locales_date_format'); $date_format = $ldf[isset($_SESSION['locale']) ? $_SESSION['locale'] : 'en_GB']; $gui->selected_start_date = strftime($date_format, time() - $reports_cfg->start_date_offset); $gui->selected_start_time = $reports_cfg->start_time; $gui->selected_end_date = strftime($date_format, time()); $gui->selected_end_time = null; return $gui; }
function initializeGui(&$dbHandler, $args) { $gui = new stdClass(); $tplan_mgr = new testplan($dbHandler); $tproject_mgr = new testproject($dbHandler); $gui_open = config_get('gui_separator_open'); $gui_close = config_get('gui_separator_close'); $gui->str_option_any = $gui_open . lang_get('any') . $gui_close; $gui->str_option_none = $gui_open . lang_get('nobody') . $gui_close; $gui->tplan_id = $args->tplan_id; $gui->tproject_id = $args->tproject_id; $tplan_info = $tplan_mgr->get_by_id($gui->tplan_id); $gui->tplan_name = $tplan_info['name']; $tproject_info = $tproject_mgr->get_by_id($gui->tproject_id); $gui->tproject_name = $tproject_info['name']; $re = new results($dbHandler, $tplan_mgr, $tproject_info, $tplan_info); $gui->assigned_users = new stdClass(); $gui->keywords = new stdClass(); $gui->builds = new stdClass(); $gui->testsuites = new stdClass(); // 20090107 - franciscom // Show only users that are able to execute test cases ? // What happens if a user that has loose right to execute, but // before loosing this right has been assigned some tests, or have executed it? // // $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, ADD_BLANK_OPTION); // $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, // array(TL_USER_ANYBODY => $gui->str_option_any, // TL_USER_NOBODY => $gui->str_option_none) ); // $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any)); $gui->assigned_users->qty = count($gui->assigned_users->items); // BUGID 2012 - franciscom $gui->keywords->items[0] = $gui->str_option_any; if (!is_null($tplan_keywords_map = $tplan_mgr->get_keywords_map($gui->tplan_id))) { $gui->keywords->items += $tplan_keywords_map; } $gui->builds->items = $tplan_mgr->get_builds($gui->tplan_id, testplan::ACTIVE_BUILDS); $gui->testsuites->items = $re->getTopLevelSuites(); $gui->keywords->qty = count($gui->keywords->items); $gui->builds->qty = count($gui->builds->items); $gui->testsuites->qty = count($gui->testsuites->items); $gui->status_code_label = get_status_for_reports_html_options(); $gui->report_type = $args->format; $reports_cfg = config_get('reportsCfg'); $startDate = time() - $reports_cfg->start_date_offset; $gui->selected_start_date = $startDate; $gui->selected_start_time = $reports_cfg->start_time; $gui->selected_end_date = null; $gui->selected_end_time = null; return $gui; }
function init_args(&$dbHandler) { $_REQUEST = strings_stripSlashes($_REQUEST); $args = new stdClass(); $args->target_date = null; $args->start_date = null; // Important!!! // name of these variables is generated by smarty (See html_select_date in Smarty Manual) $date_vars = array('target_date_Year', 'target_date_Month', 'target_date_Day'); $start_date_vars = array('start_date_Year', 'start_date_Month', 'start_date_Day'); $create_date = true; $create_start_date = true; foreach ($date_vars as $my) { ${$my} = isset($_REQUEST[$my]) ? $_REQUEST[$my] : null; $create_date = $create_date && !is_null(${$my}) && trim(${$my}) != ''; } if ($create_date) { $args->target_date = $target_date_Year . "-" . $target_date_Month . "-" . $target_date_Day; } foreach ($start_date_vars as $my) { ${$my} = isset($_REQUEST[$my]) ? $_REQUEST[$my] : null; $create_start_date = $create_start_date && !is_null(${$my}) && trim(${$my}) != ''; } if ($create_start_date) { $args->start_date = $start_date_Year . "-" . $start_date_Month . "-" . $start_date_Day; } $key2loop = array('low_priority_tcases', 'medium_priority_tcases', 'high_priority_tcases'); foreach ($key2loop as $key) { $args->{$key} = isset($_REQUEST[$key]) ? intval($_REQUEST[$key]) : 0; } $args->id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0; $args->name = isset($_REQUEST['milestone_name']) ? $_REQUEST['milestone_name'] : null; $args->doAction = isset($_REQUEST['doAction']) ? $_REQUEST['doAction'] : null; $args->basehref = $_SESSION['basehref']; $args->tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0; $args->tproject_name = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : ""; $args->tplan_name = ''; $args->tplan_id = isset($_REQUEST['tplan_id']) ? $_REQUEST['tplan_id'] : 0; if ($args->tplan_id == 0) { $args->tplan_id = isset($_SESSION['testplanID']) ? $_SESSION['testplanID'] : 0; } if ($args->tplan_id > 0) { $tplan_mgr = new testplan($dbHandler); $info = $tplan_mgr->get_by_id($args->tplan_id); $args->tplan_name = $info['name']; } return $args; }
function init_args(&$dbHandler, $dateFormat) { $_REQUEST = strings_stripSlashes($_REQUEST); $args = new stdClass(); $args->target_date_original = isset($_REQUEST['target_date']) ? $_REQUEST['target_date'] : null; $args->start_date_original = isset($_REQUEST['start_date']) ? $_REQUEST['start_date'] : null; // convert target date to iso format to write to db if (isset($_REQUEST['target_date']) && $_REQUEST['target_date'] != '') { $date_array = split_localized_date($_REQUEST['target_date'], $dateFormat); if ($date_array != null) { // set date in iso format $args->target_date = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day']; } } // convert start date to iso format to write to db if (isset($_REQUEST['start_date']) && $_REQUEST['start_date'] != '') { $date_array = split_localized_date($_REQUEST['start_date'], $dateFormat); if ($date_array != null) { // set date in iso format $args->start_date = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day']; } } $key2loop = array('low_priority_tcases', 'medium_priority_tcases', 'high_priority_tcases'); foreach ($key2loop as $key) { $args->{$key} = isset($_REQUEST[$key]) ? intval($_REQUEST[$key]) : 0; } $args->id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $args->name = isset($_REQUEST['milestone_name']) ? $_REQUEST['milestone_name'] : null; $args->doAction = isset($_REQUEST['doAction']) ? $_REQUEST['doAction'] : null; $args->basehref = $_SESSION['basehref']; $args->tproject_id = isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0; $args->tproject_name = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : ""; $args->tplan_name = ''; $args->tplan_id = isset($_REQUEST['tplan_id']) ? intval($_REQUEST['tplan_id']) : 0; if ($args->tplan_id == 0) { $args->tplan_id = isset($_SESSION['testplanID']) ? intval($_SESSION['testplanID']) : 0; } if ($args->tplan_id > 0) { $tplan_mgr = new testplan($dbHandler); $info = $tplan_mgr->get_by_id($args->tplan_id); $args->tplan_name = $info['name']; } return $args; }
function initializeGui(&$dbHandler, &$argsObj, &$userObj, &$tprojectMgr) { $tcaseCfg = config_get('testcase_cfg'); $guiObj = new stdClass(); $guiObj->can_manage_testplans = $userObj->hasRight($dbHandler, "mgt_testplan_create", $argsObj->tproject_id, $argsObj->tplan_id); $guiObj->show_details = 0; $guiObj->user_feedback = ''; $guiObj->tcasePrefix = $tprojectMgr->getTestCasePrefix($argsObj->tproject_id) . $tcaseCfg->glue_character; $guiObj->tproject_name = $argsObj->tproject_name; $tplanMgr = new testplan($dbHandler); $tplan_info = $tplanMgr->get_by_id($argsObj->tplan_id); $guiObj->tplan_name = $tplan_info['name']; $guiObj->tplan_id = $argsObj->tplan_id; $guiObj->tproject_id = $argsObj->tproject_id; $guiObj->testcases = $tplanMgr->get_linked_and_newest_tcversions($argsObj->tplan_id); $linked_tcases = $tplanMgr->get_linked_items_id($argsObj->tplan_id); $guiObj->doIt = count($linked_tcases) > 0; $guiObj->tplans = array(); $tplans = $userObj->getAccessibleTestPlans($dbHandler, $argsObj->tproject_id); foreach ($tplans as $key => $value) { $guiObj->tplans[$value['id']] = $value['name']; } return $guiObj; }
function init_args(&$dbHandler, &$treeMgr) { $iParams = array("format" => array(tlInputParameter::INT_N), "tproject_id" => array(tlInputParameter::INT_N), "tplan_id" => array(tlInputParameter::INT_N), "type" => array(tlInputParameter::STRING_N, 0, 1)); $argsObj = new stdClass(); R_PARAMS($iParams, $argsObj); $argsObj->doIt = false; $argsObj->showPlatforms = false; $argsObj->tproject_name = ''; if ($argsObj->tproject_id > 0) { $dummy = $treeMgr->get_node_hierarchy_info($argsObj->tproject_id); $argsObj->tproject_name = $dummy['name']; } $argsObj->tplan_name = ''; if ($argsObj->tplan_id > 0) { $tplan_mgr = new testplan($dbHandler); $tplan_info = $tplan_mgr->get_by_id($argsObj->tplan_id); $argsObj->tplan_name = $tplan_info['name']; $argsObj->doIt = $tplan_mgr->count_testcases($argsObj->tplan_id) > 0; $argsObj->showPlatforms = $tplan_mgr->hasLinkedPlatforms($argsObj->tplan_id); $getOpt = array('outputFormat' => 'map'); $argsObj->platforms = $tplan_mgr->getPlatforms($argsObj->tplan_id, $getOpt); unset($tplan_mgr); } return $argsObj; }
/** * * */ private function init_setting_testplan() { if (is_null($this->testplan_mgr)) { $this->testplan_mgr = new testplan($this->db); } $key = 'setting_testplan'; $testplans = $this->user->getAccessibleTestPlans($this->db, $this->args->testproject_id); if (isset($_SESSION['testplanID']) && $_SESSION['testplanID'] != $this->args->{$key}) { // testplan was changed, we need to reset all filters // --> they were chosen for another testplan, not this one! $this->args->reset_filters = true; // check if user is allowed to set chosen testplan before changing foreach ($testplans as $plan) { if ($plan['id'] == $this->args->{$key}) { setSessionTestPlan($plan); } } } // now load info from session $info = $this->testplan_mgr->get_by_id($_SESSION['testplanID']); $this->args->testplan_name = $info['name']; $this->args->testplan_id = $info['id']; $this->args->{$key} = $info['id']; $this->settings[$key]['selected'] = $info['id']; // Final filtering based on mode: // Now get all selectable testplans for the user to display. // For execution: // For assign test case execution feature: // don't take testplans into selection which have no (active/open) builds! // // For plan add mode: // add every plan no matter if he has builds or not. foreach ($testplans as $plan) { $add_plan = $this->mode == 'plan_add_mode' || $this->mode == 'plan_mode' && $this->args->feature != 'tc_exec_assignment'; if (!$add_plan) { $builds = $this->testplan_mgr->get_builds($plan['id'], testplan::GET_ACTIVE_BUILD, testplan::GET_OPEN_BUILD); $add_plan = is_array($builds) && count($builds); } if ($add_plan) { $this->settings[$key]['items'][$plan['id']] = $plan['name']; } } }
* 20100716 - eloff - BUGID 3562: include bug tracking if activated * 20100221 - franciscom - fixed call to getPlatforms() */ require_once '../../config.inc.php'; require_once 'common.php'; if (config_get('interface_bugs') != 'NO') { require_once TL_ABS_PATH . 'lib' . DIRECTORY_SEPARATOR . 'bugtracking' . DIRECTORY_SEPARATOR . 'int_bugtracking.php'; } testlinkInitPage($db); $templateCfg = templateConfiguration(); $gui = new stdClass(); $tplan_mgr = new testplan($db); $tproject_mgr = new testproject($db); $gui->tplan_id = intval($_REQUEST['tplan_id']); $gui->tproject_id = intval($_REQUEST['tproject_id']); $tplan_info = $tplan_mgr->get_by_id($gui->tplan_id); $tproject_info = $tproject_mgr->get_by_id($gui->tproject_id); // ?? // $tplan_mgr->getStatusTotalsByPlatform($gui->tplan_id); $gui->can_use_charts = checkLibGd(); $totals = $tplan_mgr->getStatusTotals($gui->tplan_id); if ($gui->can_use_charts == 'OK') { $gui->tplan_name = $tplan_info['name']; $gui->tproject_name = $tproject_info['name']; $resultsCfg = config_get('results'); // Save in session to improve perfomance. // This data will be used in different *chart.php to generate on the fly image unset($_SESSION['statistics']); $re = new results($db, $tplan_mgr, $tproject_info, $tplan_info, ALL_TEST_SUITES, ALL_BUILDS, ALL_PLATFORMS); $_SESSION['statistics']['getTopLevelSuites'] = $re->getTopLevelSuites(); $_SESSION['statistics']['getAggregateMap'] = $re->getAggregateMap();
function init_args(&$dbHandler) { $argsObj = new stdClass(); $argsObj->doIt = false; $argsObj->showPlatforms = false; $argsObj->tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0; $argsObj->tproject_name = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : ''; $argsObj->tplan_name = ''; $argsObj->tplan_id = isset($_REQUEST['tplan_id']) ? $_REQUEST['tplan_id'] : 0; if ($argsObj->tplan_id == 0) { $argsObj->tplan_id = isset($_SESSION['testplanID']) ? $_SESSION['testplanID'] : 0; } if ($argsObj->tplan_id > 0) { $tplan_mgr = new testplan($dbHandler); $tplan_info = $tplan_mgr->get_by_id($argsObj->tplan_id); $argsObj->tplan_name = $tplan_info['name']; $argsObj->doIt = $tplan_mgr->count_testcases($argsObj->tplan_id) > 0; $argsObj->showPlatforms = $tplan_mgr->hasLinkedPlatforms($argsObj->tplan_id); unset($tplan_mgr); } return $argsObj; }
/** * get user input and create an object with properties representing this inputs. * @return stdClass object */ function init_args(&$dbHandler) { $args = new stdClass(); $iParams = array("tplan_id" => array(tlInputParameter::INT_N), "format" => array(tlInputParameter::INT_N, 999), "type" => array(tlInputParameter::STRING_N, 0, 100), "activity" => array(tlInputParameter::STRING_N, 1, 10)); $l18n = array(); $l18n['addTC'] = lang_get('navigator_add_remove_tcase_to_tplan'); $l18n['test_plan'] = lang_get('test_plan'); R_PARAMS($iParams, $args); $args->tproject_id = intval(isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0); $args->tproject_name = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : ''; $args->basehref = $_SESSION['basehref']; $args->testprojectOptReqs = $_SESSION['testprojectOptions']->requirementsEnabled; $args->format = is_null($args->format) ? FORMAT_HTML : $args->format; $args->type = is_null($args->type) ? DOC_TEST_PLAN_DESIGN : $args->type; $args->doc_type = $args->type; // Changes to call this page also in add/remove test cases feature $args->showOptions = true; $args->showHelpIcon = true; $args->tplan_info = null; $args->mainTitle = ''; if (($args->tplan_id = intval($args->tplan_id)) <= 0 || $args->activity != '') { $args->showOptions = false; $args->showHelpIcon = false; $args->tplan_id = intval(isset($_SESSION['testplanID']) ? intval($_SESSION['testplanID']) : 0); if ($args->tplan_id > 0) { $tplan_mgr = new testplan($dbHandler); $args->tplan_info = $tplan_mgr->get_by_id($args->tplan_id); $args->mainTitle = $l18n['test_plan'] . ': ' . $args->tplan_info['name']; } } return $args; }
<?php //@TODO this file seems not to be in use include "../../third_party/charts/charts.php"; require_once '../functions/results.class.php'; require_once '../functions/testplan.class.php'; testlinkInitPage($db); $tplan_mgr = new testplan($db); $tproject_mgr = new testproject($db); $tplan_id = $_REQUEST['tplan_id']; $tproject_id = $_SESSION['testprojectID']; $tplan_info = $tplan_mgr->get_by_id($tplan_id); $tproject_info = $tproject_mgr->get_by_id($tproject_id); $re = new results($db, $tplan_mgr, $tproject_info, $tplan_info, ALL_TEST_SUITES, ALL_BUILDS); /** * KEYWORDS REPORT */ $arrDataKeys = $re->getAggregateKeywordResults(); $i = 0; $arrDataKeys2 = null; if ($arrDataKeys != null) { while ($keywordId = key($arrDataKeys)) { $arr = $arrDataKeys[$keywordId]; $arrDataKeys2[$i] = $arr; $i++; next($arrDataKeys); } } $namesOfKeywordsArray = array(); $namesOfKeywordsArray[0] = ""; $passArray = array();
/** * * */ function launch_inner_exec(&$dbHandler, &$tplMgr) { $itemCode = array('exec' => 'lib/execute/execNavigator.php'); $op = array('status_ok' => true, 'msg' => ''); // First check for keys in _GET that MUST EXIST // key: key on _GET, value: labelID defined on strings.txt $mandatoryKeys = array('item' => 'item_not_set', 'build_id' => 'build_id_not_set'); foreach ($mandatoryKeys as $key => $labelID) { $op['status_ok'] = isset($_GET[$key]); if (!$op['status_ok']) { $op['msg'] = lang_get($labelID); break; } } if ($op['status_ok']) { $op['status_ok'] = isset($_GET['feature_id']); if (!$op['status_ok']) { $keySet = array('tplan_id' => 'testplan_not_set', 'tcversion_id' => 'tcversion_id', 'platform_id' => 'platform_id_not_set'); foreach ($keySet as $key => $labelID) { $op['status_ok'] = isset($_GET[$key]); if (!$op['status_ok']) { $op['msg'] = lang_get($labelID); break; } } } } $args = init_args($dbHandler); if ($op['status_ok']) { // Set Environment $tplan_mgr = new testplan($dbHandler); $info = $tplan_mgr->get_by_id($args->tplan_id, array('output' => 'minimun')); if (is_null($info)) { die('ltx - tplan info does not exist'); } $tproject_mgr = new testproject($dbHandler); $tproject_mgr->setSessionProject($info['tproject_id']); $op['status_ok'] = true; } if ($op['status_ok']) { // Build name of function to call for doing the job. $pfn = 'process_' . $args->item; $ctx = array(); $ctx['setting_testplan'] = $args->tplan_id; $ctx['setting_build'] = $args->build_id; $ctx['setting_platform'] = $args->platform_id; $ctx['tcversion_id'] = $args->tcversion_id; $ctx['tcase_id'] = 0; $ctx['user_id'] = $args->user_id; $jump_to = $pfn($dbHandler, $ctx); $op['status_ok'] = !is_null($jump_to['url']); $op['msg'] = $jump_to['msg']; } if ($op['status_ok']) { $treeframe = $itemCode[$args->item] . '?loadExecDashboard=0' . '&setting_testplan=' . $args->tplan_id . '&setting_build=' . $args->build_id . '&setting_platform=' . $args->platform_id; $tplMgr->assign('title', lang_get('main_page_title')); $tplMgr->assign('treewidth', TL_FRMWORKAREA_LEFT_FRAME_WIDTH); $tplMgr->assign('workframe', $jump_to['url']); $tplMgr->assign('treeframe', $treeframe); $tplMgr->display('frmInner.tpl'); } else { echo $op['msg']; ob_end_flush(); exit; } }
tLog('Active Builds count = ' . $build_count); if ($build_count == 0) { // Test plan without builds can have execution data $gui->do_report['status_ok'] = 0; $gui->do_report['msg'] = lang_get('report_tplan_has_no_build'); } // ----------------------------------------------------------------------------- // get navigation data $gui->menuItems = array(); if ($gui->do_report['status_ok']) { // create a list or reports $context = new stdClass(); $context->tproject_id = $args->tproject_id; $context->tplan_id = $args->tplan_id; $tplan_mgr = new testplan($db); $dmy = $tplan_mgr->get_by_id($context->tplan_id); $gui->buildInfoSet = $tplan_mgr->get_builds($gui->tplan_id); $report_plans = $tplan_mgr->report_get_plans($args->tproject_id); $report_suites = $tplan_mgr->report_get_suites($args->tproject_id); $report_builds = $tplan_mgr->report_get_builds(); $report_build_total = count($report_builds); $report_devices = $tplan_mgr->report_get_devices($args->tproject_id); $report_device_total = count($report_devices); unset($tplan_mgr); $context->apikey = $dmy['api_key']; // $context->apikey = $_SESSION['currentUser']->userApiKey; $context->imgSet = $smarty->getImages(); $gui->menuItems = $reports_mgr->get_list_reports($context, $gui->btsEnabled, $args->optReqs, $tlCfg->reports_formats[$args->format]); } $smarty->assign('gui', $gui); $smarty->assign('report_plans', $report_plans);
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]; } }
<?php require '../../config.inc.php'; require_once 'common.php'; require '../../third_party/PHPExcel/PHPExcel.php'; $args = init_args($db); $tplan_mgr = new testplan($db); $allsuite = $tplan_mgr->get_all_suites(); $platformSet = $tplan_mgr->getPlatforms($args->tplan_id, array('outputFormat' => 'map')); $testplan = $tplan_mgr->get_by_id($args->tplan_id); if ($args->build_id == 1) { $testbuild = array('name' => '任意版本', 'notes' => ''); } else { $testbuild = $tplan_mgr->get_build_by_id($args->tplan_id, $args->build_id); } if ($args->device_id == '1') { $alldevice = $platformSet; foreach ($alldevice as $device_id => $device_name) { $results[$device_id] = $tplan_mgr->get_exec_device_group_by_suite($args->tplan_id, $args->build_id, $device_id, $args->stack); } } else { $alldevice = array($args->device_id => $platformSet[$args->device_id]); $results[$args->device_id] = $tplan_mgr->get_exec_device_group_by_suite($args->tplan_id, $args->build_id, $args->device_id, $args->stack); } ob_clean(); $objPHPExcel = new PHPExcel(); $objPHPExcel->getProperties()->setCreator('DCN TestLink')->setLastModifiedBy('DCN TestLink')->setTitle('DCN Test Report'); $objPHPExcel->getDefaultStyle()->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER); $objPHPExcel->getDefaultStyle()->getAlignment()->setWrapText(TRUE); $allindex = 0; $deviceindex = 0; foreach ($alldevice as $deviceid => $devicename) {
* * */ require '../../config.inc.php'; require_once "common.php"; testlinkInitPage($db); $templateCfg = templateConfiguration(); $tplan_mgr = new testplan($db); $build_mgr = new build_mgr($db); $gui = new StdClass(); $gui->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0; $gui->tplan_name = ' '; $gui->tplan_id = isset($_REQUEST['tplan_id']) ? intval($_REQUEST['tplan_id']) : 0; checkRights($db, $_SESSION['currentUser'], $gui); if ($gui->tplan_id > 0) { $dummy = $tplan_mgr->get_by_id($gui->tplan_id); $gui->tplan_name = $dummy['name']; } $gui->manageURL = "lib/plan/buildEdit.php?tproject_id={$gui->tproject_id}&tplan_id={$gui->tplan_id}"; $gui->editAction = $gui->manageURL . "&do_action=edit&build_id="; $gui->deleteAction = $gui->manageURL . "&do_action=do_delete&build_id="; $gui->createAction = $gui->manageURL . "&do_action=create"; $gui->buildSet = $tplan_mgr->get_builds($gui->tplan_id); $gui->user_feedback = null; $smarty = new TLSmarty(); $smarty->assign('gui', $gui); $smarty->display($templateCfg->template_dir . $templateCfg->default_template); /** * checkRights * */
/** * validate that some build exists (for Test Plan related features). * If no valid build is found give feedback to user and exit. * * @author Martin Havlat **/ function validateBuildAvailability(&$db, $tplanID, $tprojectID, $open) { $tplanMrg = new testplan($db); if (!$tplanMrg->getNumberOfBuilds($tplanID, $open, $open)) { $info = $tplanMrg->get_by_id($tplanID); $gui = new stdClass(); $gui->link_to_op = "login.php"; $gui->content = '<p>' . lang_get('no_build_warning_part1') . "<b> " . htmlspecialchars($info['name']) . "</b>"; $gui->link_to_op = ''; $gui->hint_text = ''; if ($_SESSION['currentUser']->hasRight($db, "testplan_create_build", $tprojectID, $tplanID) == 'yes') { // final url will be composed adding to $basehref // (one TL variable available on smarty templates) to $link_to_op $gui->link_to_op = "lib/plan/buildEdit.php?tproject_id={$tprojectID}&tplan_id={$tplanID}&do_action=create"; $gui->hint_text = lang_get('create_a_build'); } else { $gui->content .= '</p><p>' . lang_get('no_build_warning_part2') . '</p>'; } // show info and exit $smarty = new TLSmarty(); $smarty->assign('gui', $gui); $smarty->display('workAreaSimple.tpl'); exit; } }
function saveImportedResultData(&$db, $resultData, $context) { if (!$resultData) { return; } $debugMsg = ' FUNCTION: ' . __FUNCTION__; $tables = tlObjectWithDB::getDBTables(array('executions', 'execution_bugs')); $l18n = array('import_results_tc_not_found' => '', 'import_results_invalid_result' => '', 'tproject_id_not_found' => '', 'import_results_ok' => ''); foreach ($l18n as $key => $value) { $l18n[$key] = lang_get($key); } // Get Column definitions to get size dinamically instead of create constants $columnDef = array(); $adodbObj = $db->get_dbmgr_object(); $columnDef['execution_bugs'] = $adodbObj->MetaColumns($tables['execution_bugs']); $keySet = array_keys($columnDef['execution_bugs']); foreach ($keySet as $keyName) { if (($keylow = strtolower($keyName)) != $keyName) { $columnDef['execution_bugs'][$keylow] = $columnDef['execution_bugs'][$keyName]; unset($columnDef['execution_bugs'][$keyName]); } } $user = new tlUser($context->userID); $user->readFromDB($db); $tcase_mgr = new testcase($db); $resulstCfg = config_get('results'); $tcaseCfg = config_get('testcase_cfg'); $resultMap = array(); $tplan_mgr = null; $tc_qty = sizeof($resultData); if ($tc_qty) { $tplan_mgr = new testplan($db); $tproject_mgr = new testproject($db); $build_mgr = new build_mgr($db); } // Need to do checks on common settings // // test project exists // // test plan id: // belongs to target test project // is active // build id: // belongs to target test plan // is open // // platform id: // is linked to target test plan // // execution type if not present -> set to MANUAL // if presente is valid i.e. inside the TL domain // $checks = array(); $checks['status_ok'] = true; $checks['msg'] = null; $dummy = null; if (!is_null($context->tprojectID) && intval($context->tprojectID) > 0) { $dummy = array($tproject_mgr->get_by_id($context->tprojectID, array('output' => 'existsByID'))); } else { if (!is_null($context->tprojectName)) { $dummy = $tproject_mgr->get_by_name($context->tprojectName, null, array('output' => 'existsByName')); } } $checks['status_ok'] = !is_null($dummy); if (!$checks['status_ok']) { $checks['msg'][] = sprintf($l18n['tproject_id_not_found'], $context->tprojectID); } if (!$checks['status_ok']) { foreach ($checks['msg'] as $warning) { $resultMap[] = array($warning); } } if ($doIt = $checks['status_ok']) { $context->tprojectID = $dummy[0]['id']; } // -------------------------------------------------------------------- $dummy = null; if (!is_null($context->tplanID) && intval($context->tplanID) > 0) { $dummy = $tplan_mgr->get_by_id($context->tplanID, array('output' => 'minimun')); if (!is_null($dummy)) { $dummy['id'] = $context->tplanID; } } else { if (!is_null($context->tplanName)) { $dummy = $tplan_mgr->get_by_name($context->tplanName, $context->tprojectID, array('output' => 'minimun')); if (!is_null($dummy)) { $dummy = $dummy[0]; } } } if (!is_null($dummy)) { $context->tplanID = $dummy['id']; } if (intval($context->tprojectID) <= 0 && intval($context->tplanID) > 0) { $dummy = $tplan_mgr->tree_manager->get_node_hierarchy_info($context->tplanID); $context->tprojectID = $dummy['parent_id']; } // -------------------------------------------------------------------- // -------------------------------------------------------------------- $dummy = null; $tplan_mgr->platform_mgr->setTestProjectID($context->tprojectID); if (!is_null($context->platformID) && intval($context->platformID) > 0) { $dummy = array($tplan_mgr->platform_mgr->getByID($context->platformID)); } else { if (property_exists($context, 'platformName') && !is_null($context->platformName)) { if (!is_null($xx = $tplan_mgr->platform_mgr->getID($context->platformName))) { $dummy = array(0 => array('id' => $xx)); } } } if (!is_null($dummy)) { $context->platformID = $dummy[0]['id']; } // -------------------------------------------------------------------- // -------------------------------------------------------------------- $optGB = array('tplan_id' => $context->tplanID, 'output' => 'minimun'); $dummy = null; if (!is_null($context->buildID) && intval($context->buildID) > 0) { $dummy = array($build_mgr->get_by_id($context->buildID, $optGB)); } else { if (!is_null($context->buildName)) { $dummy = $build_mgr->get_by_name($context->buildName, $optGB); } } if (!is_null($dummy)) { $context->buildID = $dummy[0]['id']; } // -------------------------------------------------------------------- // -------------------------------------------------------------------- for ($idx = 0; $doIt && $idx < $tc_qty; $idx++) { $tester_id = 0; $tester_name = ''; $using_external_id = false; $message = null; $status_ok = true; $tcase_exec = $resultData[$idx]; // New attribute "execution type" makes old XML import files incompatible // Important NOTICE: // tcase_exec is passed BY REFERENCE to allow check_exec_values()change execution type if needed // $checks = check_exec_values($db, $tcase_mgr, $user_mgr, $tcaseCfg, $tcase_exec, $columnDef['execution_bugs']); $status_ok = $checks['status_ok']; if ($status_ok) { $tcase_id = $checks['tcase_id']; $tcase_external_id = trim($tcase_exec['tcase_external_id']); $tester_id = $checks['tester_id']; // external_id has precedence over internal id $using_external_id = $tcase_external_id != ""; } else { foreach ($checks['msg'] as $warning) { $resultMap[] = array($warning); } } if ($status_ok) { $tcase_identity = $using_external_id ? $tcase_external_id : $tcase_id; $result_code = strtolower($tcase_exec['result']); $result_is_acceptable = isset($resulstCfg['code_status'][$result_code]) ? true : false; $notes = $tcase_exec['notes']; $message = null; $info_on_case = $tplan_mgr->getLinkInfo($context->tplanID, $tcase_id, $context->platformID); if (is_null($info_on_case)) { $message = sprintf($l18n['import_results_tc_not_found'], $tcase_identity); } else { if (!$result_is_acceptable) { $message = sprintf($l18n['import_results_invalid_result'], $tcase_identity, $tcase_exec['result']); } else { $info_on_case = current($info_on_case); $tcversion_id = $info_on_case['tcversion_id']; $version = $info_on_case['version']; $notes = $db->prepare_string(trim($notes)); // N.B.: db_now() returns an string ready to be used in an SQL insert // example '2008-09-04', while $tcase_exec["timestamp"] => 2008-09-04 // $execution_ts = $tcase_exec['timestamp'] != '' ? "'" . $tcase_exec["timestamp"] . "'" : $db->db_now(); if ($tester_id != 0) { $tester_name = $tcase_exec['tester']; } else { $tester_name = $user->login; $tester_id = $context->userID; } $addExecDuration = strlen($tcase_exec['execution_duration']) > 0 && is_numeric($tcase_exec['execution_duration']); $sql = " /* {$debugMsg} */ " . " INSERT INTO {$tables['executions']} (build_id,tester_id,status,testplan_id," . " tcversion_id,execution_ts,notes,tcversion_number,platform_id,execution_type" . ($addExecDuration ? ',execution_duration' : '') . ")" . " VALUES ({$context->buildID}, {$tester_id},'{$result_code}',{$context->tplanID}, " . " {$tcversion_id},{$execution_ts},'{$notes}', {$version}, " . " {$context->platformID}, {$tcase_exec['execution_type']}" . ($addExecDuration ? ",{$tcase_exec['execution_duration']}" : '') . ")"; $db->exec_query($sql); if (isset($tcase_exec['bug_id']) && !is_null($tcase_exec['bug_id']) && is_array($tcase_exec['bug_id'])) { $execution_id = $db->insert_id($tables['executions']); foreach ($tcase_exec['bug_id'] as $bug_id) { $bug_id = trim($bug_id); $sql = " /* {$debugMsg} */ " . " SELECT execution_id AS check_qty FROM {$tables['execution_bugs']} " . " WHERE bug_id = '{$bug_id}' AND execution_id={$execution_id} "; $rs = $db->get_recordset($sql); if (is_null($rs)) { $sql = " /* {$debugMsg} */ " . " INSERT INTO {$tables['execution_bugs']} (bug_id,execution_id)" . " VALUES ('" . $db->prepare_string($bug_id) . "', {$execution_id} )"; $db->exec_query($sql); } } } $message = sprintf($l18n['import_results_ok'], $tcase_identity, $version, $tester_name, $resulstCfg['code_status'][$result_code], $execution_ts); } } } if (!is_null($message)) { $resultMap[] = array($message); } } return $resultMap; }
/** * * */ function checkTestPlan(&$db, &$user, &$args) { $hasRight = false; // $tproject_mgr = new testproject($db); $tplan_mgr = new testplan($db); $item_info = $tplan_mgr->get_by_id($args->tplan_id, array('output' => 'minimun')); if ($op['status_ok'] = !is_null($item_info)) { $args->tproject_id = intval($item_info['tproject_id']); switch ($args->item) { case 'exec': $hasRight = $user->hasRight($db, 'testplan_execute', $args->tproject_id, $args->tplan_id); break; default: // need to fail!! break; } } return $hasRight; }
* 20050807 - fm - refactoring: changes in getTestSuiteReport() call * 20050905 - fm - reduce global coupling * 20070101 - KL - upgraded to 1.7 * 20080626 - mht - added milestomes, priority report, refactorization * * ----------------------------------------------------------------------------------- */ require '../../config.inc.php'; require_once 'common.php'; require_once 'results.class.php'; require_once 'displayMgr.php'; testlinkInitPage($db, true, false, "checkRights"); $tplan_mgr = new testplan($db); $tproject_mgr = new testproject($db); $templateCfg = templateConfiguration(); $args = init_args(); $tplan_info = $tplan_mgr->get_by_id($args->tplan_id); $tproject_info = $tproject_mgr->get_by_id($args->tproject_id); $arrDataSuite = array(); $gui = new stdClass(); $gui->title = lang_get('title_gen_test_rep'); $gui->do_report = array(); $gui->showPlatforms = true; $gui->columnsDefinition = new stdClass(); $gui->columnsDefinition->keywords = null; $gui->columnsDefinition->testers = null; $gui->columnsDefinition->platform = null; $gui->statistics = new stdClass(); $gui->statistics->keywords = null; $gui->statistics->testers = null; $gui->statistics->milestones = null; $gui->tplan_name = $tplan_info['name'];
/** * initialize user input * * @param resource dbHandler * @return array $args array with user input information */ function init_args(&$dbHandler) { $iParams = array("apikey" => array(tlInputParameter::STRING_N, 32, 64), "tproject_id" => array(tlInputParameter::INT_N), "tplan_id" => array(tlInputParameter::INT_N), "format" => array(tlInputParameter::INT_N), "show_closed_builds" => array(tlInputParameter::CB_BOOL), "show_closed_builds_hidden" => array(tlInputParameter::CB_BOOL)); $args = new stdClass(); $pParams = R_PARAMS($iParams, $args); if (!is_null($args->apikey)) { $cerbero = new stdClass(); $cerbero->args = new stdClass(); $cerbero->args->tproject_id = $args->tproject_id; $cerbero->args->tplan_id = $args->tplan_id; if (strlen($args->apikey) == 32) { $cerbero->args->getAccessAttr = true; $cerbero->method = 'checkRights'; $cerbero->redirect_target = "../../login.php?note=logout"; setUpEnvForRemoteAccess($dbHandler, $args->apikey, $cerbero); } else { $args->addOpAccess = false; $cerbero->method = null; setUpEnvForAnonymousAccess($dbHandler, $args->apikey, $cerbero); } } else { testlinkInitPage($dbHandler, false, false, "checkRights"); $args->tproject_id = isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0; } $tproject_mgr = new testproject($dbHandler); $tplan_mgr = new testplan($dbHandler); if ($args->tproject_id > 0) { $args->tproject_info = $tproject_mgr->get_by_id($args->tproject_id); $args->tproject_name = $args->tproject_info['name']; $args->tproject_description = $args->tproject_info['notes']; } if ($args->tplan_id > 0) { $args->tplan_info = $tplan_mgr->get_by_id($args->tplan_id); } $selection = false; if ($args->show_closed_builds) { $selection = true; } else { if ($args->show_closed_builds_hidden) { $selection = false; } else { if (isset($_SESSION['reports_show_closed_builds'])) { $selection = $_SESSION['reports_show_closed_builds']; } } } $args->show_closed_builds = $_SESSION['reports_show_closed_builds'] = $selection; return array($args, $tproject_mgr, $tplan_mgr); }
/** * Get info about user(s) role at test plan level, * with indication about the nature of role: inherited or assigned. * * To get a user role we consider a 3 layer model: * layer 1 - user <--- uplayer * layer 2 - test project <--- in this fuction we are interested in this level. * layer 3 - test plan args : $tplan_id $tproject_id [$user_id] * @return array map with effetive_role in context ($tplan_id) key: user_id value: map with keys: login (from users table - useful for debug) user_role_id (from users table - useful for debug) uplayer_role_id user role for test project uplayer_is_inherited 1 -> uplayer role is inherited 0 -> uplayer role is written in table effective_role_id user role for test plan is_inherited @internal revisions 20101111 - franciscom - BUGID 4006: test plan is_public */ function get_tplan_effective_role(&$db, $tplan_id, $tproject, $user_id = null, $users = null) { $tplan_mgr = new testplan($db); $tplan = $tplan_mgr->get_by_id($tplan_id); unset($tplan_mgr); $effective_role = get_tproject_effective_role($db, $tproject, $user_id, $users); foreach ($effective_role as $user_id => $row) { $isInherited = 1; $effective_role[$user_id]['uplayer_role_id'] = $effective_role[$user_id]['effective_role_id']; $effective_role[$user_id]['uplayer_is_inherited'] = $effective_role[$user_id]['is_inherited']; // Manage administrator exception DO NOT ENTER HERE if ($row['user']->globalRoleID != TL_ROLES_ADMIN && !$tplan['is_public']) { $isInherited = 0; $effective_role[$user_id]['effective_role_id'] = TL_ROLES_NO_RIGHTS; $effective_role[$user_id]['effective_role'] = '<no rights>'; } if (isset($row['user']->tplanRoles[$tplan_id])) { $isInherited = 0; $effective_role[$user_id]['effective_role_id'] = $row['user']->tplanRoles[$tplan_id]->dbID; $effective_role[$user_id]['effective_role'] = $row['user']->tplanRoles[$tplan_id]; } $effective_role[$user_id]['is_inherited'] = $isInherited; } return $effective_role; }
/** * initialize Gui */ function initializeGui(&$dbHandler, &$argsObj, $dateFormat) { $reports_cfg = config_get('reportsCfg'); $gui = new stdClass(); $tplan_mgr = new testplan($dbHandler); $tproject_mgr = new testproject($dbHandler); $getOpt = array('outputFormat' => 'map'); $gui->platformSet = $tplan_mgr->getPlatforms($argsObj->tplan_id, $getOpt); $gui->title = lang_get('query_metrics_report'); $gui->showPlatforms = true; if (is_null($gui->platformSet)) { $gui->platformSet = array(''); $gui->showPlatforms = false; } $gui->resultsCfg = config_get('results'); // BUGID 3716, BUGID 3930 // convert starttime to iso format for database usage if (isset($_REQUEST['selected_start_date']) && $_REQUEST['selected_start_date'] != '') { $date_array = split_localized_date($_REQUEST['selected_start_date'], $dateFormat); if ($date_array != null) { // set date in iso format $gui->startTime = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day']; } } // convert starttime to iso format for database usage if (isset($_REQUEST['selected_end_date']) && $_REQUEST['selected_end_date'] != '') { $date_array = split_localized_date($_REQUEST['selected_end_date'], $dateFormat); if ($date_array != null) { // set date in iso format $gui->endTime = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day']; } } $start_hour = isset($_REQUEST['start_Hour']) ? $_REQUEST['start_Hour'] : "00"; $gui->startTime = $gui->startTime . " " . $start_hour . ":00:00"; $end_hour = isset($_REQUEST['end_Hour']) ? $_REQUEST['end_Hour'] : "00"; $gui->endTime = $gui->endTime . " " . $end_hour . ":59:59"; $gui_open = config_get('gui_separator_open'); $gui_close = config_get('gui_separator_close'); $gui->str_option_any = $gui_open . lang_get('any') . $gui_close; $gui->str_option_none = $gui_open . lang_get('nobody') . $gui_close; $gui->search_notes_string = $argsObj->search_notes_string; $gui->tplan_id = $argsObj->tplan_id; $gui->tproject_id = $argsObj->tproject_id; $tplan_info = $tplan_mgr->get_by_id($gui->tplan_id); $tproject_info = $tproject_mgr->get_by_id($gui->tproject_id); $gui->tplan_name = $tplan_info['name']; $gui->tproject_name = $tproject_info['name']; $testsuiteIds = null; $testsuiteNames = null; $tsuites_qty = sizeOf($argsObj->testsuitesSelected); for ($id = 0; $id < $tsuites_qty; $id++) { list($suiteId, $suiteName) = preg_split("/\\,/", $argsObj->testsuitesSelected[$id], 2); $testsuiteIds[$id] = $suiteId; $testsuiteNames[$id] = $suiteName; } $buildsToQuery = -1; if (sizeof($argsObj->buildsSelected)) { $buildsToQuery = implode(",", $argsObj->buildsSelected); } // statusForClass is used for results.class.php // lastStatus is used to be displayed $statusForClass = 'a'; // amitkhullar - added this parameter to get the latest results. $latest_resultset = $argsObj->display->latest_results; // BUGID 2500 // $assignee = $argsObj->ownerSelected ? TL_USER_ANYBODY : null; // $tester = $argsObj->executorSelected ? TL_USER_ANYBODY : null; $assignee = $argsObj->ownerSelected > 0 ? $argsObj->ownerSelected : TL_USER_ANYBODY; $tester = $argsObj->executorSelected > 0 ? $argsObj->executorSelected : TL_USER_ANYBODY; // BUGID 4027 $re = new newResults($dbHandler, $tplan_mgr, $tproject_info, $tplan_info, $testsuiteIds, $buildsToQuery, $argsObj->platformsSelected, $statusForClass, $latest_resultset, $argsObj->keywordSelected, $assignee, $gui->startTime, $gui->endTime, $tester, $argsObj->search_notes_string, null); $gui->suiteList = $re->getSuiteList(); // test executions results // Filter test cases on selected platforms foreach ($gui->suiteList as $suiteid => $tcases) { $filtered = array(); foreach ($tcases as $index => $tcase) { if ($tcase['platform_id'] == 0 || $argsObj->platformsSelected[0] == ALL_PLATFORMS || array_search($tcase['platform_id'], $argsObj->platformsSelected) !== false) { array_push($filtered, $tcase); } } unset($gui->suiteList[$suiteid]); $gui->suiteList[$suiteid] = $filtered; } $gui->flatArray = $re->getFlatArray(); $gui->mapOfSuiteSummary = $re->getAggregateMap(); $gui->totals = new stdClass(); $gui->totals->items = $re->getTotalsForPlan(); $gui->totals->labels = array(); foreach ($gui->totals->items as $key => $value) { $l18n = $key == 'total' ? 'th_total_cases' : $gui->resultsCfg['status_label'][$key]; $gui->totals->labels[$key] = lang_get($l18n); } // BUGID 2012 - franciscom $gui->keywords = new stdClass(); $gui->keywords->items[0] = $gui->str_option_any; if (!is_null($tplan_keywords_map = $tplan_mgr->get_keywords_map($gui->tplan_id))) { $gui->keywords->items += $tplan_keywords_map; } $gui->keywords->qty = count($gui->keywords->items); $gui->keywordSelected = $gui->keywords->items[$argsObj->keywordSelected]; $gui->builds_html = $tplan_mgr->get_builds_for_html_options($gui->tplan_id); $gui->users = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any)); $gui->ownerSelected = $gui->users[$argsObj->ownerSelected]; $gui->executorSelected = $gui->users[$argsObj->executorSelected]; $gui->testsuitesSelected = $testsuiteNames; $gui->buildsSelected = $argsObj->buildsSelected; $gui->platformsSelected = $argsObj->platformsSelected; $gui->display = $argsObj->display; // init display rows attribute and some status localized labels $gui->displayResults = array(); $gui->lastStatus = array(); foreach ($reports_cfg->exec_status as $verbose => $label) { $gui->displayResults[$gui->resultsCfg['status_code'][$verbose]] = false; } foreach ($gui->resultsCfg['status_label'] as $status_verbose => $label_key) { $gui->statusLabels[$gui->resultsCfg['status_code'][$status_verbose]] = lang_get($label_key); } $lastStatus_localized = null; foreach ($argsObj->lastStatus as $key => $status_code) { $verbose = $gui->resultsCfg['code_status'][$status_code]; $gui->displayResults[$status_code] = true; $lastStatus_localized[] = lang_get($gui->resultsCfg['status_label'][$verbose]); } $gui->lastStatus = $lastStatus_localized; return $gui; }