aboutsummaryrefslogtreecommitdiff
path: root/start.php
diff options
context:
space:
mode:
Diffstat (limited to 'start.php')
-rw-r--r--start.php54
1 files changed, 51 insertions, 3 deletions
diff --git a/start.php b/start.php
index e838194f5..49312599f 100644
--- a/start.php
+++ b/start.php
@@ -16,6 +16,8 @@ elgg_register_event_handler('init','system','event_calendar_init');
function event_calendar_init() {
elgg_register_library('elgg:event_calendar', elgg_get_plugins_path() . 'event_calendar/models/model.php');
+
+ elgg_register_plugin_hook_handler('cron', 'fiveminute', 'event_calendar_handle_reminders_cron',400);
// Register a page handler, so we can have nice URLs
elgg_register_page_handler('event_calendar','event_calendar_page_handler');
@@ -64,14 +66,14 @@ function event_calendar_init() {
elgg_extend_view('css/elgg', 'event_calendar/css');
$event_calendar_listing_format = elgg_get_plugin_setting('listing_format', 'event_calendar');
- if ($event_calendar_listing_format == 'full') {
+ if (elgg_is_active_plugin('event_poll') || ($event_calendar_listing_format == 'full')) {
elgg_extend_view('css/elgg', 'fullcalendar/css');
$plugin_js = elgg_get_simplecache_url('js', 'event_calendar/fullcalendar');
elgg_register_js('elgg.full_calendar', $plugin_js);
}
//add a widget
- elgg_register_widget_type('event_calendar',elgg_echo("event_calendar:widget_title"),elgg_echo('event_calendar:widget:description'));
+ elgg_register_widget_type('event_calendar',elgg_echo("event_calendar:widget_title"),elgg_echo('event_calendar:widget:description'), 'all,groups');
// add the event calendar group tool option
$event_calendar_group_default = elgg_get_plugin_setting('group_default', 'event_calendar');
@@ -182,12 +184,16 @@ function event_calendar_page_handler($page) {
case 'view':
echo event_calendar_get_page_content_view($page[1]);
break;
+ case 'view_light_box':
+ echo event_calendar_get_page_content_view($page[1],TRUE);
+ break;
case 'display_users':
echo event_calendar_get_page_content_display_users($page[1]);
break;
case 'manage_users':
echo event_calendar_get_page_content_manage_users($page[1]);
break;
+ case 'schedule':
case 'add':
if (isset($page[1])) {
group_gatekeeper();
@@ -196,7 +202,7 @@ function event_calendar_page_handler($page) {
gatekeeper();
$group_guid = 0;
}
- echo event_calendar_get_page_content_edit($page_type,$group_guid);
+ echo event_calendar_get_page_content_edit($page_type,$group_guid,$page[2]);
break;
case 'edit':
gatekeeper();
@@ -265,6 +271,9 @@ function event_calendar_page_handler($page) {
gatekeeper();
echo event_calendar_get_page_content_review_requests($page[1]);
break;
+ case 'get_fullcalendar_events':
+ echo event_calendar_get_page_content_fullcalendar_events($page[1],$page[2],$page[3],$page[4]);
+ break;
default:
return FALSE;
}
@@ -284,6 +293,16 @@ function event_calendar_entity_menu_setup($hook, $type, $return, $params) {
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);
@@ -365,3 +384,32 @@ function event_calendar_entity_menu_prepare($hook, $type, $return, $params) {
return $return;
}
+
+function event_calendar_handle_join($event, $object_type, $object) {
+ elgg_load_library('elgg:event_calendar');
+ $group = $object['group'];
+ $user = $object['user'];
+ $user_guid = $user->getGUID();
+ $events = event_calendar_get_events_for_group($group->getGUID());
+ foreach ($events as $event) {
+ $event_id = $event->getGUID();
+ event_calendar_add_personal_event($event_id,$user_guid);
+ }
+}
+
+function event_calendar_handle_leave($event, $object_type, $object) {
+ elgg_load_library('elgg:event_calendar');
+ $group = $object['group'];
+ $user = $object['user'];
+ $user_guid = $user->getGUID();
+ $events = event_calendar_get_events_for_group($group->getGUID());
+ foreach ($events as $event) {
+ $event_id = $event->getGUID();
+ event_calendar_remove_personal_event($event_id,$user_guid);
+ }
+}
+
+function event_calendar_handle_reminders_cron() {
+ elgg_load_library('elgg:event_calendar');
+ event_calendar_queue_reminders();
+}