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 ++++++ themes/default/views/photo.html.php | 46 ++-------------------------- 5 files changed, 69 insertions(+), 45 deletions(-) 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 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

+ + + + +
diff --git a/themes/default/views/photo.html.php b/themes/default/views/photo.html.php index ffa22991..1d54fe7d 100644 --- a/themes/default/views/photo.html.php +++ b/themes/default/views/photo.html.php @@ -8,48 +8,6 @@ height="resize_height ?>" />

title_edit ?>

description_edit ?>
- -
-

Comments

- - - -
-
- Add comment -
- - -
-
- - -
-
- - -
- -
-
-
+ + id); ?> -- cgit v1.2.3