diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-06-07 22:40:58 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-06-07 22:40:58 +0000 |
commit | 02e0a58f8907c66a0dbe7241621e5ad0bb264426 (patch) | |
tree | 3b036e8301b5c8d2ea9279ea8a5ea1f4da91519b /mod/riverdashboard/endpoint/get_comments.php | |
parent | 4f5e0a8fba1460458bd74fdfc572f0394143c1c2 (diff) | |
download | elgg-02e0a58f8907c66a0dbe7241621e5ad0bb264426.tar.gz elgg-02e0a58f8907c66a0dbe7241621e5ad0bb264426.tar.bz2 |
Minimal attempt to bring riverdashboard up to code standards.
Fixed comment count in +N more string.
Added ajax grabbing of all comments when clicking more link.
git-svn-id: http://code.elgg.org/elgg/trunk@6389 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/riverdashboard/endpoint/get_comments.php')
-rw-r--r-- | mod/riverdashboard/endpoint/get_comments.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/mod/riverdashboard/endpoint/get_comments.php b/mod/riverdashboard/endpoint/get_comments.php new file mode 100644 index 000000000..59ff3d785 --- /dev/null +++ b/mod/riverdashboard/endpoint/get_comments.php @@ -0,0 +1,40 @@ +<?php +/** + * Grabs more comments to display. + */ + +require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"); + +$limit = get_input('limit', 25); +// 3 are displayed by default. +$offset = get_input('offset', 3); +$entity_guid = get_input('entity_guid'); +if (!$entity = get_entity($entity_guid)) { + exit; +} + +// same deal as the main view...get the newest $limit, but reverse it to put the newest at the bottom. +if ($comments = get_annotations($entity_guid, "", "", 'generic_comment', "", "", $limit, $offset, "desc")) { + $comments = array_reverse($comments); +} + +foreach ($comments as $comment) { + //get the comment owner + $comment_owner = get_user($comment->owner_guid); + //get the comment owner's profile url + $comment_owner_url = $comment_owner->getURL(); + + //display comment + echo "<div class='river_comment clearfloat'>"; + echo "<span class='river_comment_owner_icon'>"; + echo elgg_view("profile/icon", array('entity' => $comment_owner, 'size' => 'tiny')); + echo "</span>"; + + //truncate comment to 150 characters and strip tags + $contents = elgg_make_excerpt($comment->value, 150); + + echo "<div class='river_comment_contents'>"; + echo "<a href=\"{$comment_owner_url}\">" . $comment_owner->name . "</a> " . parse_urls($contents); + echo "<span class='entity_subtext'>" . friendly_time($comment->time_created) . "</span>"; + echo "</div></div>"; +}
\ No newline at end of file |