Beispiel #1
0
$id = optional_param('id', 0, PARAM_INT);
$summary = optional_param('summary', '', PARAM_RAW);
$sequence = optional_param('sequence', '', PARAM_SEQUENCE);
$visible = optional_param('visible', 0, PARAM_INT);
$pageaction = optional_param('action', '', PARAM_ALPHA);
// Used to simulate a DELETE command.
$maxmark = optional_param('maxmark', '', PARAM_FLOAT);
$page = optional_param('page', '', PARAM_INT);
$PAGE->set_url('/mod/quiz/edit-rest.php', array('quizid' => $quizid, 'class' => $class));
require_sesskey();
$quiz = $DB->get_record('quiz', array('id' => $quizid), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('quiz', $quiz->id, $quiz->course);
$course = $DB->get_record('course', array('id' => $quiz->course), '*', MUST_EXIST);
require_login($course, false, $cm);
$quizobj = new quiz($quiz, $cm, $course);
$structure = $quizobj->get_structure();
$modcontext = context_module::instance($cm->id);
echo $OUTPUT->header();
// Send headers.
// OK, now let's process the parameters and do stuff
// MDL-10221 the DELETE method is not allowed on some web servers,
// so we simulate it with the action URL param.
$requestmethod = $_SERVER['REQUEST_METHOD'];
if ($pageaction == 'DELETE') {
    $requestmethod = 'DELETE';
}
switch ($requestmethod) {
    case 'POST':
    case 'GET':
        // For debugging.
        switch ($class) {