123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- <?php
- /**
- * Simple Machines Forum (SMF)
- *
- * @package SMF
- * @author Simple Machines
- * @copyright 2011 Simple Machines
- * @license http://www.simplemachines.org/about/smf/license.php BSD
- *
- * @version 2.1 Alpha 1
- */
- function template_main()
- {
- global $context, $settings, $options, $txt, $scripturl, $modSettings;
- echo '
- <table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
- <tr class="titlebg">
- <td align="center" colspan="4">', $context['page_title'], '</td>
- </tr>
- <tr>
- <td class="catbg" colspan="4"><strong>', $txt['general_stats'], '</strong></td>
- </tr><tr>
- <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_info.gif" width="20" height="20" alt="" /></td>
- <td class="windowbg2" valign="top">
- <table border="0" cellpadding="1" cellspacing="0" width="100%">
- <tr>
- <td nowrap="nowrap">', $txt['total_members'], ':</td>
- <td align="right">', $context['show_member_list'] ? '<a href="' . $scripturl . '?action=mlist">' . $context['num_members'] . '</a>' : $context['num_members'], '</td>
- </tr><tr>
- <td nowrap="nowrap">', $txt['total_posts'], ':</td>
- <td align="right">', $context['num_posts'], '</td>
- </tr><tr>
- <td nowrap="nowrap">', $txt['total_topics'], ':</td>
- <td align="right">', $context['num_topics'], '</td>
- </tr><tr>
- <td nowrap="nowrap">', $txt['total_cats'], ':</td>
- <td align="right">', $context['num_categories'], '</td>
- </tr><tr>
- <td nowrap="nowrap">', $txt['users_online'], ':</td>
- <td align="right">', $context['users_online'], '</td>
- </tr><tr>
- <td nowrap="nowrap" valign="top">', $txt['most_online'], ':</td>
- <td align="right">', $context['most_members_online']['number'], ' - ', $context['most_members_online']['date'], '</td>
- </tr><tr>
- <td nowrap="nowrap">', $txt['users_online_today'], ':</td>
- <td align="right">', $context['online_today'], '</td>';
- if (!empty($modSettings['hitStats']))
- echo '
- </tr><tr>
- <td nowrap="nowrap">', $txt['num_hits'], ':</td>
- <td align="right">', $context['num_hits'], '</td>';
- echo '
- </tr>
- </table>
- </td>
- <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_info.gif" width="20" height="20" alt="" /></td>
- <td class="windowbg2" valign="top">
- <table border="0" cellpadding="1" cellspacing="0" width="100%">
- <tr>
- <td nowrap="nowrap">', $txt['average_members'], ':</td>
- <td align="right">', $context['average_members'], '</td>
- </tr><tr>
- <td nowrap="nowrap">', $txt['average_posts'], ':</td>
- <td align="right">', $context['average_posts'], '</td>
- </tr><tr>
- <td nowrap="nowrap">', $txt['average_topics'], ':</td>
- <td align="right">', $context['average_topics'], '</td>
- </tr><tr>
- <td nowrap="nowrap">', $txt['total_boards'], ':</td>
- <td align="right">', $context['num_boards'], '</td>
- </tr><tr>
- <td nowrap="nowrap">', $txt['latest_member'], ':</td>
- <td align="right">', $context['common_stats']['latest_member']['link'], '</td>
- </tr><tr>
- <td nowrap="nowrap">', $txt['average_online'], ':</td>
- <td align="right">', $context['average_online'], '</td>
- </tr><tr>
- <td nowrap="nowrap">', $txt['gender_ratio'], ':</td>
- <td align="right">', $context['gender']['ratio'], '</td>';
- if (!empty($modSettings['hitStats']))
- echo '
- </tr><tr>
- <td nowrap="nowrap">', $txt['average_hits'], ':</td>
- <td align="right">', $context['average_hits'], '</td>';
- echo '
- </tr>
- </table>
- </td>
- </tr><tr>
- <td class="catbg" colspan="2" width="50%"><strong>', $txt['top_posters'], '</strong></td>
- <td class="catbg" colspan="2" width="50%"><strong>', $txt['top_boards'], '</strong></td>
- </tr><tr>
- <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_posters.gif" width="20" height="20" alt="" /></td>
- <td class="windowbg2" width="50%" valign="top">
- <table border="0" cellpadding="1" cellspacing="0" width="100%">';
- foreach ($context['top_posters'] as $poster)
- echo '
- <tr>
- <td width="60%" valign="top">', $poster['link'], '</td>
- <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="" />' : ' ', '</td>
- <td width="20%" align="right" valign="top">', $poster['num_posts'], '</td>
- </tr>';
- echo '
- </table>
- </td>
- <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_board.gif" width="20" height="20" alt="" /></td>
- <td class="windowbg2" width="50%" valign="top">
- <table border="0" cellpadding="1" cellspacing="0" width="100%">';
- foreach ($context['top_boards'] as $board)
- echo '
- <tr>
- <td width="60%" valign="top">', $board['link'], '</td>
- <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="" />' : ' ', '</td>
- <td width="20%" align="right" valign="top">', $board['num_posts'], '</td>
- </tr>';
- echo '
- </table>
- </td>
- </tr><tr>
- <td class="catbg" colspan="2" width="50%"><strong>', $txt['top_topics_replies'], '</strong></td>
- <td class="catbg" colspan="2" width="50%"><strong>', $txt['top_topics_views'], '</strong></td>
- </tr><tr>
- <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_replies.gif" width="20" height="20" alt="" /></td>
- <td class="windowbg2" width="50%" valign="top">
- <table border="0" cellpadding="1" cellspacing="0" width="100%">';
- foreach ($context['top_topics_replies'] as $topic)
- echo '
- <tr>
- <td width="60%" valign="top">', $topic['link'], '</td>
- <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="" />' : ' ', '</td>
- <td width="20%" align="right" valign="top">', $topic['num_replies'], '</td>
- </tr>';
- echo '
- </table>
- </td>
- <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_views.gif" width="20" height="20" alt="" /></td>
- <td class="windowbg2" width="50%" valign="top">
- <table border="0" cellpadding="1" cellspacing="0" width="100%">';
- foreach ($context['top_topics_views'] as $topic)
- echo '
- <tr>
- <td width="60%" valign="top">', $topic['link'], '</td>
- <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="" />' : ' ', '</td>
- <td width="20%" align="right" valign="top">', $topic['num_views'], '</td>
- </tr>';
- echo '
- </table>
- </td>
- </tr><tr>
- <td class="catbg" colspan="2" width="50%"><strong>', $txt['top_starters'], '</strong></td>
- <td class="catbg" colspan="2" width="50%"><strong>', $txt['most_time_online'], '</strong></td>
- </tr><tr>
- <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_replies.gif" width="20" height="20" alt="" /></td>
- <td class="windowbg2" width="50%" valign="top">
- <table border="0" cellpadding="1" cellspacing="0" width="100%">';
- foreach ($context['top_starters'] as $poster)
- echo '
- <tr>
- <td width="60%" valign="top">', $poster['link'], '</td>
- <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="" />' : ' ', '</td>
- <td width="20%" align="right" valign="top">', $poster['num_topics'], '</td>
- </tr>';
- echo '
- </table>
- </td>
- <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>
- <td class="windowbg2" width="50%" valign="top">
- <table border="0" cellpadding="1" cellspacing="0" width="100%">';
- foreach ($context['top_time_online'] as $poster)
- echo '
- <tr>
- <td width="60%" valign="top">', $poster['link'], '</td>
- <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="" />' : ' ', '</td>
- <td width="20%" align="right" valign="top" nowrap="nowrap">', $poster['time_online'], '</td>
- </tr>';
- echo '
- </table>
- </td>
- </tr><tr>
- <td class="catbg" colspan="4"><strong>', $txt['forum_history'], '</strong></td>
- </tr><tr>
- <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_history.gif" width="20" height="20" alt="" /></td>
- <td class="windowbg2" colspan="4">';
- if (!empty($context['yearly']))
- {
- echo '
- <table border="0" width="100%" cellspacing="1" cellpadding="4" class="tborder" style="margin-bottom: 1ex;" id="stats">
- <tr class="titlebg" valign="middle" align="center">
- <td width="25%">', $txt['yearly_summary'], '</td>
- <td width="15%">', $txt['stats_new_topics'], '</td>
- <td width="15%">', $txt['stats_new_posts'], '</td>
- <td width="15%">', $txt['stats_new_members'], '</td>
- <td width="15%">', $txt['smf_stats_14'], '</td>';
- if (!empty($modSettings['hitStats']))
- echo '
- <td>', $txt['page_views'], '</td>';
- echo '
- </tr>';
- foreach ($context['yearly'] as $id => $year)
- {
- echo '
- <tr class="windowbg2" valign="middle" id="year_', $id, '">
- <th class="lefttext" width="25%">
- <img id="year_img_', $id, '" src="', $settings['images_url'], '/collapse.gif" alt="*" /> <a href="#year_', $id, '" id="year_link_', $id, '">', $year['year'], '</a>
- </th>
- <th align="center" width="15%">', $year['new_topics'], '</th>
- <th align="center" width="15%">', $year['new_posts'], '</th>
- <th align="center" width="15%">', $year['new_members'], '</th>
- <th align="center" width="15%">', $year['most_members_online'], '</th>';
- if (!empty($modSettings['hitStats']))
- echo '
- <th align="center">', $year['hits'], '</th>';
- echo '
- </tr>';
- foreach ($year['months'] as $month)
- {
- echo '
- <tr class="windowbg2" valign="middle" id="tr_month_', $month['id'], '">
- <th class="lefttext" width="25%" style="padding-', ($context['right_to_left'] ? 'right' : 'left'), ': 3ex;">
- <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>
- </th>
- <th align="center" width="15%">', $month['new_topics'], '</th>
- <th align="center" width="15%">', $month['new_posts'], '</th>
- <th align="center" width="15%">', $month['new_members'], '</th>
- <th align="center" width="15%">', $month['most_members_online'], '</th>';
- if (!empty($modSettings['hitStats']))
- echo '
- <th align="center">', $month['hits'], '</th>';
- echo '
- </tr>';
- if ($month['expanded'])
- {
- foreach ($month['days'] as $day)
- {
- echo '
- <tr class="windowbg2" valign="middle" align="left" id="tr_day_', $day['year'], '-', $day['month'], '-', $day['day'], '">
- <td class="lefttext" style="padding-', ($context['right_to_left'] ? 'right' : 'left'), ': 6ex;">', $day['year'], '-', $day['month'], '-', $day['day'], '</td>
- <td align="center">', $day['new_topics'], '</td>
- <td align="center">', $day['new_posts'], '</td>
- <td align="center">', $day['new_members'], '</td>
- <td align="center">', $day['most_members_online'], '</td>';
- if (!empty($modSettings['hitStats']))
- echo '
- <td align="center">', $day['hits'], '</td>';
- echo '
- </tr>';
- }
- }
- }
- }
- echo '
- </table>
- </td></tr>
- </table>
- <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/stats.js"></script>
- <script type="text/javascript"><!-- // --><![CDATA[
- var oStatsCenter = new smf_StatsCenter({
- sTableId: \'stats\',
- reYearPattern: /year_(\d+)/,
- sYearImageCollapsed: \'expand.gif\',
- sYearImageExpanded: \'collapse.gif\',
- sYearImageIdPrefix: \'year_img_\',
- sYearLinkIdPrefix: \'year_link_\',
- reMonthPattern: /tr_month_(\d+)/,
- sMonthImageCollapsed: \'expand.gif\',
- sMonthImageExpanded: \'collapse.gif\',
- sMonthImageIdPrefix: \'img_\',
- sMonthLinkIdPrefix: \'m\',
- reDayPattern: /tr_day_(\d+-\d+-\d+)/,
- sDayRowClassname: \'windowbg2\',
- sDayRowIdPrefix: \'tr_day_\',
- aCollapsedYears: [';
- foreach ($context['collapsed_years'] as $id => $year)
- {
- echo '
- \'', $year, '\'', $id != count($context['collapsed_years']) - 1 ? ',' : '';
- }
- echo '
- ],
- aDataCells: [
- \'date\',
- \'new_topics\',
- \'new_posts\',
- \'new_members\',
- \'most_members_online\'', empty($modSettings['hitStats']) ? '' :',
- \'hits\'', '
- ]
- });
- // ]]></script>';
- }
- }
- ?>
|