boardindex.template.php~

Upload: lee-walton

Post on 14-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 BoardIndex.template.php~

    1/12

  • 7/27/2019 BoardIndex.template.php~

    2/12

    sItemTemplate: ', JavaScriptEscape('%1$s'), ',

    iFadeDelay: ', empty($settings['newsfader_time']) ? 5000: $settings['newsfader_time'], '

    });

    // Create the news fader toggle.var smfNewsFadeToggle = new smc_Toggle({

    bToggleEnabled: true,bCurrentlyCollapsed: ', empty($options['collapse_news_fa

    der']) ? 'false' : 'true', ',aSwappableContainers: [

    \'smfFadeScroller\'],aSwapImages: [

    {sId: \'newsupshrink\',srcExpanded: smf_images_url + \'/collaps

    e.gif\',altExpanded: ', JavaScriptEscape($txt['u

    pshrink_description']), ',srcCollapsed: smf_images_url + \'/expand

    .gif\',altCollapsed: ', JavaScriptEscape($txt['

    upshrink_description']), ' }],oThemeOptions: {

    bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',

    sOptionName: \'collapse_news_fader\',sSessionVar: ', JavaScriptEscape($context['sessi

    on_var']), ',sSessionId: ', JavaScriptEscape($context['sessio

    n_id']), '},oCookieOptions: {

    bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',sCookieName: \'newsupshrink\'

    }});

    // ]]>';}

    echo '

    ';

    /* Each category in categories is made up of:

    id, href, link, name, is_collapsed (is it collapsed?), can_collapse (isit 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 emptycategory (unless its collapsed)

    if (empty($category['boards']) && !$category['is_collapsed'])

  • 7/27/2019 BoardIndex.template.php~

    3/12

    continue;

    echo '

    ';

    // If this category even can collapse, show a link to collapse it.

    if ($category['can_collapse'])echo '

    ', $category['collapse_image'], '';

    if (!$context['user']['is_guest'] && !empty($category['show_unread']))

    echo '', $txt['view_unread_category'], '';

    echo '', $category['li

    nk'], '

    ';

    // Assuming the category hasn't been collapsed...if (!$category['is_collapsed']){

    echo '';/* 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.), c

    hildren_new (are they new?),topics (# of), posts (# of), link, href, and last_post.

    (see below.) */foreach ($category['boards'] as $board){

    echo '';

    // If the board or children is new, show an indi

  • 7/27/2019 BoardIndex.template.php~

    4/12

    cator.if ($board['new'] || $board['children_new'])

    echo '';

    // Is it a redirection board?elseif ($board['is_redirect'])

    echo '';

    // No new posts at all! The agony!!else

    echo '';

    echo '

    ', $board['name'], '';

    // Has it outstanding posts for approval?if ($board['can_approve_posts'] && ($board['unap

    proved_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['moderators']))echo '

    ', count($board['moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '

    ';

    // Show some basic information about the number

    of posts, etc.echo '

    ', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], '

    ', $board['is_redirect'] ? '' :comma_format($board['topics']) . ' ' . $txt['board_topics'], '

  • 7/27/2019 BoardIndex.template.php~

    5/12

    ';

    /* The board's and children's 'last_post's have:time, timestamp (a number that represents the ti

    me.), id (of the post), topic (topic id.),link, href, subject, start (where they should go

    for the first unread post.),and member. (which has id, name, link, href, use

    rname in it.) */if (!empty($board['last_post']['id']))

    echo '

    ', $txt['last_post'],

    ' ', $txt['by'], ' ', $board['last_post']['member']['link'] , '
    ', $txt['in'], ' ', $board['last

    _post']['link'], '
    ', $txt['on'], ' ', $board['last

    _post']['time'],'

    ';

    echo '

    ';// Show the "Child Boards: ". (there's a link_ch

    ildren but we're going to bold the new ones...)if (!empty($board['children']))

    { // Sort the links into an array with newboards bold so it can be imploded.

    $children = array();/* Each child in each board's children h

    as:id, name, description, n

    ew (is it new?), topics (#), posts (#), href, link, and last_post. */foreach ($board['children'] as $child){

    if (!$child['is_redirect'])$child['link'] = '' . $child['name'] . ($child['new'] ?' ' : '') . '';

    else$child['link'] = '' . $child['name'] . '';

    // Has it posts awaiting approval?

    if ($child['can_approve_posts']&& ($child['unapproved_posts'] || $child['unapproved_topics']))

    $child['link'] .= ' (!)';

  • 7/27/2019 BoardIndex.template.php~

    6/12

    $children[] = $child['new'] ? '' . $child['link'] . '' : $child['link'];

    }echo '', $txt['parent_

    boards'], ': ', implode(', ', $children), '

    ';}

    }echo '

    ';}echo '

    ';

    }echo '

    ';

    if ($context['user']['is_logged']){

    echo '';

    // Mark read button.$mark_read_button = array(

    'markread' => array('text' => 'mark_as_read', 'image' =>

    'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']),);

    echo '

    ', $txt['new_posts'], '

    ', $txt['old_posts'], '

    ', $txt['redirect_board'], '

    ';

    // Show the mark all as read button?if ($settings['show_mark_read'] && !empty($context['categories']

    ))echo '', template_button_strip($m

    ark_read_button, 'right'), '';

  • 7/27/2019 BoardIndex.template.php~

    7/12

    }else{

    echo '

    ', $txt['old_posts'], ' ', $txt['redirect_board'], '

    ';}

    template_info_center();}

    function template_info_center(){

    global $context, $settings, $options, $txt, $scripturl, $modSettings;

    // Here's where the "Info Center" starts...echo '

    ', sprintf($txt['info_center_title'], $context['forum_name_html_safe']), '

    ';

    // This is the "Recent Posts" bar.if (!empty($settings['number_recent_posts']) && (!empty($context['latest_posts']) || !empty($context['latest_post'])))

    {echo '

    ', $txt['recent_posts'], '

    ', $context['forum_name_html_safe'], ' - ', $txt['recent_posts'], '

    ', $txt['subscribe_webslice'], '

    ';

  • 7/27/2019 BoardIndex.template.php~

    8/12

    // 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_posts'], '

    ', $txt['recent_view'], ' "', $context['latest_post']['link'], '" ', $txt['recent_updated'], ' (', $context['latest_post']['time'], ')

    ';}// Show lots of posts.elseif (!empty($context['latest_posts'])){

    echo '';

    /* Each post in latest_posts has:board (with an id, name, and link.), top

    ic (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'], '

    ', $txt['by'], ' ', $post['poster']['link'], ' (', $post['board']['link'], ')

    ', $post['time'], '';echo '

    ';}echo '

    ';

    }

    // Show information about events, birthdays, and holidays on the calendar.

    if ($context['show_calendar']){

    echo '

    ', $context['calendar_only_today

    '] ? $txt['calendar_today'] : $txt['calendar_upcoming'], '

    ';

    // Holidays like "Christmas", "Chanukah", and "We Love [Unknown]Day" :P.

  • 7/27/2019 BoardIndex.template.php~

    9/12

    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_onl

    y_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'] ? '
    ' : ', ';

    }// 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 '

    ';}

    // Show statistical style information...if ($settings['show_stats_index']){

    echo '

    ', $txt['forum_stats'], '

    ', $context['common_stats']['total_posts'], ' ',$txt['posts_made'], ' ', $txt['in'], ' ', $context['common_stats']['total_topic

  • 7/27/2019 BoardIndex.template.php~

    10/12

    s'], ' ', $txt['topics'], ' ', $txt['by'], ' ', $context['common_stats']['total_members'], ' ', $txt['members'], '. ', !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'], '', $context['show_stats'] ? '

    ' . $txt['more_stats'] . '' : '', '

    ';}

    // "Users online" - in order of activity.echo '

    ', $context['show_who'] ? '' : '', '', $context['show_who'] ? '' : '', '

    ', $txt['online_users'], '

    ', $context['show_who'] ? '' : '', 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']) . '

    ' . $txt['hidden'];

    if (!empty($bracketList))echo ' (' . implode(', ', $bracketList) . ')';

    echo $context['show_who'] ? '' : '', '

    ';

    // 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['l

    astActive']), ':
    ', implode(', ', $context['list_users_online']);

  • 7/27/2019 BoardIndex.template.php~

    11/12

    // Showing membergroups?if (!empty($settings['show_group_key']) && !empty($context['memb

    ergroups']))echo '


    [' . implode('][', $context['membergroups']) . ']';

    }

    echo '

    ', $txt['most_online_today'], ': ', comma_format($modSettings['mostOnlineToday']), '.

    ', $txt['most_online_ever'], ': ', comma_format($modSettings['mostOnline']), ' (', timeformat($modSettings['mostDate']), ')

    ';

    // If they are logged in, but statistical information is off... show a personal message bar.

    if ($context['user']['is_logged'] && !$settings['show_stats_index']){

    echo '

    ', $context['allow_pm'] ? '' : '', '', $context['allow_pm'] ? '' : '', '

    ', $txt['personal_message'], '

    ',

    $txt['personal_message'], '', $txt['you_have'], ' ', comma_format($

    context['user']['messages']), ' ', $context['user']['messages'] == 1 ? $txt['message_lowercase'] : $txt['msg_alert_messages'], '.... ', $txt['click'], ' ', $txt['here'], ' ', $txt['to_view'], '

    ';

    }

    echo '

    ';

    // Info center collapse object.echo '

    var oInfoCenterToggle = new smc_Toggle({bToggleEnabled: true,bCurrentlyCollapsed: ', empty($options['collapse_header_

    ic']) ? 'false' : 'true', ',aSwappableContainers: [

  • 7/27/2019 BoardIndex.template.php~

    12/12

    \'upshrinkHeaderIC\'],aSwapImages: [

    {sId: \'upshrink_ic\',srcExpanded: smf_images_url + \'/collaps

    e.gif\',altExpanded: ', JavaScriptEscape($txt['u

    pshrink_description']), ',srcCollapsed: smf_images_url + \'/expand

    .gif\',altCollapsed: ', JavaScriptEscape($txt['

    upshrink_description']), '}

    ],oThemeOptions: {

    bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',

    sOptionName: \'collapse_header_ic\',sSessionVar: ', JavaScriptEscape($context['sessi

    on_var']), ',sSessionId: ', JavaScriptEscape($context['sessio

    n_id']), '},

    oCookieOptions: {bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',

    sCookieName: \'upshrinkIC\'}

    });// ]]>';

    }?>