'; // Show the mini-blocks if they're enabled. if (empty($context['blocks_disabled'])) { echo '
', template_show_month_grid('prev', true), ' ', template_show_month_grid('current', true), ' ', template_show_month_grid('next', true), '
'; } // Are we viewing a specific week or a specific month? if (isset($_GET['viewweek'])) { echo '
', template_show_week_grid('main'), '
'; } else { echo '
', template_show_month_grid('main'), '
'; } // Close our wrapper. echo '
'; } // Display a monthly calendar grid. function template_show_month_grid($grid_name, $is_mini = false) { global $context, $settings, $txt, $scripturl, $modSettings; // If the grid doesn't exist, no point in proceeding. if (!isset($context['calendar_grid_' . $grid_name])) return false; // A handy little pointer variable. $calendar_data = &$context['calendar_grid_' . $grid_name]; // Some conditions for whether or not we should show the week links *here*. if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false))) $show_week_links = true; else $show_week_links = false; // Assuming that we've not disabled it, show the title block! if (empty($calendar_data['disable_title'])) { echo '

'; // Previous Link: If we're showing prev / next and it's not a mini-calendar. if (empty($calendar_data['previous_calendar']['disabled']) && $calendar_data['show_next_prev'] && $is_mini === false) { echo ' « '; } // Arguably the most exciting part, the title! echo '', $txt['months_titles'][$calendar_data['current_month']], ' ', $calendar_data['current_year'], ''; // Next Link: if we're showing prev / next and it's not a mini-calendar. if (empty($calendar_data['next_calendar']['disabled']) && $calendar_data['show_next_prev'] && $is_mini === false) { echo ' » '; } echo '

'; } // Finally, the main calendar table. echo ''; // Show each day of the week. if (empty($calendar_data['disable_day_titles'])) { echo ''; // If we're showing week links, there's an extra column ahead of the week links, so let's think ahead and be prepared! if ($show_week_links === true) echo ''; // Now, loop through each actual day of the week. foreach ($calendar_data['week_days'] as $day) { echo ''; } echo ''; } // Our looping begins on a per-week basis. foreach ($calendar_data['weeks'] as $week) { // Some useful looping variables. $current_month_started = false; $count = 1; $final_count = 1; echo ''; // This is where we add the actual week link, if enabled on this location. if ($show_week_links === true) { echo ' '; } // Now loop through each day in the week we're on. foreach ($week['days'] as $day) { // What classes should each day inherit? Day is default. $classes = array('days'); if (!empty($day['day'])) { // Default Classes (either compact or comfortable and either calendar_today or windowbg). $classes[] = !empty($calendar_data['size']) && $calendar_data['size'] == 'small' ? 'compact' : 'comfortable'; $classes[] = !empty($day['is_today']) ? 'calendar_today' : 'windowbg'; // Additional classes are given for events, holidays, and birthdays. if (!empty($day['events']) && !empty($calendar_data['highlight']['events'])) { if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1,3))) $classes[] = 'events'; elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2,3))) $classes[] = 'events'; } if (!empty($day['holidays']) && !empty($calendar_data['highlight']['holidays'])) { if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1,3))) $classes[] = 'holidays'; elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2,3))) $classes[] = 'holidays'; } if (!empty($day['birthdays']) && !empty($calendar_data['highlight']['birthdays'])) { if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1,3))) $classes[] = 'birthdays'; elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2,3))) $classes[] = 'birthdays'; } } else $classes[] = 'disabled'; // Now, implode the classes for each day. echo ''; ++$count; } echo ''; } // Quick Month Navigation + Post Event Link on Main Grids! if ($is_mini === false) template_calendar_base($show_week_links === true ? 8 : 7); // The end of our main table. echo '
 ', !empty($calendar_data['short_day_titles']) || $is_mini === true ? $txt['days_short'][$day] : $txt['days'][$day], '
» '; // If it's within this current month, go ahead and begin. if (!empty($day['day'])) { // If it's the first day of this month and not a mini-calendar, we'll add the month title - whether short or full. $title_prefix = !empty($day['is_first_of_month']) && $context['current_month'] == $calendar_data['current_month'] && $is_mini === false ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$calendar_data['current_month']] . ' ' : $txt['months_titles'][$calendar_data['current_month']] . ' ') : ''; // The actual day number - be it a link, or just plain old text! if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) echo '', $title_prefix, $day['day'], ''; else echo '', $title_prefix, $day['day'], ''; // A lot of stuff, we're not showing on mini-calendars to conserve space. if ($is_mini === false) { // If this is the first day of a week and we're showing week numbers, go ahead and do so now. if ($day['is_first_day'] && !empty($context['tpl_show_week_num'])) echo ' - ', $txt['calendar_week'], ' ', $week['number'], ''; // Holidays are always fun, let's show them! if (!empty($day['holidays'])) echo '
', $txt['calendar_prompt'], ' ', implode(', ', $day['holidays']), '
'; // Happy Birthday Dear, Member! if (!empty($day['birthdays'])) { echo '
', $txt['birthdays'], ''; /* Each of the birthdays has: id, name (person), age (if they have one set?), and is_last. (last in list?) */ $use_js_hide = empty($context['show_all_birthdays']) && count($day['birthdays']) > 15; $birthday_count = 0; foreach ($day['birthdays'] as $member) { echo '', $member['name'], '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '', $member['is_last'] || ($count == 10 && $use_js_hide) ? '' : ', '; // 9...10! Let's stop there. if ($birthday_count == 10 && $use_js_hide) // !!TODO - Inline CSS and JavaScript should be moved. echo '...
(', sprintf($txt['calendar_click_all'], count($day['birthdays'])), ')
'; echo '
'; } // Any special posted events? if (!empty($day['events'])) { echo '
', $txt['events'], '
'; /* The events are made up of: title, href, is_last, can_edit (are they allowed to?), and modify_href. */ foreach ($day['events'] as $event) { // If they can edit the event, show an icon they can click on.... if ($event['can_edit']) { echo ' * '; } // Exporting! if ($event['can_export']) { echo ' > '; } echo $event['link'], $event['is_last'] ? '' : '
'; } echo '
'; } } $current_month_started = $count; } // Otherwise, assuming it's not a mini-calendar, we can show previous / next month days! elseif ($is_mini === false) { if ($current_month_started === false) echo '', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- + 1, ''; else echo '', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, ''; } // Close this day and increase var count. echo '
'; } // Or show a weekly one? function template_show_week_grid($grid_name) { global $context, $settings, $txt, $scripturl, $modSettings; // We might have no reason to proceed, if the variable isn't there. if (!isset($context['calendar_grid_' . $grid_name])) return false; // Handy pointer. $calendar_data = &$context['calendar_grid_' . $grid_name]; // At the very least, we have one month. Possibly two, though. $iteration = 1; $num_months = count($calendar_data['months']); foreach ($calendar_data['months'] as $month_data) { // For our first iteration, we'll add a nice header! if ($iteration == 1) { echo '

'; // Previous Week Link... if (empty($calendar_data['previous_calendar']['disabled']) && !empty($calendar_data['show_next_prev'])) { echo ' « '; } // The Month Title + Week Number... if (!empty($calendar_data['week_number'])) echo $txt['calendar_week'], ' ', $calendar_data['week_number'], ' - ', $month_data['current_year']; // Next Week Link... if (empty($calendar_data['next_calendar']['disabled']) && !empty($calendar_data['show_next_prev'])) { echo ' » '; } echo '

'; } // Our actual month... echo '
', $txt['months_titles'][$month_data['current_month']], '
'; // The main table grid for $this week. echo ' '; // Each day of the week. foreach ($month_data['days'] as $day) { // How should we be highlighted or otherwise not...? $classes = array('days'); $classes[] = !empty($calendar_data['size']) && $calendar_data['size'] == 'small' ? 'compact' : 'comfortable'; $classes[] = !empty($day['is_today']) ? 'calendar_today' : 'windowbg'; echo ' '; } // We'll show the lower column after our last month is shown. if ($iteration == $num_months) template_calendar_base(4); // Increase iteration for loop counting. ++$iteration; echo '
', $txt['calendar_day'], ' ', $txt['events'], ' ', $txt['calendar_prompt'], ' ', $txt['birthdays'], '
'; // Should the day number be a link? if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) echo '', $txt['days'][$day['day_of_week']], ' - ', $day['day'], ''; else echo $txt['days'][$day['day_of_week']], ' - ', $day['day']; echo ' '; // Show any events... if (!empty($day['events'])) { echo '
'; foreach ($day['events'] as $event) { // If they can edit the event, show a star they can click on.... if (!empty($event['can_edit'])) { echo ' * '; } // Can we export? Sweet. if (!empty($event['can_export'])) { echo ' > '; } echo $event['link'], $event['is_last'] ? '' : '
'; } echo '
*

'; } else { if (!empty($context['can_post'])) { echo ' '; } } echo '
'; // Show any holidays! if (!empty($day['holidays'])) echo implode('
', $day['holidays']); echo '
'; // Show any birthdays... if (!empty($day['birthdays'])) { foreach ($day['birthdays'] as $member) { echo ' ', $member['name'], ' ', isset($member['age']) ? ' (' . $member['age'] . ')' : '', ' ', $member['is_last'] ? '' : '
'; } } echo '
'; } } /* * Calendar Grid Base * * This function is ONLY designed for use * within an existing table element. * * @param int $col_span = 1 */ function template_calendar_base($col_span = 1) { global $context, $scripturl, $txt; echo ' ', template_button_strip($context['calendar_buttons'], 'right'), '

'; } // Template for posting a calendar event. function template_event_post() { global $context, $txt, $scripturl; // Start the javascript for drop down boxes... echo '
'; if (!empty($context['event']['new'])) echo ''; // Start the main table. echo '

', $context['page_title'], '

'; if (!empty($context['post_error']['messages'])) { echo '
', $context['error_type'] == 'serious' ? '' . $txt['error_while_submitting'] . '' : '', '
', implode('
', $context['post_error']['messages']), '
'; } echo '
', $txt['calendar_event_title'], '
', $txt['calendar_year'], ' ', $txt['calendar_month'], ' ', $txt['calendar_day'], '
'; if (!empty($modSettings['cal_allowspan']) || $context['event']['new']) echo '
', $txt['calendar_event_options'], '
    '; // If events can span more than one day then allow the user to select how long it should last. if (!empty($modSettings['cal_allowspan'])) { echo '
  • ', $txt['calendar_numb_days'], '
  • '; } // If this is a new event let the user specify which board they want the linked post to be put into. if ($context['event']['new']) { echo '
  • ', $txt['calendar_link_event'], '
  • ', $txt['calendar_post_in'], '
  • '; } if (!empty($modSettings['cal_allowspan']) || $context['event']['new']) echo '
'; echo ' '; // Delete button? if (empty($context['event']['new'])) echo ' '; echo '
'; } function template_bcd() { global $context, $scripturl; $alt = false; echo ' '; foreach ($context['clockicons'] as $t => $v) { echo ''; $alt = !$alt; } echo '
BCD Clock
'; foreach ($v as $i) { echo '
'; } echo '
Are you hardcore?
'; } function template_hms() { global $context, $scripturl; $alt = false; echo ' '; foreach ($context['clockicons'] as $t => $v) { echo ' '; $alt = !$alt; } echo '
Binary Clock
'; foreach ($v as $i) { echo ''; } echo '
Too tough for you?
'; echo ' '; } function template_omfg() { global $context; $alt = false; echo ' '; foreach ($context['clockicons'] as $t => $v) { echo ' '; $alt = !$alt; } echo '
OMFG Binary Clock
'; foreach ($v as $i) { echo ''; } echo '
'; echo ' '; } function template_thetime() { global $context; $alt = false; echo ' '; foreach ($context['clockicons'] as $v) { echo ' '; $alt = !$alt; } echo '
The time you requested
'; foreach ($v as $i) { echo ''; } echo '
'; } ?>