From 752459c64cafec0f003c4b8531201c58a5fecad7 Mon Sep 17 00:00:00 2001 From: Jozef Selesi Date: Tue, 11 Nov 2008 20:54:12 +0000 Subject: Display comments from the database. --- modules/comment/helpers/comment.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'modules/comment/helpers') diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php index 36a07106..a768bdcf 100644 --- a/modules/comment/helpers/comment.php +++ b/modules/comment/helpers/comment.php @@ -47,4 +47,25 @@ class Comment_Core { return $comment->save(); } -} + + static function show_comments($item_id) { + $v = new View('show_comments.html'); + $v->comment_list = Comment::show_comment_list($item_id); + $v->comment_form = Comment::show_comment_form($item_id); + $v->render(true); + } + + static function show_comment_list($item_id) { + $v = new View('comment_list.html'); + $v->item_id = $item_id; + $v->comments = ORM::factory('comment')->where('item_id', $item_id) + ->orderby('datetime', 'desc') + ->find_all()->as_array(); + return $v; + } + + static function show_comment_form($item_id) { + $v = new View('comment_form.html'); + $v->item_id = $item_id; + return $v; + }} -- cgit v1.2.3