';
foreach ($context['news_lines'] as $news)
echo '
', $news, '';
echo '
';
}
}
/**
* This actually displays the board index
*/
function template_main()
{
global $context, $txt, $scripturl;
echo '
';
/* Each category in categories is made up of:
id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?),
new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down image),
and boards. (see below.) */
foreach ($context['categories'] as $category)
{
// If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
if (empty($category['boards']) && !$category['is_collapsed'])
continue;
echo '
';
// If this category even can collapse, show a link to collapse it.
if ($category['can_collapse'])
echo '
';
echo '
', $category['link'], '
', !empty($category['description']) ? '
' . $category['description'] . '
' : '', '
';
/* Each board in each category's boards has:
new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.),
children (see below.), link_children (easier to use.), children_new (are they new?),
topics (# of), posts (# of), link, href, and last_post. (see below.) */
foreach ($category['boards'] as $board)
{
echo '
', function_exists('template_bi_' . $board['type'] . '_icon') ? call_user_func('template_bi_' . $board['type'] . '_icon', $board) : template_bi_board_icon($board), '
', function_exists('template_bi_' . $board['type'] . '_info') ? call_user_func('template_bi_' . $board['type'] . '_info', $board) : template_bi_board_info($board), '
';
// Show some basic information about the number of posts, etc.
echo '
', function_exists('template_bi_' . $board['type'] . '_stats') ? call_user_func('template_bi_' . $board['type'] . '_stats', $board) : template_bi_board_stats($board), '
';
// Show the last post if there is one.
echo'
', function_exists('template_bi_' . $board['type'] . '_lastpost') ? call_user_func('template_bi_' . $board['type'] . '_lastpost', $board) : template_bi_board_lastpost($board), '
';
// Won't somebody think of the children!
if (function_exists('template_bi_' . $board['type'] . '_children'))
call_user_func('template_bi_' . $board['type'] . '_children', $board);
else
template_bi_board_children($board);
echo '
';
}
echo '
';
}
echo '
';
// Show the mark all as read button?
if ($context['user']['is_logged'] && !empty($context['categories']))
echo '
', template_button_strip($context['mark_read_button'], 'right'), '
';
}
/**
* Outputs the board icon for a standard board.
*
* @param array $board Current board information.
*/
function template_bi_board_icon($board)
{
global $context, $scripturl;
echo '
';
}
/**
* Outputs the board icon for a redirect.
*
* @param array $board Current board information.
*/
function template_bi_redirect_icon($board)
{
global $context, $scripturl;
echo '
';
}
/**
* Outputs the board info for a standard board or redirect.
*
* @param array $board Current board information.
*/
function template_bi_board_info($board)
{
global $context, $scripturl, $txt;
echo '
', $board['name'], '
';
// Has it outstanding posts for approval?
if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
echo '
!';
echo '
', $board['description'], '
';
// Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
if (!empty($board['link_moderators']))
echo '
', count($board['link_moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '
';
}
/**
* Outputs the board stats for a standard board.
*
* @param array $board Current board information.
*/
function template_bi_board_stats($board)
{
global $txt;
echo '
', $txt['posts'], ': ', comma_format($board['posts']), '
', $txt['board_topics'], ': ', comma_format($board['topics']), '
';
}
/**
* Outputs the board stats for a redirect.
*
* @param array $board Current board information.
*/
function template_bi_redirect_stats($board)
{
global $txt;
echo '
', $txt['redirects'], ': ', comma_format($board['posts']), '
';
}
/**
* Outputs the board lastposts for a standard board or a redirect.
* When on a mobile device, this may be hidden if no last post exists.
*
* @param array $board Current board information.
*/
function template_bi_board_lastpost($board)
{
if (!empty($board['last_post']['id']))
echo '
', $board['last_post']['last_post_message'], '
';
}
/**
* Outputs the board children for a standard board.
*
* @param array $board Current board information.
*/
function template_bi_board_children($board)
{
global $txt, $scripturl, $context;
// Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
if (!empty($board['children']))
{
// Sort the links into an array with new boards bold so it can be imploded.
$children = array();
/* Each child in each board's children has:
id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
foreach ($board['children'] as $child)
{
if (!$child['is_redirect'])
$child['link'] = '' . ($child['new'] ? '' . $txt['new'] . ' ' : '') . '' . $child['name'] . '';
else
$child['link'] = '' . $child['name'] . '';
// Has it posts awaiting approval?
if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics']))
$child['link'] .= ' !';
$children[] = $child['new'] ? '' . $child['link'] . '' : '' . $child['link'] . '';
}
echo '
', $txt['sub_boards'], '', implode(' ', $children), '
';
}
}
/**
* The lower part of the outer layer of the board index
*/
function template_boardindex_outer_below()
{
template_info_center();
}
/**
* Displays the info center
*/
function template_info_center()
{
global $context, $options, $txt;
if (empty($context['info_center']))
return;
// Here's where the "Info Center" starts...
echo '
';
foreach ($context['info_center'] as $block)
{
$func = 'template_ic_block_' . $block['tpl'];
$func();
}
echo '
';
// Info center collapse object.
echo '
';
}
/**
* The recent posts section of the info center
*/
function template_ic_block_recent()
{
global $context, $scripturl, $settings, $txt;
// This is the "Recent Posts" bar.
echo '
';
// Only show one post.
if ($settings['number_recent_posts'] == 1)
{
// latest_post has link, href, time, subject, short_subject (shortened with...), and topic. (its id.)
echo '
', $txt['recent_view'], ' ', sprintf($txt['is_recent_updated'], '"' . $context['latest_post']['link'] . '"'), ' (', $context['latest_post']['time'], ')
';
}
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
', $txt['message'], ' |
', $txt['author'], ' |
', $txt['board'], ' |
', $txt['date'], ' |
';
/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
foreach ($context['latest_posts'] as $post)
echo '
', $post['link'], ' |
', $post['poster']['link'], ' |
', $post['board']['link'], ' |
', $post['time'], ' |
';
echo '
';
}
echo '
';
}
/**
* The calendar section of the info center
*/
function template_ic_block_calendar()
{
global $context, $scripturl, $txt;
// Show information about events, birthdays, and holidays on the calendar.
echo '
';
// Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P
if (!empty($context['calendar_holidays']))
echo '
', $txt['calendar_prompt'], ' ', implode(', ', $context['calendar_holidays']), '
';
// People's birthdays. Like mine. And yours, I guess. Kidding.
if (!empty($context['calendar_birthdays']))
{
echo '
', $context['calendar_only_today'] ? $txt['birthdays'] : $txt['birthdays_upcoming'], '';
// Each member in calendar_birthdays has: id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?)
foreach ($context['calendar_birthdays'] as $member)
echo '
', $member['is_today'] ? '' : '', $member['name'], $member['is_today'] ? '' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '', $member['is_last'] ? '' : ', ';
echo '
';
}
// Events like community get-togethers.
if (!empty($context['calendar_events']))
{
echo '
', $context['calendar_only_today'] ? $txt['events'] : $txt['events_upcoming'], ' ';
// Each event in calendar_events should have:
// title, href, is_last, can_edit (are they allowed?), modify_href, and is_today.
foreach ($context['calendar_events'] as $event)
echo '
', $event['can_edit'] ? ' ' : '', $event['href'] == '' ? '' : '', $event['is_today'] ? '' . $event['title'] . '' : $event['title'], $event['href'] == '' ? '' : '', $event['is_last'] ? '
' : ', ';
echo '
';
}
}
/**
* The stats section of the info center
*/
function template_ic_block_stats()
{
global $scripturl, $txt, $context, $settings;
// Show statistical style information...
echo '
', $context['common_stats']['boardindex_total_posts'], '', !empty($settings['show_latest_member']) ? ' - ' . $txt['latest_member'] . ': ' . $context['common_stats']['latest_member']['link'] . '' : '', '
', (!empty($context['latest_post']) ? $txt['latest_post'] . ': "' . $context['latest_post']['link'] . '" (' . $context['latest_post']['time'] . ')
' : ''), '
', $txt['recent_view'], '
';
}
/**
* The who's online section of the info center
*/
function template_ic_block_online()
{
global $context, $scripturl, $txt, $modSettings, $settings;
// "Users online" - in order of activity.
echo '
', $context['show_who'] ? '' : '', '', $txt['online'], ': ', comma_format($context['num_guests']), ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', comma_format($context['num_users_online']), ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
// Handle hidden users and buddies.
$bracketList = array();
if ($context['show_buddies'])
$bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
if (!empty($context['num_spiders']))
$bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
if (!empty($context['num_users_hidden']))
$bracketList[] = comma_format($context['num_users_hidden']) . ' ' . ($context['num_spiders'] == 1 ? $txt['hidden'] : $txt['hidden_s']);
if (!empty($bracketList))
echo ' (' . implode(', ', $bracketList) . ')';
echo $context['show_who'] ? '' : '', '
- ', $txt['most_online_today'], ': ', comma_format($modSettings['mostOnlineToday']), ' -
', $txt['most_online_ever'], ': ', comma_format($modSettings['mostOnline']), ' (', timeformat($modSettings['mostDate']), ')
';
// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online']))
{
echo '
', sprintf($txt['users_active'], $modSettings['lastActive']), ': ', implode(', ', $context['list_users_online']);
// Showing membergroups?
if (!empty($settings['show_group_key']) && !empty($context['membergroups']))
echo '
' . implode(', ', $context['membergroups']) . '';
}
echo '
';
}
?>