|
@ -3,44 +3,52 @@ require_once("../../config.php"); |
|
|
|
|
|
|
|
|
global $DB; |
|
|
global $DB; |
|
|
|
|
|
|
|
|
$id = required_param('certnumber', PARAM_ALPHANUM); // certificate code to verify |
|
|
$code = required_param('certnumber', PARAM_ALPHANUM); // certificate code to verify |
|
|
|
|
|
|
|
|
$PAGE->set_pagelayout('standard'); |
|
|
$PAGE->set_pagelayout('standard'); |
|
|
$strverify = get_string('verifycertificate', 'block_verify_certificate'); |
|
|
$strverify = get_string('verifycertificate', 'block_verify_certificate'); |
|
|
$PAGE->set_url('/blocks/verify_certificate/index.php', array('certnumber' => $id)); |
|
|
$PAGE->set_url('/blocks/verify_certificate/index.php', array('certnumber' => $id)); |
|
|
$context = get_context_instance(CONTEXT_SYSTEM); |
|
|
$context = get_context_instance(CONTEXT_SYSTEM); |
|
|
$PAGE->set_context($context); |
|
|
$PAGE->set_context($context); |
|
|
|
|
|
|
|
|
/// Print the header |
|
|
/// Print the header |
|
|
|
|
|
|
|
|
$PAGE->navbar->add($strverify); |
|
|
$PAGE->navbar->add($strverify); |
|
|
$PAGE->set_title($strverify); |
|
|
$PAGE->set_title($strverify); |
|
|
$PAGE->set_heading($strverify); |
|
|
$PAGE->set_heading($strverify); |
|
|
$PAGE->requires->css('/blocks/verify_certificate/printstyle.css'); |
|
|
$PAGE->requires->css('/blocks/verify_certificate/printstyle.css'); |
|
|
echo $OUTPUT->header(); |
|
|
echo $OUTPUT->header(); |
|
|
$certificate = $DB->get_records_sql("SELECT s.* |
|
|
|
|
|
FROM {certificate_issues} s |
|
|
// Print results |
|
|
WHERE s.code = ?", array($id)); |
|
|
|
|
|
if (! $certificate) { |
|
|
echo $OUTPUT->box_start('generalbox boxaligncenter'); |
|
|
echo $OUTPUT->box_start('generalbox boxaligncenter'); |
|
|
if (!$issues = $DB->get_records('certificate_issues', array('code' => $code))) { |
|
|
echo get_string('notfound', 'block_verify_certificate'); |
|
|
echo get_string('notfound', 'block_verify_certificate'); |
|
|
echo $OUTPUT->box_end(); |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
echo $OUTPUT->box_start('generalbox boxaligncenter'); |
|
|
echo "<a title=\""; print_string('printerfriendly', 'certificate'); |
|
|
echo "<a title=\""; print_string('printerfriendly', 'certificate'); |
|
|
echo "\" href=\"#\" onclick=\"window.print ()\"><div class=\"printicon\">"; |
|
|
echo "\" href=\"#\" onclick=\"window.print ()\"><div class=\"printicon\">"; |
|
|
echo "<img src=\"print.gif\" height=\"16\" width=\"16\" border=\"0\"></img></a></div>"; |
|
|
echo "<img src=\"print.gif\" height=\"16\" width=\"16\" border=\"0\"></img></a></div>"; |
|
|
/// Print Section |
|
|
/// Print Section |
|
|
foreach ($issues as $issue) { |
|
|
foreach ($certificate as $certrecord) { |
|
|
if (!$certificate = $DB->get_record('certificate', array('id'=> $issue->certificateid))) { |
|
|
$certificatedate = userdate($certrecord->timecreated); |
|
|
print_error('course module is incorrect'); |
|
|
echo '<p>' . get_string('certificate', 'block_verify_certificate') . ' ' . $certrecord->code . '</p>'; |
|
|
} |
|
|
echo '<p><b>' . get_string('to', 'block_verify_certificate') . ': </b>' . $certrecord->studentname . '<br />'; |
|
|
if (!$course = $DB->get_record('course', array('id'=> $certificate->course))) { |
|
|
echo '<p><b>' . get_string('course', 'block_verify_certificate') . ': </b>' . $certrecord->classname . '<br />'; |
|
|
print_error('course is misconfigured'); |
|
|
echo '<p><b>' . get_string('date', 'block_verify_certificate') . ': </b>' . $certificatedate . '<br /></p>'; |
|
|
} |
|
|
if ($certrecord->reportgrade != null) { |
|
|
if (!$user = $DB->get_record('user', array('id'=> $issue->userid))) { |
|
|
echo '<p><b>' . get_string('grade', 'block_verify_certificate') . ': </b>' . $certrecord->reportgrade . '<br /></p>'; |
|
|
print_error('user is unreachable'); |
|
|
} |
|
|
} |
|
|
} |
|
|
$certificatedate = userdate($issue->timecreated); |
|
|
echo $OUTPUT->box_end(); |
|
|
echo '<p>' . get_string('certificate', 'block_verify_certificate') . ' ' . $issue->code . '</p>'; |
|
|
} |
|
|
echo '<p><b>' . get_string('to', 'block_verify_certificate') . ': </b>' . fullname($user) . '<br />'; |
|
|
echo $OUTPUT->footer(); |
|
|
echo '<p><b>' . get_string('course', 'block_verify_certificate') . ': </b>' . $course->fullname . '<br />'; |
|
|
|
|
|
echo '<p><b>' . get_string('date', 'block_verify_certificate') . ': </b>' . $certificatedate . '<br /></p>'; |
|
|
|
|
|
if ($certificate->customtext !== '') { |
|
|
|
|
|
echo '<p><b>' . get_string('customtext', 'block_verify_certificate') . ': </b><br/></p>'; |
|
|
|
|
|
echo $certificate->customtext; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
echo $OUTPUT->box_end(); |
|
|
|
|
|
echo $OUTPUT->footer(); |
|
|