function action_overenrol() { global $CURMAN; $id = $this->required_param('id', PARAM_INT); $recs = explode(',', $this->required_param('selected', PARAM_TEXT)); // make sure everything is an int foreach ($recs as $key => $val) { $recs[$key] = (int) $val; if (empty($recs[$key])) { unset($recs[$key]); } } $result = true; foreach ($recs as $recid) { $waitlistobj = new waitlist($recid); $waitlistobj->enrol(); } $tmppage = new waitlistpage(array('id' => $id)); if ($result) { redirect($tmppage->get_url(), get_string('success_waitlist_overenrol', 'block_curr_admin')); } else { print_error('error_waitlist_overenrol', 'block_curr_admin', $tmppage->get_url()); } }
function do_overenrol() { $id = $this->required_param('id', PARAM_INT); $recs = explode(',', $this->required_param('selected', PARAM_TEXT)); $this->session_selection_deletion(); // make sure everything is an int foreach ($recs as $key => $val) { $recs[$key] = (int) $val; if (empty($recs[$key])) { unset($recs[$key]); } } $result = !empty($recs); foreach ($recs as $recid) { $waitlistobj = new waitlist($recid); $waitlistobj->enrol(); } $tmppage = new waitlistpage(array('id' => $id)); if ($result) { redirect($tmppage->url, get_string('success_waitlist_overenrol', self::LANG_FILE)); } else { print_error('error_waitlist_overenrol', self::LANG_FILE, $tmppage->url); } }