Reports.template.php 7.2 KB

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