本文整理汇总了PHP中quiz_access_manager::save_settings方法的典型用法代码示例。如果您正苦于以下问题:PHP quiz_access_manager::save_settings方法的具体用法?PHP quiz_access_manager::save_settings怎么用?PHP quiz_access_manager::save_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quiz_access_manager
的用法示例。
在下文中一共展示了quiz_access_manager::save_settings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}