Skip to content

Commit

Permalink
MDL-81376 mod_quiz: Fix formatting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
djarran committed May 29, 2024
1 parent 668e3ab commit 8675a74
Show file tree
Hide file tree
Showing 10 changed files with 261 additions and 338 deletions.
17 changes: 8 additions & 9 deletions mod/quiz/classes/form/import_override_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ public function definition(): void {
$mode = optional_param('mode', '', PARAM_ALPHANUMEXT);
$context = context_module::instance($cmid);

// Get the course module object
// Get the course module object.
$cm = get_coursemodule_from_id(null, $cmid);
if (!$cm) {
throw new moodle_exception('invalidcoursemodule'); // Handle error if course module is not found
throw new moodle_exception('invalidcoursemodule');
}

// Get the course object
// Get the course object.
$course = get_course($cm->course);

$mform = $this->_form;
Expand All @@ -77,7 +77,7 @@ public function definition(): void {
$mform->setType('mode', PARAM_ALPHANUMEXT);

// Filepicker.
$element = $mform->createElement('filepicker', 'importfile', 'CSV override file', null, ['accepted_types' => '.csv']);
$element = $mform->createElement('filepicker', 'importfile', get_string('overridefile', 'quiz'), null, ['accepted_types' => '.csv']);
$mform->addElement($element);
$mform->addRule('importfile', null, 'required');
$mform->addElement('hidden', 'confirm', 0);
Expand Down Expand Up @@ -112,14 +112,14 @@ public function definition(): void {
$downloadurl->params([
'template' => 1,
]);

$templatename = "{$course->shortname}-{$mode}-overrides-template.csv";
$templatelink = \html_writer::link($downloadurl, $templatename);
$mform->addElement('static', 'exampleimportcsv', 'Template file', $templatelink);
$mform->addElement('static', 'exampleimportcsv', get_string('templatefile', 'quiz'), $templatelink);
$mform->addHelpButton('exampleimportcsv', 'exampleimportcsv', 'quiz');

// Action buttons
$this->add_action_buttons(true, 'Validate');
// Action buttons.
$this->add_action_buttons(true, get_string('importvalidate', 'quiz'));
}

/**
Expand All @@ -131,5 +131,4 @@ public function set_import_error($msg) {

$mform->setElementError('importfile', $msg);
}

}
Loading

0 comments on commit 8675a74

Please sign in to comment.