Example #1
0
         if ($printingOptions['cfields']) {
             $cfields = $tplan_mgr->html_table_of_custom_field_values($args->tplan_id, 'design', null, $cfieldFormatting);
             $docText .= '<p>' . $cfields . '</p>';
         }
         break;
 }
 $actionContext = (array) $args;
 foreach ($treeForPlatform as $platform_id => $tree2work) {
     $actionContext['platform_id'] = $platform_id;
     if (isset($tree2work['childNodes']) && sizeof($tree2work['childNodes']) > 0) {
         $tree2work['name'] = $args->tproject_name;
         $tree2work['id'] = $args->tproject_id;
         $tree2work['node_type_id'] = $decode['node_descr_id']['testproject'];
         switch ($doc_info->type) {
             case DOC_REQ_SPEC:
                 $docText .= renderReqSpecTreeForPrinting($db, $tree2work, $printingOptions, null, 0, 1, $args->user_id, 0, $args->tproject_id);
                 break;
             case DOC_TEST_SPEC:
                 $docText .= renderSimpleChapter(lang_get('scope'), $doc_info->tproject_scope);
                 $env = new stdClass();
                 $env->base_href = $_SESSION['basehref'];
                 $env->item_type = $doc_info->content_range;
                 $env->tocPrefix = null;
                 $env->tocCounter = 0;
                 $env->user_id = $args->user_id;
                 $env->reportType = $doc_info->type;
                 $actionContext['level'] = 0;
                 $indentLevelStart = 1;
                 $docText .= renderTestSpecTreeForPrinting($db, $tree2work, $printingOptions, $env, $actionContext, $env->tocPrefix, $indentLevelStart);
                 /*
                 $docText .= renderTestSpecTreeForPrinting($db, $_SESSION['basehref'], $tree2work, $doc_info->content_range,
Example #2
0
/**
 * render a complete tree, consisting of mixed requirement and req spec nodes, 
 * as HTML code for printing
 * 
 * @author Andreas Simon
 * 
 * @param resource $db
 * @param array $node the node to be printed
 * @param array $options
 * @param string $tocPrefix Prefix to be printed in TOC before title of each node
 * @param int $level
 * @param int $tprojectID
 * @param int $user_id ID of user which shall be printed as author of the document
 * 
 * @return string $output HTML Code
 */
function renderReqSpecTreeForPrinting(&$db, &$node, &$options, $tocPrefix, $rsCnt, $level, $user_id, $tplan_id = 0, $tprojectID = 0)
{
    static $tree_mgr;
    static $map_id_descr;
    static $tplan_mgr;
    $code = null;
    if (!$tree_mgr) {
        $tplan_mgr = new testplan($db);
        $tree_mgr = new tree($db);
        $map_id_descr = $tree_mgr->node_types;
    }
    $verbose_node_type = $map_id_descr[$node['node_type_id']];
    switch ($verbose_node_type) {
        case 'testproject':
            break;
        case 'requirement_spec':
            $tocPrefix .= (!is_null($tocPrefix) ? "." : '') . $rsCnt;
            $code .= renderReqSpecNodeForPrinting($db, $node, $options, $tocPrefix, $level, $tprojectID);
            break;
        case 'requirement':
            $tocPrefix .= (!is_null($tocPrefix) ? "." : '') . $rsCnt;
            $code .= renderReqForPrinting($db, $node, $options, $tocPrefix, $level, $tprojectID);
            break;
    }
    if (isset($node['childNodes']) && $node['childNodes']) {
        $childNodes = $node['childNodes'];
        $rsCnt = 0;
        $children_qty = sizeof($childNodes);
        for ($i = 0; $i < $children_qty; $i++) {
            $current = $childNodes[$i];
            if (is_null($current)) {
                continue;
            }
            if (isset($current['node_type_id']) && $map_id_descr[$current['node_type_id']] == 'requirement_spec') {
                $rsCnt++;
            }
            $code .= renderReqSpecTreeForPrinting($db, $current, $options, $tocPrefix, $rsCnt, $level + 1, $user_id, $tplan_id, $tprojectID);
        }
    }
    if ($verbose_node_type == 'testproject') {
        if ($options['toc']) {
            $code = str_replace("{{INSERT_TOC}}", $options['tocCode'], $code);
        }
    }
    return $code;
}