#197 Respect filters in 'My certificates' and 'Verify certificate' pages
This commit is contained in:
parent
1ecb528c11
commit
05b23b5213
3 changed files with 15 additions and 5 deletions
|
@ -94,7 +94,10 @@ class my_certificates_table extends \table_sql {
|
|||
* @return string
|
||||
*/
|
||||
public function col_name($certificate) {
|
||||
return $certificate->name;
|
||||
$cm = get_coursemodule_from_instance('customcert', $certificate->id);
|
||||
$context = \context_module::instance($cm->id);
|
||||
|
||||
return format_string($certificate->name, true, ['context' => $context]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,7 +107,10 @@ class my_certificates_table extends \table_sql {
|
|||
* @return string
|
||||
*/
|
||||
public function col_coursename($certificate) {
|
||||
return $certificate->coursename;
|
||||
$cm = get_coursemodule_from_instance('customcert', $certificate->id);
|
||||
$context = \context_module::instance($cm->id);
|
||||
|
||||
return format_string($certificate->coursename, true, ['context' => $context]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,12 +69,15 @@ class verify_certificate_result implements templatable, renderable {
|
|||
* @param \stdClass $result
|
||||
*/
|
||||
public function __construct($result) {
|
||||
$cm = get_coursemodule_from_instance('customcert', $result->certificateid);
|
||||
$context = \context_module::instance($cm->id);
|
||||
|
||||
$this->userprofileurl = new \moodle_url('/user/view.php', array('id' => $result->userid,
|
||||
'course' => $result->courseid));
|
||||
$this->userfullname = fullname($result);
|
||||
$this->courseurl = new \moodle_url('/course/view.php', array('id' => $result->courseid));
|
||||
$this->coursefullname = $result->coursefullname;
|
||||
$this->certificatename = $result->certificatename;
|
||||
$this->coursefullname = format_string($result->coursefullname, true, ['context' => $context]);
|
||||
$this->certificatename = format_string($result->certificatename, true, ['context' => $context]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -89,7 +89,8 @@ if ($form->get_data()) {
|
|||
// Ok, now check if the code is valid.
|
||||
$userfields = get_all_user_name_fields(true, 'u');
|
||||
$sql = "SELECT ci.id, u.id as userid, $userfields, co.id as courseid,
|
||||
co.fullname as coursefullname, c.name as certificatename, c.verifyany
|
||||
co.fullname as coursefullname, c.id as certificateid,
|
||||
c.name as certificatename, c.verifyany
|
||||
FROM {customcert} c
|
||||
JOIN {customcert_issues} ci
|
||||
ON c.id = ci.customcertid
|
||||
|
|
Loading…
Reference in a new issue