當前位置: 首頁>>代碼示例>>PHP>>正文


PHP quiz_delete_attempt函數代碼示例

本文整理匯總了PHP中quiz_delete_attempt函數的典型用法代碼示例。如果您正苦於以下問題:PHP quiz_delete_attempt函數的具體用法?PHP quiz_delete_attempt怎麽用?PHP quiz_delete_attempt使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了quiz_delete_attempt函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: display

 /**
  * Display the report.
  */
 function display($quiz, $cm, $course)
 {
     global $CFG, $COURSE, $DB, $PAGE, $OUTPUT;
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     // Work out some display options - whether there is feedback, and whether scores should be shown.
     $hasfeedback = quiz_has_feedback($quiz);
     $fakeattempt = new stdClass();
     $fakeattempt->preview = false;
     $fakeattempt->timefinish = $quiz->timeopen;
     $fakeattempt->userid = 0;
     $reviewoptions = quiz_get_reviewoptions($quiz, $fakeattempt, $context);
     $showgrades = quiz_has_grades($quiz) && $reviewoptions->scores;
     $download = optional_param('download', '', PARAM_ALPHA);
     if ($attemptids = optional_param('attemptid', array(), PARAM_INT)) {
         //attempts need to be deleted
         require_capability('mod/quiz:deleteattempts', $context);
         $attemptids = optional_param('attemptid', array(), PARAM_INT);
         foreach ($attemptids as $attemptid) {
             add_to_log($course->id, 'quiz', 'delete attempt', 'report.php?id=' . $cm->id, $attemptid, $cm->id);
             quiz_delete_attempt($attemptid, $quiz);
         }
         //No need for a redirect, any attemptids that do not exist are ignored.
         //So no problem if the user refreshes and tries to delete the same attempts
         //twice.
     }
     $pageoptions = array();
     $pageoptions['id'] = $cm->id;
     $pageoptions['q'] = $quiz->id;
     $pageoptions['mode'] = 'responses';
     $reporturl = new moodle_url($CFG->wwwroot . '/mod/quiz/report.php', $pageoptions);
     $qmsubselect = quiz_report_qm_filter_select($quiz);
     /// find out current groups mode
     $currentgroup = groups_get_activity_group($cm, true);
     $mform = new mod_quiz_report_responses_settings($reporturl, array('qmsubselect' => $qmsubselect, 'quiz' => $quiz, 'currentgroup' => $currentgroup));
     if ($fromform = $mform->get_data()) {
         $attemptsmode = $fromform->attemptsmode;
         if ($qmsubselect) {
             //control is not on the form if
             //the grading method is not set
             //to grade one attempt per user eg. for average attempt grade.
             $qmfilter = $fromform->qmfilter;
         } else {
             $qmfilter = 0;
         }
         set_user_preference('quiz_report_pagesize', $fromform->pagesize);
         $pagesize = $fromform->pagesize;
     } else {
         $qmfilter = optional_param('qmfilter', 0, PARAM_INT);
         $attemptsmode = optional_param('attemptsmode', null, PARAM_INT);
         if ($attemptsmode === null) {
             //default
             $attemptsmode = QUIZ_REPORT_ATTEMPTS_ALL;
         } else {
             if ($currentgroup) {
                 //default for when a group is selected
                 if ($attemptsmode === null || $attemptsmode == QUIZ_REPORT_ATTEMPTS_ALL) {
                     $attemptsmode = QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH;
                 }
             } else {
                 if (!$currentgroup && $course->id == SITEID) {
                     //force report on front page to show all, unless a group is selected.
                     $attemptsmode = QUIZ_REPORT_ATTEMPTS_ALL;
                 }
             }
         }
         $pagesize = get_user_preferences('quiz_report_pagesize', 0);
     }
     if ($pagesize < 1) {
         $pagesize = QUIZ_REPORT_DEFAULT_PAGE_SIZE;
     }
     // We only want to show the checkbox to delete attempts
     // if the user has permissions and if the report mode is showing attempts.
     $candelete = has_capability('mod/quiz:deleteattempts', $context) && $attemptsmode != QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO;
     $displayoptions = array();
     $displayoptions['attemptsmode'] = $attemptsmode;
     $displayoptions['qmfilter'] = $qmfilter;
     //work out the sql for this table.
     if (!($students = get_users_by_capability($context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'), '', '', '', '', '', '', false))) {
         $students = array();
     } else {
         $students = array_keys($students);
     }
     if (empty($currentgroup)) {
         // all users who can attempt quizzes
         $allowed = $students;
         $groupstudents = array();
     } else {
         // all users who can attempt quizzes and who are in the currently selected group
         if (!($groupstudents = get_users_by_capability($context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'), '', '', '', '', $currentgroup, '', false))) {
             $groupstudents = array();
         } else {
             $groupstudents = array_keys($groupstudents);
         }
         $allowed = $groupstudents;
     }
     $questions = quiz_report_load_questions($quiz);
     $table = new quiz_report_responses_table($quiz, $qmsubselect, $groupstudents, $students, $questions, $candelete, $reporturl, $displayoptions);
//.........這裏部分代碼省略.........
開發者ID:ajv,項目名稱:Offline-Caching,代碼行數:101,代碼來源:report.php

示例2: quiz_delete_previews

/**
 * Delete all the preview attempts at a quiz, or possibly all the attempts belonging
 * to one user.
 * @param object $quiz the quiz object.
 * @param int $userid (optional) if given, only delete the previews belonging to this user.
 */
function quiz_delete_previews($quiz, $userid = null) {
    global $DB;
    $conditions = array('quiz' => $quiz->id, 'preview' => 1);
    if (!empty($userid)) {
        $conditions['userid'] = $userid;
    }
    $previewattempts = $DB->get_records('quiz_attempts', $conditions);
    foreach ($previewattempts as $attempt) {
        quiz_delete_attempt($attempt, $quiz);
    }
}
開發者ID:Jtgadbois,項目名稱:Pedadida,代碼行數:17,代碼來源:locallib.php

示例3: set_field

    }
}
/// Load attempt or create a new attempt if there is no unfinished one
if ($ispreviewing and $forcenew) {
    // teacher wants a new preview
    // so we set a finish time on the current attempt (if any).
    // It will then automatically be deleted below
    set_field('quiz_attempts', 'timefinish', $timestamp, 'quiz', $quiz->id, 'userid', $USER->id);
}
$attempt = quiz_get_user_attempt_unfinished($quiz->id, $USER->id);
$newattempt = false;
if (!$attempt) {
    // Delete any previous preview attempts belonging to this user.
    if ($oldattempts = get_records_select('quiz_attempts', "quiz = '{$quiz->id}'\n                AND userid = '{$USER->id}' AND preview = 1")) {
        foreach ($oldattempts as $oldattempt) {
            quiz_delete_attempt($oldattempt, $quiz);
        }
    }
    $newattempt = true;
    // Start a new attempt and initialize the question sessions
    $attempt = quiz_create_attempt($quiz, $attemptnumber);
    // If this is an attempt by a teacher mark it as a preview
    if ($ispreviewing) {
        $attempt->preview = 1;
    }
    // Save the attempt
    if (!($attempt->id = insert_record('quiz_attempts', $attempt))) {
        error('Could not create new attempt');
    }
    // make log entries
    if ($ispreviewing) {
開發者ID:edwinphillips,項目名稱:moodle-485cb39,代碼行數:31,代碼來源:attempt.php

示例4: display

 /**
  * Display the report.
  */
 function display($quiz, $cm, $course)
 {
     global $CFG, $db;
     // Define some strings
     $strreallydel = addslashes(get_string('deleteattemptcheck', 'quiz'));
     $strtimeformat = get_string('strftimedatetime');
     $strreviewquestion = get_string('reviewresponse', 'quiz');
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     // Only print headers if not asked to download data
     if (!($download = optional_param('download', NULL))) {
         $this->print_header_and_tabs($cm, $course, $quiz, "overview");
     }
     if ($attemptids = optional_param('attemptid', array(), PARAM_INT)) {
         //attempts need to be deleted
         require_capability('mod/quiz:deleteattempts', $context);
         $attemptids = optional_param('attemptid', array(), PARAM_INT);
         foreach ($attemptids as $attemptid) {
             add_to_log($course->id, 'quiz', 'delete attempt', 'report.php?id=' . $cm->id, $attemptid, $cm->id);
             quiz_delete_attempt($attemptid, $quiz);
         }
         //No need for a redirect, any attemptids that do not exist are ignored.
         //So no problem if the user refreshes and tries to delete the same attempts
         //twice.
     }
     // Work out some display options - whether there is feedback, and whether scores should be shown.
     $hasfeedback = quiz_has_feedback($quiz->id) && $quiz->grade > 1.0E-7 && $quiz->sumgrades > 1.0E-7;
     $fakeattempt = new stdClass();
     $fakeattempt->preview = false;
     $fakeattempt->timefinish = $quiz->timeopen;
     $reviewoptions = quiz_get_reviewoptions($quiz, $fakeattempt, $context);
     $showgrades = $quiz->grade && $quiz->sumgrades && $reviewoptions->scores;
     $pageoptions = array();
     $pageoptions['id'] = $cm->id;
     $pageoptions['q'] = $quiz->id;
     $pageoptions['mode'] = 'overview';
     /// find out current groups mode
     $currentgroup = groups_get_activity_group($cm, true);
     $reporturl = new moodle_url($CFG->wwwroot . '/mod/quiz/report.php', $pageoptions);
     $qmsubselect = quiz_report_qm_filter_select($quiz);
     $mform = new mod_quiz_report_overview_settings($reporturl, compact('qmsubselect', 'quiz', 'currentgroup'));
     if ($fromform = $mform->get_data()) {
         $attemptsmode = $fromform->attemptsmode;
         if ($qmsubselect) {
             //control is not on the form if
             //the grading method is not set
             //to grade one attempt per user eg. for average attempt grade.
             $qmfilter = $fromform->qmfilter;
         } else {
             $qmfilter = 0;
         }
         set_user_preference('quiz_report_overview_detailedmarks', $fromform->detailedmarks);
         set_user_preference('quiz_report_pagesize', $fromform->pagesize);
         $detailedmarks = $fromform->detailedmarks;
         $pagesize = $fromform->pagesize;
     } else {
         $qmfilter = optional_param('qmfilter', 0, PARAM_INT);
         $attemptsmode = optional_param('attemptsmode', QUIZ_REPORT_ATTEMPTS_ALL, PARAM_INT);
         $detailedmarks = get_user_preferences('quiz_report_overview_detailedmarks', 1);
         $pagesize = get_user_preferences('quiz_report_pagesize', 0);
     }
     if ($attemptsmode == QUIZ_REPORT_ATTEMPTS_ALL && $currentgroup) {
         $attemptsmode = QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH;
     }
     if (!$reviewoptions->scores) {
         $detailedmarks = 0;
     }
     if ($pagesize < 1) {
         $pagesize = QUIZ_REPORT_DEFAULT_PAGE_SIZE;
     }
     // We only want to show the checkbox to delete attempts
     // if the user has permissions and if the report mode is showing attempts.
     $candelete = has_capability('mod/quiz:deleteattempts', $context) && $attemptsmode != QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO;
     $displayoptions = array();
     $displayoptions['attemptsmode'] = $attemptsmode;
     $displayoptions['qmfilter'] = $qmfilter;
     $reporturlwithdisplayoptions = new moodle_url($CFG->wwwroot . '/mod/quiz/report.php', $pageoptions + $displayoptions);
     if ($groupmode = groups_get_activity_groupmode($cm)) {
         // Groups are being used
         if (!$download) {
             groups_print_activity_menu($cm, $reporturlwithdisplayoptions->out());
         }
     }
     // Print information on the number of existing attempts
     if (!$download) {
         //do not print notices when downloading
         if ($strattemptnum = quiz_num_attempt_summary($quiz, $cm, true, $currentgroup)) {
             echo '<div class="quizattemptcounts">' . $strattemptnum . '</div>';
         }
     }
     $nostudents = false;
     if (!($students = get_users_by_capability($context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'), '', '', '', '', '', '', false))) {
         notify(get_string('nostudentsyet'));
         $nostudents = true;
         $studentslist = '';
     } else {
         $studentslist = join(',', array_keys($students));
     }
//.........這裏部分代碼省略.........
開發者ID:arshanam,項目名稱:Moodle-ITScholars-LMS,代碼行數:101,代碼來源:report.php

示例5: delete_selected_attempts

 /**
  * Delete the quiz attempts
  * @param object $quiz the quiz settings. Attempts that don't belong to
  * this quiz are not deleted.
  * @param object $cm the course_module object.
  * @param array $attemptids the list of attempt ids to delete.
  * @param array $allowed This list of userids that are visible in the report.
  *      Users can only delete attempts that they are allowed to see in the report.
  *      Empty means all users.
  */
 protected function delete_selected_attempts($quiz, $cm, $attemptids, $allowed)
 {
     global $DB;
     foreach ($attemptids as $attemptid) {
         $attempt = $DB->get_record('quiz_attempts', array('id' => $attemptid));
         if (!$attempt || $attempt->quiz != $quiz->id || $attempt->preview != 0) {
             // Ensure the attempt exists, and belongs to this quiz. If not skip.
             continue;
         }
         if ($allowed && !in_array($attempt->userid, $allowed)) {
             // Ensure the attempt belongs to a student included in the report. If not skip.
             continue;
         }
         // Set the course module id before calling quiz_delete_attempt().
         $quiz->cmid = $cm->id;
         quiz_delete_attempt($attempt, $quiz);
     }
 }
開發者ID:alanaipe2015,項目名稱:moodle,代碼行數:28,代碼來源:attemptsreport.php

示例6: optional_param

    }
    // If rescaling is required save the new maximum
    $maxgrade = optional_param('maxgrade', -1, PARAM_INTEGER);
    if ($maxgrade >= 0) {
        if (!quiz_set_grade($maxgrade, $quiz)) {
            error('Could not set a new maximum grade for the quiz');
        }
    }
    $significantchangemade = true;
}
/// Delete any teacher preview attempts if the quiz has been modified
if ($significantchangemade) {
    $previewattempts = get_records_select('quiz_attempts', 'quiz = ' . $quiz->id . ' AND preview = 1');
    if ($previewattempts) {
        foreach ($previewattempts as $attempt) {
            quiz_delete_attempt($attempt, $quiz);
        }
    }
}
question_showbank_actions($thispageurl, $cm);
/// all commands have been dealt with, now print the page
// Print basic page layout.
if (isset($quiz->instance) and record_exists_select('quiz_attempts', "quiz = '{$quiz->instance}' AND preview = '0'")) {
    // one column layout with table of questions used in this quiz
    $strupdatemodule = has_capability('moodle/course:manageactivities', $contexts->lowest()) ? update_module_button($cm->id, $course->id, get_string('modulename', 'quiz')) : "";
    $navigation = build_navigation($streditingquiz, $cm);
    print_header_simple($streditingquiz, '', $navigation, "", "", true, $strupdatemodule);
    $currenttab = 'edit';
    $mode = 'editq';
    include 'tabs.php';
    print_box_start();
開發者ID:JackCanada,項目名稱:moodle-hacks,代碼行數:31,代碼來源:edit.php

示例7: delete_selected_attempts

    /**
     * Delete the quiz attempts
     * @param object $quiz the quiz settings. Attempts that don't belong to
     * this quiz are not deleted.
     * @param object $cm the course_module object.
     * @param array $attemptids the list of attempt ids to delete.
     * @param array $allowed This list of userids that are visible in the report.
     *      Users can only delete attempts that they are allowed to see in the report.
     *      Empty means all users.
     */
    protected function delete_selected_attempts($quiz, $cm, $attemptids, $allowed) {
        global $DB;

        foreach ($attemptids as $attemptid) {
            $attempt = $DB->get_record('quiz_attempts', array('id' => $attemptid));
            if (!$attempt || $attempt->quiz != $quiz->id || $attempt->preview != 0) {
                // Ensure the attempt exists, and belongs to this quiz. If not skip.
                continue;
            }
            if ($allowed && !in_array($attempt->userid, $allowed)) {
                // Ensure the attempt belongs to a student included in the report. If not skip.
                continue;
            }
            add_to_log($quiz->course, 'quiz', 'delete attempt', 'report.php?id=' . $cm->id,
                    $attemptid, $cm->id);
            quiz_delete_attempt($attempt, $quiz);
        }
    }
開發者ID:numbas,項目名稱:moodle,代碼行數:28,代碼來源:attemptsreport.php

示例8: delete_selected_attempts

 function delete_selected_attempts($quiz, $cm, $attemptids, $allowed, $groupstudents) {
     global $DB, $COURSE;
     foreach($attemptids as $attemptid) {
         $attempt = $DB->get_record('quiz_attempts', array('id' => $attemptid));
         if (!$attempt || $attempt->quiz != $quiz->id || $attempt->preview != 0) {
             // Ensure the attempt exists, and belongs to this quiz. If not skip.
             continue;
         }
         if ($allowed && !array_key_exists($attempt->userid, $allowed)) {
             // Ensure the attempt belongs to a student included in the report. If not skip.
             continue;
         }
         if ($groupstudents && !array_key_exists($attempt->userid, $groupstudents)) {
             // Additional check in groups mode.
             continue;
         }
         add_to_log($COURSE->id, 'quiz', 'delete attempt', 'report.php?id=' . $cm->id,
                 $attemptid, $cm->id);
         quiz_delete_attempt($attempt, $quiz);
     }
 }
開發者ID:nuckey,項目名稱:moodle,代碼行數:21,代碼來源:report.php

示例9: test_attempt_deleted

 /**
  * Test the attempt deleted event.
  */
 public function test_attempt_deleted()
 {
     list($quizobj, $quba, $attempt) = $this->prepare_quiz_data();
     // Trigger and capture the event.
     $sink = $this->redirectEvents();
     quiz_delete_attempt($attempt, $quizobj->get_quiz());
     $events = $sink->get_events();
     $event = reset($events);
     // Check that the event data is valid.
     $this->assertInstanceOf('\\mod_quiz\\event\\attempt_deleted', $event);
     $this->assertEquals(context_module::instance($quizobj->get_cmid()), $event->get_context());
     $expected = array($quizobj->get_courseid(), 'quiz', 'delete attempt', 'report.php?id=' . $quizobj->get_cmid(), $attempt->id, $quizobj->get_cmid());
     $this->assertEventLegacyLogData($expected, $event);
     $this->assertEventContextNotUsed($event);
 }
開發者ID:sumitnegi933,項目名稱:Moodle_lms_New,代碼行數:18,代碼來源:events_test.php

示例10: delete_selected_attempts

 /**
  * Delete the quiz attempts
  * @param object $quiz the quiz settings. Attempts that don't belong to
  * this quiz are not deleted.
  * @param object $cm the course_module object.
  * @param array $attemptids the list of attempt ids to delete.
  * @param \core\dml\sql_join $allowedjoins (joins, wheres, params) This list of userids that are visible in the report.
  *      Users can only delete attempts that they are allowed to see in the report.
  *      Empty means all users.
  */
 protected function delete_selected_attempts($quiz, $cm, $attemptids, \core\dml\sql_join $allowedjoins)
 {
     global $DB;
     foreach ($attemptids as $attemptid) {
         if (empty($allowedjoins->joins)) {
             $sql = "SELECT quiza.*\n                          FROM {quiz_attempts} quiza\n                          JOIN {user} u ON u.id = quiza.userid\n                         WHERE quiza.id = :attemptid";
         } else {
             $sql = "SELECT quiza.*\n                          FROM {quiz_attempts} quiza\n                          JOIN {user} u ON u.id = quiza.userid\n                        {$allowedjoins->joins}\n                         WHERE {$allowedjoins->wheres} AND quiza.id = :attemptid";
         }
         $params = $allowedjoins->params + array('attemptid' => $attemptid);
         $attempt = $DB->get_record_sql($sql, $params);
         if (!$attempt || $attempt->quiz != $quiz->id || $attempt->preview != 0) {
             // Ensure the attempt exists, belongs to this quiz and belongs to
             // a student included in the report. If not skip.
             continue;
         }
         // Set the course module id before calling quiz_delete_attempt().
         $quiz->cmid = $cm->id;
         quiz_delete_attempt($attempt, $quiz);
     }
 }
開發者ID:dg711,項目名稱:moodle,代碼行數:31,代碼來源:attemptsreport.php

示例11: iterate_purge

function iterate_purge($starttime)
{
    global $SESSION, $CFG;
    $userid = current($SESSION->purge_progress);
    $incourses = implode(',', $SESSION->bulk_courses);
    // delete all quiz activity
    $quizzessql = "SELECT DISTINCT q.* FROM {$CFG->prefix}quiz q INNER JOIN {$CFG->prefix}quiz_attempts a\n                    ON a.quiz=q.id AND a.userid={$userid} AND q.course IN ({$incourses})";
    if ($quizzes = get_records_sql($quizzessql)) {
        foreach ($quizzes as $quiz) {
            $attemptssql = "SELECT a.* FROM {$CFG->prefix}quiz_attempts a\n            \t\t\t\tWHERE a.quiz={$quiz->id} AND a.userid={$userid}";
            $attempts = get_records_sql($attemptssql);
            foreach ($attempts as $attempt) {
                quiz_delete_attempt($attempt, $quiz);
            }
        }
    }
    if (is_timeout_close($starttime)) {
        return false;
    }
    // delete all lesson activity
    $lessons = get_fieldset_select('lesson', 'id', "course IN ({$incourses})");
    if (!empty($lessons)) {
        $lessons = implode(',', $lessons);
        /// Clean up the timer table
        delete_records_select('lesson_timer', "userid={$userid} AND lessonid IN ({$lessons})");
        /// Remove the grades from the grades and high_scores tables
        delete_records_select('lesson_grades', "userid={$userid} AND lessonid IN ({$lessons})");
        delete_records_select('lesson_high_scores', "userid={$userid} AND lessonid IN ({$lessons})");
        /// Remove attempts
        delete_records_select('lesson_attempts', "userid={$userid} AND lessonid IN ({$lessons})");
        /// Remove seen branches
        delete_records_select('lesson_branch', "userid={$userid} AND lessonid IN ({$lessons})");
    }
    if (is_timeout_close($starttime)) {
        return false;
    }
    // delete all assignment submissions
    $assignmentlist = array();
    // delete submission files
    $assignmentssql = "SELECT DISTINCT a.id, a.course FROM {$CFG->prefix}assignment a INNER JOIN {$CFG->prefix}assignment_submissions s\n                       ON s.assignment=a.id AND s.userid={$userid} AND a.course IN ({$incourses})";
    if ($assignments = get_records_sql($assignmentssql)) {
        foreach ($assignments as $assignment) {
            fulldelete($CFG->dataroot . '/' . $assignment->course . '/moddata/assignment/' . $assignment->id . '/' . $userid);
            $assignmentlist[] = $assignment->id;
        }
    }
    // delete submission records
    if (!empty($assignmentlist)) {
        $assignmentlist = implode(',', $assignmentlist);
        delete_records_select('assignment_submissions', "userid={$userid} AND assignment IN ({$assignmentlist})");
    }
    if (is_timeout_close($starttime)) {
        return false;
    }
    // finally, delete all grade records to clean up database
    $sql = "SELECT g.id \n            FROM {$CFG->prefix}grade_grades g INNER JOIN {$CFG->prefix}grade_items i\n            ON g.itemid = i.id AND i.courseid IN ({$incourses}) AND g.userid={$userid}";
    $grades = get_fieldset_sql($sql);
    if (!empty($grades)) {
        $grades = implode(',', $grades);
        delete_records_select('grade_grades', "id IN ({$grades})");
    }
    // unenrol selected users from all courses
    foreach ($SESSION->bulk_courses as $course) {
        $context = get_context_instance(CONTEXT_COURSE, $course);
        role_unassign(0, $userid, 0, $context->id);
    }
    array_shift($SESSION->purge_progress);
    if (is_timeout_close($starttime)) {
        return false;
    }
    return true;
}
開發者ID:hmatulis,項目名稱:RTL-BIDI-Hebrew-Moodle-Plugins,代碼行數:72,代碼來源:iterator.php

示例12: test_preview_attempt_deleted

 /**
  * Test that preview attempt deletions are not logged.
  */
 public function test_preview_attempt_deleted()
 {
     // Create quiz with preview attempt.
     list($quizobj, $quba, $previewattempt) = $this->prepare_quiz_data(true);
     // Delete a preview attempt, capturing events.
     $sink = $this->redirectEvents();
     quiz_delete_attempt($previewattempt, $quizobj->get_quiz());
     // Verify that no events were generated.
     $this->assertEmpty($sink->get_events());
 }
開發者ID:pzhu2004,項目名稱:moodle,代碼行數:13,代碼來源:events_test.php

示例13: delete_selected_attempts

 function delete_selected_attempts($quiz, $cm, $attemptids, $groupstudents)
 {
     global $DB, $COURSE;
     require_capability('mod/quiz:deleteattempts', $this->context);
     $attemptids = optional_param('attemptid', array(), PARAM_INT);
     if ($groupstudents) {
         list($usql, $params) = $DB->get_in_or_equal($groupstudents);
         $where = "qa.userid {$usql} AND ";
     }
     foreach ($attemptids as $attemptid) {
         add_to_log($COURSE->id, 'quiz', 'delete attempt', 'report.php?id=' . $cm->id, $attemptid, $cm->id);
         quiz_delete_attempt($attemptid, $quiz);
     }
 }
開發者ID:ajv,項目名稱:Offline-Caching,代碼行數:14,代碼來源:report.php


注:本文中的quiz_delete_attempt函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。