Merge branch 'MDL-76362-master-extra' of https://github.com/andrewnicols/moodle

This commit is contained in:
Jun Pataleta 2023-01-24 10:38:55 +08:00
commit da144479fb
81 changed files with 961 additions and 432 deletions

View file

@ -64,7 +64,7 @@ class course_summary_exporter extends \core\external\exporter {
if ($progress === 0 || $progress > 0) {
$hasprogress = true;
}
$progress = floor($progress);
$progress = floor($progress ?? 0);
$coursecategory = \core_course_category::get($this->data->category, MUST_EXIST, true);
return array(
'fullnamedisplay' => get_course_display_name_for_list($this->data),

View file

@ -618,7 +618,7 @@ abstract class base {
$course = $this->get_course();
try {
$sectionpreferences = (array) json_decode(
get_user_preferences('coursesectionspreferences_' . $course->id, null, $USER->id)
get_user_preferences("coursesectionspreferences_{$course->id}", '', $USER->id)
);
if (empty($sectionpreferences)) {
$sectionpreferences = [];

View file

@ -84,7 +84,7 @@ class frontpagesection implements named_templatable, renderable {
$sectionoutput = new $this->sectionclass($format, $section);
$sectionoutput->hide_controls();
if (trim($section->name) == '') {
if (trim($section->name ?? '') == '') {
$sectionoutput->hide_title();
}

View file

@ -148,7 +148,7 @@ switch ($mode) {
$coursenode->collapse = true;
$coursenode->make_inactive();
if (!preg_match('/^user\d{0,}$/', $activenode->key)) { // No user name found.
if (!preg_match('/^user\d{0,}$/', $activenode->key ?? '')) { // No user name found.
$userurl = new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $course->id));
// Add the user name.
$usernode = $activenode->add(fullname($user), $userurl, navigation_node::TYPE_SETTING);