From f0b454aa06a631d20e896cef3ea5704fed3e5e72 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 11 Feb 2021 13:28:56 +0530 Subject: Update completed books view format --- tbc_details.inc | 53 +++++++++++++++++++++++++++++++++++++++++++++++ textbook_companion.module | 19 ++++++++++++++++- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 tbc_details.inc diff --git a/tbc_details.inc b/tbc_details.inc new file mode 100644 index 0000000..6316b80 --- /dev/null +++ b/tbc_details.inc @@ -0,0 +1,53 @@ +fields('pe', array('book', 'author', 'publisher', 'year', 'id')); + $query->leftJoin('textbook_companion_proposal', 'po', 'pe.proposal_id = po.id'); + $query->condition('po.proposal_status', 3); + $query->condition('pe.approval_status', 1); + $query->orderBy('pe.book', 'ASC'); + $result = $query->execute(); + + if ($result->rowCount() == 0) + { + $output .= "Work has been completed on the following books under the Textbook Companion Project. + The list below is not the books as named but only are the solved example for DWSIM"; + + } //$result->rowCount() == 0 + else + { + /*$output .= "Total number of completed TBC: " . $result->rowCount() . "
";*/ + $output .= "Work has been completed on the following books under the Textbook Companion Project.
+ The list below is not the books as named but only are the solved example for DWSIM."; + $preference_rows = array(); + $i = 1; + while ($row = $result->fetchObject()) + { + $year = date("Y", $row->year); + $preference_rows[] = array( + $i, + l($row->book, "textbook-companion/textbook-run/" . $row->id), + $row->author, + $row->publisher, + $row->year + ); + $i++; + /*$preference_data->book . " by " . $preference_data->author . ", " . $preference_data->publisher . ", " . $preference_data->year, 'textbook-companion/textbook-run/' . $preference_data->id*/ + } //$row = $result->fetchObject() + $preference_header = array( + 'S.No', + 'TBC Project', + 'Contributor Name', + 'Publisher', + 'Year of Completion' + ); + $output .= theme('table', array( + 'header' => $preference_header, + 'rows' => $preference_rows + )); + } + return $output; +} \ No newline at end of file diff --git a/textbook_companion.module b/textbook_companion.module index 3bba94a..106257e 100755 --- a/textbook_companion.module +++ b/textbook_companion.module @@ -781,6 +781,15 @@ function textbook_companion_menu() ), 'type' => MENU_CALLBACK ); + /* COMPLETED DWSIM TBC Completed Books */ + $items['textbook-companion/completed-books'] = array( + 'title' => 'TBC Completed Books', + 'page callback' => 'dwsim_tbc_completed_book_proposal_all', + 'access arguments' => array( + 'download code' + ), + 'file' => 'tbc_details.inc', + ); return $items; } /** @@ -884,7 +893,15 @@ function textbook_companion_permission() "verify certificates" => array( "title" => t("verify the certificates"), "description" => t("verify the certificates") - ) + ), + /*'dwsim tbc completed books' => array( + 'title' => t('dwsim textbook-companion completed code'), + "description" => t("Allows to view completed books") + )*/ + 'TBC download abstract' => array( + 'title' => t('dwsim textbook-companion completed code'), + 'restrict access' => TRUE + ), ); } -- cgit From e1e3007a02a98a13f3b8134709f4586b7ce4069d Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 11 Feb 2021 14:05:23 +0530 Subject: Viewing completed books in descending order --- tbc_details.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tbc_details.inc b/tbc_details.inc index 6316b80..db2dd0b 100644 --- a/tbc_details.inc +++ b/tbc_details.inc @@ -8,7 +8,7 @@ function dwsim_tbc_completed_book_proposal_all() $query->leftJoin('textbook_companion_proposal', 'po', 'pe.proposal_id = po.id'); $query->condition('po.proposal_status', 3); $query->condition('pe.approval_status', 1); - $query->orderBy('pe.book', 'ASC'); + $query->orderBy('pe.year', 'DESC'); $result = $query->execute(); if ($result->rowCount() == 0) -- cgit From a45f460f6ac2f65712c9cfef3318c32689b48c18 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 11 Feb 2021 14:31:40 +0530 Subject: Update header in the table --- tbc_details.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tbc_details.inc b/tbc_details.inc index db2dd0b..4c265b1 100644 --- a/tbc_details.inc +++ b/tbc_details.inc @@ -38,10 +38,10 @@ function dwsim_tbc_completed_book_proposal_all() /*$preference_data->book . " by " . $preference_data->author . ", " . $preference_data->publisher . ", " . $preference_data->year, 'textbook-companion/textbook-run/' . $preference_data->id*/ } //$row = $result->fetchObject() $preference_header = array( - 'S.No', + 'No', 'TBC Project', 'Contributor Name', - 'Publisher', + 'University / Institute', 'Year of Completion' ); $output .= theme('table', array( -- cgit From 99b89b2e3c30fb64c34b2332fc7eadad202a32ed Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 11 Feb 2021 14:48:38 +0530 Subject: Update header in the table --- tbc_details.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tbc_details.inc b/tbc_details.inc index 4c265b1..a990a09 100644 --- a/tbc_details.inc +++ b/tbc_details.inc @@ -39,7 +39,7 @@ function dwsim_tbc_completed_book_proposal_all() } //$row = $result->fetchObject() $preference_header = array( 'No', - 'TBC Project', + 'Tittle of the Book', 'Contributor Name', 'University / Institute', 'Year of Completion' -- cgit From ee8c969fcea83cd7c92eac8b67e06510ef6812b7 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 11 Feb 2021 14:54:49 +0530 Subject: Update header in the table --- tbc_details.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tbc_details.inc b/tbc_details.inc index a990a09..639557b 100644 --- a/tbc_details.inc +++ b/tbc_details.inc @@ -39,7 +39,7 @@ function dwsim_tbc_completed_book_proposal_all() } //$row = $result->fetchObject() $preference_header = array( 'No', - 'Tittle of the Book', + 'Title of the Book', 'Contributor Name', 'University / Institute', 'Year of Completion' -- cgit From 29e5418d64f7253f9a533bafc1b13c72efbf060a Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 11 Feb 2021 16:56:32 +0530 Subject: Update completed books table --- tbc_details.inc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tbc_details.inc b/tbc_details.inc index 639557b..b3d7e87 100644 --- a/tbc_details.inc +++ b/tbc_details.inc @@ -5,12 +5,12 @@ function dwsim_tbc_completed_book_proposal_all() $output = ""; $query = db_select('textbook_companion_preference', 'pe'); $query->fields('pe', array('book', 'author', 'publisher', 'year', 'id')); - $query->leftJoin('textbook_companion_proposal', 'po', 'pe.proposal_id = po.id'); + $query->leftJoin('textbook_companion_proposal', 'po','pe.proposal_id = po.id'); + $query->fields('po', array('full_name', 'university', 'completion_date')); $query->condition('po.proposal_status', 3); $query->condition('pe.approval_status', 1); - $query->orderBy('pe.year', 'DESC'); + $query->orderBy('po.completion_date', 'DESC'); $result = $query->execute(); - if ($result->rowCount() == 0) { $output .= "Work has been completed on the following books under the Textbook Companion Project. @@ -26,13 +26,13 @@ function dwsim_tbc_completed_book_proposal_all() $i = 1; while ($row = $result->fetchObject()) { - $year = date("Y", $row->year); + $completion_date = date("Y", $row->completion_date); $preference_rows[] = array( $i, - l($row->book, "textbook-companion/textbook-run/" . $row->id), - $row->author, - $row->publisher, - $row->year + l($row->book . ' by ' . $row->author . ', ' . $row->publisher . ', ' . $row->year, 'textbook-companion/textbook-run/' . $row->id), + $row->full_name, + $row->university, + $completion_date ); $i++; /*$preference_data->book . " by " . $preference_data->author . ", " . $preference_data->publisher . ", " . $preference_data->year, 'textbook-companion/textbook-run/' . $preference_data->id*/ @@ -50,4 +50,5 @@ function dwsim_tbc_completed_book_proposal_all() )); } return $output; -} \ No newline at end of file +} + -- cgit From 53e7dc76344ef0159b0b741887addb5e944c6ff3 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 11 Feb 2021 17:02:04 +0530 Subject: Update heading of completed books --- textbook_companion.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textbook_companion.module b/textbook_companion.module index 106257e..0aefaa5 100755 --- a/textbook_companion.module +++ b/textbook_companion.module @@ -783,7 +783,7 @@ function textbook_companion_menu() ); /* COMPLETED DWSIM TBC Completed Books */ $items['textbook-companion/completed-books'] = array( - 'title' => 'TBC Completed Books', + 'title' => 'Completed Books', 'page callback' => 'dwsim_tbc_completed_book_proposal_all', 'access arguments' => array( 'download code' -- cgit From 781fe72e80e47eeffe06b53be6c83ae280bf006b Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 11 Feb 2021 18:04:31 +0530 Subject: Update heading of completed books --- textbook_companion.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textbook_companion.module b/textbook_companion.module index 0aefaa5..106257e 100755 --- a/textbook_companion.module +++ b/textbook_companion.module @@ -783,7 +783,7 @@ function textbook_companion_menu() ); /* COMPLETED DWSIM TBC Completed Books */ $items['textbook-companion/completed-books'] = array( - 'title' => 'Completed Books', + 'title' => 'TBC Completed Books', 'page callback' => 'dwsim_tbc_completed_book_proposal_all', 'access arguments' => array( 'download code' -- cgit From 8ac8e96c558480eedf62d7dac35332d991f3bae6 Mon Sep 17 00:00:00 2001 From: Saketh1499 Date: Thu, 11 Feb 2021 18:12:13 +0530 Subject: Update heading of completed books --- textbook_companion.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textbook_companion.module b/textbook_companion.module index 106257e..0aefaa5 100755 --- a/textbook_companion.module +++ b/textbook_companion.module @@ -783,7 +783,7 @@ function textbook_companion_menu() ); /* COMPLETED DWSIM TBC Completed Books */ $items['textbook-companion/completed-books'] = array( - 'title' => 'TBC Completed Books', + 'title' => 'Completed Books', 'page callback' => 'dwsim_tbc_completed_book_proposal_all', 'access arguments' => array( 'download code' -- cgit