Reports.template.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2014 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. // Choose which type of report to run?
  13. function template_report_type()
  14. {
  15. global $context, $options, $scripturl, $txt, $modSettings;
  16. echo '
  17. <div id="admincenter">
  18. <form action="', $scripturl, '?action=admin;area=reports" method="post" accept-charset="', $context['character_set'], '">
  19. <div id="generate_reports_type">
  20. <div class="cat_bar">
  21. <h3 class="catbg">', $txt['generate_reports_type'], '</h3>
  22. </div>
  23. <div class="windowbg">
  24. <div class="content">
  25. <dl class="generate_report">';
  26. // Go through each type of report they can run.
  27. foreach ($context['report_types'] as $type)
  28. {
  29. echo '
  30. <dt>
  31. <input type="radio" id="rt_', $type['id'], '" name="rt" value="', $type['id'], '"', $type['is_first'] ? ' checked="checked"' : '', ' class="input_radio" />
  32. <strong><label for="rt_', $type['id'], '">', $type['title'], '</label></strong>
  33. </dt>';
  34. if (isset($type['description']))
  35. echo '
  36. <dd>', $type['description'], '</dd>';
  37. }
  38. echo '
  39. </dl>
  40. <input type="submit" name="continue" value="', $txt['generate_reports_continue'], '" class="button_submit" />
  41. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  42. </div>
  43. </div>
  44. </div>
  45. </form>
  46. </div>';
  47. }
  48. // This is the standard template for showing reports in.
  49. function template_main()
  50. {
  51. global $context, $options, $scripturl, $txt, $modSettings;
  52. echo '
  53. <div id="admincenter">
  54. <div class="cat_bar">
  55. <h3 class="catbg">', $txt['results'], '</h3>
  56. </div>
  57. <div id="report_buttons">';
  58. if (!empty($context['report_buttons']))
  59. template_button_strip($context['report_buttons'], 'right');
  60. echo '
  61. </div>
  62. <div class="generic_list_wrapper">';
  63. // Go through each table!
  64. foreach ($context['tables'] as $table)
  65. {
  66. echo '
  67. <table class="table_grid report_results" width="100%">';
  68. if (!empty($table['title']))
  69. echo '
  70. <thead>
  71. <tr class="catbg">
  72. <th scope="col" colspan="', $table['column_count'], '">', $table['title'], '</th>
  73. </tr>
  74. </thead>
  75. <tbody>';
  76. // Now do each row!
  77. $row_number = 0;
  78. $alternate = false;
  79. foreach ($table['data'] as $row)
  80. {
  81. if ($row_number == 0 && !empty($table['shading']['top']))
  82. echo '
  83. <tr class="windowbg table_caption">';
  84. else
  85. echo '
  86. <tr class="', !empty($row[0]['separator']) ? 'catbg' : ($alternate ? 'windowbg' : 'windowbg2'), '" valign="top">';
  87. // Now do each column.
  88. $column_number = 0;
  89. foreach ($row as $key => $data)
  90. {
  91. // If this is a special separator, skip over!
  92. if (!empty($data['separator']) && $column_number == 0)
  93. {
  94. echo '
  95. <td colspan="', $table['column_count'], '" class="smalltext">
  96. ', $data['v'], ':
  97. </td>';
  98. break;
  99. }
  100. // Shaded?
  101. if ($column_number == 0 && !empty($table['shading']['left']))
  102. echo '
  103. <td align="', $table['align']['shaded'], '" class="table_caption"', $table['width']['shaded'] != 'auto' ? ' width="' . $table['width']['shaded'] . '"' : '', '>
  104. ', $data['v'] == $table['default_value'] ? '' : ($data['v'] . (empty($data['v']) ? '' : ':')), '
  105. </td>';
  106. else
  107. echo '
  108. <td class="smalltext" align="', $table['align']['normal'], '"', $table['width']['normal'] != 'auto' ? ' width="' . $table['width']['normal'] . '"' : '', !empty($data['style']) ? ' style="' . $data['style'] . '"' : '', '>
  109. ', $data['v'], '
  110. </td>';
  111. $column_number++;
  112. }
  113. echo '
  114. </tr>';
  115. $row_number++;
  116. $alternate = !$alternate;
  117. }
  118. echo '
  119. </tbody>
  120. </table>
  121. <br />';
  122. }
  123. echo '
  124. </div>
  125. </div>';
  126. }
  127. // Header of the print page!
  128. function template_print_above()
  129. {
  130. global $context, $settings, $options, $txt;
  131. echo '<!DOCTYPE html>
  132. <html', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  133. <head>
  134. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  135. <title>', $context['page_title'], '</title>
  136. <link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/css/report.css" />
  137. </head>
  138. <body>';
  139. }
  140. function template_print()
  141. {
  142. global $context, $options, $scripturl, $txt, $modSettings;
  143. // Go through each table!
  144. foreach ($context['tables'] as $table)
  145. {
  146. echo '
  147. <div style="overflow: visible;', $table['max_width'] != 'auto' ? ' width: ' . $table['max_width'] . 'px;' : '', '">
  148. <table border="0" cellspacing="1" cellpadding="4" width="100%" class="bordercolor">';
  149. if (!empty($table['title']))
  150. echo '
  151. <tr class="catbg">
  152. <td colspan="', $table['column_count'], '">
  153. ', $table['title'], '
  154. </td>
  155. </tr>';
  156. // Now do each row!
  157. $alternate = false;
  158. $row_number = 0;
  159. foreach ($table['data'] as $row)
  160. {
  161. if ($row_number == 0 && !empty($table['shading']['top']))
  162. echo '
  163. <tr class="titlebg" valign="top">';
  164. else
  165. echo '
  166. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '" valign="top">';
  167. // Now do each column!!
  168. $column_number = 0;
  169. foreach ($row as $key => $data)
  170. {
  171. // If this is a special separator, skip over!
  172. if (!empty($data['separator']) && $column_number == 0)
  173. {
  174. echo '
  175. <td colspan="', $table['column_count'], '" class="catbg">
  176. <strong>', $data['v'], ':</strong>
  177. </td>';
  178. break;
  179. }
  180. // Shaded?
  181. if ($column_number == 0 && !empty($table['shading']['left']))
  182. echo '
  183. <td align="', $table['align']['shaded'], '" class="titlebg"', $table['width']['shaded'] != 'auto' ? ' width="' . $table['width']['shaded'] . '"' : '', '>
  184. ', $data['v'] == $table['default_value'] ? '' : ($data['v'] . (empty($data['v']) ? '' : ':')), '
  185. </td>';
  186. else
  187. echo '
  188. <td align="', $table['align']['normal'], '"', $table['width']['normal'] != 'auto' ? ' width="' . $table['width']['normal'] . '"' : '', !empty($data['style']) ? ' style="' . $data['style'] . '"' : '', '>
  189. ', $data['v'], '
  190. </td>';
  191. $column_number++;
  192. }
  193. echo '
  194. </tr>';
  195. $row_number++;
  196. $alternate = !$alternate;
  197. }
  198. echo '
  199. </table>
  200. </div><br />';
  201. }
  202. }
  203. // Footer of the print page.
  204. function template_print_below()
  205. {
  206. echo '
  207. <div class="copyright">', theme_copyright(), '</div>
  208. </body>
  209. </html>';
  210. }
  211. ?>