本文整理匯總了PHP中default_questiontype::check_file_access方法的典型用法代碼示例。如果您正苦於以下問題:PHP default_questiontype::check_file_access方法的具體用法?PHP default_questiontype::check_file_access怎麽用?PHP default_questiontype::check_file_access使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類default_questiontype
的用法示例。
在下文中一共展示了default_questiontype::check_file_access方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: reset
function check_file_access($question, $state, $options, $contextid, $component, $filearea, $args)
{
if ($component == 'question' && $filearea == 'answerfeedback') {
$answerid = reset($args);
// itemid is answer id.
$answers =& $question->options->answers;
if (isset($state->responses[''])) {
$response = $state->responses[''];
} else {
$response = '';
}
return $options->feedback && !empty($response);
} else {
return parent::check_file_access($question, $state, $options, $contextid, $component, $filearea, $args);
}
}
示例2: reset
function check_file_access($question, $state, $options, $contextid, $component, $filearea, $args)
{
$itemid = reset($args);
if ($component == 'question' && $filearea == 'answerfeedback') {
// check if answer id exists
$result = $options->feedback && array_key_exists($itemid, $question->options->answers);
if (!$result) {
return false;
}
// check response
if (!$this->check_response($question, $state)) {
return false;
}
return true;
} else {
if ($filearea == 'instruction') {
// TODO: should it be display all the time like questiontext?
// check if question id exists
if ($itemid != $question->id) {
return false;
} else {
return true;
}
} else {
if (in_array($filearea, array('correctfeedback', 'partiallycorrectfeedback', 'incorrectfeedback'))) {
// TODO: calculated type doesn't display question feedback yet
return false;
} else {
return parent::check_file_access($question, $state, $options, $contextid, $component, $filearea, $args);
}
}
}
}