예제 #1
0
/**
 * called on daily cron
 * build reminder annotations ahead of when we need them
 * 
 * @param type $hook
 * @param type $type
 * @param type $return
 * @param type $params
 */
function daily_build_reminders($hook, $type, $return, $params)
{
    $time = time();
    // get the largest reminder offset
    // @TODO - what if someone sets a stupid reminder for a year or something?
    // we don't want to be calculating all of those every day...
    $longest_reminder = Util::getLongestReminder();
    $longest_lookahead = Util::getDayEnd($time + $longest_reminder);
    $default_lookahead = Util::getDayEnd($time + Util::SECONDS_IN_A_DAY * 2);
    $reminder_lookahead = max(array($default_lookahead, $longest_lookahead));
    // get all events that are upcoming
    $events = Util::getAllEvents($time, $reminder_lookahead);
    foreach ($events as $event) {
        $event->buildReminders($time, $reminder_lookahead);
    }
}
예제 #2
0
<?php

namespace Events\UI;

$country = get_input('country');
$timezones = \Events\API\Util::getTimezonesByCountry();
if (!$country) {
    echo json_encode($timezones);
    return;
}
$country = strtoupper($country);
$country_timezones = elgg_extract($country, $timezones);
echo json_encode($country_timezones);
예제 #3
0
/**
 * Send reminder notifications to users based on their notification settings
 * @todo if there are a *lot* of recipients we should somehow break this off into parallel threads
 * 
 * @param Event $event Event
 * @return void
 */
function send_event_reminder($event, $remindertime = null)
{
    $force_send = true;
    if ($remindertime === null) {
        $remindertime = time();
        $force_send = false;
        // default cron send
    }
    $dbprefix = elgg_get_config('dbprefix');
    $options = array('type' => 'object', 'subtype' => 'calendar', 'relationship' => Calendar::EVENT_CALENDAR_RELATIONSHIP, 'relationship_guid' => $event->guid, 'joins' => array("JOIN {$dbprefix}users_entity ue ON e.container_guid = ue.guid"), 'limit' => false);
    $calendars = new ElggBatch('elgg_get_entities_from_relationship', $options);
    $starttimestamp = $event->getNextOccurrence($remindertime);
    $endtimestamp = $starttimestamp + $event->delta;
    // prevent sending if it was in the past, unless this is a forced reminder
    if (!$force_send && $starttimestamp < strtotime('-10 minutes')) {
        return true;
    }
    $owner = $event->getOwnerEntity();
    $owner_link = elgg_view('output/url', array('text' => $owner->name, 'href' => $owner->getURL()));
    $in_group = '';
    $in_group_link = '';
    $container = $event->getContainerEntity();
    $container_link = elgg_view('output/url', array('text' => $container->name, 'href' => $container->getURL()));
    if ($container instanceof \ElggGroup) {
        $in_group = elgg_echo('events:notify:subject:ingroup', array($container->name));
        $in_group_link = elgg_echo('events:notify:subject:ingroup', array($container_link));
    }
    $event_link = elgg_view('output/url', array('text' => $event->title, 'href' => $event->getURL()));
    $notified = array();
    // users could have multiple calendars
    foreach ($calendars as $calendar) {
        $user = $calendar->getContainerEntity();
        if (in_array($user->guid, $notified)) {
            continue;
        }
        $ia = elgg_set_ignore_access(false);
        if (!has_access_to_entity($event, $user)) {
            error_log($user->username . ' does not have access to ' . $event->guid);
            // the user can't see it, lets not notify them
            $notified[] = $user->guid;
            elgg_set_ignore_access($ia);
            continue;
        }
        elgg_set_ignore_access($ia);
        $notify_self = false;
        // support for notify self
        if (is_callable('notify_self_should_notify')) {
            $notify_self = notify_self_should_notify($user);
        }
        if (elgg_get_logged_in_user_guid() == $user->guid && !$notify_self) {
            $notified[] = $user->guid;
            continue;
        }
        $methods = get_calendar_notification_methods($user, 'eventreminder');
        if (!$methods) {
            $notified[] = $user->guid;
            continue;
        }
        $timezone = Util::getClientTimezone($user);
        $dt = new DateTime(null, new DateTimeZone($timezone));
        $dt->modify("{$event->start_date} {$event->start_time}");
        $original_subject = elgg_echo('event:notify:eventreminder:subject', array($event->title, $in_group, $dt->format('D, F j g:ia T')));
        $original_message = elgg_echo('event:notify:eventreminder:message', array($event_link, $in_group_link, elgg_view('output/events_ui/date_range', array('start' => $starttimestamp, 'end' => $endtimestamp, 'timezone' => $timezone)), $event->location, $event->description));
        $params = array('event' => $event, 'entity' => $event, 'calendar' => $calendar, 'user' => $user, 'starttime' => $starttimestamp, 'endtime' => $endtimestamp);
        $subject = elgg_trigger_plugin_hook('events_ui', 'subject:eventreminder', $params, $original_subject);
        $message = elgg_trigger_plugin_hook('events_ui', 'message:eventreminder', $params, $original_message);
        notify_user($user->guid, $event->container_guid, $subject, $message, array(), $methods);
        $notified[] = $user->guid;
    }
}
예제 #4
0
 /**
  * Returns an array of timezones by country
  * @return array
  */
 public static function getTimezonesByCountry()
 {
     $timezones = array();
     $tz_ids = array_keys(self::getTimezones(true, false, 'now', self::TIMEZONE_SORT_OFFSET));
     foreach ($tz_ids as $tz_id) {
         if ($tz_id == Util::UTC) {
             continue;
         }
         $info = Util::getTimezoneInfo($tz_id);
         $cc = $info->country_code;
         $abbr = $info->abbr;
         if (!isset($timezones[$cc])) {
             $timezones[$cc] = array();
         }
         $timezones[$cc][] = $info;
     }
     ksort($timezones);
     return $timezones;
 }
