本文整理汇总了PHP中question_pluginfile函数的典型用法代码示例。如果您正苦于以下问题:PHP question_pluginfile函数的具体用法?PHP question_pluginfile怎么用?PHP question_pluginfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了question_pluginfile函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qtype_calculated_pluginfile
/**
* Checks file access for calculated questions.
*
* @package qtype_calculated
* @category files
* @param stdClass $course course object
* @param stdClass $cm course module object
* @param stdClass $context context object
* @param string $filearea file area
* @param array $args extra arguments
* @param bool $forcedownload whether or not force download
* @param array $options additional options affecting the file serving
* @return bool
*/
function qtype_calculated_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array())
{
global $CFG;
require_once $CFG->libdir . '/questionlib.php';
question_pluginfile($course, $context, 'qtype_calculated', $filearea, $args, $forcedownload, $options);
}
示例2: file_pluginfile
//.........这里部分代码省略.........
if ($filearea === 'activity' and $context->contextlevel == CONTEXT_MODULE) {
require_login($course, false, $cm);
require_capability('moodle/backup:downloadfile', $context);
$filename = array_pop($args);
$filepath = $args ? '/' . implode('/', $args) . '/' : '/';
if (!($file = $fs->get_file($context->id, 'backup', 'activity', 0, $filepath, $filename)) or $file->is_directory()) {
send_file_not_found();
}
\core\session\manager::write_close();
send_stored_file($file, 60 * 60, 0, $forcedownload, array('preview' => $preview));
} else {
if ($filearea === 'automated' and $context->contextlevel == CONTEXT_COURSE) {
// Backup files that were generated by the automated backup systems.
require_login($course);
require_capability('moodle/site:config', $context);
$filename = array_pop($args);
$filepath = $args ? '/' . implode('/', $args) . '/' : '/';
if (!($file = $fs->get_file($context->id, 'backup', 'automated', 0, $filepath, $filename)) or $file->is_directory()) {
send_file_not_found();
}
\core\session\manager::write_close();
// Unlock session during file serving.
send_stored_file($file, 0, 0, $forcedownload, array('preview' => $preview));
} else {
send_file_not_found();
}
}
}
}
// ========================================================================================================================
} else {
if ($component === 'question') {
require_once $CFG->libdir . '/questionlib.php';
question_pluginfile($course, $context, 'question', $filearea, $args, $forcedownload);
send_file_not_found();
// ========================================================================================================================
} else {
if ($component === 'grading') {
if ($filearea === 'description') {
// files embedded into the form definition description
if ($context->contextlevel == CONTEXT_SYSTEM) {
require_login();
} else {
if ($context->contextlevel >= CONTEXT_COURSE) {
require_login($course, false, $cm);
} else {
send_file_not_found();
}
}
$formid = (int) array_shift($args);
$sql = "SELECT ga.id\n FROM {grading_areas} ga\n JOIN {grading_definitions} gd ON (gd.areaid = ga.id)\n WHERE gd.id = ? AND ga.contextid = ?";
$areaid = $DB->get_field_sql($sql, array($formid, $context->id), IGNORE_MISSING);
if (!$areaid) {
send_file_not_found();
}
$fullpath = "/{$context->id}/{$component}/{$filearea}/{$formid}/" . implode('/', $args);
if (!($file = $fs->get_file_by_hash(sha1($fullpath))) or $file->is_directory()) {
send_file_not_found();
}
\core\session\manager::write_close();
// Unlock session during file serving.
send_stored_file($file, 60 * 60, 0, $forcedownload, array('preview' => $preview));
}
// ========================================================================================================================
} else {
if (strpos($component, 'mod_') === 0) {
示例3: qtype_easyonamejs_pluginfile
/**
* Checks file access for easyonamejs questions.
*/
function qtype_easyonamejs_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload)
{
global $DB, $CFG;
require_once $CFG->libdir . '/questionlib.php';
question_pluginfile($course, $context, 'qtype_easyonamejs', $filearea, $args, $forcedownload);
}
示例4: qtype_ordering_pluginfile
/**
* Checks file access for multiple choice questions.
*/
function qtype_ordering_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload)
{
global $CFG;
require_once $CFG->dirroot . '/lib/questionlib.php';
question_pluginfile($course, $context, 'qtype_ordering', $filearea, $args, $forcedownload);
}
示例5: send_file_not_found
send_file_not_found();
}
session_get_instance()->write_close();
// unlock session during fileserving
send_stored_file($file, 0, 0, $forcedownload);
} else {
send_file_not_found();
}
}
}
}
// ========================================================================================================================
} else {
if ($component === 'question') {
require_once $CFG->libdir . '/questionlib.php';
question_pluginfile($course, $context, 'question', $filearea, $args, $forcedownload);
send_file_not_found();
// ========================================================================================================================
} else {
if (strpos($component, 'mod_') === 0) {
$modname = substr($component, 4);
if (!file_exists("{$CFG->dirroot}/mod/{$modname}/lib.php")) {
send_file_not_found();
}
require_once "{$CFG->dirroot}/mod/{$modname}/lib.php";
if ($context->contextlevel == CONTEXT_MODULE) {
if ($cm->modname !== $modname) {
// somebody tries to gain illegal access, cm type must match the component!
send_file_not_found();
}
}
示例6: qtype_poodllrecording_pluginfile
/**
* Checks file access for poodllrecording questions.
*/
function qtype_poodllrecording_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload)
{
global $CFG;
require_once $CFG->libdir . '/questionlib.php';
question_pluginfile($course, $context, 'qtype_poodllrecording', $filearea, $args, $forcedownload);
}
示例7: qtype_calculatedsimple_pluginfile
/**
* Checks file access for simple calculated questions.
*/
function qtype_calculatedsimple_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload)
{
global $CFG;
require_once $CFG->libdir . '/questionlib.php';
question_pluginfile($course, $context, 'qtype_calculatedsimple', $filearea, $args, $forcedownload);
}
示例8: qtype_omeromultichoice_pluginfile
/**
* Checks file access for omeromultichoice questions.
*
* @package qtype_omeromultichoice
* @category files
* @param stdClass $course course object
* @param stdClass $cm course module object
* @param stdClass $context context object
* @param string $filearea file area
* @param array $args extra arguments
* @param bool $forcedownload whether or not force download
* @param array $options additional options affecting the file serving
* @return bool
*/
function qtype_omeromultichoice_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array())
{
global $DB, $CFG;
require_once $CFG->libdir . '/questionlib.php';
question_pluginfile($course, $context, 'qtype_omeromultichoice', $filearea, $args, $forcedownload, $options);
}