set_pagelayout('standard'); $strverify = get_string('verifycertificate', 'block_verify_certificate'); $PAGE->set_url('/blocks/verify_certificate/index.php', array('certnumber' => $id)); $context = get_context_instance(CONTEXT_SYSTEM); $PAGE->set_context($context); /// Print the header $PAGE->navbar->add($strverify); $PAGE->set_title($strverify); $PAGE->set_heading($strverify); $PAGE->requires->css('/blocks/verify_certificate/printstyle.css'); echo $OUTPUT->header(); // Print results echo $OUTPUT->box_start('generalbox boxaligncenter'); if (!$issues = $DB->get_records('certificate_issues', array('code' => $code))) { echo get_string('notfound', 'block_verify_certificate'); } else { echo "
"; echo "
"; /// Print Section foreach ($issues as $issue) { if (!$certificate = $DB->get_record('certificate', array('id'=> $issue->certificateid))) { print_error('course module is incorrect'); } if (!$course = $DB->get_record('course', array('id'=> $certificate->course))) { print_error('course is misconfigured'); } if (!$user = $DB->get_record('user', array('id'=> $issue->userid))) { print_error('user is unreachable'); } $certificatedate = userdate($issue->timecreated); echo '

' . get_string('certificate', 'block_verify_certificate') . ' ' . $issue->code . '

'; echo '

' . get_string('to', 'block_verify_certificate') . ': ' . fullname($user) . '
'; echo '

' . get_string('course', 'block_verify_certificate') . ': ' . $course->fullname . '
'; echo '

' . get_string('date', 'block_verify_certificate') . ': ' . $certificatedate . '

'; if ($certificate->customtext !== '') { echo '

' . get_string('customtext', 'block_verify_certificate') . ':

'; echo $certificate->customtext; } } } echo $OUTPUT->box_end(); echo $OUTPUT->footer();