function sched_conf_entity_menu_setup($hook, $type, $return, $params)
{
    if (elgg_in_context('widgets')) {
        return $return;
    }
    elgg_load_library('elgg:sched_conf');
    $entity = $params['entity'];
    $entity = sched_conf_get_event_for_conference($entity->guid);
    $handler = elgg_extract('handler', $params, false);
    if ($handler != 'sched_conf') {
        return $return;
    }
    $user_guid = elgg_get_logged_in_user_guid();
    if (event_calendar_personal_can_manage($entity, $user_guid)) {
        if (event_calendar_has_personal_event($entity->guid, $user_guid)) {
            $options = array('name' => 'personal_calendar', 'text' => elgg_echo('event_calendar:remove_from_the_calendar_menu_text'), 'title' => elgg_echo('event_calendar:remove_from_my_calendar'), 'href' => elgg_add_action_tokens_to_url("action/event_calendar/remove_personal?guid={$entity->guid}"), 'priority' => 150);
            $return[] = ElggMenuItem::factory($options);
        } else {
            if (!event_calendar_is_full($entity->guid) && !event_calendar_has_collision($entity->guid, $user_guid)) {
                $options = array('name' => 'personal_calendar', 'text' => elgg_echo('event_calendar:add_to_the_calendar_menu_text'), 'title' => elgg_echo('event_calendar:add_to_my_calendar'), 'href' => elgg_add_action_tokens_to_url("action/event_calendar/add_personal?guid={$entity->guid}"), 'priority' => 150);
                $return[] = ElggMenuItem::factory($options);
            }
        }
    } else {
        if (!event_calendar_has_personal_event($entity->guid, $user_guid) && !check_entity_relationship($user_guid, 'event_calendar_request', $entity->guid)) {
            $options = array('name' => 'personal_calendar', 'text' => elgg_echo('event_calendar:make_request_title'), 'title' => elgg_echo('event_calendar:make_request_title'), 'href' => elgg_add_action_tokens_to_url("action/event_calendar/request_personal_calendar?guid={$entity->guid}"), 'priority' => 150);
            $return[] = ElggMenuItem::factory($options);
        }
    }
    $count = event_calendar_get_users_for_event($entity->guid, 0, 0, true);
    if ($count == 1) {
        $calendar_text = elgg_echo('event_calendar:personal_event_calendars_link_one');
    } else {
        $calendar_text = elgg_echo('event_calendar:personal_event_calendars_link', array($count));
    }
    $options = array('name' => 'calendar_listing', 'text' => $calendar_text, 'title' => elgg_echo('event_calendar:users_for_event_menu_title'), 'href' => "event_calendar/display_users/{$entity->guid}", 'priority' => 150);
    $return[] = ElggMenuItem::factory($options);
    /*if (elgg_is_admin_logged_in() && (elgg_get_plugin_setting('allow_featured', 'event_calendar') == 'yes')) {
    		if ($event->featured) {
    			add_submenu_item(elgg_echo('event_calendar:unfeature'), $CONFIG->url . "action/event_calendar/unfeature?event_id=".$event_id.'&'.event_calendar_security_fields(), 'eventcalendaractions');
    		} else {
    			add_submenu_item(elgg_echo('event_calendar:feature'), $CONFIG->url . "action/event_calendar/feature?event_id=".$event_id.'&'.event_calendar_security_fields(), 'eventcalendaractions');
    		}
    	}*/
    return $return;
}
Esempio n. 2
0
<?php

elgg_load_library('elgg:event_calendar');
$event_guid = get_input('guid', 0);
$event = get_entity($event_guid);
if (elgg_instanceof($event, 'object', 'event_calendar')) {
    $user_guid = elgg_get_logged_in_user_guid();
    if (!event_calendar_has_personal_event($event_guid, $user_guid)) {
        if (event_calendar_add_personal_event($event_guid, $user_guid)) {
            system_message(elgg_echo('event_calendar:add_to_my_calendar_response'));
        } else {
            register_error(elgg_echo('event_calendar:add_to_my_calendar_error'));
        }
    }
}
forward(REFERER);
<?php

