示例#1
0
$PAGE->set_title($blockname . ': ' . $header);
$PAGE->set_heading($blockname . ': ' . $header);
$PAGE->navbar->add($header);
$PAGE->set_pagetype($blockname);
$PAGE->set_pagelayout('standard');
$changed = false;
if ($reset) {
    $changed = true;
    clampmail::default_config($courseid);
}
$roles = $DB->get_records_menu('role', null, 'sortorder ASC', 'id, shortname');
$form = new config_form(null, array('courseid' => $courseid, 'roles' => $roles));
if ($data = $form->get_data()) {
    $config = get_object_vars($data);
    unset($config['save'], $config['courseid']);
    $config['roleselection'] = implode(',', $config['roleselection']);
    clampmail::save_config($courseid, $config);
    $changed = true;
}
$config = clampmail::load_config($courseid);
$config['roleselection'] = explode(',', $config['roleselection']);
$form->set_data($config);
echo $OUTPUT->header();
echo $OUTPUT->heading($header);
echo $OUTPUT->box_start();
if ($changed) {
    echo $OUTPUT->notification(get_string('changessaved'), 'notifysuccess');
}
$form->display();
echo $OUTPUT->box_end();
echo $OUTPUT->footer();