예제 #5
0
</div>
<?php 
if (elgg_get_plugin_setting('timezone_picker', 'events_ui')) {
    ?>
	<div class="events-ui-row">
		<label><?php 
    echo elgg_echo('events:edit:label:timezone');
    ?>
</label>
		<?php 
    echo elgg_view('input/timezone', array('name' => 'timezone', 'value' => $entity->timezone ?: Util::getClientTimezone()));
    ?>
	</div>
	<?php 
} else {
    elgg_echo('input/hidden', array('name' => 'timezone', 'value' => Util::getClientTimezone()));
}
?>
<div class="events-ui-row">
	<ul class="elgg-menu elgg-menu-hz">
		<?php 
//		<li>
//			<label>
//
//				echo elgg_view('input/checkbox', array(
//					'name' => 'all_day',
//					'value' => 1,
//					'checked' => $entity->all_day ? true : false
//				));
//				echo elgg_echo('events_ui:allday');
//
예제 #6
0
<?php

namespace Events\UI;

use Events\API\Util;
$tz = Util::getClientTimezone();
echo "elgg.config.timezone='{$tz}';";
예제 #7
0
<?php

namespace Events\UI;

use Events\API\Util;
$entity = elgg_extract('entity', $vars);
echo '<div>';
echo '<label>' . elgg_echo('events:settings:sitecalendar:enable') . '</label>';
echo elgg_view('input/dropdown', array('name' => "params[sitecalendar]", 'value' => (int) $entity->sitecalendar, 'options_values' => array(1 => elgg_echo('option:yes'), 0 => elgg_echo('option:no'))));
echo '</div>';
echo '<h3>' . elgg_echo('events:settings:timezone') . '</h3>';
echo '<p class="elgg-text-help">' . elgg_echo('events:settings:timezone:help') . '</p>';
$timezones = Util::getTimezones(false, Util::TIMEZONE_FORMAT_FULL, time(), Util::TIMEZONE_SORT_OFFSET);
echo '<div>';
echo '<label>' . elgg_echo('events:settings:timezone:picker') . '</label>';
echo elgg_view('input/dropdown', array('name' => "params[timezone_picker]", 'value' => $entity->timezone_picker, 'options_values' => array(true => elgg_echo('option:yes'), false => elgg_echo('option:no'))));
echo '</div>';
echo '<div>';
echo '<label>' . elgg_echo('events:settings:timezone:default') . '</label>';
echo elgg_view('input/dropdown', array('name' => "params[default_timezone]", 'value' => $entity->default_timezone, 'options_values' => $timezones));
echo '</div>';
echo '<div>';
echo '<label>' . elgg_echo('events:settings:timezone:config') . '</label>';
echo elgg_view('input/checkboxes', array('options' => array_flip($timezones), 'name' => "params[custom_timezones]", 'value' => isset($entity->custom_timezones) ? unserialize($entity->custom_timezones) : array_keys($timezones)));
echo '</div>';
echo '<div>';
echo '<label>' . elgg_echo('events:settings:ical:help_page_url') . '</label>';
echo elgg_view('input/text', array('name' => "params[ical_help_page_url]", 'value' => $entity->ical_help_page_url));
echo '</div>';
예제 #8
0
namespace Events\UI;

