本文整理汇总了PHP中quiz_process_options函数的典型用法代码示例。如果您正苦于以下问题:PHP quiz_process_options函数的具体用法?PHP quiz_process_options怎么用?PHP quiz_process_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quiz_process_options函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quiz_update_instance
/**
* Given an object containing all the necessary data,
* (defined by the form in mod_form.php) this function
* will update an existing instance with new data.
*
* @param object $quiz the data that came from the form.
* @return mixed true on success, false or a string error message on failure.
*/
function quiz_update_instance($quiz, $mform)
{
global $CFG, $DB;
// Process the options from the form.
$result = quiz_process_options($quiz);
if ($result && is_string($result)) {
return $result;
}
$oldquiz = $DB->get_record('quiz', array('id' => $quiz->instance));
// Repaginate, if asked to.
if (!$quiz->shufflequestions && !empty($quiz->repaginatenow)) {
require_once $CFG->dirroot . '/mod/quiz/locallib.php';
$quiz->questions = quiz_repaginate(quiz_clean_layout($oldquiz->questions, true), $quiz->questionsperpage);
}
unset($quiz->repaginatenow);
// Update the database.
$quiz->id = $quiz->instance;
$DB->update_record('quiz', $quiz);
// Do the processing required after an add or an update.
quiz_after_add_or_update($quiz);
if ($oldquiz->grademethod != $quiz->grademethod) {
require_once $CFG->dirroot . '/mod/quiz/locallib.php';
$quiz->sumgrades = $oldquiz->sumgrades;
$quiz->grade = $oldquiz->grade;
quiz_update_all_final_grades($quiz);
quiz_update_grades($quiz);
}
// Delete any previous preview attempts
quiz_delete_previews($quiz);
return true;
}
示例2: quiz_update_instance
/**
* Given an object containing all the necessary data,
* (defined by the form in mod.html) this function
* will update an existing instance with new data.
*
* @param object $quiz the data that came from the form.
* @return mixed true on success, false or a string error message on failure.
*/
function quiz_update_instance($quiz)
{
// Process the options from the form.
$result = quiz_process_options($quiz);
if ($result && is_string($result)) {
return $result;
}
// Update the database.
$quiz->id = $quiz->instance;
if (!update_record("quiz", $quiz)) {
return false;
// some error occurred
}
// Do the processing required after an add or an update.
quiz_after_add_or_update($quiz);
// Delete any previous preview attempts
delete_records('quiz_attempts', 'preview', '1', 'quiz', $quiz->id);
return true;
}
示例3: quiz_update_instance
/**
* Given an object containing all the necessary data,
* (defined by the form in mod_form.php) this function
* will update an existing instance with new data.
*
* @param object $quiz the data that came from the form.
* @return mixed true on success, false or a string error message on failure.
*/
function quiz_update_instance($quiz, $mform)
{
global $CFG, $DB;
require_once $CFG->dirroot . '/mod/quiz/locallib.php';
// Process the options from the form.
$result = quiz_process_options($quiz);
if ($result && is_string($result)) {
return $result;
}
// Get the current value, so we can see what changed.
$oldquiz = $DB->get_record('quiz', array('id' => $quiz->instance));
// We need two values from the existing DB record that are not in the form,
// in some of the function calls below.
$quiz->sumgrades = $oldquiz->sumgrades;
$quiz->grade = $oldquiz->grade;
// Repaginate, if asked to.
if (!$quiz->shufflequestions && !empty($quiz->repaginatenow)) {
$quiz->questions = quiz_repaginate(quiz_clean_layout($oldquiz->questions, true), $quiz->questionsperpage);
}
unset($quiz->repaginatenow);
// Update the database.
$quiz->id = $quiz->instance;
$DB->update_record('quiz', $quiz);
// Do the processing required after an add or an update.
quiz_after_add_or_update($quiz);
if ($oldquiz->grademethod != $quiz->grademethod) {
quiz_update_all_final_grades($quiz);
quiz_update_grades($quiz);
}
$quizdateschanged = $oldquiz->timelimit != $quiz->timelimit || $oldquiz->timeclose != $quiz->timeclose || $oldquiz->graceperiod != $quiz->graceperiod;
if ($quizdateschanged) {
quiz_update_open_attempts(array('quizid' => $quiz->id));
}
// Delete any previous preview attempts.
quiz_delete_previews($quiz);
return true;
}
示例4: RWSISRec
//.........这里部分代码省略.........
}
if ($r_pct <= 0 || $r_pct >= 100) {
return false;
}
if ($r_i > 0 && $r_bd >= $r_lb) {
return false;
}
$r_lb = $r_bd * $r_qiz->grade / 100.0;
}
$r_bds[] = $r_bd;
}
$r_nf = count($r_fds);
$r_nb = count($r_bds);
if ($r_nf > 0) {
if ($r_nf != $r_nb + 1) {
return false;
}
for ($r_i = 0; $r_i < $r_nf; $r_i++) {
if (isset($r_qiz->feedbacktext[$r_i]["itemid"])) {
$r_drf = $r_qiz->feedbacktext[$r_i]["itemid"];
} else {
$r_drf = 0;
}
$r_cmp = "mod_quiz";
$r_far = "feedback";
$r_iti = null;
$r_op = null;
$r_txt = $r_fds[$r_i];
$r_qiz->feedbacktext[$r_i]["text"] = file_prepare_draft_area($r_drf, $r_ctxi, $r_cmp, $r_far, $r_iti, $r_op, $r_txt);
$r_qiz->feedbacktext[$r_i]["format"] = FORMAT_HTML;
$r_qiz->feedbacktext[$r_i]["itemid"] = $r_drf;
if ($r_i < $r_nf - 1) {
$r_qiz->feedbackboundaries[$r_i] = $r_bds[$r_i];
}
}
}
$r_ct = 1;
if ($r_sz < $r_ct) {
return false;
}
$r_fld = substr($r_rcd, $r_p, $r_ct);
$r_p += $r_ct;
$r_sz -= $r_ct;
$r_dat = unpack("C", $r_fld);
$r_lbq = intval($r_dat[1]);
if ($r_lbq != 0 && $r_lbq != 1) {
return false;
}
$RWSLB->atts = $r_lbq;
$r_ct = 1;
if ($r_sz < $r_ct) {
return false;
}
$r_fld = substr($r_rcd, $r_p, $r_ct);
$r_p += $r_ct;
$r_sz -= $r_ct;
$r_dat = unpack("C", $r_fld);
$r_lbr = intval($r_dat[1]);
if ($r_lbr != 0 && $r_lbr != 1) {
return false;
}
$RWSLB->revs = $r_lbr;
if ($r_sz < 1) {
return false;
}
$r_ct = strpos(substr($r_rcd, $r_p), "");
if ($r_ct === false) {
return false;
}
if ($r_ct > 0) {
$r_fld = substr($r_rcd, $r_p, $r_ct);
} else {
$r_fld = "";
}
$r_ct++;
$r_p += $r_ct;
$r_sz -= $r_ct;
$RWSLB->pw = trim($r_fld);
$r_ct = 4;
if ($r_sz < $r_ct) {
return false;
}
$r_fld = substr($r_rcd, $r_p, $r_ct);
$r_p += $r_ct;
$r_sz -= $r_ct;
$r_dat = unpack("N", $r_fld);
$r_ct = $r_dat[1];
if ($r_sz < $r_ct) {
return false;
}
$r_p += $r_ct;
$r_sz -= $r_ct;
if ($r_pop) {
if (is_null($r_qiz->quizpassword) && !is_null($r_qiz->password)) {
$r_qiz->quizpassword = $r_qiz->password;
}
quiz_process_options($r_qiz);
}
return true;
}