|
@ -1,14 +1,19 @@ |
|
|
<?php |
|
|
<?php |
|
|
require_once("../../config.php"); |
|
|
require_once("../../config.php"); |
|
|
require_once("$CFG->dirroot/enrol/locallib.php"); |
|
|
require_once("$CFG->dirroot/enrol/locallib.php"); |
|
|
|
|
|
require_once("$CFG->libdir/blocklib.php"); |
|
|
|
|
|
require_once("$CFG->dirroot/user/profile/lib.php"); |
|
|
|
|
|
|
|
|
global $DB; |
|
|
global $DB; |
|
|
|
|
|
|
|
|
$code = required_param('certnumber', PARAM_ALPHANUM); // certificate code to verify |
|
|
$code = required_param('certnumber', PARAM_ALPHANUM); // certificate code to verify |
|
|
|
|
|
$fieldid = required_param('list', PARAM_SEQUENCE); |
|
|
|
|
|
$fieldid = explode(',', $fieldid); |
|
|
|
|
|
$profile_fields = $DB->get_records_list('user_info_field', 'id', $fieldid); |
|
|
|
|
|
|
|
|
$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' => $code)); |
|
|
$context = get_context_instance(CONTEXT_SYSTEM); |
|
|
$context = get_context_instance(CONTEXT_SYSTEM); |
|
|
$PAGE->set_context($context); |
|
|
$PAGE->set_context($context); |
|
|
|
|
|
|
|
@ -42,6 +47,8 @@ global $DB; |
|
|
print_error('user is unreachable'); |
|
|
print_error('user is unreachable'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
profile_load_data($user); |
|
|
|
|
|
|
|
|
$enrol_manager = new course_enrolment_manager($PAGE, $course); |
|
|
$enrol_manager = new course_enrolment_manager($PAGE, $course); |
|
|
$user_enrols = $enrol_manager->get_user_enrolments($user->id); |
|
|
$user_enrols = $enrol_manager->get_user_enrolments($user->id); |
|
|
$start_date = 0; |
|
|
$start_date = 0; |
|
@ -83,6 +90,11 @@ global $DB; |
|
|
$certificatedate = userdate($issue->timecreated); |
|
|
$certificatedate = userdate($issue->timecreated); |
|
|
echo '<p>' . get_string('certificate', 'block_verify_certificate') . " <strong>{$issue->code}</strong></p>"; |
|
|
echo '<p>' . get_string('certificate', 'block_verify_certificate') . " <strong>{$issue->code}</strong></p>"; |
|
|
echo '<p><strong>' . get_string('to', 'block_verify_certificate') . ': </strong>' . fullname($user) . '</p>'; |
|
|
echo '<p><strong>' . get_string('to', 'block_verify_certificate') . ': </strong>' . fullname($user) . '</p>'; |
|
|
|
|
|
foreach ($profile_fields as $field) { |
|
|
|
|
|
$fieldname = "profile_field_{$field->shortname}"; |
|
|
|
|
|
$fieldvalue = $user->$fieldname; |
|
|
|
|
|
echo "<p><strong>{$field->name}: <strong>{$fieldvalue}"; |
|
|
|
|
|
} |
|
|
echo '<p><strong>' . get_string('course', 'block_verify_certificate') . ": </strong>{$course->fullname}</p>"; |
|
|
echo '<p><strong>' . get_string('course', 'block_verify_certificate') . ": </strong>{$course->fullname}</p>"; |
|
|
echo '<p><strong>' . get_string('date', 'block_verify_certificate') . ": </strong>$certificatedate</p>"; |
|
|
echo '<p><strong>' . get_string('date', 'block_verify_certificate') . ": </strong>$certificatedate</p>"; |
|
|
echo '<p><strong>' . get_string('enrol_period', 'block_verify_certificate') . ": </strong>$start_date - $end_date</p>"; |
|
|
echo '<p><strong>' . get_string('enrol_period', 'block_verify_certificate') . ": </strong>$start_date - $end_date</p>"; |
|
|