function event_calendar_get_formatted_time($event) { $date_format = 'j M Y'; $event_calendar_times = elgg_get_plugin_setting('times', 'event_calendar') != 'no'; $start_date = date($date_format, $event->start_date); if ($event->end_date) { $end_date = date($date_format, $event->end_date); } if (!$event->end_date || $end_date == $start_date) { if ($event_calendar_times) { $start_date = event_calendar_format_time($start_date, $event->start_time, $event->end_time); } $time_bit = $start_date; } else { if ($event_calendar_times) { $start_date = event_calendar_format_time($start_date, $event->start_time); $end_date = event_calendar_format_time($end_date, $event->end_time); } $time_bit = "{$start_date} - {$end_date}"; } return $time_bit; }
function event_calendar_get_formatted_time($event) { if (!$event->start_date) { return ''; } $date_format = 'j M Y'; $event_calendar_times = elgg_get_plugin_setting('times', 'event_calendar') != 'no'; $start_date = date($date_format, $event->start_date); if ($event->end_date) { $end_date = date($date_format, $event->end_date); } if (!$event->end_date || $end_date == $start_date) { if (!$event->all_day && $event_calendar_times) { $start_date = event_calendar_format_time($start_date, $event->start_time, $event->end_time); } $time_bit = $start_date; } else { if (!$event->all_day && $event_calendar_times) { $start_date = event_calendar_format_time($start_date, $event->start_time); $end_date = event_calendar_format_time($end_date, $event->end_time); } $time_bit = "{$start_date} - {$end_date}"; } if ($event->repeats == 'yes') { $dow = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'); $r = array(); foreach ($dow as $w) { $fn = 'event-calendar-repeating-' . $w . '-value'; if ($event->{$fn}) { $r[] = elgg_echo('event_calendar:dow:full:' . $w); } } $week_bit = implode(", ", $r); if ($event->repeat_interval > 1) { $week_bit .= ' ' . elgg_echo('event_calendar:repeated_event:week_interval', array($event->repeat_interval)); } else { $week_bit .= ' ' . elgg_echo('event_calendar:repeated_event:week_single'); } $time_bit = elgg_echo('event_calendar:repeated_event:format', array($time_bit, $week_bit)); } return $time_bit; }