summaryrefslogtreecommitdiff
path: root/pdf/list_all_certificates.inc
diff options
context:
space:
mode:
authorprashant2016-01-30 12:25:22 +0530
committerprashantsinalkar2016-01-30 13:05:18 +0530
commit205c03ca3b0c7caaf42ba2e7649edd4ee06ccc44 (patch)
tree7e4b74e141452039fe6d5618cd058d2a2e696e75 /pdf/list_all_certificates.inc
parent96743e5f2674f353030512da2a58db05658912c2 (diff)
downloadDWSIM_textbook_companion-205c03ca3b0c7caaf42ba2e7649edd4ee06ccc44.tar.gz
DWSIM_textbook_companion-205c03ca3b0c7caaf42ba2e7649edd4ee06ccc44.tar.bz2
DWSIM_textbook_companion-205c03ca3b0c7caaf42ba2e7649edd4ee06ccc44.zip
Done minor changes and added submit all code notification for tbc reviver interface
Diffstat (limited to 'pdf/list_all_certificates.inc')
-rwxr-xr-xpdf/list_all_certificates.inc202
1 files changed, 112 insertions, 90 deletions
diff --git a/pdf/list_all_certificates.inc b/pdf/list_all_certificates.inc
index 766c1f1..19dede5 100755
--- a/pdf/list_all_certificates.inc
+++ b/pdf/list_all_certificates.inc
@@ -1,97 +1,119 @@
<?php
/* function _list_all_certificates()
- {
- global $user;
- $uid1 = $user->uid;
+{
+global $user;
+$uid1 = $user->uid;
- $query2 = db_query("SELECT * FROM {textbook_companion_proposal} WHERE proposal_status=3 AND uid=".$user->uid);
- $data2 = db_fetch_object($query2);
- if($data2->id)
- /*while($data2 = db_fetch_object($query2))
- {*/
- /* if($data2->id)
- {
- $search_rows = array();
- global $output;
- $output = '';
- $query3 = db_query("SELECT * FROM textbook_companion_preference WHERE approval_status=1 AND proposal_id=".$data2->id);
+$query2 = db_query("SELECT * FROM {textbook_companion_proposal} WHERE proposal_status=3 AND uid=".$user->uid);
+$data2 = db_fetch_object($query2);
+if($data2->id)
+/*while($data2 = db_fetch_object($query2))
+{*/
+/* if($data2->id)
+{
+$search_rows = array();
+global $output;
+$output = '';
+$query3 = db_query("SELECT * FROM textbook_companion_preference WHERE approval_status=1 AND proposal_id=".$data2->id);
- while ($search_data3 = db_fetch_object($query3))
- {
- $search_rows[] = array($search_data3->isbn,$search_data3->book,$search_data3->author,l('Download Certificate', 'certificate/generate_pdf/'.$search_data3->id));
- }
- if ($search_rows)
- {
- $search_header = array('ISBN', 'Book Name', 'Author', 'Download Certificates');
- $output = theme_table($search_header, $search_rows);
- return $output;
- }
- else
- {
- echo("Error");
- return '';
- }
- }
- else
- {
- $query3 = db_query("SELECT * FROM {textbook_companion_proposal} WHERE uid=".$user->uid);
- $data3 = db_fetch_object($query3);
- if($data3)
- {
- drupal_set_message('<strong>Your book is still under Review!</strong>', 'status');
- return '';
- }
- else
- {
- drupal_set_message('<strong>You need to propose a book <a href="/proposal">Book Proposal</a></strong>', 'status');
- return '';
- }
- }
+while ($search_data3 = db_fetch_object($query3))
+{
+$search_rows[] = array($search_data3->isbn,$search_data3->book,$search_data3->author,l('Download Certificate', 'certificate/generate_pdf/'.$search_data3->id));
+}
+if ($search_rows)
+{
+$search_header = array('ISBN', 'Book Name', 'Author', 'Download Certificates');
+$output = theme_table($search_header, $search_rows);
+return $output;
+}
+else
+{
+echo("Error");
+return '';
+}
+}
+else
+{
+$query3 = db_query("SELECT * FROM {textbook_companion_proposal} WHERE uid=".$user->uid);
+$data3 = db_fetch_object($query3);
+if($data3)
+{
+drupal_set_message('<strong>Your book is still under Review!</strong>', 'status');
+return '';
+}
+else
+{
+drupal_set_message('<strong>You need to propose a book <a href="/proposal">Book Proposal</a></strong>', 'status');
+return '';
+}
+}
//}
-} */
-
+} */
function _list_all_certificates()
- {
- global $user;
- $query_id =db_query("SELECT id FROM textbook_companion_proposal WHERE proposal_status=3 AND uid=".$user->uid);
- $exist_id = db_fetch_object($query_id);
- if($exist_id->id)
- {
- if($exist_id->id<3)
- {
- drupal_set_message('<strong>You need to propose a book <a href="/proposal">Book Proposal</a></strong>', 'status');
- return '';
- }
- else
- {
- $search_rows = array();
- global $output;
- $output = '';
- $query3 = db_query("SELECT prop.id,pref.isbn,pref.book,pref.author FROM textbook_companion_proposal as prop,textbook_companion_preference as pref WHERE prop.proposal_status=3 AND pref.approval_status=1 AND pref.proposal_id=prop.id AND prop.uid=".$user->uid);
- while ($search_data3 = db_fetch_object($query3))
- {
- if($search_data3->id)
- {
- $search_rows[] = array($search_data3->isbn,$search_data3->book,$search_data3->author,l('Download Certificate', 'certificate/generate_pdf/'.$search_data3->id));
- }
- }
- if($search_rows)
- {
- $search_header = array('ISBN', 'Book Name', 'Author', 'Download Certificates');
- $output = theme_table($search_header, $search_rows);
- return $output;
- }
- else
- {
- echo("Error");
- return '';
- }
- }
- }
- else
- {
- drupal_set_message('<strong>You need to propose a book <a href="/proposal">Book Proposal</a></strong>', 'status');
- return '';
- }
-}
+ {
+ global $user;
+ /*$query_id =db_query("SELECT id FROM textbook_companion_proposal WHERE proposal_status=3 AND uid=".$user->uid);
+ $exist_id = db_fetch_object($query_id);*/
+ $query = db_select('textbook_companion_proposal');
+ $query->fields('textbook_companion_proposal', array(
+ 'id'
+ ));
+ $query->condition('proposal_status', 3);
+ $query->condition('uid', $user->uid);
+ $result = $query->execute();
+ $exist_id = $result->fetchObject();
+ if ($exist_id->id)
+ {
+ if ($exist_id->id < 3)
+ {
+ drupal_set_message('<strong>You need to propose a book <a href="/proposal">Book Proposal</a></strong>', 'status');
+ return '';
+ }
+ else
+ {
+ $search_rows = array();
+ global $output;
+ $output = '';
+ $query3 = db_query("SELECT prop.id,pref.isbn,pref.book,pref.author FROM textbook_companion_proposal as prop,textbook_companion_preference as pref WHERE prop.proposal_status=3 AND pref.approval_status=1 AND pref.proposal_id=prop.id AND prop.uid=:uid", array(
+ ":uid" => $user->uid
+ ));
+ while ($search_data3 = $query3->fetchObject())
+ {
+ if ($search_data3->id)
+ {
+ $search_rows[] = array(
+ $search_data3->isbn,
+ $search_data3->book,
+ $search_data3->author,
+ l('Download Certificate', 'textbook-companion/certificate/generate-pdf/' . $search_data3->id)
+ );
+ }
+ }
+ if ($search_rows)
+ {
+ $search_header = array(
+ 'ISBN',
+ 'Book Name',
+ 'Author',
+ 'Download Certificates'
+ );
+ $output = theme('table', array(
+ 'header' => $search_header,
+ 'rows' => $search_rows
+ ));
+ return $output;
+ }
+ else
+ {
+ echo ("Error");
+ return '';
+ }
+ }
+ }
+ else
+ {
+ drupal_set_message('<strong>You need to propose a book <a href="/proposal">Book Proposal</a></strong>', 'status');
+ return '';
+ }
+ }
?>