diff options
-rw-r--r-- | models/model.php | 22 | ||||
-rw-r--r-- | show_events.php | 2 | ||||
-rw-r--r-- | start.php | 21 | ||||
-rw-r--r-- | views/default/event_calendar/forms/add_to_group.php | 18 | ||||
-rw-r--r-- | views/default/event_calendar/forms/manage_event.php | 2 |
5 files changed, 45 insertions, 20 deletions
diff --git a/models/model.php b/models/model.php index 04a168e55..dcc9506f3 100644 --- a/models/model.php +++ b/models/model.php @@ -491,7 +491,11 @@ function event_calendar_get_entities_from_metadata_between_related($meta_start_n } } $related_list = array(); - $related_events = get_entities_from_relationship("display_on_group", $container_guid, TRUE); + $related_events = elgg_get_entities_from_relationship(array( + 'relationship' => 'display_on_group', + 'relationship_guid' => $container_guid, + 'inverse_relationship' => TRUE, + )); if ($related_events) { foreach ($related_events as $event) { $related_list[$event->guid] = $event; @@ -719,7 +723,13 @@ function event_calendar_remove_personal_event($event_id,$user_id) { } function event_calendar_get_personal_events_for_user($user_id,$limit) { - $events = get_entities_from_annotations("object", "event_calendar", "personal_event", $user_id,0, 0, 1000); + $events = elgg_get_entities_from_annotations(array( + 'type' => 'object', + 'subtype' => 'event_calendar', + 'annotation_names' => 'personal_event', + 'annotation_value' => $user_id, + 'limit' => 1000, + )); $final_events = array(); if ($events) { $now = time(); @@ -759,7 +769,13 @@ function event_calendar_security_fields() { } function event_calendar_get_events_for_group($group_guid) { - return get_entities('object','event_calendar',0,"",0,0,false,0,$group_guid); + $options = array( + 'type' => 'object', + 'subtype' => 'event_calendar', + 'container_guid' => $group_guid, + 'limit' => 0, + ); + return elgg_get_entities($options); } function event_calendar_handle_join($event, $object_type, $object) { diff --git a/show_events.php b/show_events.php index 4d8f09702..d3cd8c76a 100644 --- a/show_events.php +++ b/show_events.php @@ -156,7 +156,7 @@ if ($filter == 'all') { $events = event_calendar_get_events_for_user_between($start_ts,$end_ts,false,$limit,$offset,$user_guid,$group_guid,$region); } -extend_view('metatags','event_calendar/metatags'); +elgg_extend_view('metatags','event_calendar/metatags'); $vars = array( 'original_start_date' => $original_start_date, 'start_date' => $start_date, @@ -33,8 +33,7 @@ register_entity_url_handler('event_calendar_url','object', 'event_calendar'); // Register granular notification for this type - if (is_callable('register_notification_object')) - register_notification_object('object', 'event_calendar', elgg_echo('event_calendar:new_event')); + register_notification_object('object', 'event_calendar', elgg_echo('event_calendar:new_event')); // Set up menu for users if (isloggedin()) { @@ -53,26 +52,24 @@ if (!$group_calendar || $group_calendar != 'no') { $group_profile_display = get_plugin_setting('group_profile_display', 'event_calendar'); if (!$group_profile_display || $group_profile_display == 'right') { - extend_view('groups/right_column', 'event_calendar/groupprofile_calendar'); + elgg_extend_view('groups/right_column', 'event_calendar/groupprofile_calendar'); } else if ($group_profile_display == 'left') { - extend_view('groups/left_column', 'event_calendar/groupprofile_calendar'); + elgg_extend_view('groups/left_column', 'event_calendar/groupprofile_calendar'); } } //add to the css - extend_view('css', 'event_calendar/css'); + elgg_extend_view('css', 'event_calendar/css'); //add a widget add_widget_type('event_calendar',elgg_echo("event_calendar:widget_title"),elgg_echo('event_calendar:widget:description')); // add the event calendar group tool option - if (function_exists('add_group_tool_option')) { - $event_calendar_group_default = get_plugin_setting('group_default', 'event_calendar'); - if (!$event_calendar_group_default || ($event_calendar_group_default == 'yes')) { - add_group_tool_option('event_calendar',elgg_echo('event_calendar:enable_event_calendar'),true); - } else { - add_group_tool_option('event_calendar',elgg_echo('event_calendar:enable_event_calendar'),false); - } + $event_calendar_group_default = get_plugin_setting('group_default', 'event_calendar'); + if (!$event_calendar_group_default || ($event_calendar_group_default == 'yes')) { + add_group_tool_option('event_calendar',elgg_echo('event_calendar:enable_event_calendar'),true); + } else { + add_group_tool_option('event_calendar',elgg_echo('event_calendar:enable_event_calendar'),false); } // if autogroup is set, listen and respond to join/leave events diff --git a/views/default/event_calendar/forms/add_to_group.php b/views/default/event_calendar/forms/add_to_group.php index fc77495e1..07e2e8b33 100644 --- a/views/default/event_calendar/forms/add_to_group.php +++ b/views/default/event_calendar/forms/add_to_group.php @@ -10,16 +10,28 @@ $event_container = $vars['event']->container_guid; // get the list of all groups: if (isadminloggedin()) { - $groups = get_entities("group","",0,"",5000); + $groups = elgg_get_entities(array( + 'type' => 'group', + 'limit' => 5000, + )); } else { - $groups = get_entities("group","",get_loggedin_userid(),"",5000); + $groups = elgg_get_entities(array( + 'type' => 'group', + 'owner_guid' => get_loggedin_userid(), + 'limit' => 5000, + )); } // split the group list into two lists $add_options = array(); $remove_options = array(); -$remove_group = get_entities_from_relationship("display_on_group",$event_id,FALSE,"","",0,"",5000); +$remove_group = elgg_get_entities_from_relationship(array( + 'relationship' => 'display_on_group', + 'relationship_guid' => $event_id, + 'inverse_relationship' => FALSE, + 'limit' => 5000, +)); $remove_group_ids = array(); foreach ($remove_group as $group) { $remove_group_ids[] = $group->guid; diff --git a/views/default/event_calendar/forms/manage_event.php b/views/default/event_calendar/forms/manage_event.php index 35b9dba71..f9d78e3f4 100644 --- a/views/default/event_calendar/forms/manage_event.php +++ b/views/default/event_calendar/forms/manage_event.php @@ -11,7 +11,7 @@ * */ -extend_view('metatags','event_calendar/metatags'); +elgg_extend_view('metatags','event_calendar/metatags'); $body = elgg_view('event_calendar/forms/manage_event_content',$vars); |