'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_certificates_form_submit',
'progress' => array(
'message' => ''
)
)
);
$form['displaytable'] = array(
'#type' => 'markup',
'#prefix' => '
',
'#markup' => ''
);
return $form;
}
function verify_certificates_form_submit($form, &$form_state)
{
$page_content = "";
$v = $form_state["values"];
$qr_code = $v["QR_code"];
$page_content = verify_qrcode_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_fromdb($qr_code)
{
$query = db_select('om_flowsheet_qr_code');
$query->fields('om_flowsheet_qr_code', array(
'proposal_id'
));
$query->condition('qr_code', $qr_code);
$result = $query->execute();
$proposal_id = $result->fetchObject()->proposal_id;
if ($proposal_id)
{
$query2 = db_query("SELECT * FROM {om_flowsheet_proposal} WHERE approval_status=3", array(
':uid' => $proposal_id
));
$data2 = $query2->fetchObject();
$query3 = db_query("SELECT * FROM om_flowsheet_proposal WHERE approval_status=3 AND id=:uid", array(
':uid' => $proposal_id
));
$data3 = $query3->fetchObject();
/*$query3 = db_query("SELECT * FROM {dwsim_flowsheet_proposal} WHERE approval_status=3 AND uid= :uid", array(
':uid' => $user->uid
));
$data3 = $query3->fetchObject();**/
if($data3->project_guide_name) {
$page_content = "";
$page_content .= "Participation Details
Name | ";
$page_content .= "" . $data3->contributor_name . " |
";
$page_content .= "Project | ";
$page_content .= "OpenModelica Flowsheeting Project |
";
$page_content .= "OpenModelica Flowsheeting completed | ";
$page_content .= "" . $data3->project_title . " |
";
$page_content .= "Project Guide | ";
$page_content .= "" . $data3->project_guide_name . " |
";
$page_content .= "
";
}
else {
$page_content = "";
$page_content .= "Participation Details
Name | ";
$page_content .= "" . $data3->contributor_name . " |
";
$page_content .= "Project | ";
$page_content .= "OpenModelica Flowsheeting Project |
";
$page_content .= "OpenModelica Flowsheeting completed | ";
$page_content .= "" . $data3->project_title . " |
";
$page_content .= "
";
}
} //$proposal_id
else
{
$page_content = "Sorry ! The serial number you entered seems to be invalid. Please try again ! ";
}
return $page_content;
}