From 847fd04ce69c607da844aa91476396a815832537 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Mon, 8 May 2017 12:43:36 +0530 Subject: added completed books display with new category --- display_books.inc | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 101 insertions(+), 2 deletions(-) mode change 100644 => 100755 display_books.inc diff --git a/display_books.inc b/display_books.inc old mode 100644 new mode 100755 index dd8706d..18e531e --- a/display_books.inc +++ b/display_books.inc @@ -7,13 +7,12 @@ function tbc_books_in_progress_all() $query->fields('list_of_category'); $query->orderBy('id', 'ASC'); $category_list = $query->execute(); - $query = " SELECT po.creation_date, pe.book as book, pe.author as author, pe.publisher as publisher,pe.edition as edition, pe.isbn as isbn, pe.year as year, pe.id as pe_id, loc.category_name as category, loc.category_id as cat_id FROM textbook_companion_preference pe LEFT JOIN textbook_companion_proposal po ON pe.proposal_id = po.id LEFT JOIN list_of_category loc on pe.category = loc.category_id -WHERE po.proposal_status IN (1,4) AND pe.approval_status = 1 +WHERE po.proposal_status IN (1,4) AND pe.approval_status = 1 ORDER BY po.creation_date DESC "; $result = db_query($query); @@ -52,3 +51,103 @@ ORDER BY po.creation_date DESC )); return $output; } +function _textbook_companion_list_of_new_category($category_id = NULL) +{ + $category .= ""; + if ($category_id != NULL) + { + $query = db_select('list_of_category'); + $query->fields('list_of_category'); + $query->condition('id', $category_id); + $category_list = $query->execute(); + $category .= ""; + return $category; +} +function _textbook_companion_list_of_new_category_display($category_id = NULL) +{ + $category .= ""; + if ($category_id != NULL) + { + $query = db_select('list_of_category'); + $query->fields('list_of_category'); + $query->condition('id', $category_id); + $category_list = $query->execute(); + $category .= ""; + return $category; +} +function tbc_completed_books_all() +{ + $category_id = NULL; + $output = ""; + $output = "

Category

"; + $output .= "
"; + $output .= _textbook_companion_list_of_new_category($category_id); + $output .= "
"; + $result_count = db_query("SELECT pe.book FROM textbook_companion_preference pe LEFT JOIN textbook_companion_proposal po ON pe.proposal_id = po.id WHERE po.proposal_status =3 AND pe.approval_status =1 AND pe.category>0"); + $row_count = $result_count->rowCount(); + $output .= "

Total number of completed books :  " . $row_count . "

"; + $output .= "
"; + $result_category = db_query("SELECT * FROM list_of_category WHERE category_id !=0"); + $row_category_count = $result_category->rowCount(); + for ($i = 1; $i <= $row_category_count; $i++) + { + $output .= "
" . _textbook_companion_list_of_new_category_display($i) . "
"; + } //$i = 1; $i <= $row_category_count; $i++ + return $output; +} -- cgit