$gui->outputFormatDomain = $args->outputFormatDomain; $gui->object_name = ''; $gui->goback_url = !is_null($args->goback_url) ? $args->goback_url : ''; $gui->object_name = $node['name']; $gui->page_title = sprintf(lang_get('print_testcase'), $node['name']); $gui->tproject_name = $args->tproject_name; $gui->tproject_id = $args->tproject_id; $gui->tcase_id = $args->tcase_id; $gui->tcversion_id = $args->tcversion_id; // Struture defined in printDocument.php $printingOptions = array('toc' => 0, 'body' => 1, 'summary' => 1, 'header' => 0, 'headerNumbering' => 0, 'passfail' => 0, 'author' => 1, 'notes' => 1, 'requirement' => 1, 'keyword' => 1, 'cfields' => 1, 'displayVersion' => 1, 'displayDates' => 1, 'docType' => SINGLE_TESTCASE, 'importance' => 1); $level = 0; $tplanID = 0; $prefix = null; $text2print = ''; $text2print .= renderHTMLHeader($gui->page_title, $_SESSION['basehref'], SINGLE_TESTCASE); $text2print .= renderTestCaseForPrinting($db, $node, $printingOptions, $level, $tplanID, $prefix, $args->tproject_id); echo $text2print; /* function: init_args args: returns: */ function init_args(&$treeMgr) { $_REQUEST = strings_stripSlashes($_REQUEST); $args = new stdClass(); $args->tcase_id = isset($_REQUEST['testcase_id']) ? intval($_REQUEST['testcase_id']) : 0; $args->tcversion_id = isset($_REQUEST['tcversion_id']) ? intval($_REQUEST['tcversion_id']) : 0; $args->tproject_name = '';
$templateCfg = templateConfiguration(); $tree_mgr = new tree($db); $args = init_args(); $gui = new stdClass(); $gui->goback_url = !is_null($args->goback_url) ? $args->goback_url : ''; $gui->page_title = ''; if ($args->deleteAttachmentID > 0) { deleteAttachment($db, $args->deleteAttachmentID); } // Struture defined in printDocument.php $printingOptions = array('toc' => 0, 'body' => 1, 'summary' => 1, 'header' => 0, 'headerNumbering' => 0, 'passfail' => 0, 'author' => 1, 'notes' => 1, 'requirement' => 1, 'keyword' => 1, 'cfields' => 1, 'displayVersion' => 1, 'displayDates' => 1, 'docType' => SINGLE_TESTCASE, 'importance' => 1); $level = 0; $tplanID = 0; $prefix = null; $text2print = ''; $text2print .= renderHTMLHeader($gui->page_title, $_SESSION['basehref'], SINGLE_TESTCASE, array('gui/javascript/testlink_library.js')); $text2print .= renderExecutionForPrinting($db, $_SESSION['basehref'], $args->id, $_SESSION['currentUser']); echo $text2print; /* function: init_args args: returns: */ function init_args() { $_REQUEST = strings_stripSlashes($_REQUEST); $args = new stdClass(); $args->id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $args->deleteAttachmentID = isset($_REQUEST['deleteAttachmentID']) ? intval($_REQUEST['deleteAttachmentID']) : 0; $args->goback_url = null;
$treeForPlatform = buildContentForTestPlan($db, $subtree, $args->tplan_id, $platformIDSet, $decode, $tplan_mgr, $filters); break; case 'testsuite': list($treeForPlatform, $items2use) = buildContentForTestPlanBranch($db, $subtree, $args->itemID, $args->tplan_id, $platformIDSet, $doc_info, $decode, $tplan_mgr, $my['options']['prepareNode']); break; } // Create list of execution id, that will be used to compute execution time if // CF_EXEC_TIME custom field exists and is linked to current testproject $doc_data->statistics = null; if ($printingOptions['metrics']) { $doc_data->statistics = timeStatistics($items2use, $args->tplan_id, $decode, $tplan_mgr); } break; } // ----- rendering logic ----- $topText = renderHTMLHeader($doc_info->type . ' ' . $doc_info->title, $_SESSION['basehref'], $doc_info->type); $topText .= renderFirstPage($doc_info); // Init table of content (TOC) data renderTOC($printingOptions); // @TODO check if is really useful $tocPrefix = null; if ($showPlatforms = !isset($treeForPlatform[0]) ? true : false) { $tocPrefix = 0; } if ($treeForPlatform) { // Things that have to be printed just once // switch ($doc_info->type) { case DOC_TEST_PLAN_DESIGN: $printingOptions['metrics'] = true; // FORCED
$tree_mgr = new tree($db); $reqspec_mgr = new requirement_spec_mgr($db); $args = init_args($tree_mgr); checkRights($db, $_SESSION['currentUser'], $args); $node = $tree_mgr->get_node_hierarchy_info($args->reqspec_id); $gui = new stdClass(); $gui->object_name = ''; $gui->object_name = $node['name']; $gui->page_title = sprintf(lang_get('print_requirement_specification'), $node['name']); $gui->tproject_name = $args->tproject_name; $gui->tproject_id = $args->tproject_id; $gui->reqspec_id = $args->reqspec_id; // Struture defined in printDocument.php $options = array('toc' => 0, 'req_spec_scope' => 1, 'req_spec_author' => 1, 'req_spec_type' => 1, 'req_spec_cf' => 1, 'req_spec_overwritten_count_reqs' => 1, 'headerNumbering' => 0, 'docType' => SINGLE_REQSPEC); $text2print = ''; $text2print .= renderHTMLHeader($gui->page_title, $_SESSION['basehref'], SINGLE_REQSPEC) . '<body>'; //$text2print .= '<div><h2>' . lang_get('req_specification') . '</h2></div>'; $text2print .= renderReqSpecNodeForPrinting($db, $node, $options, null, 0, $args->tproject_id); // now get all it's children (just requirements). $childrenReq = $reqspec_mgr->get_requirements($args->reqspec_id); if (!is_null($childrenReq) && $req_cfg->show_child_reqs_on_reqspec_print_view) { // IMPORTANT NOTICE: // 'docType' => 'SINGLE_REQ' among other things remove the indent on req table // that is present by default. // That's why we need to pass any other value. $reqPrintOpts = array('toc' => 0, 'req_linked_tcs' => 1, 'req_cf' => 1, 'req_scope' => 1, 'req_relations' => 1, 'req_coverage' => 1, 'req_status' => 1, 'req_type' => 1, 'req_author' => 1, 'displayVersion' => 1, 'displayDates' => 1, 'displayLastEdit' => 1, 'docType' => SINGLE_REQ); $text2print .= '<div><h2>' . lang_get('reqs') . '</h2></div>'; $loop2do = count($childrenReq); for ($rdx = 0; $rdx < $loop2do; $rdx++) { $text2print .= renderReqForPrinting($db, $childrenReq[$rdx], $reqPrintOpts, null, 0, $args->tproject_id); }