Reports.template.php 6.7 KB

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