diff options
author | prashantsinalkar | 2018-07-11 15:10:21 +0530 |
---|---|---|
committer | prashantsinalkar | 2018-07-11 15:10:21 +0530 |
commit | b16fbaeb5f3ded0298780a655f330947301289f8 (patch) | |
tree | 213de513140f6a8e8b372e8b61207a2bdb0792e1 /pdf/verify_m_tbc_certificates.inc | |
parent | cd438aedb195cf83f2f198153c571f4abf3e5812 (diff) | |
download | scilab_in_migration_certificates-b16fbaeb5f3ded0298780a655f330947301289f8.tar.gz scilab_in_migration_certificates-b16fbaeb5f3ded0298780a655f330947301289f8.tar.bz2 scilab_in_migration_certificates-b16fbaeb5f3ded0298780a655f330947301289f8.zip |
added certificate files
Diffstat (limited to 'pdf/verify_m_tbc_certificates.inc')
-rwxr-xr-x | pdf/verify_m_tbc_certificates.inc | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/pdf/verify_m_tbc_certificates.inc b/pdf/verify_m_tbc_certificates.inc new file mode 100755 index 0000000..7fc044b --- /dev/null +++ b/pdf/verify_m_tbc_certificates.inc @@ -0,0 +1,113 @@ +<?php +function verify_m_tbc_certificates($qr_code = 0) + { + $qr_code = arg(3); + $page_content = ""; + if ($qr_code) + { + $page_content = verify_qrcode_m_tbc_fromdb($qr_code); + } //$qr_code + else + { + $verify_certificates_form = drupal_get_form("verify_m_tbc_certificates_form"); + $page_content = drupal_render($verify_certificates_form); + } + return $page_content; + } +function verify_m_tbc_certificates_form($form, &$form_state) + { + $form = array(); + $form['Title'] = array( + '#type' => 'markup', + '#markup' => '' + ); + $form["QR_code"] = array( + "#type" => "textfield", + "#title" => "Enter QR Code", + "#default_value" => '', + "#required" => TRUE + ); + $form["submit"] = array( + "#type" => "submit", + "#value" => "Verify", + '#ajax' => array( + 'callback' => 'verify_m_tbc_certificates_form_submit', + 'progress' => array( + 'message' => '' + ) + ) + ); + $form['displaytable'] = array( + '#type' => 'markup', + '#prefix' => '<div><div id="displaytable" style="font-weight:bold;padding-top:10px">', + '#suffix' => '</div></div>', + '#markup' => '' + ); + return $form; + } +function verify_m_tbc_certificates_form_submit($form, &$form_state) + { + $page_content = ""; + $v = $form_state["values"]; + $qr_code = $v["QR_code"]; + $page_content = verify_qrcode_m_tbc_fromdb($qr_code); + $form['displaytable']['#markup'] = $page_content; + $commands[] = ajax_command_html("#displaytable", drupal_render($form['displaytable'])); + return array( + '#type' => 'ajax', + '#commands' => $commands + ); + } +function verify_qrcode_m_tbc_fromdb($qr_code) + { + $query = db_select('m_tbc_certificate_qr_code'); + $query->fields('m_tbc_certificate_qr_code'); + $query->condition('qr_code', $qr_code); + $result = $query->execute()->fetchObject(); + $proposal_id = $result->proposal_id; + $certificate_id = $result->certificate_id; + if ($proposal_id) + { + $query2 = db_query("SELECT * FROM {m_tbc_certificate} WHERE proposal_id= :prop_id AND id=:certificate_id", array( + ':prop_id' => $proposal_id, + ':certificate_id' => $certificate_id + )); + $data2 = $query2->fetchObject(); + if ($data2->type == "Proposer") + { + $page_content = ""; + $page_content .= "<h4>Participation Details</h4><table>"; + //$page_content.="<tr><td>Name</td>"; + //$page_content.="<td>".$data2->name_title. ' '.$data2->name."</td></tr>"; + $page_content = ""; + $page_content .= "<h4>Participation Details</h4><table><tr><td>Name</td>"; + $page_content .= "<td>" . $data2->name . "</td></tr>"; + $page_content .= "<tr><td>Project</td>"; + $page_content .= "<td>Scilab Textbook Companion</td></tr>"; + $page_content .= "<tr><td>Books completed</td>"; + $page_content .= "<td>" . $data2->book_name . "</td></tr>"; + $page_content .= "<tr><td>Book Author</td>"; + $page_content .= "<td>" . $data2->author . "</td></tr>"; + $page_content .= "</table>"; + $page_content .= "</table>"; + } //$data2->type == "Proposer" + elseif ($data2->type == "Participant") + { + $page_content = ""; + $page_content .= "<h4>Participation Details</h4><table><tr><td>Name</td>"; + $page_content .= "<td>" . $data2->name . "</td></tr>"; + $page_content .= "<tr><td>Project</td>"; + $page_content .= "<td>Scilab Textbook Companion</td></tr>"; + $page_content .= "<tr><td>Books completed</td>"; + $page_content .= "<td>" . $data2->book_name . "</td></tr>"; + $page_content .= "<tr><td>Book Author</td>"; + $page_content .= "<td>" . $data2->author . "</td></tr>"; + $page_content .= "</table>"; + } //$data2->type == "Participant" + else + { + $page_content = "<b>Sorry ! The serial number you entered seems to be invalid. Please try again ! <b>"; + } + return $page_content; + } //$proposal_id + } |