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


PHP quiz_update_events函數代碼示例

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


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

示例1: save_dates

 public function save_dates(cm_info $cm, array $dates)
 {
     parent::save_dates($cm, $dates);
     // Fetch module instance from $mods array.
     $quiz = $this->mods[$cm->instance];
     $quiz->instance = $cm->instance;
     $quiz->coursemodule = $cm->id;
     // Updating date values.
     foreach ($dates as $datetype => $datevalue) {
         $quiz->{$datetype} = $datevalue;
     }
     // Calling the update event method to change the calender evenrs accordingly.
     quiz_update_events($quiz);
 }
開發者ID:merrill-oakland,項目名稱:moodle-report_editdates,代碼行數:14,代碼來源:quizdates.php

示例2: quiz_after_add_or_update

/**
 * This function is called at the end of quiz_add_instance
 * and quiz_update_instance, to do the common processing.
 *
 * @param object $quiz the quiz object.
 */
function quiz_after_add_or_update($quiz) {
    global $DB;
    $cmid = $quiz->coursemodule;

    // We need to use context now, so we need to make sure all needed info is already in db.
    $DB->set_field('course_modules', 'instance', $quiz->id, array('id'=>$cmid));
    $context = context_module::instance($cmid);

    // Save the feedback.
    $DB->delete_records('quiz_feedback', array('quizid' => $quiz->id));

    for ($i = 0; $i <= $quiz->feedbackboundarycount; $i++) {
        $feedback = new stdClass();
        $feedback->quizid = $quiz->id;
        $feedback->feedbacktext = $quiz->feedbacktext[$i]['text'];
        $feedback->feedbacktextformat = $quiz->feedbacktext[$i]['format'];
        $feedback->mingrade = $quiz->feedbackboundaries[$i];
        $feedback->maxgrade = $quiz->feedbackboundaries[$i - 1];
        $feedback->id = $DB->insert_record('quiz_feedback', $feedback);
        $feedbacktext = file_save_draft_area_files((int)$quiz->feedbacktext[$i]['itemid'],
                $context->id, 'mod_quiz', 'feedback', $feedback->id,
                array('subdirs' => false, 'maxfiles' => -1, 'maxbytes' => 0),
                $quiz->feedbacktext[$i]['text']);
        $DB->set_field('quiz_feedback', 'feedbacktext', $feedbacktext,
                array('id' => $feedback->id));
    }

    // Store any settings belonging to the access rules.
    quiz_access_manager::save_settings($quiz);

    // Update the events relating to this quiz.
    quiz_update_events($quiz);

    // Update related grade item.
    quiz_grade_item_update($quiz);
}
開發者ID:nutanrajmalanai,項目名稱:moodle,代碼行數:42,代碼來源:lib.php

示例3: unset

                unset($fromform->id);
                $fromform->id = $DB->insert_record('quiz_overrides', $fromform);
                // Determine which override created event to fire.
                $params['objectid'] = $fromform->id;
                if (!$groupmode) {
                    $params['relateduserid'] = $fromform->userid;
                    $event = \mod_quiz\event\user_override_created::create($params);
                } else {
                    $params['other']['groupid'] = $fromform->groupid;
                    $event = \mod_quiz\event\group_override_created::create($params);
                }
                // Trigger the override created event.
                $event->trigger();
            }
            quiz_update_open_attempts(array('quizid' => $quiz->id));
            quiz_update_events($quiz, $fromform);
            if (!empty($fromform->submitbutton)) {
                redirect($overridelisturl);
            }
            // The user pressed the 'again' button, so redirect back to this page.
            $url->remove_params('cmid');
            $url->param('action', 'duplicate');
            $url->param('id', $fromform->id);
            redirect($url);
        }
    }
}
// Print the form.
$pagetitle = get_string('editoverride', 'quiz');
$PAGE->navbar->add($pagetitle);
$PAGE->set_pagelayout('admin');
開發者ID:pzhu2004,項目名稱:moodle,代碼行數:31,代碼來源:overrideedit.php


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