From 01dcbbcda5a4630cec6a1bbee052ef108e291a5d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 7 Jan 2009 09:08:53 +0000 Subject: Add very basic comment listing which shows the different queues (approved, unapproved, spam). --- modules/comment/controllers/admin_comments.php | 62 +++++++++++++++++++ modules/comment/helpers/comment_menu.php | 2 +- modules/comment/models/comment.php | 4 ++ modules/comment/views/admin_comments.html.php | 85 ++++++++++++++++++++++++++ 4 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 modules/comment/controllers/admin_comments.php create mode 100644 modules/comment/views/admin_comments.html.php (limited to 'modules') diff --git a/modules/comment/controllers/admin_comments.php b/modules/comment/controllers/admin_comments.php new file mode 100644 index 00000000..f518238f --- /dev/null +++ b/modules/comment/controllers/admin_comments.php @@ -0,0 +1,62 @@ +content = new View("admin_comments.html"); + $view->content->menu = Menu::factory("root") + ->append(Menu::factory("link") + ->id("published") + ->label(_("Published")) + ->url(url::site("admin/comments/published"))) + ->append(Menu::factory("link") + ->id("unpublished") + ->label(_("Unpublished")) + ->url(url::site("admin/comments/unpublished"))) + ->append(Menu::factory("link") + ->id("spam") + ->label(_("Spam")) + ->url(url::site("admin/comments/spam"))); + $view->content->comments = ORM::factory("comment") + ->where("state", $state) + ->orderby("created", "DESC") + ->find_all(); + + return $view; + } + + public function index() { + return $this->published(); + } + + public function published() { + print $this->_get_base_view("published"); + } + + public function unpublished() { + print $this->_get_base_view("unpublished"); + } + + public function spam() { + print $this->_get_base_view("spam"); + } +} + diff --git a/modules/comment/helpers/comment_menu.php b/modules/comment/helpers/comment_menu.php index 6b17f57f..9c7a5698 100644 --- a/modules/comment/helpers/comment_menu.php +++ b/modules/comment/helpers/comment_menu.php @@ -23,7 +23,7 @@ class comment_menu_Core { ->append(Menu::factory("link") ->id("comments") ->label(_("Comments")) - ->url("#")); + ->url(url::site("admin/comments"))); } public static function photo($menu, $theme) { diff --git a/modules/comment/models/comment.php b/modules/comment/models/comment.php index 323356b4..cd7a5d07 100644 --- a/modules/comment/models/comment.php +++ b/modules/comment/models/comment.php @@ -23,4 +23,8 @@ class Comment_Model extends ORM { "email" => "valid_email", "url" => "valid_url", "text" => "required"); + + function item() { + return ORM::factory("item", $this->item_id); + } } diff --git a/modules/comment/views/admin_comments.html.php b/modules/comment/views/admin_comments.html.php new file mode 100644 index 00000000..b8527a46 --- /dev/null +++ b/modules/comment/views/admin_comments.html.php @@ -0,0 +1,85 @@ + +
+

+ +
+ +
+ +
+ + + + + + + + + + + + + +
+ + + + + +
+
+ author ?> +
+
+ url ?> | email ?> +
+
+ text ?> +
+
+ item(); ?> + <?= $item->title ?>thumb_width, $item->thumb_height, 75) ?> + /> + %s"), $item->url(), $item->title) ?> +
+
+ created); ?> + + +
+
+
-- cgit v1.2.3