Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding allcomments module

  • Loading branch information...
commit 3a13a0f287634b171e2fd29fae7553b52fa1a5c4 1 parent b616184
@vkdimitrov vkdimitrov authored
View
45 3.0/modules/allcomments/controllers/allcomments.php
@@ -0,0 +1,45 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+
+class allcomments_Controller extends Controller
+{
+ public function index()
+ {
+ url::redirect('allcomments/page/0');
+ /*
+ $this->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;
+ }
+}
+?>
View
18 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;
+}
+
View
10 3.0/modules/allcomments/helpers/allcomments_theme.php
@@ -0,0 +1,10 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+
+class allcomments_theme
+{
+ static function head($theme) {
+ return $theme->css("allcomments.css");
+ }
+}
+
+?>
View
6 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"
View
38 3.0/modules/allcomments/views/allcomments.html.php
@@ -0,0 +1,38 @@
+<?php defined("SYSPATH") or die("No direct script access."); ?>
+
+<h1>All Comments</h1>
+<div id="allcomments">
+<ul>
+ <? foreach ($comments as $comment): ?>
+ <div class="allcomments-comment">
+ <li id="g-comment-<?= $comment->id ?>">
+ <p class="allcomments-author">
+ <a href="<?= $comment->item()->url() ?>">
+ <?= t("on %date",
+ array("date" => gallery::date_time($comment->created),
+ "title" => $comment->item()->title)); ?></a><br />
+ <a href="<?= $comment->item()->url() ?>">
+ <?= $comment->item()->thumb_img(array(), 128) ?></a>
+ <a href="<?= $comment->author_url() ?>">
+ <?= nl2br(html::purify($comment->author_name())) ?></a>:
+ <?= nl2br(html::purify($comment->text)) ?>
+ </p>
+ </li>
+ </div>
+ <? endforeach ?>
+</ul>
+
+<?php
+if($page > 0)
+{
+?>
+ <a class="g-button ui-icon-right ui-state-default ui-corner-all" href="<?=url::base()?>allcomments/page/<?=$page-1?>">
+ <span class="ui-icon ui-icon-seek-prev"></span>
+ prev
+ </a>
+<?}?>
+ <a class="g-button ui-icon-right ui-state-default ui-corner-all" href="<?=url::base()?>allcomments/page/<?=$page+1?>">
+ <span class="ui-icon ui-icon-seek-next"></span>
+ next
+ </a>
+</div>
Please sign in to comment.
Something went wrong with that request. Please try again.