aboutsummaryrefslogtreecommitdiff
path: root/views/default/annotation
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-04 21:05:54 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-04 21:05:54 +0000
commit7433b07dac28a87a8d22bd0dd5fa78effe333255 (patch)
tree76040c3b6de7f82688d9025cf2af88f19dbd804e /views/default/annotation
parentb2c08a52541a12050ae12bac2dbc8e1f0563c2b0 (diff)
downloadelgg-7433b07dac28a87a8d22bd0dd5fa78effe333255.tar.gz
elgg-7433b07dac28a87a8d22bd0dd5fa78effe333255.tar.bz2
welcome to the new media view - it is being used in the new latest comments module
git-svn-id: http://code.elgg.org/elgg/trunk@7530 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/annotation')
-rw-r--r--views/default/annotation/generic_comment.php54
-rw-r--r--views/default/annotation/latest_comments.php36
2 files changed, 53 insertions, 37 deletions
diff --git a/views/default/annotation/generic_comment.php b/views/default/annotation/generic_comment.php
index 26fd468b7..ac603e978 100644
--- a/views/default/annotation/generic_comment.php
+++ b/views/default/annotation/generic_comment.php
@@ -1,8 +1,60 @@
<?php
/**
- * Elgg generic comment
+ * Elgg generic comment view
+ *
+ * @uses $vars['annotation'] ElggAnnotation object
+ * @uses $vars['full_view'] Display fill view or brief view
*/
+if (!isset($vars['annotation'])) {
+ return true;
+}
+
+$full_view = elgg_get_array_value('full_view', $vars, true);
+
+$comment = $vars['annotation'];
+
+$entity = get_entity($comment->entity_guid);
+$commenter = get_user($comment->owner_guid);
+if (!$entity || !$commenter) {
+ return true;
+}
+
+
+$friendlytime = elgg_view_friendly_time($comment->time_created);
+
+$commenter_icon = elgg_view("profile/icon", array('entity' => $commenter, 'size' => 'tiny'));
+$commenter_link = "<a href=\"{$commenter->getURL()}\">$commenter->name</a>";
+
+$entity_title = $entity->title ? $entity->title : elgg_echo('untitled');
+$entity_link = "<a href=\"{$entity->getURL()}\">$entity_title</a>";
+
+if ($full_view) {
+
+} else {
+ // brief view
+
+ //@todo need link to actual comment!
+
+ $on = elgg_echo('on');
+
+ $body = <<<HTML
+<span class="entity-subtext">$commenter_link $on <span class='entity-title'>$entity_link</span> ($friendlytime)</span>
+HTML;
+
+ $params = array(
+ 'img' => $commenter_icon,
+ 'body' => $body,
+ );
+ echo elgg_view('layout_elements/media', $params);
+
+ // @todo remove this once the full view has been rewritten
+ return true;
+}
+
+
+// @todo - below needs to be rewritten like the brief view
+
$owner = get_user($vars['annotation']->owner_guid);
?>
diff --git a/views/default/annotation/latest_comments.php b/views/default/annotation/latest_comments.php
deleted file mode 100644
index d603a3830..000000000
--- a/views/default/annotation/latest_comments.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * Display latest comments on objects
- */
-
-if ($vars['comments']){
- global $CONFIG;
- //echo "<h3>" . elgg_echo('generic_comments:latest') . "</h3>";
- foreach ($vars['comments'] as $comment) {
- //grab the entity the comment is on
- $entity = get_entity($comment->entity_guid);
- //comment owner
- $comment_owner = get_user($comment->owner_guid);
- $friendlytime = elgg_view_friendly_time($comment->time_created); // get timestamp for comment
-
- //set the title
- if($entity->title){
- $objecttitle = $entity->title;
- }else{
- $objecttitle = elgg_echo('untitled');
- }
-
- //if the entity has been deleted, don't link to it
- if($entity){
- $url = $entity->getURL(); // get url to file for comment link
- $url_display = "<a href=\"{$url}\">{$objecttitle}</a>";
- }else{
- $url_display = $objecttitle;
- }
-
- echo "<div class='generic-comment latest clearfix'><span class='generic-comment-icon'>" . elgg_view("profile/icon",array('entity' => $comment_owner, 'size' => 'tiny')) . "</span>";
- echo "<div class='generic-comment-details'><span class='entity-subtext'><a href=\"".elgg_get_site_url()."pg/profile/{$comment_owner->username}\">{$comment_owner->name}</a> " . elgg_echo('on') . " <span class='entity-title'>{$url_display}</span> ({$friendlytime})</span></div>";
- echo "</div>";
-
- }
-} \ No newline at end of file