Skip to content

Commit

Permalink
Quiz\Answer sheets: exception caused by argument type of possbiel_use…
Browse files Browse the repository at this point in the history
…r_info_visibility_settings #688018
  • Loading branch information
danghieu1407 authored and Kristiina.Bax committed Aug 21, 2023
1 parent b5aa4cd commit a9ad568
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 4 additions & 2 deletions classes/report_display_options.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

use context_module;
use quiz_attempts_report;
use stdClass;
use cm_info;

defined('MOODLE_INTERNAL') || die();

Expand Down Expand Up @@ -156,10 +158,10 @@ protected function parse_user_info_visibility(string $combined): void {
/**
* Considering the site settings, work out what user info visibility settings there should be.
*
* @param \stdClass $cm the course_module info for this quiz.
* @param stdClass|cm_info $cm the course_module info for this quiz.
* @return array setting name => true
*/
public static function possible_user_info_visibility_settings(\stdClass $cm): array {
public static function possible_user_info_visibility_settings(stdClass|cm_info $cm): array {
$settings = ['fullname' => true];

$userfields = \core_user\fields::get_identity_fields(context_module::instance($cm->id));
Expand Down
5 changes: 3 additions & 2 deletions classes/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use quiz_attempt;
use ReflectionClass;
use stdClass;
use cm_info;
use user_picture;

defined('MOODLE_INTERNAL') || die();
Expand Down Expand Up @@ -208,12 +209,12 @@ public static function prepare_summary_attempt_information(quiz_attempt $attempt
* Get user detail with identity fields
*
* @param stdClass $attemptuser User info
* @param stdClass $cm quiz course_module.
* @param stdClass|cm_info $cm quiz course_module.
* @param report_display_options|array $fieldoptions which use fields to show, either an options object,
* or just a array of field names.
* @return string User detail string
*/
public static function get_user_details(stdClass $attemptuser, stdClass $cm, $fieldoptions): string {
public static function get_user_details(stdClass $attemptuser, stdClass|cm_info $cm, $fieldoptions): string {
$fields = [];
if ($fieldoptions instanceof report_display_options) {
foreach ($fieldoptions->userinfovisibility as $field => $show) {
Expand Down
4 changes: 2 additions & 2 deletions report.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,10 @@ protected function attempt_has_any_questions_with_files(int $attemptid, array $q
* if all else fails, just call it 'attempts'.
*
* @param stdClass $quiz the quiz settings.
* @param stdClass $cm the course-module settings for the quiz.
* @param stdClass|cm_info $cm the course-module settings for the quiz.
* @return string suggested filename.
*/
protected function generate_zip_filename(stdClass $quiz, stdClass $cm): string {
protected function generate_zip_filename(stdClass $quiz, stdClass|cm_info $cm): string {
$filename = '';
if ($cm->idnumber) {
$filename = $this->clean_filename($cm->idnumber);
Expand Down

0 comments on commit a9ad568

Please sign in to comment.