From 3a13a0f287634b171e2fd29fae7553b52fa1a5c4 Mon Sep 17 00:00:00 2001 From: vkdimitrov Date: Sat, 15 Dec 2012 22:10:35 +0200 Subject: [PATCH] adding allcomments module --- .../allcomments/controllers/allcomments.php | 45 +++++++++++++++++++ 3.0/modules/allcomments/css/allcomments.css | 18 ++++++++ .../allcomments/helpers/allcomments_theme.php | 10 +++++ 3.0/modules/allcomments/module.info | 6 +++ .../allcomments/views/allcomments.html.php | 38 ++++++++++++++++ 5 files changed, 117 insertions(+) create mode 100644 3.0/modules/allcomments/controllers/allcomments.php create mode 100644 3.0/modules/allcomments/css/allcomments.css create mode 100644 3.0/modules/allcomments/helpers/allcomments_theme.php create mode 100644 3.0/modules/allcomments/module.info create mode 100644 3.0/modules/allcomments/views/allcomments.html.php diff --git a/3.0/modules/allcomments/controllers/allcomments.php b/3.0/modules/allcomments/controllers/allcomments.php new file mode 100644 index 00000000..df577023 --- /dev/null +++ b/3.0/modules/allcomments/controllers/allcomments.php @@ -0,0 +1,45 @@ +request->redirect('allcomments/page/0'); + $comments = ORM::factory("comment") + ->order_by("created", "DESC") + ->where("state", "=", "published") + ->find_all(); + + $v = new Theme_View("page.html", "other", "profile"); + $v->page_title = t("All comments"); + $v->content = new View("allcomments.html", array('comments' => $comments)); + print $v; + */ + } + + + public function page($page_no) + { + $comments = ORM::factory("comment") + ->order_by("created", "DESC") + ->where("state", "=", "published") + ->limit(30) + ->offset($page_no*30) + ->find_all(); + + /* + $pagination = new Pagination(array( + 'base_url' => 'allcomments/page/', // Set our base URL to controller 'items' and method 'page' + 'uri_segment' => 'page', // Our URI will look something like http://domain/items/page/19 + 'total_items' => 100 // Total number of items. + )); + */ + $v = new Theme_View("page.html", "other"); + $v->page_title = t("All comments"); + $v->content = new View("allcomments.html", array('comments' => $comments, 'page' => $page_no)); + print $v; + } +} +?> diff --git a/3.0/modules/allcomments/css/allcomments.css b/3.0/modules/allcomments/css/allcomments.css new file mode 100644 index 00000000..ca9dd187 --- /dev/null +++ b/3.0/modules/allcomments/css/allcomments.css @@ -0,0 +1,18 @@ +#allcomments { +} + +#allcomments .allcomments-author { + color: #999; + height: 32px; + line-height: 32px; +} + +#allcomments .allcomments-comment { + border-top: 1px solid; + color: #999; + height: 150px; + line-height: 32px; + padding-top: 10px; + padding-bottom: 15px; +} + diff --git a/3.0/modules/allcomments/helpers/allcomments_theme.php b/3.0/modules/allcomments/helpers/allcomments_theme.php new file mode 100644 index 00000000..26d2d9b4 --- /dev/null +++ b/3.0/modules/allcomments/helpers/allcomments_theme.php @@ -0,0 +1,10 @@ +css("allcomments.css"); + } +} + +?> diff --git a/3.0/modules/allcomments/module.info b/3.0/modules/allcomments/module.info new file mode 100644 index 00000000..7b81fd76 --- /dev/null +++ b/3.0/modules/allcomments/module.info @@ -0,0 +1,6 @@ +name = "AllComments" +description = "This module shows all comments" +version = 1 +author_name = "Vladimir Dimitrov" +author_url = "http://vladko.org" +info_url = "https://github.com/vkdimitrov/allcomments" diff --git a/3.0/modules/allcomments/views/allcomments.html.php b/3.0/modules/allcomments/views/allcomments.html.php new file mode 100644 index 00000000..72d4dec9 --- /dev/null +++ b/3.0/modules/allcomments/views/allcomments.html.php @@ -0,0 +1,38 @@ + + +

All Comments

+
+ + + 0) +{ +?> + + + prev + + + + + next + +