aboutsummaryrefslogtreecommitdiff
path: root/views/default/annotation/generic_comment.php
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-15 14:46:48 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-15 14:46:48 -0300
commit5041c6c48153453ed597206d08eeff37cf20e676 (patch)
treeb25f495baf01202485f05b5245625f28558c6135 /views/default/annotation/generic_comment.php
downloadelgg-5041c6c48153453ed597206d08eeff37cf20e676.tar.gz
elgg-5041c6c48153453ed597206d08eeff37cf20e676.tar.bz2
Squashed 'mod/cool_theme/' content from commit a26f7df
git-subtree-dir: mod/cool_theme git-subtree-split: a26f7df43a266f7d1ff04847da330d15f6041e9b
Diffstat (limited to 'views/default/annotation/generic_comment.php')
-rw-r--r--views/default/annotation/generic_comment.php72
1 files changed, 72 insertions, 0 deletions
diff --git a/views/default/annotation/generic_comment.php b/views/default/annotation/generic_comment.php
new file mode 100644
index 000000000..d15ae2325
--- /dev/null
+++ b/views/default/annotation/generic_comment.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Elgg generic comment view
+ *
+ * @uses $vars['annotation'] ElggAnnotation object
+ * @uses $vars['full'] Display fill view or brief view
+ */
+
+if (!isset($vars['annotation'])) {
+ return true;
+}
+
+$full_view = elgg_extract('full', $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_entity_icon($commenter, 'tiny');
+$commenter_link = "<a href=\"{$commenter->getURL()}\" class=\"elgg-river-subject\">$commenter->name</a>";
+
+$entity_title = $entity->title ? $entity->title : elgg_echo('untitled');
+$entity_link = "<a href=\"{$entity->getURL()}\">$entity_title</a>";
+
+if ($full_view) {
+
+ $delete_button = '';
+ if ($comment->canEdit()) {
+ $url = "action/comments/delete?annotation_id=$comment->id";
+ $delete_button = elgg_view("output/confirmlink", array(
+ 'href' => $url,
+ 'class' => 'right',
+ 'text' => elgg_view_icon('delete'),
+ 'confirm' => elgg_echo('deleteconfirm'),
+ 'text_encode' => false,
+ ));
+ }
+
+ $comment_text = elgg_view("output/longtext", array("value" => $comment->value));
+
+ $body = <<<HTML
+$delete_button
+$commenter_link
+$comment_text
+<span class="elgg-subtext">
+ $friendlytime
+</span>
+HTML;
+
+ echo elgg_view_image_block($commenter_icon, $body);
+
+} else {
+ // brief view
+
+ //@todo need link to actual comment!
+
+ $on = elgg_echo('on');
+
+ $body = <<<HTML
+<span class="elgg-subtext">
+ $commenter_link $on $entity_link ($friendlytime)
+</span>
+HTML;
+
+ echo elgg_view_image_block($commenter_icon, $body);
+} \ No newline at end of file