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 ++++++++++++++++++++++- modules/comment/views/comment_form.html.php | 21 +++++++++++++++++++++ modules/comment/views/comment_list.html.php | 15 +++++++++++++++ modules/comment/views/show_comments.html.php | 9 +++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 modules/comment/views/comment_form.html.php create mode 100644 modules/comment/views/comment_list.html.php create mode 100644 modules/comment/views/show_comments.html.php (limited to 'modules') 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; + }} diff --git a/modules/comment/views/comment_form.html.php b/modules/comment/views/comment_form.html.php new file mode 100644 index 00000000..418f0027 --- /dev/null +++ b/modules/comment/views/comment_form.html.php @@ -0,0 +1,21 @@ + +
+
+ Add comment +
+ + +
+
+ + +
+
+ + +
+ + +
+
+ diff --git a/modules/comment/views/comment_list.html.php b/modules/comment/views/comment_list.html.php new file mode 100644 index 00000000..2196af1c --- /dev/null +++ b/modules/comment/views/comment_list.html.php @@ -0,0 +1,15 @@ + + diff --git a/modules/comment/views/show_comments.html.php b/modules/comment/views/show_comments.html.php new file mode 100644 index 00000000..9726364f --- /dev/null +++ b/modules/comment/views/show_comments.html.php @@ -0,0 +1,9 @@ + +
+ +

Comments

+ + + + +
-- cgit v1.2.3