use Events\API\Calendar;
use Events\API\Util;
use Events\API\PAM;
$is_logged_in = elgg_is_logged_in();
$guid = get_input('guid');
$consumer = get_input('consumer');
if (!$is_logged_in) {
    $token = get_input('token');
    $user_guid = get_input('uid');
    try {
        PAM::authenticate();
    } catch (Exception $ex) {
        register_error($ex->getMessage());
        forward('', '403');
    }
}
$entity = get_entity($guid);
if (!$entity instanceof Calendar) {
    forward('', '404');
}
$start = (int) get_input('start', time());
$end = (int) get_input('end', strtotime('+1 month', $start));
$start = (int) Util::getDayStart($start);
$end = (int) Util::getDayEnd($end);
$events = $entity->getAllEventInstances($start, $end, true, $consumer);
echo json_encode($events);
if (!$is_logged_in) {
    logout();
}
예제 #9
0
 /**
  * Returns all event occurrences (one-time and recurring) in a given time range
  * To prevent memory leaks, the return is a sorted array formatted as:
  * <code>
  *  array(
  *   0 => array(
  *    'id' => $guid,
  *    'start' => $start_time,
  *    'end' => $end_time,
  *    'title' => $title,
  *    'description' => $description,
  *    'url' => $url,
  *    ...
  *   ),
  *  );
  * </code>
  *
  * @param int    $starttime Range start timestamp
  * @param int    $endtime   Range end timestamp
  * @param bool   $export    Export EventInstance objects to array
  * @param string $consumer  Consumer name (passed to the export hook, so plugins can decide on exportable values)
  * @return EventsInstance[]|array
  */
 public function getAllEventInstances($starttime = null, $endtime = null, $export = true, $consumer = '', $tz = null)
 {
     $instances = array();
     if (!Util::isValidTimezone($tz)) {
         if (elgg_is_logged_in()) {
             // if logged in use the timezone settings of the current user
             $tz = Util::getClientTimezone();
         } else {
             // use timezone of calendar owner
             $tz = Util::getClientTimezone($this->getOwnerEntity());
         }
     }
     $events = $this->getAllEvents($starttime, $endtime);
     foreach ($events as $event) {
         /* @var $event Event */
         if (!$event instanceof Event) {
             continue;
         }
         $start_times = $event->getStartTimes($starttime, $endtime, $tz);
         foreach ($start_times as $start_time) {
             $instance = new EventInstance($event, $start_time);
             $instance->setCalendar($this);
             $instances[] = $instance;
         }
     }
     usort($instances, array($this, 'compareInstancesByStartTime'));
     if ($export) {
         foreach ($instances as $key => $instance) {
             $instances[$key] = $instance->export($consumer);
         }
     }
     return $instances;
 }
예제 #10
0
 /**
  * @dataProvider providerTestConvert
  */
 public function testGetOffset($ts, $timezone, $target_timezone, $expected)
 {
     $this->assertEquals($expected, $this->util->getOffset($ts, $timezone, $target_timezone));
 }
예제 #11
0
<?php

/**
 * Allows users to select their preferred timezone
 */
namespace Events\UI;

use Events\API\Util;
$user = elgg_get_page_owner_entity();
if ($user) {
    $title = elgg_echo('user:set:timezone');
    $content = '<label>' . elgg_echo('user:timezone:label') . '</label>';
    $content .= elgg_view("input/timezone", array('name' => 'timezone', 'value' => Util::getClientTimezone($user)));
    echo elgg_view_module('info', $title, $content);
}
예제 #12
0
<?php

namespace Events\UI;

