From 9456cf380a51d4863dd0ee96499763bb32f54284 Mon Sep 17 00:00:00 2001 From: dave Date: Wed, 10 Mar 2010 16:32:05 +0000 Subject: the beginnings of a new activity river with ajax notification and conversation clustering. git-svn-id: http://code.elgg.org/elgg/trunk@5344 36083f99-b078-4883-b0ff-0f9b5a30f544 --- .../views/default/river/item/wrapper.php | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 mod/riverdashboard/views/default/river/item/wrapper.php (limited to 'mod/riverdashboard/views/default/river/item/wrapper.php') diff --git a/mod/riverdashboard/views/default/river/item/wrapper.php b/mod/riverdashboard/views/default/river/item/wrapper.php new file mode 100644 index 000000000..1aa508d99 --- /dev/null +++ b/mod/riverdashboard/views/default/river/item/wrapper.php @@ -0,0 +1,119 @@ +object_guid); +//get object url +$object_url = $object->getURL(); +//user +//if displaying on the profile get the object owner, else the subject_guid +if(get_context() == 'profile' && $object->getSubtype() == 'thewire') + $user = get_entity($object->owner_guid); +else + $user = get_entity($vars['item']->subject_guid); + +//get the right annotation type +//*todo - use the same for comments, everywhere e.g. comment +switch($vars['item']->subtype){ + case 'thewire': + $annotation_comment = 'wire_reply'; + break; + default: + $annotation_comment = 'generic_comment'; + break; +} + +//count comment annotations +$comment_count = count_annotations($vars['item']->object_guid, $vars['item']->type, $vars['item']->subtype, $annotation_comment); + +//count like annotations +$likes = count_annotations($vars['item']->object_guid, $vars['item']->type, $vars['item']->subtype, "likes"); + +//get last two comments display +$get_comments = get_annotations($vars['item']->object_guid, "", "", $annotation_comment, "", "", 3, 0, "desc"); + +if($get_comments){ + //reverse the array so we can display comments in the right order + $get_comments = array_reverse($get_comments); +} + +//minus two off the comment total as we display two by default +if($comment_count < 3) + $num_comments = 0; +else + $num_comments = $comment_count - 3; +?> +
+ + + $user, 'size' => 'small')); + ?> + + + +
+ +
+ "; + //set the correct context comment or comments + if($num_comments == 1) + echo "+{$num_comments} more comment"; + else + echo "+{$num_comments} more comments"; + + echo "
"; + } + //display latest 2 comments if there are any + if($get_comments){ + $counter = 0; + $background = ""; + echo "
"; + foreach($get_comments as $gc){ + //get the comment owner + $comment_owner = get_user($gc->owner_guid); + //get the comment owner's profile url + $comment_owner_url = $comment_owner->getURL(); + // color-code each of the 3 comments + if( ($counter == 2 && $comment_count >= 4) || ($counter == 1 && $comment_count == 2) || ($counter == 0 && $comment_count == 1) || ($counter == 2 && $comment_count == 3) ) + $alt = 'latest'; + else if( ($counter == 1 && $comment_count >= 4) || ($counter == 0 && $comment_count == 2) || ($counter == 1 && $comment_count == 3) ) + $alt = 'penultimate'; + + //display comment + echo "
"; + echo "
"; + echo elgg_view("profile/icon",array('entity' => $comment_owner, 'size' => 'tiny')); + echo "
"; + //truncate comment to 150 characters + if(strlen($gc->value) > 150) { + $gc->value = substr($gc->value, 0, strpos($gc->value, ' ', 150)) . "..."; + } + $contents = strip_tags($gc->value); + echo "
"; + echo "" . $comment_owner->name . " " . parse_urls($contents); + echo "
" . friendly_time($gc->time_created) . ""; + echo "
"; + echo "
"; + $counter++; + } + echo "
"; + } + //display the comment link + if($vars['item']->type != 'user'){ + //for now don't display the comment link on bookmarks and wire messages + if($vars['item']->subtype != 'thewire' && $vars['item']->subtype != 'bookmarks' && $vars['item']->subtype != '') + echo "Comment"; + } + ?> +
+
+ \ No newline at end of file -- cgit v1.2.3