<?php elgg_load_library('elgg:event_poll'); $event = $vars['event']; $owner = $event->getOwnerEntity(); echo '<h3>' . elgg_echo('event_poll:vote_subtitle', array($event->title, $owner->name)) . '</h3>'; if ($event->event_poll) { $event_poll = unserialize($event->event_poll); if (is_array($event_poll) && count($event_poll) > 0) { if (!($current_schedule_slot = event_poll_get_current_schedule_slot($event)) || $event->canEdit()) { echo '<p class="mtm">' . elgg_echo('event_poll:vote_explanation') . '</p>'; echo elgg_view('input/hidden', array('name' => 'event_guid', 'value' => $event->guid)); $current_user = elgg_get_logged_in_user_entity(); $times_choices = event_poll_get_times($event->guid); $invitees = event_poll_get_invitees($event->guid); $voted_guids = event_poll_get_voted_guids($event->guid); $current_schedule_slot = event_poll_get_current_schedule_slot($event); $table_rows = event_poll_display_vote_table_header($event_poll); @(list($table_extra, $others) = event_poll_display_invitees($event_poll, $times_choices, $invitees, $voted_guids, $current_user->guid)); $table_rows .= $table_extra; // current user $table_rows .= '<tr><td class="event-poll-name-td">' . $current_user->name . '</td>'; foreach ($event_poll as $date) { $iso_date = $date['iso_date']; foreach ($date['times_array'] as $time) { $minutes = $time['minutes']; if ($minutes == '-') { $table_rows .= '<td class="event-poll-vote-current-td"> </td>'; } else { $name = "{$iso_date}__{$minutes}"; if (isset($times_choices[$current_user->guid]) && in_array($name, $times_choices[$current_user->guid])) {
<?php $guid = get_input('event_guid'); $message_option = get_input('message_option'); $message = get_input('message'); $event = get_entity($guid); if (elgg_instanceof($event, 'object', 'event_calendar') && $event->canEdit()) { $guids = array(); $invitees = event_poll_get_invitees($guid); if ($message_option == 'all') { foreach ($invitees as $user) { $guids[] = $user->guid; } } else { $voted_guids = event_poll_get_voted_guids($guid); foreach ($invitees as $user) { if (!in_array($user->guid, voted_guids)) { $guids[] = $user->guid; } } } $subject = elgg_echo('event_poll:schedule_message:subject', array($event->title)); $body = $message . "\n\n" . elgg_get_site_url() . 'event_poll/vote/' . $guid; $sender_guid = elgg_get_logged_in_user_guid(); notify_user($guids, $sender_guid, $subject, $body, array(), 'email'); foreach ($guids as $guid) { messages_send($subject, $body, $guid, $sender_guid, 0, false, false); } system_message(elgg_echo('event_poll:schedule_message:response')); forward($event->getURL()); } else {
function event_poll_resend_invitations($event) { $subject = elgg_echo('event_poll:reschedule_subject', array($event->title)); $body = elgg_echo('event_poll:reschedule_body'); $invitees = event_poll_get_invitees($event->guid); $guids = array(); foreach ($invitees as $invitee) { $guids[] = $invitee->guid; } $sender_guid = elgg_get_logged_in_user_guid(); $body .= "\n\n" . elgg_get_site_url() . 'event_poll/vote/' . $event->guid; if (is_array($invitees) && count($invitees) > 0) { // email invitees notify_user($guids, $sender_guid, $subject, $body, array(), 'email'); foreach ($guids as $guid) { messages_send($subject, $body, $guid, $sender_guid, 0, false, false); } } return true; }