// A non-admin / non-event-creator only sees the button if they have the event on his/her personal calendar
// and it is at most 15 minutes before the conference starts.
// The button is removed for everyone (even admins) one day after the event end time.
$event = $vars['event'];
if ($event) {
    elgg_load_library('elgg:event_calendar');
    $user_guid = elgg_get_logged_in_user_guid();
    $termination_time = strtotime("1 day", $event->real_end_time);
    if ($termination_time < time()) {
        $in_time_window = false;
    } else {
        if ($event->canEdit()) {
            $in_time_window = true;
        } else {
            if (event_calendar_has_personal_event($event->guid, $user_guid) && strtotime('-15 minutes', $event->start_date) <= time()) {
                $in_time_window = true;
            } else {
                $in_time_window = false;
            }
        }
    }
    if ($in_time_window) {
        $button = elgg_view('output/url', array('href' => 'action/event_calendar/join_conference?event_guid=' . $event->guid, 'text' => elgg_echo('event_calendar:join_conf_button'), 'class' => 'elgg-button elgg-button-action', 'target' => '_blank', 'is_action' => true));
        echo '<div class="event-calendar-conf-join-button">' . $button . '</div>';
    }
}
<?php

// A non-admin / non-event-creator only sees the button if they have the event on his/her personal calendar
// and it is at most 15 minutes before the conference starts.
// The button is removed for everyone (even admins) one day after the conference ends.
$conf = $vars['conf'];
if ($conf && $conf->application == 'bbb') {
    elgg_load_library('elgg:sched_conf');
    elgg_load_library('elgg:event_calendar');
    $user_guid = elgg_get_logged_in_user_guid();
    $event = sched_conf_get_event_for_conference($conf->guid);
    $termination_time = $event->real_end_time + 60 * 60 * 24;
    if ($termination_time < time()) {
        $in_time_window = FALSE;
    } else {
        if ($conf->canEdit()) {
            $in_time_window = TRUE;
        } else {
            if (event_calendar_has_personal_event($event->guid, $user_guid) && $event->start_date - 15 * 60 >= time()) {
                $in_time_window = TRUE;
            } else {
                $in_time_window = FALSE;
            }
        }
    }
    if ($in_time_window) {
        $button = elgg_view('output/url', array('href' => sched_conf_get_join_bbb_url($conf), 'text' => elgg_echo('sched_conf:join_conf_button'), 'class' => 'elgg-button elgg-button-action', 'target' => '_blank'));
        echo '<div class="sched-conf-join-button">' . $button . '</div>';
    }
}
Esempio n. 5
0
<?php

$event = $vars['event'];
$time_bit = '';
if (is_numeric($event->start_time)) {
    $time_bit = event_calendar_convert_time($event->start_time);
}
$date_bit = event_calendar_get_formatted_date($event->start_date);
if (event_calendar_has_personal_event($event->guid, elgg_get_logged_in_user_guid())) {
    $calendar_bit = 'checked = "checked"';
} else {
    $calendar_bit = '';
}
$info = '<tr>';
$info .= '<td class="event_calendar_paged_date">' . $date_bit . '</td>';
$info .= '<td class="event_calendar_paged_time">' . $time_bit . '</td>';
$info .= '<td class="event_calendar_paged_title"><a href="' . $event->getUrl() . '">' . $event->title . '</a></td>';
$info .= '<td class="event_calendar_paged_venue">' . $event->venue . '</td>';
if ($vars['personal_manage'] != 'no') {
    $info .= '<td class="event_calendar_paged_calendar"><input class="event_calendar_paged_checkbox" id="event_calendar_paged_checkbox_' . $event->guid . '" ' . $calendar_bit . ' type="checkbox" /></td>';
}
$info .= '</tr>';
echo $info;
Esempio n. 6
0
function event_calendar_add_personal_event($event_guid, $user_guid)
{
    if ($event_guid && $user_guid) {
        if (!event_calendar_has_personal_event($event_guid, $user_guid) && !event_calendar_has_collision($event_guid, $user_guid)) {
            if (!event_calendar_is_full($event_guid)) {
                add_entity_relationship($user_guid, 'personal_event', $event_guid);
                return TRUE;
            }
        }
    }
    return FALSE;
}
Esempio n. 7
0
/**
 * Add particular event calendar links/info to entity menu
 */
