summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--display_books.inc54
-rwxr-xr-xtextbook_companion.module16
2 files changed, 70 insertions, 0 deletions
diff --git a/display_books.inc b/display_books.inc
new file mode 100644
index 0000000..dd8706d
--- /dev/null
+++ b/display_books.inc
@@ -0,0 +1,54 @@
+<?php
+/* function to display books in progress */
+function tbc_books_in_progress_all()
+{
+ $output = "";
+ $query = db_select('list_of_category');
+ $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
+ORDER BY po.creation_date DESC
+ ";
+ $result = db_query($query);
+ $proposal_rows = array();
+ $i = 1;
+ $category_data = _tbc_list_of_category($preference_data->category);
+ $output = "<hr>";
+ while ($row = $result->fetchObject())
+ {
+ $proposal_date = date("d-m-Y", $row->creation_date); // remove comment to display year
+ if ($row->category != NULL)
+ {
+ $category = $row->category;
+ } //$row->category != NULL
+ else
+ {
+ $category = "Not assigned";
+ }
+ $preference_rows[] = array(
+ $i,
+ $proposal_date,
+ $row->book . "<br><br>[ Author: " . $row->author . ", Publisher: " . $row->publisher . ", Year: " . $row->year . ", Edition: " . $row->edition . ", ISBN: " . $row->isbn . " ]",
+ $category
+ );
+ $i++;
+ } //$row = $result->fetchObject()
+ $preference_header = array(
+ 'No',
+ 'Proposal Date',
+ 'Book',
+ 'Category'
+ );
+ $output .= theme('table', array(
+ 'header' => $preference_header,
+ 'rows' => $preference_rows
+ ));
+ return $output;
+}
diff --git a/textbook_companion.module b/textbook_companion.module
index 98263fb..ef16f37 100755
--- a/textbook_companion.module
+++ b/textbook_companion.module
@@ -8,6 +8,16 @@ function textbook_companion_menu()
{
$items = array();
/* users */
+ /* BOOKS IN PROGRESS */
+ $items['books_in_progress'] = array(
+ 'title' => 'Books in Progress',
+ 'page callback' => 'tbc_books_in_progress_all',
+ 'access arguments' => array(
+ 'display books in progress'
+ ),
+ 'type' => MENU_LOCAL_TASK,
+ 'file' => 'display_books.inc'
+ );
$items['proposal'] = array(
'title' => 'Book Proposal Form',
'description' => 'Book Proposal Form.',
@@ -661,6 +671,7 @@ function textbook_companion_menu()
'access arguments' => array(
'list all certificates'
),
+ 'type' => MENU_LOCAL_TASK,
'file' => 'pdf/list_all_form_pdf.inc'
);
$items['Summer_Internship_Forms/copyright-form/generate_pdf'] = array(
@@ -673,6 +684,7 @@ function textbook_companion_menu()
'access arguments' => array(
'generate pdf'
),
+ 'type' => MENU_LOCAL_TASK,
'file' => 'pdf/generate_pdf.inc'
);
/*******************/
@@ -701,6 +713,10 @@ function textbook_companion_permission()
"title" => t("Book Proposal Form"),
"description" => t("Book Proposal Form.")
),
+ "display books in progress" => array(
+ "title" => t("Book display books in progress"),
+ "description" => t("display books in progress.")
+ ),
"approve book proposal" => array(
"title" => t("Approve book proposal"),
"description" => t("Allows users to approve book proposal.")