I finally made it work, Any suggestions for the betterment of this just post it here.
Code: Select all
<?php
/**
* TestLink Open Source Project - http://testlink.sourceforge.net/
*
* @filesource $RCSfile: print.inc.php,v $
* @version $Revision: 1.29.2.1 $
* @modified $Date: 2007/11/18 02:12:10 $ by $Author: havlat $
*
* @author Martin Havlat <havlat@users.sourceforge.net>
*
* Functions for support printing of documents.
*
* 20070509 - franciscom
* changes in renderTestSpecTreeForPrinting() interface
*
* 20070106 - franciscom
* 1. remove of some magic numbers
*
*/
/**
* print HTML header
* Standard: HTML 4.01 trans (because is more flexible to bugs in user data)
*/
function printHeader($title, $base_href, $cssTemplate = TL_DOC_BASIC_CSS)
{
//$output = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n";
$output .= "<html xmlns:v='urn:schemas-microsoft-com:vml'
xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word'
xmlns:m='http://schemas.microsoft.com/office/2004/12/omml'
xmlns='http://www.w3.org/TR/REC-html40'>\n<head>\n";
//$output .= '<meta http-equiv="Content-Type" content="text/html; charset='.TL_TPL_CHARSET.'" />';
$output .= '<meta http-equiv="Content-Type" content="text/html; charset=unicode" />';
$output .= '<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 12">
<meta name=Originator content="Microsoft Word 12">';
$output .= '<title>' . htmlspecialchars($title). "</title>\n";
$output .= '<link type="text/css" rel="stylesheet" href="' . $base_href . $cssTemplate . '" />';
//$output .= '<style type="text/css" media="print">.notprintable { display:none;}</style>';
$output .= '<style>
<!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;
mso-font-charset:2;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:0 268435456 0 0 -2147483648 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
{font-family:Cambria;
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-1610611985 1073741899 0 0 159 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:1627400839 -2147483648 8 0 66047 0;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-format:other;
mso-font-pitch:auto;
mso-font-signature:0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
h1
{mso-style-priority:9;
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-link:"Heading 1 Char";
margin-top:112.5pt;
margin-right:15.0pt;
margin-bottom:7.5pt;
margin-left:15.0pt;
text-align:center;
mso-pagination:widow-orphan;
mso-outline-level:1;
font-size:14.5pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
font-weight:bold;}
h2
{mso-style-priority:9;
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-link:"Heading 2 Char";
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
text-indent:3.75pt;
mso-pagination:widow-orphan;
mso-outline-level:2;
font-size:14.5pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
font-weight:bold;}
h3
{mso-style-priority:9;
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-link:"Heading 3 Char";
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
text-indent:7.5pt;
mso-pagination:widow-orphan;
mso-outline-level:3;
font-size:13.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
font-weight:bold;}
h4
{mso-style-priority:9;
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-link:"Heading 4 Char";
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
text-indent:11.25pt;
mso-pagination:widow-orphan;
mso-outline-level:4;
font-size:12.5pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
font-weight:bold;}
p.MsoToc1, li.MsoToc1, div.MsoToc1
{mso-style-update:auto;
mso-style-priority:39;
mso-style-next:Normal;
margin-top:0in;
margin-right:0in;
margin-bottom:5.0pt;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
p.MsoToc2, li.MsoToc2, div.MsoToc2
{mso-style-update:auto;
mso-style-priority:39;
mso-style-next:Normal;
margin-top:0in;
margin-right:0in;
margin-bottom:5.0pt;
margin-left:12.0pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
p.MsoToc3, li.MsoToc3, div.MsoToc3
{mso-style-update:auto;
mso-style-priority:39;
mso-style-next:Normal;
margin-top:0in;
margin-right:0in;
margin-bottom:5.0pt;
margin-left:24.0pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:black;
mso-text-animation:none;
text-decoration:none;
text-underline:none;
text-decoration:none;
text-line-through:none;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
pre
{mso-style-noshow:yes;
mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
font-size:10.0pt;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-noshow:yes;
mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
p.MsoTocHeading, li.MsoTocHeading, div.MsoTocHeading
{mso-style-noshow:yes;
mso-style-priority:39;
mso-style-qformat:yes;
mso-style-parent:"Heading 1";
mso-style-next:Normal;
margin-top:24.0pt;
margin-right:0in;
margin-bottom:0in;
margin-left:0in;
margin-bottom:.0001pt;
line-height:115%;
mso-pagination:widow-orphan lines-together;
page-break-after:avoid;
font-size:14.0pt;
font-family:"Cambria","serif";
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:major-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:major-fareast;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:major-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:major-bidi;
color:#365F91;
mso-themecolor:accent1;
mso-themeshade:191;
font-weight:bold;}
span.Heading1Char
{mso-style-name:"Heading 1 Char";
mso-style-priority:9;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"Heading 1";
mso-ansi-font-size:14.0pt;
mso-bidi-font-size:14.0pt;
font-family:"Cambria","serif";
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:major-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:major-fareast;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:major-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:major-bidi;
color:#365F91;
mso-themecolor:accent1;
mso-themeshade:191;
font-weight:bold;}
span.Heading2Char
{mso-style-name:"Heading 2 Char";
mso-style-noshow:yes;
mso-style-priority:9;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"Heading 2";
mso-ansi-font-size:13.0pt;
mso-bidi-font-size:13.0pt;
font-family:"Cambria","serif";
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:major-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:major-fareast;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:major-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:major-bidi;
color:#4F81BD;
mso-themecolor:accent1;
font-weight:bold;}
span.Heading3Char
{mso-style-name:"Heading 3 Char";
mso-style-noshow:yes;
mso-style-priority:9;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"Heading 3";
mso-ansi-font-size:12.0pt;
mso-bidi-font-size:12.0pt;
font-family:"Cambria","serif";
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:major-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:major-fareast;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:major-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:major-bidi;
color:#4F81BD;
mso-themecolor:accent1;
font-weight:bold;}
span.Heading4Char
{mso-style-name:"Heading 4 Char";
mso-style-noshow:yes;
mso-style-priority:9;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"Heading 4";
mso-ansi-font-size:12.0pt;
mso-bidi-font-size:12.0pt;
font-family:"Cambria","serif";
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:major-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:major-fareast;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:major-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:major-bidi;
color:#4F81BD;
mso-themecolor:accent1;
font-weight:bold;
font-style:italic;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"HTML Preformatted";
font-family:"Consolas","serif";
mso-ascii-font-family:Consolas;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Consolas;}
p.important, li.important, div.important
{mso-style-name:important;
mso-style-unhide:no;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:13.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
font-weight:bold;}
p.notprintable, li.notprintable, div.notprintable
{mso-style-name:notprintable;
mso-style-unhide:no;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
display:none;
mso-hide:all;}
p.note, li.note, div.note
{mso-style-name:note;
mso-style-unhide:no;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
p.numberedlist, li.numberedlist, div.numberedlist
{mso-style-name:numberedlist;
mso-style-unhide:no;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
p.listcontinued, li.listcontinued, div.listcontinued
{mso-style-name:listcontinued;
mso-style-unhide:no;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
p.bodytext, li.bodytext, div.bodytext
{mso-style-name:bodytext;
mso-style-unhide:no;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"Balloon Text";
mso-ansi-font-size:8.0pt;
mso-bidi-font-size:8.0pt;
font-family:"Tahoma","sans-serif";
mso-ascii-font-family:Tahoma;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Tahoma;
mso-bidi-font-family:Tahoma;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-size:10.0pt;
mso-ansi-font-size:10.0pt;
mso-bidi-font-size:10.0pt;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
/* List Definitions */
@list l0
{mso-list-id:1444862;
mso-list-template-ids:1816839108;}
@list l1
{mso-list-id:14769254;
mso-list-template-ids:-246410296;}
@list l1:level1
{mso-level-start-at:5;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l2
{mso-list-id:243153172;
mso-list-template-ids:98996550;}
@list l2:level1
{mso-level-start-at:6;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l3
{mso-list-id:352801658;
mso-list-template-ids:1196052432;}
@list l3:level1
{mso-level-start-at:4;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l4
{mso-list-id:370501404;
mso-list-template-ids:-915389982;}
@list l4:level1
{mso-level-start-at:8;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l5
{mso-list-id:882138145;
mso-list-template-ids:1386922386;}
@list l5:level1
{mso-level-number-format:bullet;
mso-level-text:·;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l6
{mso-list-id:924462046;
mso-list-template-ids:669696314;}
@list l6:level1
{mso-level-start-at:5;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l7
{mso-list-id:1013067749;
mso-list-template-ids:565770946;}
@list l7:level1
{mso-level-number-format:bullet;
mso-level-text:·;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l8
{mso-list-id:1062173593;
mso-list-template-ids:-881307198;}
@list l8:level1
{mso-level-start-at:3;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l9
{mso-list-id:1138648925;
mso-list-template-ids:963010878;}
@list l10
{mso-list-id:1200898252;
mso-list-template-ids:935727302;}
@list l10:level1
{mso-level-number-format:bullet;
mso-level-text:·;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l11
{mso-list-id:1284649394;
mso-list-template-ids:1324010672;}
@list l11:level1
{mso-level-start-at:7;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l12
{mso-list-id:1324509618;
mso-list-template-ids:1270754774;}
@list l12:level1
{mso-level-number-format:bullet;
mso-level-text:·;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l13
{mso-list-id:1369376408;
mso-list-template-ids:1670691600;}
@list l13:level1
{mso-level-start-at:11;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l14
{mso-list-id:1537083581;
mso-list-template-ids:-1206079252;}
@list l14:level1
{mso-level-number-format:bullet;
mso-level-text:·;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l15
{mso-list-id:1600914171;
mso-list-template-ids:-178098694;}
@list l15:level1
{mso-level-number-format:bullet;
mso-level-text:·;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l16
{mso-list-id:1618247161;
mso-list-template-ids:438962092;}
@list l16:level1
{mso-level-start-at:4;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l17
{mso-list-id:1665620274;
mso-list-template-ids:1336576566;}
@list l17:level1
{mso-level-start-at:10;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l18
{mso-list-id:1688600977;
mso-list-template-ids:-1673389332;}
@list l18:level1
{mso-level-start-at:3;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l19
{mso-list-id:1742748162;
mso-list-template-ids:1288324854;}
@list l19:level1
{mso-level-start-at:5;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l20
{mso-list-id:1794782219;
mso-list-template-ids:-1923154860;}
@list l20:level1
{mso-level-number-format:bullet;
mso-level-text:·;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l21
{mso-list-id:1797749274;
mso-list-template-ids:-231996904;}
@list l22
{mso-list-id:1914195859;
mso-list-template-ids:128452592;}
@list l22:level1
{mso-level-start-at:4;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l23
{mso-list-id:1955332389;
mso-list-template-ids:1362951258;}
@list l24
{mso-list-id:2038775735;
mso-list-template-ids:165213790;}
@list l25
{mso-list-id:2144108210;
mso-list-template-ids:-2112730450;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
';
$output .= "\n</head>\n<body>\n";
return $output;
}
/**
print HTML - initial page of document
*/
function printFirstPage(&$db,$title, $prodName, $prodNotes, $userID, $tplan_name="")
{
tLog("printFirstPage called (TPlan=".$tplan_name.")");
$g_date_format = config_get('date_format');
$prodName = htmlspecialchars($prodName);
$author = htmlspecialchars(getUserName($db,$userID));
$title = htmlspecialchars($title);
$output = '<div>';
$output .= '<div class="groupBtn" style="text-align:right"><input class="notprintable" type="button" name="print" value="'.lang_get('btn_print').'" onclick="javascript: print();" style="margin-left:2px;" /></div>';
$output .= '<div class="pageheader">'. $prodName ."</div>\n";
if (TL_DOC_COMPANY != '' || TL_DOC_COMPANY_LOGO != '' )
{
$output .= '<br /><center><table class="company">';
if (TL_DOC_COMPANY != '' )
{
$output .= '<tr><td id="company_name">'. htmlspecialchars(TL_DOC_COMPANY) ."</td></tr>";
}
$output .= '<tr><td/></tr>';
if (TL_DOC_COMPANY_LOGO != '' )
{
$output .= '<tr><td id="company_logo">'.
str_replace('%BASE_HREF%',$_SESSION['basehref'],TL_DOC_COMPANY_LOGO) ."</td></tr>";
}
$output .= "</table></center>\n";
}
$output .= "</div>\n";
if ($tplan_name != "")
{
$output .= '<p style="margin-top:100px; font-size:16; text-align: center; font-weight: bold;">'. $title."</h1>\n";
$output .= '<p style="margin-bottom:300px; font-size:16; text-align: center; font-weight: bold;">'. lang_get('test_plan').": " .$tplan_name."</h1>\n";
} else {
//$output .= '<h1 id="doctitle" style="margin-bottom:1000px;">'.$title."</h1>\n";
$output .= '<h1 style="margin-bottom:750.0pt"><a name="_Toc196540490"></a><a name="_Toc196540490">
</a>
<a name="_Toc196540490">
<span style="mso-bookmark:_Toc196540490">
<span style="mso-bookmark:_Toc196540490"><span style="font-size:12.0pt;font-family:"Arial","sans-serif";mso-fareast-font-family:"Times New Roman"">
Test Specification</span>
</span>
</span>
</a>
<span style="font-size:12.0pt;font-family:"Arial","sans-serif";mso-fareast-font-family:"Times New Roman"">
<o:p></o:p></span></h1>';
}
$output .= '<div id="summary">' .
'<p id="prodname">'. lang_get('product').": " . $prodName . "</p>\n";
if (strlen($prodNotes))
$output .= '<p id="prodnotes">'. $prodNotes . "</p>\n";
$output .= '<p id="author">' . lang_get('author').": " . $author . "</p>\n" .
'<p id="printedby">' . lang_get('printed_by_TestLink_on')." ".
strftime($g_date_format, time()) . "</p></div>\n";
if (TL_DOC_COPYRIGHT != '')
$output .= '<div class="pagefooter" id="copyright">'.htmlspecialchars(TL_DOC_COPYRIGHT)."</div>\n";
if (TL_DOC_CONFIDENT != '')
$output .= '<div class="pagefooter" id="confidential" style="margin-bottom:600px;">'.htmlspecialchars(TL_DOC_CONFIDENT)."</div>\n";
return $output;
}
/*
function: renderTestSpecTreeForPrinting
args :
[$tplan_id]
returns:
rev :
20070509 - franciscom - added $tplan_id in order to refactor and
add contribution BUGID
*/
function renderTestSpecTreeForPrinting(&$db,&$printingOptions,&$node,$tocPrefix,$tcCnt,$level,$tplan_id=0,$tplan_name="")
{
tLog("renderTestSpecTreeForPrinting called (TPlan=".$tplan_name.")");
$tree_mgr = new tree($db);
$map_id_descr = array_flip($tree_mgr->get_available_node_types());
$code = null;
$bCloseTOC = 0;
if (isset($node['node_type_id']))
{
$verbose_node_type = $map_id_descr[$node['node_type_id']];
switch($verbose_node_type)
{
case 'testproject':
$code .= renderProjectNodeForPrinting($db,$printingOptions,$printingOptions['title'],$node,$tplan_name);
break;
case 'testsuite':
if (!is_null($tocPrefix))
$tocPrefix .= ".";
$tocPrefix .= $tcCnt;
$code .= renderTestSuiteNodeForPrinting($db,$printingOptions,$node,$tocPrefix,$level);
break;
case 'testcase':
$code .= renderTestCaseForPrinting($db,$printingOptions,$node,$level,$tplan_id);
break;
}
}
if (isset($node['childNodes']) && $node['childNodes'])
{
$childNodes = $node['childNodes'];
$tsCnt = 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']] == 'testsuite')
$tsCnt++;
$code .= renderTestSpecTreeForPrinting($db,$printingOptions,$current,$tocPrefix,$tsCnt,$level+1,$tplan_name);
}
}
if (isset($node['node_type_id']) && $map_id_descr[$node['node_type_id']] == 'testproject')
{
if ($printingOptions['toc'])
{
//$printingOptions['tocCode'] .= '</div><hr />';
$printingOptions['tocCode'] .= ' <p class="MsoNormal"><!--[if supportFields]><span style="mso-element:field-end"></span><![endif]--><o:p> </o:p></p></w:Sdt>';
$code = str_replace("{{INSERT_TOC}}",$printingOptions['tocCode'],$code);
}
$code .= "</body></html>";
}
return $code;
}
/*
function:
args :
returns:
rev :
20070509 - franciscom - added Contribution
*/
function renderTestCaseForPrinting(&$db,&$printingOptions,&$node,$level,$tplan_id=0)
{
$id = $node['id'];
$name = htmlspecialchars($node['name']);
$code = null;
$tc_mgr = null;
$tcInfo = null;
$versionID = isset($node['tcversion_id']) ? $node['tcversion_id'] : TC_LATEST_VERSION;
if( $printingOptions['body'] || $printingOptions['summary'] ||
$printingOptions['author'] )
{
$tc_mgr = new testcase($db);
$tcInfo = $tc_mgr->get_by_id($id,$versionID);
if ($tcInfo)
{
$tcInfo=$tcInfo[0];
}
}
if ($printingOptions['toc'])
{
// SDM - changed padding-left -> margin-left
/*$printingOptions['tocCode'] .= '<p style="margin-left:45px;"><a href="#tc' . $id . '">Test Case ' . $id . ': ' .
$name . '</a></p>'; */
$printingOptions['tocCode'] .= '<p class=MsoToc3 style="tab-stops:right dotted 467.5pt">
<span class="MsoHyperlink">
<span style="mso-no-proof:yes"><a href="#_Toc' . $id . '"><span style=font-family:"Arial","sans-serif";mso-fareast-font-family:"Times New Roman">Test Case ' . $id . ': ' .
$name . '</span>
<span style="color:windowtext;display:none;mso-hide:screen">
<span style="mso-tab-count:1 dotted">. </span>
</span>
<!--[if supportFields]>
<span style="color:windowtext;display:none;mso-hide:screen">
<span style="mso-element: field-begin"></span>
</span><span style="color:windowtext;display:none; mso-hide:screen"> PAGEREF _Toc' . $node['id'] . ' \h
</span>
<span style="color:windowtext; display:none;mso-hide:screen">
<span style="mso-element:field-separator">
</span>
</span><![endif]-->
<span style="color:windowtext;display:none;mso-hide:screen">
5
</span>
<!--[if supportFields]>
<span style="color:windowtext; display:none;mso-hide:screen">
<span style="mso-element:field-end"></span>
</span>
<![endif]-->
</a>
</span></span>
<span style=font-size:11.0pt;font-family:"Calibri","sans-serif";mso-ascii-theme-font: minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;mso-no-proof:yes>
<o:p></o:p></span></p>';
$code .= "<a name='_Toc" . $id . "'></a>";
}
$code .= "<div class=\"tc\"><h3>".lang_get('test_case')." " . $id . ": " . $name . "</h3><table class=\"tc\" width=\"90%\">";
if ($printingOptions['body'] || $printingOptions['summary'])
{
if ($tcInfo)
{
if ($printingOptions['summary'])
$code .= "<tr><td colspan=\"2\"><u>".lang_get('summary')."</u>: " . $tcInfo['summary'] . "</td></tr>";
if ($printingOptions['body'])
{
$code .= "<tr><td colspan=\"2\"><u>".lang_get('steps')."</u>:<br />" . $tcInfo['steps'] . "</td></tr>";
$code .= "<tr><td colspan=\"2\"><u>".lang_get('expected_results')."</u>:<br />" . $tcInfo['expected_results'] . "</td></tr>";
}
if ($printingOptions['passfail'])
{
// SDM - BEGIN changes for printing testresult and notes in 'Print Test Plan'
$testplan_id2 = $_SESSION['testPlanId'];
$id2 = $id+=1;
$query = mysql_query("SELECT status, execution_ts, notes FROM executions
where tcversion_id = $id2
and testplan_id = $testplan_id2
and execution_ts = (select MAX(execution_ts) from executions
where tcversion_id = $id2
and testplan_id = $testplan_id2
group by tcversion_id, testplan_id)");
$result = mysql_fetch_assoc($query);
if (!$result) {
$tcstatus2 = 'not run';
$tcnotes2 = '';
}else{
$tcstatus2 = $result['status'];
$tcnotes2 = $result['notes'];
}
if ($tcstatus2 == 'p'){$tcstatus2 = '<FONT COLOR=\"#000000\"><b>passed</b></FONT>';}
if ($tcstatus2 == 'b'){$tcstatus2 = '<FONT COLOR=\"#000000\">blocked</FONT>';}
if ($tcstatus2 == 'f'){$tcstatus2 = '<FONT COLOR=\"#000000\">failed</FONT>';}
// SDM - END changes for printing testresult and notes in 'Print Test Plan'
// SDM = added $tcstatus2 and $tcnotes2
$code .= "<tr><td width=\"20%\" valign=\"top\"><u>".lang_get('passfail')."</u>:<br /><br />".$tcstatus2."</td><td><u>".
lang_get('testnotes')."</u>:<br /><br />".$tcnotes2."<br /></td></tr>";
}
}
}
if ($printingOptions['author'])
{
$authorName = getUserName($db, $tcInfo['author_id']);
$code .= '<tr><td colspan="2"><b>' . lang_get("author") . " </b>" . $authorName . "</td></tr>";
}
//SDM - added <br /> to add a line between to printed testcases
$code .= "</table></div><br />";
if( !is_null($tc_mgr) )
{
unset($tc_mgr);
}
return $code;
}
function renderProjectNodeForPrinting(&$db,&$printingOptions,$title,&$node, $tplan_name)
{
$stitle = lang_get('title_test_spec');
if (strlen($title))
$stitle .= " - " . $title;
$my_userID = isset($_SESSION['userID']) ? intval($_SESSION['userID']) : null;
$tproject = new testproject($db);
$projectData = $tproject->get_by_id($node['id']);
unset($tproject);
$code = printHeader($stitle,$_SESSION['basehref']);
$code .= printFirstPage($db,$stitle, $projectData['name'], $projectData['notes'], $my_userID, $tplan_name);
$printingOptions['toc_numbers'][1] = 0;
if ($printingOptions['toc'])
{
//$printingOptions['tocCode'] = '<div class="toc"><center><h2>'.lang_get('title_toc').'</h2></center>';
$printingOptions['tocCode'] = '<w:Sdt SdtDocPart="t" DocPartType="Table of Contents" DocPartUnique="t" ID="4628251">
<p class=MsoTocHeading align=center style="text-align:center"><span
style="font-family:"Arial","sans-serif";color:windowtext">Table of Contents<o:p></o:p></span><span
style="font-family:"Arial","sans-serif";mso-ascii-font-family:Cambria;
mso-ascii-theme-font:major-latin;mso-hansi-font-family:Cambria;mso-hansi-theme-font:
major-latin;mso-bidi-font-family:"Times New Roman";mso-bidi-theme-font:major-bidi"><w:sdtPr></w:sdtPr></span></p>
<p class=MsoToc1 style=tab-stops:right dotted 467.5pt><!--[if supportFields]><span
style=mso-element:field-begin></span><span
style=mso-spacerun:yes> </span>TOC \o "1-3" \h \z \u <span
style=mso-element:field-separator></span><![endif]--><span
class=MsoHyperlink><span style=mso-no-proof:yes><a href="#_Toc196540490"><span
style=font-family:"Arial","sans-serif">Test Specification</span><span
style=color:windowtext;display:none;mso-hide:screen><span style="mso-tab-count:
1 dotted">.. </span></span><!--[if supportFields]><span style=color:windowtext;
display:none;mso-hide:screen><span style=mso-element:field-begin></span></span><span
style=color:windowtext;display:none;mso-hide:screen> PAGEREF _Toc196540490
\h </span><span style=color:windowtext;display:none;mso-hide:screen><span
style=mso-element:field-separator></span></span><![endif]--><span
style=color:windowtext;display:none;mso-hide:screen>1</span><span
style=color:windowtext;display:none;mso-hide:screen>
</span><!--[if supportFields]><span style=color:windowtext;
display:none;mso-hide:screen><span style=mso-element:field-end></span></span><![endif]--></a></span></span><span
style=font-size:11.0pt;font-family:"Calibri","sans-serif";mso-ascii-theme-font:
minor-latin;mso-fareast-font-family:"Times New Roman";mso-fareast-theme-font:
minor-fareast;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;mso-no-proof:yes><o:p></o:p></span></p>
';
$code .= "{{INSERT_TOC}}";
}
return $code;
}
function renderTestSuiteNodeForPrinting(&$db,&$printingOptions,&$node,$tocPrefix,$level)
{
$code = null;
$name = isset($node['name']) ? htmlspecialchars($node['name']) : '';
if ($printingOptions['toc'])
{
// SDM - changed padding-left -> margin-left
/*$printingOptions['tocCode'] .= '<li class="toc"><p style="margin-left:10px;"><a href="#cat' . $node['id'] . '">Test Suite ' .
$name . '</a></p>1</li>*/
$printingOptions['tocCode'] .= '<p class=MsoToc1 style="tab-stops:right dotted 467.5pt">
<span class="MsoHyperlink">
<span style="mso-no-proof:yes"><a href="#_Toc' . $node['id'] . '"><span style=font-family:"Arial","sans-serif";mso-fareast-font-family:"Times New Roman">Test Suite ' .
$name . '</span>
<span style="color:windowtext;display:none; mso-hide:screen">
<span style="mso-tab-count:1 dotted">. </span>
</span><!--[if supportFields]>
<span style="color:windowtext;display:none;mso-hide:screen">
<span style="mso-element: field-begin"></span>
</span>
<span style="color:windowtext;display:none; mso-hide:screen"> PAGEREF _Toc' . $node['id'] . ' \h
</span>
<span style="color:windowtext; display:none;mso-hide:screen">
<span style="mso-element:field-separator"></span>
</span>
<![endif]-->
<span style="color:windowtext;display:none;mso-hide:screen">
5
</span>
<!--[if supportFields]>
<span style="color:windowtext; display:none;mso-hide:screen">
<span style="mso-element:field-end"></span>
</span>
<![endif]-->
</a>
</span>
</span>
<span style=font-size:11.0pt;font-family:"Calibri","sans-serif";mso-ascii-theme-font: minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;mso-no-proof:yes>
<o:p></o:p>
</span></p>
<p class=MsoToc2 style="tab-stops:right dotted 467.5pt">
<span class="MsoHyperlink">
<span style="mso-no-proof:yes"><a href="#_Toc' . $node['id'] . '">
<span style=font-family:"Arial","sans-serif";mso-fareast-font-family:"Times New Roman">
Overview
</span>
<span style="color:windowtext;display:none;mso-hide:screen">
<span style="mso-tab-count:1 dotted">.. </span>
</span>
<!--[if supportFields]><span style="color:windowtext; display:none;mso-hide:screen">
<span style="mso-element:field-begin"></span>
</span>
<span style="color:windowtext;display:none;mso-hide:screen"> PAGEREF _Toc' . $node['id'] . ' \h</span>
<span style="color:windowtext;display:none;mso-hide:screen">
<span style="mso-element:field-separator"></span>
</span>
<![endif]--><span style="color:windowtext;display:none;mso-hide:screen">
5
</span>
<!--[if supportFields]>
<span style="color:windowtext; display:none;mso-hide:screen">
<span style="mso-element:field-end"></span>
</span>
<![endif]-->
</a>
</span>
</span>
<span style=font-size:11.0pt;font-family:"Calibri","sans-serif";mso-ascii-theme-font: minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;mso-no-proof:yes>
<o:p>
</o:p>
</span>
</p>';
//<p style="margin-left:20px;"><a href="#cat' . $node['id'] . '">Overview</a></p>';
$code .= "<a name='_Toc{$node['id']}'></a>";
}
$code .= "<center><h1> ".lang_get('test_suite') ." {$name}</h1></center>"; //removed tocPrefix
if ($printingOptions['header'])
{
$tsuite = new testsuite($db);
$tInfo = $tsuite->get_by_id($node['id']);
unset($tsuite);
$code .= "<h2> ".lang_get('details'). //removed tocPrefix
"</h2><div>{$tInfo['details']}</div><br />";
}
return $code;
}
?>