本文整理匯總了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;
}