From e8d016a1b229517eff7bfc28cc7d3c83dc7a1607 Mon Sep 17 00:00:00 2001 From: Jayaram Pai Date: Fri, 20 Jun 2014 14:02:17 +0530 Subject: added pagination --- cloud_comments.module | 11 ++++++----- css/cloud_comments.css | 0 js/cloud_comments.js | 0 js/jquery.min.js | 0 4 files changed, 6 insertions(+), 5 deletions(-) mode change 100644 => 100755 css/cloud_comments.css mode change 100644 => 100755 js/cloud_comments.js mode change 100644 => 100755 js/jquery.min.js diff --git a/cloud_comments.module b/cloud_comments.module index 7bbbdad..467cd52 100755 --- a/cloud_comments.module +++ b/cloud_comments.module @@ -43,8 +43,9 @@ function cloud_comments_all() { ); $page_content = ""; - $query = "SELECT * FROM {scilab_cloud_comment}"; - $query_result = db_query($query); + $query = "SELECT scc.*, tcc.number AS chapter_no, tce.number AS example_no FROM scilab_cloud_comment scc LEFT JOIN textbook_companion_chapter tcc ON tcc.id = scc.chapter LEFT JOIN textbook_companion_example tce ON tce.id = scc.example ORDER BY scc.date DESC"; + $query_result = pager_query($query, 5, 0 ); + //$query_result = db_query($query); while ($row = db_fetch_object($query_result)) { @@ -65,7 +66,7 @@ function cloud_comments_all() { $qr = db_query($q, $row->chapter); $obj = db_fetch_object($qr); $chapter = $obj->name?$obj->name:"None"; - $page_content .= t("
Chapter: ") . $chapter . t("
"); + $page_content .= t("
Chapter: ") . $chapter . ($row->chapter_no?" ({$row->chapter_no})":"") . t("
"); $page_content .= t("
Category: ") . $categories[$row->category] . t("
"); @@ -74,7 +75,7 @@ function cloud_comments_all() { $obj = db_fetch_object($qr); $example_link = $obj->caption?l($obj->caption,"http://cloud.scilab.in/index.php?eid=".$row->example):"None"; - $page_content .= t("
Example: ") . $example_link .t("
"); + $page_content .= t("
Example: ") . $example_link . ($row->example_no?" ({$row->example_no})":"") . t("
"); $page_content .= t("

Comment:
") . $row->comment . t("
"); @@ -92,7 +93,7 @@ function cloud_comments_all() { } $page_content .= t(""); } // while ends - + $page_content .= theme('pager', NULL, 5, 0); return $page_content; } // function cloud_comments_all diff --git a/css/cloud_comments.css b/css/cloud_comments.css old mode 100644 new mode 100755 diff --git a/js/cloud_comments.js b/js/cloud_comments.js old mode 100644 new mode 100755 diff --git a/js/jquery.min.js b/js/jquery.min.js old mode 100644 new mode 100755 -- cgit