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