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; }
$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']; $gui->tproject_name = $tproject_info['name']; $mailCfg = buildMailCfg($gui); $getOpt = array('outputFormat' => 'map'); $gui->platformSet = $tplan_mgr->getPlatforms($args->tplan_id, $getOpt); if (is_null($gui->platformSet)) { $gui->platformSet = array(''); $gui->showPlatforms = false; } $metricsMgr = new tlTestPlanMetrics($db); $re = new results($db, $tplan_mgr, $tproject_info, $tplan_info, ALL_TEST_SUITES, ALL_BUILDS); // ---------------------------------------------------------------------------- $topLevelSuites = $re->getTopLevelSuites(); if (is_null($topLevelSuites)) { // no test cases -> no report $gui->do_report['status_ok'] = 0; $gui->do_report['msg'] = lang_get('report_tspec_has_no_tsuites'); tLog('Overall Metrics page: no test cases defined'); } else { $gui->do_report['status_ok'] = 1; $gui->do_report['msg'] = ''; //$items2loop = array('keywords','assigned_testers'); $items2loop = array('keywords'); $kwr = $tplan_mgr->getStatusTotalsByKeyword($args->tplan_id); $gui->statistics->keywords = $tplan_mgr->tallyResultsForReport($kwr); // $usr=$tplan_mgr->getStatusTotalsByAssignedTester($args->tplan_id);
<?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();
$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(); $_SESSION['statistics']['getAggregateOwnerResults'] = $re->getAggregateOwnerResults(); $_SESSION['statistics']['getAggregateKeywordResults'] = $re->getAggregateKeywordResults(); $pathToScripts = "lib/results/"; $tprojectTplanInfo = "?tproject_id={$gui->tproject_id}&tplan_id={$gui->tplan_id}"; $chartsUrl = new stdClass(); $chartsUrl->overallPieChart = $pathToScripts . "overallPieChart.php" . $tprojectTplanInfo; $chartsUrl->keywordBarChart = $pathToScripts . "keywordBarChart.php" . $tprojectTplanInfo; $chartsUrl->ownerBarChart = $pathToScripts . "ownerBarChart.php" . $tprojectTplanInfo; $chartsUrl->topLevelSuitesBarChart = $pathToScripts . "topLevelSuitesBarChart.php" . $tprojectTplanInfo; $platformSet = $tplan_mgr->getPlatforms($gui->tplan_id, array('outputFormat' => 'map')); $platformIDSet = is_null($platformSet) ? array(0) : array_keys($platformSet); $gui->charts = array(lang_get('overall_metrics') => $chartsUrl->overallPieChart); if (!is_null($platformSet)) {
$buildIDSet = null; $buildQty = 0; $tplan_mgr = new testPlanUrgency($db); $tproject_mgr = new testproject($db); $tplan_info = $tplan_mgr->get_by_id($args->tplan_id); $tproject_info = $tproject_mgr->get_by_id($args->tproject_id); $gui->tplan_name = $tplan_info['name']; $gui->tproject_name = $tproject_info['name']; $gui->tproject_id = $args->tproject_id; $testCaseCfg = config_get('testcase_cfg'); $testCasePrefix = $tproject_info['prefix'] . $testCaseCfg->glue_character; $mailCfg = buildMailCfg($gui); $getOpt = array('outputFormat' => 'map'); $gui->platforms = $tplan_mgr->getPlatforms($args->tplan_id, $getOpt); $show_platforms = !is_null($gui->platforms); $re = new results($db, $tplan_mgr, $tproject_info, $tplan_info, ALL_TEST_SUITES, ALL_BUILDS, ALL_PLATFORMS); $gui->buildInfoSet = $tplan_mgr->get_builds($args->tplan_id, 1); //MHT: active builds only if ($gui->buildInfoSet) { $buildIDSet = array_keys($gui->buildInfoSet); $buildQty = sizeOf($buildIDSet); } // BUGID 3590 $last_build = end($buildIDSet); // Get Results on map with access key = test case's parent test suite id $executionsMap = $re->getSuiteList(); // lastResultMap provides list of all test cases in plan - data set includes title and suite names $lastResultMap = $re->getMapOfLastResult(); $indexOfArrData = 0; $resultsCfg = config_get('results'); $urgencyCfg = config_get('urgency');