use DateTime;
use DateTimeZone;
use Events\API\Util;
$start = (int) Util::getMonthStart((int) get_input('event_widget_start', time()));
$dt = new DateTime(null, new DateTimeZone(Util::UTC));
$prev_start = $dt->setTimestamp($start)->modify('-1 month')->getTimestamp();
$next_start = $dt->setTimestamp($start)->modify('+1 month')->getTimestamp();
$prev = elgg_view('output/url', array('text' => '<<', 'href' => '#', 'class' => 'elgg-button elgg-button-action events-widget-nav', 'data-guid' => $vars['entity']->guid, 'data-start' => $prev_start));
if ($prev_start < $now && $start < $now && $vars['entity']->upcoming) {
    $prev = '&nbsp;';
}
$next = elgg_view('output/url', array('text' => '>>', 'href' => '#', 'class' => 'elgg-button elgg-button-action events-widget-nav float-alt', 'data-guid' => $vars['entity']->guid, 'data-start' => $next_start));
$current = $dt->setTimestamp($start)->format('F');
?>
<div class="row clearfix mbm">
	<div class="elgg-col elgg-col-1of3">
		<?php 
echo $prev;
?>
	</div>
	<div class="elgg-col elgg-col-1of3 center pts">
		<h3><?php 
echo $current;
?>
</h3>
	</div>
	<div class="elgg-col elgg-col-1of3">
예제 #13
0
?>
		</div>
	</div>
	<div class="events-ui-row" data-frequency="<?php 
echo Util::FREQUENCY_WEEKLY;
?>
" class="hidden">
		<div class="elgg-col elgg-col-1of4 events-ui-label">
			<?php 
echo elgg_echo('repeat_ui:repeat_weekly_days');
?>
		</div>
		<div class="elgg-col elgg-col-3of4">
			<?php 
$weekdays_options = array();
$weekdays = Util::getWeekdays();
foreach ($weekdays as $weekday) {
    $label = substr(elgg_echo("events:wd:{$weekday}"), 0, 3);
    $weekdays_options[$label] = $weekday;
}
if (!$vars['repeat_weekly_days']) {
    $vars['repeat_weekly_days'] = $entity ? date('D', $entity->getStartTimestamp()) : array();
}
$value = $entity ? $entity->repeat_weekly_days : $vars['repeat_weekly_days'];
$value = !is_array($value) ? array($value) : $value;
echo elgg_view('input/checkboxes', array('name' => 'repeat_weekly_days', 'value' => $value, 'align' => 'horizontal', 'default' => '', 'options' => $weekdays_options));
?>
		</div>
	</div>
	<div class="events-ui-row">
		<div class="elgg-col elgg-col-1of4 events-ui-label">
예제 #14
0
}
$entity = get_entity($guid);
if (!$entity instanceof Calendar) {
    forward('', '404');
}
$owner = $entity->getOwnerEntity();
elgg_set_page_owner_guid($owner->guid);
//elgg_push_breadcrumb(elgg_echo('events:calendar'), "calendar/all");
elgg_push_breadcrumb($owner->name, "calendar/owner/{$owner->username}");
elgg_push_breadcrumb($entity->getDisplayName());
$start = (int) get_input('start', time());
$start = (int) Util::getMonthStart($start);
$end = (int) Util::getMonthEnd($start);
$timezone = Util::getClientTimezone();
$start_local = $start - Util::getOffset($start, Util::UTC, $timezone);
$end_local = $end - Util::getOffset($end, Util::UTC, $timezone);
$events = $entity->getAllEventInstances($start_local, $end_local);
if (!$is_logged_in) {
    logout();
}
elgg_register_menu_item('title', array('name' => 'calendar_view', 'href' => elgg_http_add_url_query_elements("calendar/view/{$entity->guid}", array('start' => $start, 'end' => $end)), 'text' => elgg_echo('events:view:calendar'), 'title' => elgg_echo('events:view:calendar:switch'), 'link_class' => 'elgg-button elgg-button-action'));
elgg_register_menu_item('title', array('name' => 'ical_view', 'href' => $entity->getIcalURL("calendar/ical/{$entity->guid}/calendar{$entity->guid}.ics", array()), 'text' => elgg_echo('events:view:ical'), 'title' => elgg_echo('events:view:ical'), 'link_class' => 'elgg-button elgg-button-action js-events-ui-ical-modal-trigger'));
$dt = new DateTime(null, new DateTimeZone(Util::UTC));
$prev_start = $dt->setTimestamp($start)->modify('-1 month')->getTimestamp();
$next_start = $dt->setTimestamp($start)->modify('+1 month')->getTimestamp();
elgg_register_menu_item('title', array('name' => 'prev_month', 'text' => "&laquo;&nbsp;" . $dt->setTimestamp($prev_start)->format('F'), 'href' => elgg_http_add_url_query_elements("calendar/feed/{$entity->guid}", array('start' => $prev_start)), 'link_class' => 'elgg-button elgg-button-action mlm', 'priority' => 100));
elgg_register_menu_item('title', array('name' => 'next_month', 'text' => $dt->setTimestamp($next_start)->format('F') . "&nbsp;&raquo;", 'href' => elgg_http_add_url_query_elements("calendar/feed/{$entity->guid}", array('start' => $next_start)), 'link_class' => 'elgg-button elgg-button-action', 'priority' => 101));
$title = elgg_echo('events:feed:month', array($dt->setTimestamp($start)->format('F')));
$content = elgg_view('events_ui/feed', array('events' => $events));
$layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'sidebar' => false, 'filter' => false, 'entity' => $entity));
echo elgg_view_page($title, $layout, 'default', array('entity' => $entity));
예제 #15
0
 */
