From e8b0ba5db7e3aa4014cd565a68320896f4b684dc Mon Sep 17 00:00:00 2001 From: Stuart Lamour Date: Fri, 22 Nov 2024 15:13:02 +0000 Subject: [PATCH] CR update --- block_my_feedback.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/block_my_feedback.php b/block_my_feedback.php index d6dead2..f7a0e35 100644 --- a/block_my_feedback.php +++ b/block_my_feedback.php @@ -36,14 +36,12 @@ class block_my_feedback extends block_base { public function init() { global $USER; - // If $USER->firstname is not set yet do not try to use it. if (!isset($USER->firstname)) { $this->title = get_string('pluginname', 'block_my_feedback'); + } else if (self::is_teacher()) { + $this->title = get_string('markingfor', 'block_my_feedback').' '.$USER->firstname; } else { $this->title = get_string('feedbackfor', 'block_my_feedback').' '.$USER->firstname; - if (self::is_teacher()) { - $this->title = get_string('markingfor', 'block_my_feedback').' '.$USER->firstname; - } } } @@ -87,7 +85,6 @@ public function get_content(): stdClass { * @param stdClass $user */ public function fetch_marking(stdClass $user): ?array { - global $DB, $OUTPUT; // User courses. $courses = enrol_get_all_users_courses($user->id, false, ['enddate']); // Marking. @@ -103,7 +100,7 @@ public function fetch_marking(stdClass $user): ?array { continue; } // Skip if no summative assessments. - if (!$summatives = assess_type::get_assess_type_records_by_courseid($course->id, "1")) { + if (!$summatives = assess_type::get_assess_type_records_by_courseid($course->id, 1)) { continue; } @@ -311,10 +308,7 @@ public function fetch_feedback($user): ?array { $template->feedback[] = $feedback; } - if ($template->feedback) { - return $template->feedback; - } - return null; + return $template->feedback ?: null; } /**