annotate forum/Themes/core/Stats.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 function template_main()
Chris@76 14 {
Chris@76 15 global $context, $settings, $options, $txt, $scripturl, $modSettings;
Chris@76 16
Chris@76 17 echo '
Chris@76 18 <table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
Chris@76 19 <tr class="titlebg">
Chris@76 20 <td align="center" colspan="4">', $context['page_title'], '</td>
Chris@76 21 </tr>
Chris@76 22 <tr>
Chris@76 23 <td class="catbg" colspan="4"><strong>', $txt['general_stats'], '</strong></td>
Chris@76 24 </tr><tr>
Chris@76 25 <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_info.gif" width="20" height="20" alt="" /></td>
Chris@76 26 <td class="windowbg2" valign="top">
Chris@76 27 <table border="0" cellpadding="1" cellspacing="0" width="100%">
Chris@76 28 <tr>
Chris@76 29 <td nowrap="nowrap">', $txt['total_members'], ':</td>
Chris@76 30 <td align="right">', $context['show_member_list'] ? '<a href="' . $scripturl . '?action=mlist">' . $context['num_members'] . '</a>' : $context['num_members'], '</td>
Chris@76 31 </tr><tr>
Chris@76 32 <td nowrap="nowrap">', $txt['total_posts'], ':</td>
Chris@76 33 <td align="right">', $context['num_posts'], '</td>
Chris@76 34 </tr><tr>
Chris@76 35 <td nowrap="nowrap">', $txt['total_topics'], ':</td>
Chris@76 36 <td align="right">', $context['num_topics'], '</td>
Chris@76 37 </tr><tr>
Chris@76 38 <td nowrap="nowrap">', $txt['total_cats'], ':</td>
Chris@76 39 <td align="right">', $context['num_categories'], '</td>
Chris@76 40 </tr><tr>
Chris@76 41 <td nowrap="nowrap">', $txt['users_online'], ':</td>
Chris@76 42 <td align="right">', $context['users_online'], '</td>
Chris@76 43 </tr><tr>
Chris@76 44 <td nowrap="nowrap" valign="top">', $txt['most_online'], ':</td>
Chris@76 45 <td align="right">', $context['most_members_online']['number'], ' - ', $context['most_members_online']['date'], '</td>
Chris@76 46 </tr><tr>
Chris@76 47 <td nowrap="nowrap">', $txt['users_online_today'], ':</td>
Chris@76 48 <td align="right">', $context['online_today'], '</td>';
Chris@76 49 if (!empty($modSettings['hitStats']))
Chris@76 50 echo '
Chris@76 51 </tr><tr>
Chris@76 52 <td nowrap="nowrap">', $txt['num_hits'], ':</td>
Chris@76 53 <td align="right">', $context['num_hits'], '</td>';
Chris@76 54 echo '
Chris@76 55 </tr>
Chris@76 56 </table>
Chris@76 57 </td>
Chris@76 58 <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_info.gif" width="20" height="20" alt="" /></td>
Chris@76 59 <td class="windowbg2" valign="top">
Chris@76 60 <table border="0" cellpadding="1" cellspacing="0" width="100%">
Chris@76 61 <tr>
Chris@76 62 <td nowrap="nowrap">', $txt['average_members'], ':</td>
Chris@76 63 <td align="right">', $context['average_members'], '</td>
Chris@76 64 </tr><tr>
Chris@76 65 <td nowrap="nowrap">', $txt['average_posts'], ':</td>
Chris@76 66 <td align="right">', $context['average_posts'], '</td>
Chris@76 67 </tr><tr>
Chris@76 68 <td nowrap="nowrap">', $txt['average_topics'], ':</td>
Chris@76 69 <td align="right">', $context['average_topics'], '</td>
Chris@76 70 </tr><tr>
Chris@76 71 <td nowrap="nowrap">', $txt['total_boards'], ':</td>
Chris@76 72 <td align="right">', $context['num_boards'], '</td>
Chris@76 73 </tr><tr>
Chris@76 74 <td nowrap="nowrap">', $txt['latest_member'], ':</td>
Chris@76 75 <td align="right">', $context['common_stats']['latest_member']['link'], '</td>
Chris@76 76 </tr><tr>
Chris@76 77 <td nowrap="nowrap">', $txt['average_online'], ':</td>
Chris@76 78 <td align="right">', $context['average_online'], '</td>
Chris@76 79 </tr><tr>
Chris@76 80 <td nowrap="nowrap">', $txt['gender_ratio'], ':</td>
Chris@76 81 <td align="right">', $context['gender']['ratio'], '</td>';
Chris@76 82 if (!empty($modSettings['hitStats']))
Chris@76 83 echo '
Chris@76 84 </tr><tr>
Chris@76 85 <td nowrap="nowrap">', $txt['average_hits'], ':</td>
Chris@76 86 <td align="right">', $context['average_hits'], '</td>';
Chris@76 87 echo '
Chris@76 88 </tr>
Chris@76 89 </table>
Chris@76 90 </td>
Chris@76 91 </tr><tr>
Chris@76 92 <td class="catbg" colspan="2" width="50%"><strong>', $txt['top_posters'], '</strong></td>
Chris@76 93 <td class="catbg" colspan="2" width="50%"><strong>', $txt['top_boards'], '</strong></td>
Chris@76 94 </tr><tr>
Chris@76 95 <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_posters.gif" width="20" height="20" alt="" /></td>
Chris@76 96 <td class="windowbg2" width="50%" valign="top">
Chris@76 97 <table border="0" cellpadding="1" cellspacing="0" width="100%">';
Chris@76 98 foreach ($context['top_posters'] as $poster)
Chris@76 99 echo '
Chris@76 100 <tr>
Chris@76 101 <td width="60%" valign="top">', $poster['link'], '</td>
Chris@76 102 <td width="20%" align="', $context['right_to_left'] ? 'right' : 'left', '" valign="top">', $poster['num_posts'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $poster['post_percent'] . '" height="15" alt="" />' : '&nbsp;', '</td>
Chris@76 103 <td width="20%" align="right" valign="top">', $poster['num_posts'], '</td>
Chris@76 104 </tr>';
Chris@76 105 echo '
Chris@76 106 </table>
Chris@76 107 </td>
Chris@76 108 <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_board.gif" width="20" height="20" alt="" /></td>
Chris@76 109 <td class="windowbg2" width="50%" valign="top">
Chris@76 110 <table border="0" cellpadding="1" cellspacing="0" width="100%">';
Chris@76 111 foreach ($context['top_boards'] as $board)
Chris@76 112 echo '
Chris@76 113 <tr>
Chris@76 114 <td width="60%" valign="top">', $board['link'], '</td>
Chris@76 115 <td width="20%" align="', $context['right_to_left'] ? 'right' : 'left', '" valign="top">', $board['num_posts'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $board['post_percent'] . '" height="15" alt="" />' : '&nbsp;', '</td>
Chris@76 116 <td width="20%" align="right" valign="top">', $board['num_posts'], '</td>
Chris@76 117 </tr>';
Chris@76 118 echo '
Chris@76 119 </table>
Chris@76 120 </td>
Chris@76 121 </tr><tr>
Chris@76 122 <td class="catbg" colspan="2" width="50%"><strong>', $txt['top_topics_replies'], '</strong></td>
Chris@76 123 <td class="catbg" colspan="2" width="50%"><strong>', $txt['top_topics_views'], '</strong></td>
Chris@76 124 </tr><tr>
Chris@76 125 <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_replies.gif" width="20" height="20" alt="" /></td>
Chris@76 126 <td class="windowbg2" width="50%" valign="top">
Chris@76 127 <table border="0" cellpadding="1" cellspacing="0" width="100%">';
Chris@76 128 foreach ($context['top_topics_replies'] as $topic)
Chris@76 129 echo '
Chris@76 130 <tr>
Chris@76 131 <td width="60%" valign="top">', $topic['link'], '</td>
Chris@76 132 <td width="20%" align="', $context['right_to_left'] ? 'right' : 'left', '" valign="top">', $topic['num_replies'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $topic['post_percent'] . '" height="15" alt="" />' : '&nbsp;', '</td>
Chris@76 133 <td width="20%" align="right" valign="top">', $topic['num_replies'], '</td>
Chris@76 134 </tr>';
Chris@76 135 echo '
Chris@76 136 </table>
Chris@76 137 </td>
Chris@76 138 <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_views.gif" width="20" height="20" alt="" /></td>
Chris@76 139 <td class="windowbg2" width="50%" valign="top">
Chris@76 140 <table border="0" cellpadding="1" cellspacing="0" width="100%">';
Chris@76 141 foreach ($context['top_topics_views'] as $topic)
Chris@76 142 echo '
Chris@76 143 <tr>
Chris@76 144 <td width="60%" valign="top">', $topic['link'], '</td>
Chris@76 145 <td width="20%" align="', $context['right_to_left'] ? 'right' : 'left', '" valign="top">', $topic['num_views'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $topic['post_percent'] . '" height="15" alt="" />' : '&nbsp;', '</td>
Chris@76 146 <td width="20%" align="right" valign="top">', $topic['num_views'], '</td>
Chris@76 147 </tr>';
Chris@76 148 echo '
Chris@76 149 </table>
Chris@76 150 </td>
Chris@76 151 </tr><tr>
Chris@76 152 <td class="catbg" colspan="2" width="50%"><strong>', $txt['top_starters'], '</strong></td>
Chris@76 153 <td class="catbg" colspan="2" width="50%"><strong>', $txt['most_time_online'], '</strong></td>
Chris@76 154 </tr><tr>
Chris@76 155 <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_replies.gif" width="20" height="20" alt="" /></td>
Chris@76 156 <td class="windowbg2" width="50%" valign="top">
Chris@76 157 <table border="0" cellpadding="1" cellspacing="0" width="100%">';
Chris@76 158 foreach ($context['top_starters'] as $poster)
Chris@76 159 echo '
Chris@76 160 <tr>
Chris@76 161 <td width="60%" valign="top">', $poster['link'], '</td>
Chris@76 162 <td width="20%" align="', $context['right_to_left'] ? 'right' : 'left', '" valign="top">', $poster['num_topics'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $poster['post_percent'] . '" height="15" alt="" />' : '&nbsp;', '</td>
Chris@76 163 <td width="20%" align="right" valign="top">', $poster['num_topics'], '</td>
Chris@76 164 </tr>';
Chris@76 165 echo '
Chris@76 166 </table>
Chris@76 167 </td>
Chris@76 168 <td class="windowbg" width="20" valign="middle" align="center" nowrap="nowrap"><img src="', $settings['images_url'], '/stats_views.gif" width="20" height="20" alt="" /></td>
Chris@76 169 <td class="windowbg2" width="50%" valign="top">
Chris@76 170 <table border="0" cellpadding="1" cellspacing="0" width="100%">';
Chris@76 171 foreach ($context['top_time_online'] as $poster)
Chris@76 172 echo '
Chris@76 173 <tr>
Chris@76 174 <td width="60%" valign="top">', $poster['link'], '</td>
Chris@76 175 <td width="20%" align="', $context['right_to_left'] ? 'right' : 'left', '" valign="top">', $poster['time_online'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $poster['time_percent'] . '" height="15" alt="" />' : '&nbsp;', '</td>
Chris@76 176 <td width="20%" align="right" valign="top" nowrap="nowrap">', $poster['time_online'], '</td>
Chris@76 177 </tr>';
Chris@76 178 echo '
Chris@76 179 </table>
Chris@76 180 </td>
Chris@76 181 </tr><tr>
Chris@76 182 <td class="catbg" colspan="4"><strong>', $txt['forum_history'], '</strong></td>
Chris@76 183 </tr><tr>
Chris@76 184 <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_history.gif" width="20" height="20" alt="" /></td>
Chris@76 185 <td class="windowbg2" colspan="4">';
Chris@76 186
Chris@76 187 if (!empty($context['yearly']))
Chris@76 188 {
Chris@76 189 echo '
Chris@76 190 <table border="0" width="100%" cellspacing="1" cellpadding="4" class="tborder" style="margin-bottom: 1ex;" id="stats">
Chris@76 191 <tr class="titlebg" valign="middle" align="center">
Chris@76 192 <td width="25%">', $txt['yearly_summary'], '</td>
Chris@76 193 <td width="15%">', $txt['stats_new_topics'], '</td>
Chris@76 194 <td width="15%">', $txt['stats_new_posts'], '</td>
Chris@76 195 <td width="15%">', $txt['stats_new_members'], '</td>
Chris@76 196 <td width="15%">', $txt['smf_stats_14'], '</td>';
Chris@76 197
Chris@76 198 if (!empty($modSettings['hitStats']))
Chris@76 199 echo '
Chris@76 200 <td>', $txt['page_views'], '</td>';
Chris@76 201 echo '
Chris@76 202 </tr>';
Chris@76 203
Chris@76 204 foreach ($context['yearly'] as $id => $year)
Chris@76 205 {
Chris@76 206 echo '
Chris@76 207 <tr class="windowbg2" valign="middle" id="year_', $id, '">
Chris@76 208 <th class="lefttext" width="25%">
Chris@76 209 <img id="year_img_', $id, '" src="', $settings['images_url'], '/collapse.gif" alt="*" /> <a href="#year_', $id, '" id="year_link_', $id, '">', $year['year'], '</a>
Chris@76 210 </th>
Chris@76 211 <th align="center" width="15%">', $year['new_topics'], '</th>
Chris@76 212 <th align="center" width="15%">', $year['new_posts'], '</th>
Chris@76 213 <th align="center" width="15%">', $year['new_members'], '</th>
Chris@76 214 <th align="center" width="15%">', $year['most_members_online'], '</th>';
Chris@76 215 if (!empty($modSettings['hitStats']))
Chris@76 216 echo '
Chris@76 217 <th align="center">', $year['hits'], '</th>';
Chris@76 218 echo '
Chris@76 219 </tr>';
Chris@76 220
Chris@76 221 foreach ($year['months'] as $month)
Chris@76 222 {
Chris@76 223 echo '
Chris@76 224 <tr class="windowbg2" valign="middle" id="tr_month_', $month['id'], '">
Chris@76 225 <th class="lefttext" width="25%" style="padding-', ($context['right_to_left'] ? 'right' : 'left'), ': 3ex;">
Chris@76 226 <img src="', $settings['images_url'], '/', $month['expanded'] ? 'collapse.gif' : 'expand.gif', '" alt="" id="img_', $month['id'], '" /> <a id="m', $month['id'], '" href="', $month['href'], '" onclick="return doingExpandCollapse;">', $month['month'], ' ', $month['year'], '</a>
Chris@76 227 </th>
Chris@76 228 <th align="center" width="15%">', $month['new_topics'], '</th>
Chris@76 229 <th align="center" width="15%">', $month['new_posts'], '</th>
Chris@76 230 <th align="center" width="15%">', $month['new_members'], '</th>
Chris@76 231 <th align="center" width="15%">', $month['most_members_online'], '</th>';
Chris@76 232 if (!empty($modSettings['hitStats']))
Chris@76 233 echo '
Chris@76 234 <th align="center">', $month['hits'], '</th>';
Chris@76 235 echo '
Chris@76 236 </tr>';
Chris@76 237
Chris@76 238 if ($month['expanded'])
Chris@76 239 {
Chris@76 240 foreach ($month['days'] as $day)
Chris@76 241 {
Chris@76 242 echo '
Chris@76 243 <tr class="windowbg2" valign="middle" align="left" id="tr_day_', $day['year'], '-', $day['month'], '-', $day['day'], '">
Chris@76 244 <td class="lefttext" style="padding-', ($context['right_to_left'] ? 'right' : 'left'), ': 6ex;">', $day['year'], '-', $day['month'], '-', $day['day'], '</td>
Chris@76 245 <td align="center">', $day['new_topics'], '</td>
Chris@76 246 <td align="center">', $day['new_posts'], '</td>
Chris@76 247 <td align="center">', $day['new_members'], '</td>
Chris@76 248 <td align="center">', $day['most_members_online'], '</td>';
Chris@76 249 if (!empty($modSettings['hitStats']))
Chris@76 250 echo '
Chris@76 251 <td align="center">', $day['hits'], '</td>';
Chris@76 252 echo '
Chris@76 253 </tr>';
Chris@76 254 }
Chris@76 255 }
Chris@76 256 }
Chris@76 257 }
Chris@76 258
Chris@76 259 echo '
Chris@76 260 </table>
Chris@76 261 </td></tr>
Chris@76 262 </table>
Chris@76 263 <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/stats.js"></script>
Chris@76 264 <script type="text/javascript"><!-- // --><![CDATA[
Chris@76 265 var oStatsCenter = new smf_StatsCenter({
Chris@76 266 sTableId: \'stats\',
Chris@76 267
Chris@76 268 reYearPattern: /year_(\d+)/,
Chris@76 269 sYearImageCollapsed: \'expand.gif\',
Chris@76 270 sYearImageExpanded: \'collapse.gif\',
Chris@76 271 sYearImageIdPrefix: \'year_img_\',
Chris@76 272 sYearLinkIdPrefix: \'year_link_\',
Chris@76 273
Chris@76 274 reMonthPattern: /tr_month_(\d+)/,
Chris@76 275 sMonthImageCollapsed: \'expand.gif\',
Chris@76 276 sMonthImageExpanded: \'collapse.gif\',
Chris@76 277 sMonthImageIdPrefix: \'img_\',
Chris@76 278 sMonthLinkIdPrefix: \'m\',
Chris@76 279
Chris@76 280 reDayPattern: /tr_day_(\d+-\d+-\d+)/,
Chris@76 281 sDayRowClassname: \'windowbg2\',
Chris@76 282 sDayRowIdPrefix: \'tr_day_\',
Chris@76 283
Chris@76 284 aCollapsedYears: [';
Chris@76 285
Chris@76 286 foreach ($context['collapsed_years'] as $id => $year)
Chris@76 287 {
Chris@76 288 echo '
Chris@76 289 \'', $year, '\'', $id != count($context['collapsed_years']) - 1 ? ',' : '';
Chris@76 290 }
Chris@76 291
Chris@76 292 echo '
Chris@76 293 ],
Chris@76 294
Chris@76 295 aDataCells: [
Chris@76 296 \'date\',
Chris@76 297 \'new_topics\',
Chris@76 298 \'new_posts\',
Chris@76 299 \'new_members\',
Chris@76 300 \'most_members_online\'', empty($modSettings['hitStats']) ? '' :',
Chris@76 301 \'hits\'', '
Chris@76 302 ]
Chris@76 303 });
Chris@76 304 // ]]></script>';
Chris@76 305 }
Chris@76 306 }
Chris@76 307
Chris@76 308 ?>