annotate forum/Themes/default/Reports.template.php @ 76:e3e11437ecea website

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