Ejemplo n.º 1
0
        $sessid = optional_param_array('sessid', '', PARAM_INT);
        $ids = optional_param('ids', '', PARAM_ALPHANUMEXT);
        $slist = '';
        if (isset($sessid) && is_array($sessid) && count($sessid)) {
            $slist = implode('_', $sessid);
        }
        $url = $att->url_sessions(array('action' => att_sessions_page_params::ACTION_CHANGE_DURATION));
        $formparams['ids'] = $slist;
        $mform = new mod_attcontrol_duration_form($url, $formparams);
        if ($mform->is_cancelled()) {
            redirect($att->url_manage());
        }
        if ($formdata = $mform->get_data()) {
            $sessionsids = explode('_', $ids);
            $duration = $formdata->durtime['hours'] * HOURSECS + $formdata->durtime['minutes'] * MINSECS;
            $att->update_sessions_duration($sessionsids, $duration);
            redirect($att->url_manage(), get_string('sessionupdated', 'attcontrol'));
        }
        if ($slist === '') {
            print_error('nosessionsselected', 'attcontrol', $att->url_manage());
        }
        break;
}
$output = $PAGE->get_renderer('mod_attcontrol');
$tabs = new attcontrol_tabs($att, attcontrol_tabs::TAB_ADD);
echo $output->header();
echo $output->heading(get_string('attendancecontrol', 'attcontrol'));
echo $output->render($tabs);
$mform->display();
echo $OUTPUT->footer();
function construct_sessions_data_for_add($formdata)