123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452 |
- <?php
- /**
- * Simple Machines Forum (SMF)
- *
- * @package SMF
- * @author Simple Machines
- * @copyright 2014 Simple Machines and individual contributors
- * @license http://www.simplemachines.org/about/smf/license.php BSD
- *
- * @version 2.1 Alpha 1
- */
- function template_main()
- {
- global $context, $settings, $txt, $scripturl, $modSettings;
- echo '
- <div id="statistics" class="main_section">
- <div class="cat_bar">
- <h3 class="catbg">', $context['page_title'], '</h3>
- </div>
- <div class="flow_hidden">
- <div class="title_bar">
- <h4 class="titlebg statstitle">
- <span class="stats_icon general"></span>', $txt['general_stats'], '
- </h4>
- </div>
- <div id="stats_left">
- <div class="windowbg2">
- <div class="content top_row">
- <dl class="stats">
- <dt>', $txt['total_members'], ':</dt>
- <dd>', $context['show_member_list'] ? '<a href="' . $scripturl . '?action=mlist">' . $context['num_members'] . '</a>' : $context['num_members'], '</dd>
- <dt>', $txt['total_posts'], ':</dt>
- <dd>', $context['num_posts'], '</dd>
- <dt>', $txt['total_topics'], ':</dt>
- <dd>', $context['num_topics'], '</dd>
- <dt>', $txt['total_cats'], ':</dt>
- <dd>', $context['num_categories'], '</dd>
- <dt>', $txt['users_online'], ':</dt>
- <dd>', $context['users_online'], '</dd>
- <dt>', $txt['most_online'], ':</dt>
- <dd>', $context['most_members_online']['number'], ' - ', $context['most_members_online']['date'], '</dd>
- <dt>', $txt['users_online_today'], ':</dt>
- <dd>', $context['online_today'], '</dd>';
- if (!empty($modSettings['hitStats']))
- echo '
- <dt>', $txt['num_hits'], ':</dt>
- <dd>', $context['num_hits'], '</dd>';
- echo '
- </dl>
- </div>
- </div>
- </div>
- <div id="stats_right">
- <div class="windowbg2">
- <div class="content top_row">
- <dl class="stats">
- <dt>', $txt['average_members'], ':</dt>
- <dd>', $context['average_members'], '</dd>
- <dt>', $txt['average_posts'], ':</dt>
- <dd>', $context['average_posts'], '</dd>
- <dt>', $txt['average_topics'], ':</dt>
- <dd>', $context['average_topics'], '</dd>
- <dt>', $txt['total_boards'], ':</dt>
- <dd>', $context['num_boards'], '</dd>
- <dt>', $txt['latest_member'], ':</dt>
- <dd>', $context['common_stats']['latest_member']['link'], '</dd>
- <dt>', $txt['average_online'], ':</dt>
- <dd>', $context['average_online'], '</dd>';
- if (!empty($context['gender']))
- echo '
- <dt>', $txt['gender_ratio'], ':</dt>
- <dd>', $context['gender']['ratio'], '</dd>';
- if (!empty($modSettings['hitStats']))
- echo '
- <dt>', $txt['average_hits'], ':</dt>
- <dd>', $context['average_hits'], '</dd>';
- echo '
- </dl>
- </div>
- </div>
- </div>
- </div>
- <div class="flow_hidden">
- <div id="top_posters">
- <div class="title_bar">
- <h4 class="titlebg statstitle">
- <span class="stats_icon posters"></span>', $txt['top_posters'], '
- </h4>
- </div>
- <div class="windowbg2">
- <div class="content">
- <dl class="stats">';
- foreach ($context['top_posters'] as $poster)
- {
- echo '
- <dt>
- ', $poster['link'], '
- </dt>
- <dd class="statsbar">';
- if (!empty($poster['post_percent']))
- echo '
- <div class="bar" style="width: ', $poster['post_percent'] + 4, 'px;">
- <div style="width: ', $poster['post_percent'], 'px;"></div>
- </div>';
- else
- echo '
- <div class="bar empty"></div>';
- echo '
- <span class="righttext">', $poster['num_posts'], '</span>
- </dd>';
- }
- echo '
- </dl>
- </div>
- </div>
- </div>
- <div id="top_boards">
- <div class="title_bar">
- <h4 class="titlebg statstitle">
- <span class="stats_icon boards"></span>', $txt['top_boards'], '
- </h4>
- </div>
- <div class="windowbg2">
- <div class="content">
- <dl class="stats">';
- foreach ($context['top_boards'] as $board)
- {
- echo '
- <dt>
- ', $board['link'], '
- </dt>
- <dd class="statsbar">';
- if (!empty($board['post_percent']))
- echo '
- <div class="bar" style="width: ', $board['post_percent'] + 4, 'px;">
- <div style="width: ', $board['post_percent'], 'px;"></div>
- </div>';
- else
- echo '
- <div class="bar empty"></div>';
- echo '
- <span class="righttext">', $board['num_posts'], '</span>
- </dd>';
- }
- echo '
- </dl>
- </div>
- </div>
- </div>
- </div>
- <div class="flow_hidden">
- <div id="top_topics_replies">
- <div class="title_bar">
- <h4 class="titlebg statstitle">
- <span class="stats_icon replies"></span>', $txt['top_topics_replies'], '
- </h4>
- </div>
- <div class="windowbg2">
- <div class="content">
- <dl class="stats">';
- foreach ($context['top_topics_replies'] as $topic)
- {
- echo '
- <dt>
- ', $topic['link'], '
- </dt>
- <dd class="statsbar">';
- if (!empty($topic['post_percent']))
- echo '
- <div class="bar" style="width: ', $topic['post_percent'] + 4, 'px;">
- <div style="width: ', $topic['post_percent'], 'px;"></div>
- </div>';
- else
- echo '
- <div class="bar empty"></div>';
- echo '
- <span class="righttext">' . $topic['num_replies'] . '</span>
- </dd>';
- }
- echo '
- </dl>
- </div>
- </div>
- </div>
- <div id="top_topics_views">
- <div class="title_bar">
- <h4 class="titlebg statstitle">
- <span class="stats_icon views"></span>', $txt['top_topics_views'], '
- </h4>
- </div>
- <div class="windowbg2">
- <div class="content">
- <dl class="stats">';
- foreach ($context['top_topics_views'] as $topic)
- {
- echo '
- <dt>', $topic['link'], '</dt>
- <dd class="statsbar">';
- if (!empty($topic['post_percent']))
- echo '
- <div class="bar" style="width: ', $topic['post_percent'] + 4, 'px;">
- <div style="width: ', $topic['post_percent'], 'px;"></div>
- </div>';
- else
- echo '
- <div class="bar empty"></div>';
- echo '
- <span class="righttext">' . $topic['num_views'] . '</span>
- </dd>';
- }
- echo '
- </dl>
- </div>
- </div>
- </div>
- </div>
- <div class="flow_hidden">
- <div id="top_topics_starter">
- <div class="title_bar">
- <h4 class="titlebg statstitle">
- <span class="stats_icon starters"></span>', $txt['top_starters'], '
- </h4>
- </div>
- <div class="windowbg2">
- <div class="content">
- <dl class="stats">';
- foreach ($context['top_starters'] as $poster)
- {
- echo '
- <dt>
- ', $poster['link'], '
- </dt>
- <dd class="statsbar">';
- if (!empty($poster['post_percent']))
- echo '
- <div class="bar" style="width: ', $poster['post_percent'] + 4, 'px;">
- <div style="width: ', $poster['post_percent'], 'px;"></div>
- </div>';
- echo '
- <span class="righttext">', $poster['num_topics'], '</span>
- </dd>';
- }
- echo '
- </dl>
- </div>
- </div>
- </div>
- <div id="most_online">
- <div class="title_bar">
- <h4 class="titlebg statstitle">
- <span class="stats_icon history"></span>', $txt['most_time_online'], '
- </h4>
- </div>
- <div class="windowbg2">
- <div class="content">
- <dl class="stats">';
- foreach ($context['top_time_online'] as $poster)
- {
- echo '
- <dt>
- ', $poster['link'], '
- </dt>
- <dd class="statsbar">';
- if (!empty($poster['time_percent']))
- echo '
- <div class="bar" style="width: ', $poster['time_percent'] + 4, 'px;">
- <div style="width: ', $poster['time_percent'], 'px;"></div>
- </div>';
- else
- echo '
- <div class="bar empty"></div>';
- echo '
- <span>', $poster['time_online'], '</span>
- </dd>';
- }
- echo '
- </dl>
- </div>
- </div>
- </div>
- </div>
- <br class="clear">
- <div class="cat_bar">
- <h3 class="catbg">
- <span class="stats_icon history"></span>', $txt['forum_history'], '
- </h3>
- </div>
- <div class="flow_hidden">';
- if (!empty($context['yearly']))
- {
- echo '
- <table border="0" cellspacing="1" cellpadding="4" class="table_grid" id="stats">
- <thead>
- <tr class="titlebg" valign="middle" align="center">
- <th class="first_th lefttext">', $txt['yearly_summary'], '</th>
- <th>', $txt['stats_new_topics'], '</th>
- <th>', $txt['stats_new_posts'], '</th>
- <th>', $txt['stats_new_members'], '</th>
- <th', empty($modSettings['hitStats']) ? ' class="last_th"' : '', '>', $txt['most_online'], '</th>';
- if (!empty($modSettings['hitStats']))
- echo '
- <th class="last_th">', $txt['page_views'], '</th>';
- echo '
- </tr>
- </thead>
- <tbody>';
- foreach ($context['yearly'] as $id => $year)
- {
- echo '
- <tr class="windowbg2" valign="middle" align="center" id="year_', $id, '">
- <th class="lefttext">
- <img id="year_img_', $id, '" src="', $settings['images_url'], '/selected_open.png" alt="*"> <a href="#year_', $id, '" id="year_link_', $id, '">', $year['year'], '</a>
- </th>
- <th>', $year['new_topics'], '</th>
- <th>', $year['new_posts'], '</th>
- <th>', $year['new_members'], '</th>
- <th>', $year['most_members_online'], '</th>';
- if (!empty($modSettings['hitStats']))
- echo '
- <th>', $year['hits'], '</th>';
- echo '
- </tr>';
- foreach ($year['months'] as $month)
- {
- echo '
- <tr class="windowbg2" valign="middle" align="center" id="tr_month_', $month['id'], '">
- <th class="stats_month">
- <img src="', $settings['images_url'], '/', $month['expanded'] ? 'selected_open.png' : 'selected.png', '" alt="" id="img_', $month['id'], '"> <a id="m', $month['id'], '" href="', $month['href'], '" onclick="return doingExpandCollapse;">', $month['month'], ' ', $month['year'], '</a>
- </th>
- <th>', $month['new_topics'], '</th>
- <th>', $month['new_posts'], '</th>
- <th>', $month['new_members'], '</th>
- <th>', $month['most_members_online'], '</th>';
- if (!empty($modSettings['hitStats']))
- echo '
- <th>', $month['hits'], '</th>';
- echo '
- </tr>';
- if ($month['expanded'])
- {
- foreach ($month['days'] as $day)
- {
- echo '
- <tr class="windowbg2" valign="middle" align="center" id="tr_day_', $day['year'], '-', $day['month'], '-', $day['day'], '">
- <td class="stats_day">', $day['year'], '-', $day['month'], '-', $day['day'], '</td>
- <td>', $day['new_topics'], '</td>
- <td>', $day['new_posts'], '</td>
- <td>', $day['new_members'], '</td>
- <td>', $day['most_members_online'], '</td>';
- if (!empty($modSettings['hitStats']))
- echo '
- <td>', $day['hits'], '</td>';
- echo '
- </tr>';
- }
- }
- }
- }
- echo '
- </tbody>
- </table>
- </div>
- </div>
- <script src="', $settings['default_theme_url'], '/scripts/stats.js"></script>
- <script><!-- // --><![CDATA[
- var oStatsCenter = new smf_StatsCenter({
- sTableId: \'stats\',
- reYearPattern: /year_(\d+)/,
- sYearImageCollapsed: \'selected.png\',
- sYearImageExpanded: \'selected_open.png\',
- sYearImageIdPrefix: \'year_img_\',
- sYearLinkIdPrefix: \'year_link_\',
- reMonthPattern: /tr_month_(\d+)/,
- sMonthImageCollapsed: \'selected.png\',
- sMonthImageExpanded: \'selected_open.png\',
- 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>';
- }
- }
- ?>
|