diff options
author | Jayaram R Pai | 2014-06-20 14:23:05 +0530 |
---|---|---|
committer | Jayaram R Pai | 2014-06-20 14:23:05 +0530 |
commit | a2b141ef477dfa2fcffdf9ddb8b4dfdb58e8b8e5 (patch) | |
tree | 3ce8ecb78eeae1b81891d7e72fcc5b749ee9ca40 | |
parent | e8d016a1b229517eff7bfc28cc7d3c83dc7a1607 (diff) | |
download | cloud-comments-a2b141ef477dfa2fcffdf9ddb8b4dfdb58e8b8e5.tar.gz cloud-comments-a2b141ef477dfa2fcffdf9ddb8b4dfdb58e8b8e5.tar.bz2 cloud-comments-a2b141ef477dfa2fcffdf9ddb8b4dfdb58e8b8e5.zip |
added filtering for an examples comment
-rwxr-xr-x | cloud_comments.module | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cloud_comments.module b/cloud_comments.module index 467cd52..26c444a 100755 --- a/cloud_comments.module +++ b/cloud_comments.module @@ -14,7 +14,7 @@ function cloud_comments_perm() { return array("access cloud_comments", "reply cloud_comments"); } // function cloud_comments_perm -function cloud_comments_all() { +function cloud_comments_all($example_id=0) { $types = array( "None", "Blank Code / Incorrect code", @@ -43,7 +43,11 @@ function cloud_comments_all() { ); $page_content = ""; - $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"; + if($example_id) { + $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 WHERE scc.example = {$example_id} ORDER BY scc.date DESC"; + } else { + $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); @@ -53,7 +57,9 @@ function cloud_comments_all() { $page_content .= t("<div class='feedback {$border}'>"); $page_content .= t("<div class='timestamp'>") . $row->date . t("</div>"); - $page_content .= t("<div class='from'> <b>From:</b> ") . $row->email . t("</div>"); + if (user_access("reply cloud_comments")) { + $page_content .= t("<div class='from'> <b>From:</b> ") . $row->email . t("</div>"); + } $page_content .= t("<div class='type'> <b>Type:</b> ") . $types[$row->type] . t("</div>"); |