namespace Events\UI;

use DateTime;
use DateTimeZone;
use Events\API\Util;
$start = (int) elgg_extract('start', $vars);
$end = (int) elgg_extract('end', $vars);
$timezone = elgg_extract('timezone', $vars, Util::UTC);
if (!$start || !$end) {
    return;
}
if (!$vars['user']) {
    $vars['user'] = elgg_get_logged_in_user_entity();
}
$client_tz = Util::getClientTimezone($vars['user']);
$dt_start = new DateTime("@{$start}", new DateTimeZone($timezone));
$start_at_org_tz = $dt_start->format('D, F j, Y H:ia T');
$dt_start->setTimezone(new DateTimeZone($client_tz));
$dt_end = new DateTime("@{$end}", new DateTimeZone($timezone));
$end_at_org_tz = $dt_end->format('D, F j, Y H:ia T');
$dt_end->setTimezone(new DateTimeZone($client_tz));
$output = '';
if ($dt_start->format('Y-m-d') == $dt_end->format('Y-m-d')) {
    if (date('Y') == $dt_start->format('Y')) {
        $output .= $dt_start->format('D, F j');
    } else {
        $output .= $dt_start->format('D, F j, Y');
    }
    $output .= ', ' . $dt_start->format('g:ia') . ' - ' . $dt_end->format('g:ia');
} else {
예제 #16
0
/**
 * Callback that fires on add_to_calendar event
 *
 * @param string $event  "events_api"
 * @param string $type   "add_to_calendar"
 * @param array  $params Event params
 * @return boolean
 */
function add_to_calendar($event, $type, $params)
{
    $event = $params['event'];
    $calendar = $params['calendar'];
    if (!$event instanceof Event || !$calendar instanceof $calendar) {
        return true;
    }
    $user = $calendar->getContainerEntity();
    if (!$user instanceof ElggUser) {
        return true;
    }
    $ia = elgg_set_ignore_access(false);
    if (!has_access_to_entity($event, $user)) {
        // the user can't see it, lets not notify them
        elgg_set_ignore_access($ia);
        return true;
    }
    elgg_set_ignore_access($ia);
    // notify the user
    $notify_self = false;
    // support for notify self
    if (is_callable('notify_self_should_notify')) {
        $notify_self = notify_self_should_notify($user);
    }
    if (elgg_get_logged_in_user_guid() == $user->guid && !$notify_self) {
        return true;
    }
    $methods = get_calendar_notification_methods($user, 'addtocal');
    if (!$methods) {
        return true;
    }
    $owner = $event->getOwnerEntity();
    $owner_link = elgg_view('output/url', array('text' => $owner->name, 'href' => $owner->getURL()));
    $in_group = '';
    $in_group_link = '';
    $container = $event->getContainerEntity();
    $container_link = elgg_view('output/url', array('text' => $container->name, 'href' => $container->getURL()));
    if ($container instanceof \ElggGroup) {
        $in_group = elgg_echo('events:notify:subject:ingroup', array($container->name));
        $in_group_link = elgg_echo('events:notify:subject:ingroup', array($container_link));
    }
    $event_link = elgg_view('output/url', array('text' => $event->title, 'href' => $event->getURL()));
    $subject = elgg_echo('event:notify:addtocal:subject', array($event->title, $in_group, $owner->name));
    $timezone = Util::getClientTimezone($user);
    $message = elgg_echo('event:notify:addtocal:message', array($owner_link, $event_link, $in_group_link, elgg_view('output/events_ui/date_range', array('start' => $event->getStartTimestamp(), 'end' => $event->getEndTimestamp(), 'timezone' => $timezone)), $event->location, $event->description));
    $params = array('event' => $event, 'entity' => $event, 'calendar' => $calendar, 'user' => $user);
    $subject = elgg_trigger_plugin_hook('events_ui', 'subject:addtocal', $params, $subject);
    $message = elgg_trigger_plugin_hook('events_ui', 'message:addtocal', $params, $message);
    $params = array();
    if ($event->canComment($user->guid)) {
        $params = array('entity' => $event);
    }
    notify_user($user->guid, $event->container_guid, $subject, $message, $params, $methods);
}
예제 #17
0
/**
 * Filter default timezones to only include those specified in plugin settings
 *
 * @param string $hook   "timezones"
 * @param string $type   "events_api"
 * @param array  $return Current list of timezones
 * @param array  $params Additional params
 * @return array Filtered list
 */
function filter_timezones($hook, $type, $return, $params)
{
    $setting = elgg_get_plugin_setting('custom_timezones', 'events_ui');
    $custom = $setting ? unserialize($setting) : false;
    if (!empty($custom)) {
        $default = Util::getClientTimezone();
        foreach ($return as $key => $value) {
            if (!in_array($key, $custom) && $key !== $default) {
                unset($return[$key]);
            }
        }
    }
    return $return;
}
예제 #18
0
<?php

/**
 * Display a timezone input
 */
namespace Events\UI;

use Events\API\Util;
elgg_load_js('events/timezone');
$name = elgg_extract('name', $vars, 'timezone');
$value = elgg_extract('value', $vars, Util::getClientTimezone());
$this_timezone = Util::getTimezoneInfo($value);
$this_country_code = $this_timezone->country_code;
$timezones = Util::getTimezonesByCountry();
$country_options = array();
$timezone_options = array();
foreach ($timezones as $country_code => $country_timezones) {
    $country_options[$country_code] = elgg_echo("timezone:country:{$country_code}");
    if ($country_code == $this_country_code) {
        foreach ($country_timezones as $country_timezone) {
            $timezone_options[$country_timezone->id] = $country_timezone->label;
        }
    }
}
asort($country_options);
?>
<div class="elgg-input-timezone clearfix">
	<div class="elgg-col elgg-col-1of3">
		<?php 
echo elgg_view('input/dropdown', array('data-timezone-country' => $this_country_code, 'value' => $this_country_code, 'options_values' => $country_options));
?>
예제 #19
0
 public function getRecurringDescription($viewer = null)
 {
     if (!$this->isRecurring()) {
         return elgg_echo('events_ui:repeat:once');
     }
     if ($viewer === null) {
         $viewer = elgg_get_logged_in_user_entity();
     }
     $c_timezone = Util::getClientTimezone($viewer);
     $timezone = $this->timezone ? $this->timezone : Util::UTC;
     $dt_start = new DateTime("@{$this->start_timestamp}", new DateTimeZone($timezone));
     $dt_start->setTimezone(new DateTimeZone($c_timezone));
     $description = elgg_echo('events_ui:repeat:' . $this->repeat_frequency);
     switch ($this->repeat_frequency) {
         case 'monthly':
             if ($this->repeat_monthly_by == 'day_of_month') {
                 $description .= elgg_echo('repeat_ui:repeat_monthly_by:day_of_month:date', array($dt_start->format('jS')));
             } else {
                 $day = $dt_start->format('j');
                 $weeknum = ceil($day / 7);
                 $weekday = elgg_echo('events:wd:' . $dt_start->format('D'));
                 $suffix = str_replace($weeknum, '', date('jS', mktime(12, 0, 0, 04, $weeknum, 2015)));
                 $description .= elgg_echo('repeat_ui:repeat_monthly_by:day_of_month:weekday', array($weeknum . $suffix, $weekday));
             }
             break;
         case 'weekly':
             $weekdays = array_map(function ($val) {
                 return elgg_echo('events:wd:' . $val);
             }, (array) $this->repeat_weekly_days);
             $description .= elgg_echo('repeat_ui:repeat:weekly:weekday', array(implode(', ', $weekdays)));
             break;
     }
     return $description;
 }