From b16fbaeb5f3ded0298780a655f330947301289f8 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Wed, 11 Jul 2018 15:10:21 +0530 Subject: added certificate files --- pdf/verify_m_tbc_certificates.inc | 113 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100755 pdf/verify_m_tbc_certificates.inc (limited to 'pdf/verify_m_tbc_certificates.inc') 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 @@ + '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' => '
', + '#suffix' => '
', + '#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 .= "

Participation Details

"; + //$page_content.=""; + //$page_content.=""; + $page_content = ""; + $page_content .= "

Participation Details

Name".$data2->name_title. ' '.$data2->name."
"; + $page_content .= ""; + $page_content .= ""; + $page_content .= ""; + $page_content .= ""; + $page_content .= ""; + $page_content .= ""; + $page_content .= ""; + $page_content .= "
Name" . $data2->name . "
ProjectScilab Textbook Companion
Books completed" . $data2->book_name . "
Book Author" . $data2->author . "
"; + $page_content .= ""; + } //$data2->type == "Proposer" + elseif ($data2->type == "Participant") + { + $page_content = ""; + $page_content .= "

Participation Details

"; + $page_content .= ""; + $page_content .= ""; + $page_content .= ""; + $page_content .= ""; + $page_content .= ""; + $page_content .= ""; + $page_content .= ""; + $page_content .= "
Name" . $data2->name . "
ProjectScilab Textbook Companion
Books completed" . $data2->book_name . "
Book Author" . $data2->author . "
"; + } //$data2->type == "Participant" + else + { + $page_content = "Sorry ! The serial number you entered seems to be invalid. Please try again ! "; + } + return $page_content; + } //$proposal_id + } -- cgit