From ae6e80c3be2b0af5ed746a3adda14434316016ed Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Tue, 3 Aug 2021 16:28:39 +0800 Subject: [PATCH] Minor changes and CHANGES.md note (#433) --- CHANGES.md | 5 +++++ classes/load_template_form.php | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index edd3186..1c2fc95 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. Note - All hash comments refer to the issue number. Eg. #169 refers to https://github.com/mdjnelson/moodle-mod_customcert/issues/169. +## [3.10.2] - 2021-??-?? + +### Fixed +- Fix places not using the multi-language filter (#433). + ## [3.10.1] - 2021-06-13 ### Added diff --git a/classes/load_template_form.php b/classes/load_template_form.php index 34ab93c..ef9a8d7 100644 --- a/classes/load_template_form.php +++ b/classes/load_template_form.php @@ -47,21 +47,21 @@ class load_template_form extends \moodleform { // Get the context. $context = $this->_customdata['context']; + $syscontext = \context_system::instance(); $mform->addElement('header', 'loadtemplateheader', get_string('loadtemplate', 'customcert')); // Display a link to the manage templates page. - if ($context->contextlevel != CONTEXT_SYSTEM && has_capability('mod/customcert:manage', \context_system::instance())) { + if ($context->contextlevel != CONTEXT_SYSTEM && has_capability('mod/customcert:manage', $syscontext)) { $link = \html_writer::link(new \moodle_url('/mod/customcert/manage_templates.php'), get_string('managetemplates', 'customcert')); $mform->addElement('static', 'managetemplates', '', $link); } - $templates = $DB->get_records_menu('customcert_templates', - array('contextid' => \context_system::instance()->id), 'name ASC', 'id, name'); - if ($templates) { - $context = \context_system::instance()->id; - foreach ($templates as $key => $template) { + $arrtemplates = $DB->get_records_menu('customcert_templates', ['contextid' => $syscontext->id], 'name ASC', 'id, name'); + if ($arrtemplates) { + $templates = []; + foreach ($arrtemplates as $key => $template) { $templates[$key] = format_string($template, true, ['context' => $context]); } $group = array();