Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion classes/question/question.php
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,7 @@ protected function form_preprocess_data($formdata) {
*/
protected function form_preprocess_choicedata($formdata) {
if (empty($formdata->allchoices)) {
error (get_string('enterpossibleanswers', 'questionnaire'));
throw new \moodle_exception('enterpossibleanswers', 'mod_questionnaire');
}
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions lang/en/questionnaire.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
$string['confpagedesc'] = 'Heading (in bold) and body text for the "Confirmation" page displayed after a user completes this questionnaire. (URL, if present, takes precedence over confirmation text.)';
$string['contentoptions'] = 'Content options';
$string['couldnotdelresp'] = 'Could not delete response ';
$string['couldnotdelrespby'] = 'Could not delete response {$a->rid} by {$a->user}';
$string['couldnotcreatenewsurvey'] = 'Could not create a new survey!';
$string['createcontent'] = 'Define New Content';
$string['createcontent_help'] = 'Select one of the radio button options. \'Create new\' is the default.';
Expand Down Expand Up @@ -177,6 +178,7 @@
$string['emailsend'] = 'Send reports';
$string['emailssent'] = 'Downloads sent to specified email(s).';
$string['enabled'] = 'Enabled';
$string['enterpossibleanswers'] = 'Enter possible answers';
$string['errnewname'] = 'Sorry, name already in use. Pick a new name.';
$string['erroropening'] = 'Error opening questionnaire.';
$string['errortable'] = 'Error system table corrupt.';
Expand Down
25 changes: 18 additions & 7 deletions report.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@
require_capability('mod/questionnaire:deleteresponses', $context);

if (empty($questionnaire->survey)) {
$id = $questionnaire->survey;
notify ("questionnaire->survey = /$id/");
throw new \moodle_exception('surveynotexists', 'mod_questionnaire');
} else if ($questionnaire->survey->courseid != $course->id) {
throw new \moodle_exception('surveyowner', 'mod_questionnaire');
Expand Down Expand Up @@ -352,9 +350,18 @@
} else {
$ruser = $response->userid;
}
error (get_string('couldnotdelresp', 'questionnaire').$rid.get_string('by', 'questionnaire').$ruser.'?',
$CFG->wwwroot.'/mod/questionnaire/report.php?action=vresp&sid='.$sid.'&&instance='.
$instance.'byresponse=1');
$link = new \moodle_url('/mod/questionnaire/report.php', [
'action' => 'vresp',
'sid' => $sid,
'instance' => $instance,
'byresponse' => '1',
]);
throw new \moodle_exception(
'couldnotdelrespby',
'mod_questionnaire',
$link,
['rid' => $rid, 'user' => $ruser]
);
}
break;

Expand Down Expand Up @@ -424,8 +431,12 @@

redirect($redirection);
} else {
error (get_string('couldnotdelresp', 'questionnaire'),
$CFG->wwwroot.'/mod/questionnaire/report.php?action=vall&sid='.$sid.'&instance='.$instance);
$link = new \moodle_url('/mod/questionnaire/report.php', [
'action' => 'vall',
'sid' => $sid,
'instance' => $instance,
]);
throw new \moodle_exception('couldnotdelresp', 'mod_questionnaire', $link);
}
break;

Expand Down