本文整理汇总了PHP中question_edit_form::data_preprocessing_answers方法的典型用法代码示例。如果您正苦于以下问题:PHP question_edit_form::data_preprocessing_answers方法的具体用法?PHP question_edit_form::data_preprocessing_answers怎么用?PHP question_edit_form::data_preprocessing_answers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_edit_form
的用法示例。
在下文中一共展示了question_edit_form::data_preprocessing_answers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: data_preprocessing_answers
protected function data_preprocessing_answers($question) {
$question = parent::data_preprocessing_answers($question);
if (empty($question->options->answers)) {
return $question;
}
$key = 0;
foreach ($question->options->answers as $answer) {
// See comment in the parent method about this hack.
unset($this->_form->_defaultValues["tolerance[$key]"]);
$question->tolerance[$key] = $answer->tolerance;
$key++;
}
return $question;
}
示例2: data_preprocessing_answers
protected function data_preprocessing_answers($question, $withanswerfiles = false)
{
$question = parent::data_preprocessing_answers($question, $withanswerfiles);
if (empty($question->options->answers)) {
return $question;
}
$key = 0;
foreach ($question->options->answers as $answer) {
// See comment in the parent method about this hack.
unset($this->_form->_defaultValues["tolerance[{$key}]"]);
unset($this->_form->_defaultValues["tolerancetype[{$key}]"]);
unset($this->_form->_defaultValues["correctanswerlength[{$key}]"]);
unset($this->_form->_defaultValues["correctanswerformat[{$key}]"]);
$question->tolerance[$key] = $answer->tolerance;
$question->tolerancetype[$key] = $answer->tolerancetype;
$question->correctanswerlength[$key] = $answer->correctanswerlength;
$question->correctanswerformat[$key] = $answer->correctanswerformat;
$key++;
}
return $question;
}
示例3: data_preprocessing_answers
protected function data_preprocessing_answers($question, $withanswerfiles = false)
{
parent::data_preprocessing_answers($question, $withanswerfiles);
$key = 0;
foreach ($question->options->answers as $answer) {
// Prepare the answersound filemanager to display files in draft area.
$draftitemid = file_get_submitted_draft_itemid('answersound[' . $key . ']');
file_prepare_draft_area($draftitemid, 1, 'question', 'answersound', $answer->id);
$question->answersound[$key] = $draftitemid;
// Prepare the feedbacksound filemanager to display files in draft area.
$draftitemid = file_get_submitted_draft_itemid('feedbacksound[' . $key . ']');
file_prepare_draft_area($draftitemid, 1, 'question', 'feedbacksound', $answer->id);
$question->feedbacksound[$key] = $draftitemid;
$key++;
}
return $question;
}