Printpage.template.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2013 Simple Machines and individual contributors
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. function template_print_above()
  13. {
  14. global $context, $txt, $topic, $scripturl;
  15. $url_text = $scripturl . '?action=printpage;topic=' . $topic . '.0';
  16. $url_images = $url_text . ';images';
  17. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  18. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  19. <head>
  20. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  21. <meta name="robots" content="noindex" />
  22. <link rel="canonical" href="', $context['canonical_url'], '" />
  23. <title>', $txt['print_page'], ' - ', $context['topic_subject'], '</title>
  24. <style type="text/css">
  25. body, a {
  26. color: #000;
  27. background: #fff;
  28. }
  29. body, td, .normaltext {
  30. font-family: Verdana, arial, helvetica, serif;
  31. font-size: small;
  32. }
  33. h1#title {
  34. font-size: large;
  35. font-weight: bold;
  36. }
  37. h2#linktree {
  38. margin: 1em 0 2.5em 0;
  39. font-size: small;
  40. font-weight: bold;
  41. }
  42. dl#posts {
  43. width: 90%;
  44. margin: 0;
  45. padding: 0;
  46. list-style: none;
  47. }
  48. div.postheader, #poll_data {
  49. border: solid #000;
  50. border-width: 1px 0;
  51. padding: 4px 0;
  52. }
  53. div.postbody {
  54. margin: 1em 0 2em 2em;
  55. }
  56. table {
  57. empty-cells: show;
  58. }
  59. blockquote, code {
  60. border: 1px solid #000;
  61. margin: 3px;
  62. padding: 1px;
  63. display: block;
  64. }
  65. code {
  66. font: x-small monospace;
  67. }
  68. blockquote {
  69. font-size: x-small;
  70. }
  71. .smalltext, .quoteheader, .codeheader {
  72. font-size: x-small;
  73. }
  74. .largetext {
  75. font-size: large;
  76. }
  77. .centertext {
  78. text-align: center;
  79. }
  80. hr {
  81. height: 1px;
  82. border: 0;
  83. color: black;
  84. background-color: black;
  85. }
  86. .voted {
  87. font-weight: bold;
  88. }
  89. @media print {
  90. .print_options {
  91. display:none;
  92. }
  93. }
  94. @media screen {
  95. .print_options {
  96. margin:1em;
  97. }
  98. }
  99. </style>
  100. </head>
  101. <body>
  102. <div class="print_options">';
  103. // which option is set, text or text&images
  104. if (isset($_REQUEST['images']))
  105. echo '
  106. <a href="', $url_text, '">', $txt['print_page_text'], '</a> | <strong><a href="', $url_images, '">', $txt['print_page_images'], '</a></strong>';
  107. else
  108. echo '
  109. <strong><a href="', $url_text, '">', $txt['print_page_text'], '</a></strong> | <a href="', $url_images, '">', $txt['print_page_images'], '</a>';
  110. echo '
  111. </div>
  112. <h1 id="title">', $context['forum_name_html_safe'], '</h1>
  113. <h2 id="linktree">', $context['category_name'], ' => ', (!empty($context['parent_boards']) ? implode(' => ', $context['parent_boards']) . ' => ' : ''), $context['board_name'], ' => ', $txt['topic_started'], ': ', $context['poster_name'], ' ', $txt['search_on'], ' ', $context['post_time'], '</h2>
  114. <div id="posts">';
  115. }
  116. function template_main()
  117. {
  118. global $context, $options, $txt, $scripturl, $topic;
  119. if (!empty($context['poll']))
  120. {
  121. echo '
  122. <div id="poll_data">', $txt['poll'], '
  123. <div class="question">', $txt['poll_question'], ': <strong>', $context['poll']['question'], '</strong>';
  124. $options = 1;
  125. foreach ($context['poll']['options'] as $option)
  126. echo '
  127. <div class="', $option['voted_this'] ? 'voted' : '', '">', $txt['option'], ' ', $options++, ': <strong>', $option['option'], '</strong>
  128. ', $context['allow_poll_view'] ? $txt['votes'] . ': ' . $option['votes'] . '' : '', '
  129. </div>';
  130. echo '
  131. </div>';
  132. }
  133. foreach ($context['posts'] as $post)
  134. {
  135. echo '
  136. <div class="postheader">
  137. ', $txt['title'], ': <strong>', $post['subject'], '</strong><br />
  138. ', $txt['post_by'], ': <strong>', $post['member'], '</strong> ', $txt['search_on'], ' <strong>', $post['time'], '</strong>
  139. </div>
  140. <div class="postbody">
  141. ', $post['body'];
  142. // Show attachment images
  143. if (isset($_GET['images']) && !empty($context['printattach'][$post['id_msg']]))
  144. {
  145. echo '
  146. <hr />';
  147. foreach ($context['printattach'][$post['id_msg']] as $attach)
  148. echo '
  149. <img width="' . $attach['width'] . '" height="' . $attach['height'] . '" src="', $scripturl . '?action=dlattach;topic=' . $topic . '.0;attach=' . $attach['id_attach'] . '" alt="" />';
  150. }
  151. echo '
  152. </div>';
  153. }
  154. }
  155. function template_print_below()
  156. {
  157. global $topic, $txt, $scripturl;
  158. $url_text = $scripturl . '?action=printpage;topic=' . $topic . '.0';
  159. $url_images = $url_text . ';images';
  160. echo '
  161. </div>
  162. <div class="print_options">';
  163. // Show the text / image links
  164. if (isset($_GET['images']))
  165. echo '
  166. <a href="', $url_text, '">', $txt['print_page_text'], '</a> | <strong><a href="', $url_images, '">', $txt['print_page_images'], '</a></strong>';
  167. else
  168. echo '
  169. <strong><a href="', $url_text, '">', $txt['print_page_text'], '</a></strong> | <a href="', $url_images, '">', $txt['print_page_images'], '</a>';
  170. echo '
  171. </div>
  172. <div id="footer" class="smalltext">
  173. ', theme_copyright(), '
  174. </div>
  175. </body>
  176. </html>';
  177. }
  178. ?>