function make_event(&$event) { if ($this->dayobj->date == substr($event->start, 0, 10)) { $title = ec3_get_start_time(); // same day if ($this->dayobj->date == substr($event->end, 0, 10)) { $title .= ' - ' . ec3_get_end_time(); } else { $title .= '...'; } } else { if ($this->dayobj->date == substr($event->end, 0, 10)) { $title = '...' . ec3_get_end_time(); } else { $title .= '...' . __('all day', 'ec3') . '...'; } } return "\n\t " . '<p class="ec3_event"><a title="' . $title . '" href="' . get_permalink() . '">' . get_the_title() . '</a></p>'; }
/** Formats the schedule for the current post as one or more 'iconlets'. * Returns the HTML fragment as a string. */ function ec3_get_iconlets_active() { if (!ec3_is_event()) { return ''; } global $ec3; $result = ''; $current = false; $this_year = date('Y'); for ($evt = ec3_iter_post_events(); $evt->valid(); $evt->next()) { $year_start = ec3_get_start_date('Y'); $month_start = ec3_get_start_date('M'); $day_start = ec3_get_start_date('j'); // Don't bother about intra-day details. Empeche d'afficher plusieur fois le même jour. /*if($current==$day_start.$month_start.$year_start) continue;*/ $current = $day_start . $month_start . $year_start; // Grey-out past events. if ($ec3->event->active) { // Only put the year in if it isn't *this* year. if ($year_start != $this_year) { $month_start .= ' ’' . substr($year_start, 2); } // OK, make the iconlet. $result .= "<div class='ec3_iconlet'><table><tbody>"; if (!$ec3->event->allday) { // Event with start time. $time_start = ec3_get_start_time(); if (substr($ec3->event->start, 0, 10) < substr($ec3->event->end, 0, 10)) { $month_end = ec3_get_end_date('M'); $day_end = ec3_get_end_date('j'); $time_end = ec3_get_end_time(); $result .= "<tr class='ec3_month'>" . "<td class='ec3_multi_start'>{$month_start}</td>" . "<td class='ec3_multi_end'>{$month_end}</td></tr>"; $result .= "<tr class='ec3_day'>" . "<td class='ec3_multi_start'>{$day_start}</td>" . "<td class='ec3_multi_end'>{$day_end}</td></tr>"; $result .= "<tr class='ec3_time'>" . "<td>{$time_start}</td>" . "<td>{$time_end}</td></tr>"; } else { $result .= "<tr class='ec3_month'><td>{$month_start}</td></tr>" . "<tr class='ec3_day'><td>{$day_start}</td></tr>" . "<tr class='ec3_time'><td>{$time_start}</td></tr>"; } } elseif (substr($ec3->event->start, 0, 10) == substr($ec3->event->end, 0, 10)) { // Single, all-day event. $result .= "<tr class='ec3_month'><td>{$month_start}</td></tr>" . "<tr class='ec3_day'><td>{$day_start}</td></tr>"; } else { // Multi-day event. $month_end = ec3_get_end_date('M'); $day_end = ec3_get_end_date('j'); $result .= "<tr class='ec3_month'>" . "<td class='ec3_multi_start'>{$month_start}</td>" . "<td class='ec3_multi_end'>{$month_end}</td></tr>"; $result .= "<tr class='ec3_day'>" . "<td class='ec3_multi_start'>{$day_start}</td>" . "<td class='ec3_multi_end'>{$day_end}</td></tr>"; } //echo stripslashes($ec3->event->info_shed); if (!empty($ec3->event->info_shed)) { $bulle = stripslashes($ec3->event->info_shed); $result .= "<tr><td class='bulle'>{$bulle}</td></tr></tbody></table></div>\n"; } else { $result .= "</tbody></table></div>\n"; } } else { $result .= ""; } } return apply_filters('ec3_filter_iconlets_active', $result); }
/** Formats the schedule for the current post. * Returns the HTML fragment as a string. */ function ec3_get_schedule($format_single = EC3_DEFAULT_FORMAT_SINGLE, $format_range = EC3_DEFAULT_FORMAT_RANGE, $format_wrapper = EC3_DEFAULT_FORMAT_WRAPPER) { if (!ec3_is_event()) { return ''; } global $ec3; $result = ''; $date_format = get_option('date_format'); $time_format = get_option('time_format'); $current = false; for ($evt = ec3_iter_post_events(); $evt->valid(); $evt->next()) { $date_start = ec3_get_start_date(); $date_end = ec3_get_end_date(); $time_start = ec3_get_start_time(); $time_end = ec3_get_end_time(); if ($ec3->event->active) { $active = ''; } else { $active = 'ec3_past'; } if ($ec3->event->allday) { if ($date_start != $date_end) { $result .= sprintf($format_range, $date_start, $date_end, __('to', 'ec3'), $active); } elseif ($date_start != $current) { $current = $date_start; $result .= sprintf($format_single, $date_start, $active); } } else { if ($date_start != $date_end) { $current = $date_start; $result .= sprintf($format_range, "{$date_start} {$time_start}", "{$date_end} {$time_end}", __('to', 'ec3'), $active); } else { if ($date_start != $current) { $current = $date_start; $result .= sprintf($format_single, $date_start, $active); } if ($time_start == $time_end) { $result .= sprintf($format_single, $time_start, $active); } else { $result .= sprintf($format_range, $time_start, $time_end, __('to', 'ec3'), $active); } } } } return sprintf($format_wrapper, $result); }