diff --git a/duration_form.php b/duration_form.php index 92877ba..3051642 100644 --- a/duration_form.php +++ b/duration_form.php @@ -61,8 +61,11 @@ class mod_attendance_duration_form extends moodleform { $mform->addGroup($durselect, 'durtime', get_string('newduration', 'attendance'), array(' '), true); $mform->addElement('hidden', 'ids', $ids); + $mform->setType('ids', PARAM_ALPHANUMEXT); $mform->addElement('hidden', 'id', $cm->id); + $mform->setType('id', PARAM_INT); $mform->addElement('hidden', 'action', att_sessions_page_params::ACTION_CHANGE_DURATION); + $mform->setType('action', PARAM_INT); $mform->setDefaults(array('durtime' => array('hours'=>0, 'minutes'=>0))); diff --git a/sessions.php b/sessions.php index 2b60e57..1bc08f5 100644 --- a/sessions.php +++ b/sessions.php @@ -126,7 +126,7 @@ switch ($att->pageparams->action) { } redirect($att->url_manage(), get_string('sessiondeleted', 'attendance')); } - $sessid = required_param('sessid', PARAM_SEQUENCE); + $sessid = required_param_array('sessid', PARAM_SEQUENCE); $sessionsinfo = $att->get_sessions_info($sessid); @@ -149,10 +149,10 @@ switch ($att->pageparams->action) { echo $OUTPUT->footer(); exit; case att_sessions_page_params::ACTION_CHANGE_DURATION: - $sessid = optional_param('sessid', '', PARAM_SEQUENCE); + $sessid = optional_param_array('sessid', '', PARAM_SEQUENCE); $ids = optional_param('ids', '', PARAM_ALPHANUMEXT); - $slist = isset($sessid) ? implode('_', $sessid) : ''; + $slist = !empty($sessid) ? implode('_', $sessid) : ''; $url = $att->url_sessions(array('action' => att_sessions_page_params::ACTION_CHANGE_DURATION)); $formparams['ids'] = $slist;