summaryrefslogtreecommitdiff
path: root/modules/comment
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-01-24 15:27:33 -0800
committerTim Almdal <tnalmdal@shaw.ca>2010-01-24 15:27:33 -0800
commit7c06e21ec443a46bd78bc9e99d8284283ff85c59 (patch)
treef30063fc106eaace4a02c01a9c857924213f7eb9 /modules/comment
parent3b16d0662b8a4b06f4be72165c858a1231e9bd67 (diff)
Refactor creating the user profile page content into the the event module. The show_user_profile is used to provide content to the user profile page. Add the list of the users comments to the profile page.
Diffstat (limited to 'modules/comment')
-rw-r--r--modules/comment/helpers/comment_event.php12
-rw-r--r--modules/comment/views/user_profile_comments.html.php20
2 files changed, 32 insertions, 0 deletions
diff --git a/modules/comment/helpers/comment_event.php b/modules/comment/helpers/comment_event.php
index bd336cda..12e8d73f 100644
--- a/modules/comment/helpers/comment_event.php
+++ b/modules/comment/helpers/comment_event.php
@@ -76,4 +76,16 @@ class comment_event_Core {
$data[] = $row->text;
}
}
+
+ static function show_user_profile($data) {
+ $view = new View("user_profile_comments.html");
+ $view->comments = ORM::factory("comment")
+ ->order_by("created", "DESC")
+ ->where("state", "=", "published")
+ ->where("author_id", "=", $data->user->id)
+ ->find_all();
+ if ($view->comments->count()) {
+ $data->content[] = (object)array("title" => t("Comments"), "view" => $view);
+ }
+ }
}
diff --git a/modules/comment/views/user_profile_comments.html.php b/modules/comment/views/user_profile_comments.html.php
new file mode 100644
index 00000000..a2a641ba
--- /dev/null
+++ b/modules/comment/views/user_profile_comments.html.php
@@ -0,0 +1,20 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="g-comment-detail">
+<ul>
+ <? foreach ($comments as $comment): ?>
+ <li id="g-comment-<?= $comment->id ?>">
+ <p class="g-author">
+ <?= t('on %date for %title ',
+ array("date" => date("Y-M-d H:i:s", $comment->created),
+ "title" => $comment->item()->title)); ?>
+ <a href="<?= $comment->item()->url() ?>">
+ <?= $comment->item()->thumb_img(array(), 50) ?>
+ </a>
+ </p>
+ <div>
+ <?= nl2br(html::purify($comment->text)) ?>
+ </div>
+ </li>
+ <? endforeach ?>
+</ul>
+</div>