function event_calendar_entity_menu_setup($hook, $type, $return, $params)
{
    if (elgg_in_context('widgets')) {
        return $return;
    }
    $entity = $params['entity'];
    $handler = elgg_extract('handler', $params, false);
    if ($handler != 'event_calendar') {
        return $return;
    }
    if (elgg_is_active_plugin('event_poll') && $entity->canEdit() && $entity->schedule_type == 'poll') {
        $options = array('name' => 'schedule', 'text' => elgg_echo('event_poll:schedule_button'), 'title' => elgg_echo('event_poll:schedule_button'), 'href' => 'event_poll/vote/' . $entity->guid, 'priority' => 150);
        $return[] = ElggMenuItem::factory($options);
    }
    $user_guid = elgg_get_logged_in_user_guid();
    if ($user_guid) {
        $calendar_status = event_calendar_personal_can_manage($entity, $user_guid);
        if ($calendar_status == 'open') {
            if (event_calendar_has_personal_event($entity->guid, $user_guid)) {
                $options = array('name' => 'personal_calendar', 'text' => elgg_echo('event_calendar:remove_from_the_calendar_menu_text'), 'title' => elgg_echo('event_calendar:remove_from_my_calendar'), 'href' => elgg_add_action_tokens_to_url("action/event_calendar/remove_personal?guid={$entity->guid}"), 'priority' => 150);
                $return[] = ElggMenuItem::factory($options);
            } else {
                if (!event_calendar_is_full($entity->guid) && !event_calendar_has_collision($entity->guid, $user_guid)) {
                    $options = array('name' => 'personal_calendar', 'text' => elgg_echo('event_calendar:add_to_the_calendar_menu_text'), 'title' => elgg_echo('event_calendar:add_to_my_calendar'), 'href' => elgg_add_action_tokens_to_url("action/event_calendar/add_personal?guid={$entity->guid}"), 'priority' => 150);
                    $return[] = ElggMenuItem::factory($options);
                }
            }
        } else {
            if ($calendar_status == 'closed') {
                if (!event_calendar_has_personal_event($entity->guid, $user_guid) && !check_entity_relationship($user_guid, 'event_calendar_request', $entity->guid)) {
                    $options = array('name' => 'personal_calendar', 'text' => elgg_echo('event_calendar:make_request_title'), 'title' => elgg_echo('event_calendar:make_request_title'), 'href' => elgg_add_action_tokens_to_url("action/event_calendar/request_personal_calendar?guid={$entity->guid}"), 'priority' => 150);
                    $return[] = ElggMenuItem::factory($options);
                }
            }
        }
        $count = event_calendar_get_users_for_event($entity->guid, 0, 0, true);
        if ($count == 1) {
            $calendar_text = elgg_echo('event_calendar:personal_event_calendars_link_one');
        } else {
            $calendar_text = elgg_echo('event_calendar:personal_event_calendars_link', array($count));
        }
        $options = array('name' => 'calendar_listing', 'text' => $calendar_text, 'title' => elgg_echo('event_calendar:users_for_event_menu_title'), 'href' => "event_calendar/display_users/{$entity->guid}", 'priority' => 150);
        $return[] = ElggMenuItem::factory($options);
        if (elgg_get_plugin_setting('ical_import_export', 'event_calendar') == "yes") {
            $url = elgg_get_site_url() . 'action/event_calendar/export?filter=' . $entity->guid;
            $options = array('name' => 'ical_export', 'text' => elgg_view('output/img', array('src' => elgg_get_simplecache_url('event_calendar/ics.png'))), 'href' => elgg_add_action_tokens_to_url($url), 'priority' => 1000);
            $return[] = ElggMenuItem::factory($options);
        }
    }
    return $return;
}
Esempio n. 8
0
<?php

$event_guid = get_input('guid');
$event = get_entity($event_guid);
$container = get_entity($event->container_guid);
$user = $vars['entity'];
if ($container->canEdit()) {
    $has_event = event_calendar_has_personal_event($event->guid, $user->guid);
    $class_add = $has_event ? 'hidden' : '';
    $class_remove = $has_event ? '' : 'hidden';
    echo elgg_view('input/button', array('class' => "elgg-button-delete event-calendar-personal-calendar-toggle {$class_remove}", 'value' => elgg_echo('event_calendar:remove_from_the_calendar_button'), 'data-event-guid' => $event->guid, 'data-user-guid' => $user->guid));
    echo elgg_view('input/button', array('class' => "elgg-button-submit event-calendar-personal-calendar-toggle {$class_add}", 'value' => elgg_echo('event_calendar:add_to_the_calendar'), 'data-event-guid' => $event->guid, 'data-user-guid' => $user->guid));
}