コード例 #1
0
ファイル: editlib_test.php プロジェクト: covex-nn/moodle
 public function test_quiz_delete_empty_page()
 {
     $this->assertEquals(quiz_delete_empty_page('0', 0), '0');
     $this->assertEquals(quiz_delete_empty_page('1,2,0', 2), '1,2,0');
     $this->assertEquals(quiz_delete_empty_page('0,1,2,0', -1), '1,2,0');
     $this->assertEquals(quiz_delete_empty_page('0,1,2,0', 0), '0,1,2,0');
     $this->assertEquals(quiz_delete_empty_page('1,2,0', 3), '1,2,0');
     $this->assertEquals(quiz_delete_empty_page('1,2,0', -1), '1,2,0');
     $this->assertEquals(quiz_delete_empty_page('1,2,0,0', 2), '1,2,0');
     $this->assertEquals(quiz_delete_empty_page('1,2,0,0', 1), '1,2,0,0');
     $this->assertEquals(quiz_delete_empty_page('1,2,0,0,3,4,0', 2), '1,2,0,3,4,0');
     $this->assertEquals(quiz_delete_empty_page('0,0,1,2,0', 0), '0,1,2,0');
 }
コード例 #2
0
ファイル: edit.php プロジェクト: saurabh947/MoodleLearning
        $quiz->questions = quiz_add_page_break_after($quiz->questions, $questionid);
    }
    $DB->set_field('quiz', 'questions', $quiz->questions, array('id' => $quiz->id));
    quiz_delete_previews($quiz);
    redirect($afteractionurl);
}
$addpage = optional_param('addpage', false, PARAM_INT);
if ($addpage !== false && confirm_sesskey()) {
    $quiz->questions = quiz_add_page_break_at($quiz->questions, $addpage);
    $DB->set_field('quiz', 'questions', $quiz->questions, array('id' => $quiz->id));
    quiz_delete_previews($quiz);
    redirect($afteractionurl);
}
$deleteemptypage = optional_param('deleteemptypage', false, PARAM_INT);
if ($deleteemptypage !== false && confirm_sesskey()) {
    $quiz->questions = quiz_delete_empty_page($quiz->questions, $deleteemptypage);
    $DB->set_field('quiz', 'questions', $quiz->questions, array('id' => $quiz->id));
    quiz_delete_previews($quiz);
    redirect($afteractionurl);
}
$remove = optional_param('remove', false, PARAM_INT);
if ($remove && confirm_sesskey()) {
    // Remove a question from the quiz.
    // We require the user to have the 'use' capability on the question,
    // so that then can add it back if they remove the wrong one by mistake.
    quiz_require_question_use($remove);
    quiz_remove_question($quiz, $remove);
    quiz_delete_previews($quiz);
    quiz_update_sumgrades($quiz);
    redirect($afteractionurl);
}
コード例 #3
0
ファイル: edit.php プロジェクト: narasimhaeabyas/tataaiapro
        quiz_add_page_break_after_slot($quiz, $slot);
    }
    quiz_delete_previews($quiz);
    redirect($afteractionurl);
}

$addpage = optional_param('addpage', false, PARAM_INT);
if ($addpage !== false && confirm_sesskey()) {
    quiz_add_page_break_after_slot($quiz, $addpage);
    quiz_delete_previews($quiz);
    redirect($afteractionurl);
}

$deleteemptypage = optional_param('deleteemptypage', false, PARAM_INT);
if (($deleteemptypage !== false) && confirm_sesskey()) {
    quiz_delete_empty_page($quiz, $deleteemptypage);
    quiz_delete_previews($quiz);
    redirect($afteractionurl);
}

$remove = optional_param('remove', false, PARAM_INT);
if ($remove && confirm_sesskey() && quiz_has_question_use($quiz, $remove)) {
    // Remove a question from the quiz.
    // We require the user to have the 'use' capability on the question,
    // so that then can add it back if they remove the wrong one by mistake,
    // but, if the question is missing, it can always be removed.
    quiz_remove_slot($quiz, $remove);
    quiz_delete_previews($quiz);
    quiz_update_sumgrades($quiz);
    redirect($afteractionurl);
}