aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authorKevin Jardine <kevinjardine@yahoo.com>2012-01-27 15:09:49 +0100
committerKevin Jardine <kevinjardine@yahoo.com>2012-01-27 15:09:49 +0100
commit3e1e4d60de443a067aeb18f2873f5e35b4a5f4e2 (patch)
treeef4dfa81079ffa0b7848e6cf9e8155c645d0fdb8 /models
parent2a3e34d1c5724b29a4f2404081f30b425fcdee50 (diff)
downloadelgg-3e1e4d60de443a067aeb18f2873f5e35b4a5f4e2.tar.gz
elgg-3e1e4d60de443a067aeb18f2873f5e35b4a5f4e2.tar.bz2
removed two deprecated function calls
Diffstat (limited to 'models')
-rw-r--r--models/model.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/models/model.php b/models/model.php
index 90f20fba3..ad0bde1a9 100644
--- a/models/model.php
+++ b/models/model.php
@@ -699,8 +699,9 @@ function event_calendar_has_personal_event($event_guid,$user_guid) {
return TRUE;
} else {
// use old method for now
- $annotations = get_annotations($event_guid, "object", "event_calendar", "personal_event", (int) $user_guid, $user_guid);
- if ($annotations && count($annotations) > 0) {
+ $options = array('guid'=>$event_guid,'annotation_name' => 'personal_event', 'annotation_value' => $user_guid,'count'=>TRUE);
+ //$annotations = get_annotations($event_guid, "object", "event_calendar", "personal_event", (int) $user_guid, $user_guid);
+ if (elgg_get_annotations($options)) {
return TRUE;
} else {
return FALSE;
@@ -774,6 +775,9 @@ function event_calendar_get_personal_events_for_user($user_guid,$limit) {
return array_slice($sorted,0,$limit);
}
+// the old way used annotations, and the new Elgg 1.8 way uses relationships
+// for now this version attempts to bridge the gap by using both methods for older sites
+
function event_calendar_get_users_for_event($event_guid,$limit,$offset,$is_count) {
$options = array(
'type' => 'user',
@@ -783,13 +787,28 @@ function event_calendar_get_users_for_event($event_guid,$limit,$offset,$is_count
'limit' => 0,
);
if ($is_count) {
- $count_old_way = count_annotations($event_guid, "object", "event_calendar", "personal_event");
+ //$count_old_way = count_annotations($event_guid, "object", "event_calendar", "personal_event");
+ $count_old_way = elgg_get_annotations(array(
+ 'guid'=>$event_guid,
+ 'type'=>"object",
+ 'subtype'=>"event_calendar",
+ 'annotation_name' => "personal_event",
+ 'count'=>TRUE)
+ );
$options ['count'] = TRUE;
$count_new_way = elgg_get_entities_from_relationship($options);
return $count_old_way + $count_new_way;
} else {
$users_old_way = array();
- $annotations = get_annotations($event_id, "object", "event_calendar", "personal_event", "", 0, $limit, $offset);
+ //$annotations = get_annotations($event_id, "object", "event_calendar", "personal_event", "", 0, $limit, $offset);
+ $annotations = elgg_get_annotations(array(
+ 'guid'=>$event_guid,
+ 'type'=>"object",
+ 'subtype'=>"event_calendar",
+ 'annotation_name' => "personal_event",
+ 'limit' => $limit,
+ 'offset' => $offset)
+ );
if ($annotations) {
foreach($annotations as $annotation) {
if (($user = get_entity($annotation->value)) && ($user instanceOf ElggUser)) {