summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSashi202021-02-24 10:17:35 +0530
committerGitHub2021-02-24 10:17:35 +0530
commitc11e8af8ac96cf0358c89d4e79e1008e335038e2 (patch)
tree1182e9774e2f499e3c3f82713fa373e91e65cc39
parent08051b1894f3003b72542a0910ea0ccf1d4dab5b (diff)
parent8ac8e96c558480eedf62d7dac35332d991f3bae6 (diff)
downloaddwsim_textbook_companion-c11e8af8ac96cf0358c89d4e79e1008e335038e2.tar.gz
dwsim_textbook_companion-c11e8af8ac96cf0358c89d4e79e1008e335038e2.tar.bz2
dwsim_textbook_companion-c11e8af8ac96cf0358c89d4e79e1008e335038e2.zip
Merge pull request #6 from Saketh1499/development
Update completed books view format
-rw-r--r--tbc_details.inc54
-rwxr-xr-xtextbook_companion.module19
2 files changed, 72 insertions, 1 deletions
diff --git a/tbc_details.inc b/tbc_details.inc
new file mode 100644
index 0000000..b3d7e87
--- /dev/null
+++ b/tbc_details.inc
@@ -0,0 +1,54 @@
+<?php
+// DWSIM TBC display completed Books
+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->fields('po', array('full_name', 'university', 'completion_date'));
+ $query->condition('po.proposal_status', 3);
+ $query->condition('pe.approval_status', 1);
+ $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.
+ <span style='color:red;'>The list below is not the books as named but only are the solved example for DWSIM</span>";
+
+ } //$result->rowCount() == 0
+ else
+ {
+ /*$output .= "Total number of completed TBC: " . $result->rowCount() . "<br>";*/
+ $output .= "Work has been completed on the following books under the Textbook Companion Project. <br>
+ <span style='color:red;'>The list below is not the books as named but only are the solved example for DWSIM.</span>";
+ $preference_rows = array();
+ $i = 1;
+ while ($row = $result->fetchObject())
+ {
+ $completion_date = date("Y", $row->completion_date);
+ $preference_rows[] = array(
+ $i,
+ 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*/
+ } //$row = $result->fetchObject()
+ $preference_header = array(
+ 'No',
+ 'Title of the Book',
+ 'Contributor Name',
+ 'University / Institute',
+ 'Year of Completion'
+ );
+ $output .= theme('table', array(
+ 'header' => $preference_header,
+ 'rows' => $preference_rows
+ ));
+ }
+ return $output;
+}
+
diff --git a/textbook_companion.module b/textbook_companion.module
index 3bba94a..0aefaa5 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' => '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
+ ),
);
}