本文整理汇总了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);
}
示例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);
}
示例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');