Reports.template.php 6.7 KB

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