diff --git a/view.php b/view.php index f94b5ea..90db998 100644 --- a/view.php +++ b/view.php @@ -33,7 +33,6 @@ $action = optional_param('action', '', PARAM_ALPHA); $userids = optional_param_array('userid', array(), PARAM_INT); // array of attempt ids for delete action $notify = optional_param('notify', '', PARAM_ALPHA); -$maxenrollments = optional_param('maxenrollments', '', PARAM_INT); $url = new moodle_url('/mod/choicegroup/view.php', array('id'=>$id)); if ($action !== '') { @@ -104,20 +103,19 @@ if ($choicegroup->multipleenrollmentspossible == 1) { $number_of_groups = optional_param('number_of_groups', '', PARAM_INT); $enrollmentscount = 0; - $maxenrollments = $choicegroup->maxenrollments; - if($maxenrollments > 0){ + if ($choicegroup->maxenrollments > 0) { for ($i = 0; $i < $number_of_groups; $i++) { $answer_value = optional_param('answer_' . $i, '', PARAM_INT); if ($answer_value != '') { $enrollmentscount++; } } - if ($enrollmentscount > $maxenrollments) { + if ($enrollmentscount > $choicegroup->maxenrollments) { redirect(new moodle_url('/mod/choicegroup/view.php', - array('id' => $cm->id, 'notify' => 'mustchoosemax', 'sesskey' => sesskey(), 'maxenrollments' => $maxenrollments))); + array('id' => $cm->id, 'notify' => 'mustchoosemax', 'sesskey' => sesskey()))); } - } + } for ($i = 0; $i < $number_of_groups; $i++) { $answer_value = optional_param('answer_' . $i, '', PARAM_INT); @@ -180,7 +178,7 @@ } else if ($notify === 'mustchooseone') { echo $OUTPUT->notification(get_string('mustchooseone', 'choicegroup'), 'notifyproblem'); } else if ($notify === 'mustchoosemax') { - echo $OUTPUT->notification(get_string('mustchoosemax', 'choicegroup', $maxenrollments), 'notifyproblem'); + echo $OUTPUT->notification(get_string('mustchoosemax', 'choicegroup', $choicegroup->maxenrollments), 'notifyproblem'); } }