/** * display_confirmunenrol() new page to allow users to self-unenrol, if enabled * ELIS-8524 * @uses $OUTPUT */ public function display_confirmunenrol() { global $OUTPUT; $stuid = $this->optional_param('stuid', 0, PARAM_INT); $wlid = $this->optional_param('wlid', 0, PARAM_INT); $buttoncancel = new single_button(new moodle_url('index.php', array('s' => $this->pagename, 'action' => 'available')), get_string('no')); $prompt = null; if (!empty($stuid) && ($stu = new student($stuid))) { $pmclass = new pmclass($stu->classid); $pmclass->load(); $prompt = get_string('unenrol_student', 'local_elisprogram', $pmclass->to_object()); $buttoncontinue = new single_button(new moodle_url('index.php', array('s' => $this->pagename, 'action' => 'unenrol', 'stuid' => $stuid)), get_string('yes')); } else { if (!empty($wlid) && ($waitlist = new waitlist($wlid))) { $pmclass = new pmclass($waitlist->classid); $pmclass->load(); $prompt = get_string('unenrol_waitlist', 'local_elisprogram', $pmclass->to_object()); $buttoncontinue = new single_button(new moodle_url('index.php', array('s' => $this->pagename, 'action' => 'unenrol', 'wlid' => $wlid)), get_string('yes')); } } if ($prompt) { echo $OUTPUT->confirm($prompt, $buttoncontinue, $buttoncancel); } else { $this->display('available'); } }