function initializeGuiForResult(&$dbHandler, $argsObj, &$guiObj) { $rcfg = config_get('results'); $map_status_code = $rcfg['status_code']; $map_code_status = $rcfg['code_status']; $map_status_label = $rcfg['status_label']; $map_statuscode_css = array(); foreach ($map_code_status as $code => $status) { if (isset($map_status_label[$status])) { $label = $map_status_label[$status]; $map_statuscode_css[$code] = array(); $map_statuscode_css[$code]['translation'] = lang_get($label); $map_statuscode_css[$code]['css_class'] = $map_code_status[$code] . '_text'; } } $options = array(); // convert starttime to iso format for database usage $dateFormat = config_get('date_format'); $k2l = array('selected_start_date' => 'startTime', 'selected_end_date' => 'endTime'); foreach ($k2l as $in => $opt) { if (isset($argsObj->{$in}) && sizeof($argsObj->{$in}) > 0) { $dd = split_localized_date(current($argsObj->{$in}), $dateFormat); if ($dd != null) { $options[$opt] = $dd['year'] . "-" . $dd['month'] . "-" . $dd['day']; } } } $options['startTime'] .= " " . (isset($argsObj->start_Hour) ? $argsObj->start_Hour : "00") . ":00:00"; $options['endTime'] .= " " . (isset($argsObj->end_Hour) ? $argsObj->end_Hour : "00") . ":59:59"; $mgr = new testproject($dbHandler); $guiObj->resultSet = $mgr->getTestCasesCreatedByUser($argsObj->tproject_id, $argsObj->user_id, $options); if (!is_null($guiObj->resultSet)) { // test case can exist multiple times, due to versions $rows = array(); foreach ($guiObj->resultSet as $idx => $itemInfo) { list($columns, $sortByColumn) = getColumnsDefinition(); foreach ($itemInfo as $tcase) { $current_row = array(); $tcase_id = $tcase['tcase_id']; $tcversion_id = $tcase['tcversion_id']; $current_row[] = htmlspecialchars($tcase['login']); $current_row[] = htmlspecialchars($tcase['path']); // Create linked icons $edit_link = "<a href=\"javascript:openTCEditWindow({$tcase_id},{$tcversion_id});\">" . "<img title=\"{$guiObj->l18n['design']}\" src=\"{$guiObj->images['edit']}\" /></a> "; $current_row[] = "<!-- " . sprintf("%010d", $tcase['external_id']) . " -->" . $edit_link . htmlspecialchars($tcase['external_id']) . " : " . htmlspecialchars($tcase['tcase_name']) . sprintf($guiObj->l18n['tcversion_indicator'], $tcase['version']); $current_row[] = $tcase['importance']; $current_row[] = $tcase['creation_ts']; $current_row[] = $tcase['modification_ts']; $rows[] = $current_row; } } // Different table ID for different reports: $table_id = "tl_table_tc_created_per_user_"; // Add test plan ID to table ID $table_id .= $guiObj->tproject_id; $matrix = new tlExtTable($columns, $rows, $table_id); $matrix->title = $guiObj->l18n['testproject'] . ": " . htmlspecialchars($guiObj->tproject_name); // // @TODO how this work ? // $matrix->addCustomBehaviour(arg1, arg2) // arg1: type that can be user defined, here we use 'importance'. // arg2: array with methods // 'render' => javascript render method (has to be present on inc_ext_table.tpl). // 'filter' => piece of name used on several files // 1. on exttable.class.php is used on buildColumns() to call build{piece}FilterOptions() // 2. on ext_extensions a method named Ext.ux.grid.filter.{piece}Filter // has to exists or rendering will fail // $matrix->addCustomBehaviour('importance', array('render' => 'importanceRenderer', 'filter' => 'Importance')); // Default grouping by first column, which is user for overview, build otherwise $matrix->setGroupByColumnName(lang_get($columns[0]['title_key'])); // Define toolbar $matrix->showToolbar = true; $matrix->toolbarExpandCollapseGroupsButton = true; $matrix->toolbarShowAllColumnsButton = true; // TICKET 5562: Test Cases created per User - toolbar refresh button breaks filter behaivour $matrix->toolbarDefaultStateButton = false; $matrix->toolbarRefreshButton = false; $matrix->setSortByColumnName($sortByColumn); $matrix->sortDirection = 'DESC'; $guiObj->tableSet[$guiObj->tproject_id] = $matrix; } }