當前位置: 首頁>>代碼示例>>PHP>>正文


PHP question_pluginfile函數代碼示例

本文整理匯總了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);
}
開發者ID:EmmanuelYupit,項目名稱:educursos,代碼行數:20,代碼來源:lib.php

示例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) {
開發者ID:IFPBMoodle,項目名稱:moodle,代碼行數:67,代碼來源:filelib.php

示例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);
}
開發者ID:Kathrin84,項目名稱:moodle-qtype_easyonamejs,代碼行數:9,代碼來源:lib.php

示例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);
}
開發者ID:Kathrin84,項目名稱:moodle-qtype_ordering,代碼行數:9,代碼來源:lib.php

示例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();
                 }
             }
開發者ID:vuchannguyen,項目名稱:web,代碼行數:31,代碼來源:pluginfile.php

示例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);
}
開發者ID:laiello,項目名稱:poodll.poodll2,代碼行數:9,代碼來源:lib.php

示例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);
}
開發者ID:sebastiansanio,項目名稱:tallerdeprogramacion2fiuba,代碼行數:9,代碼來源:lib.php

示例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);
}
開發者ID:kikkomep,項目名稱:moodle.omero-qtypes,代碼行數:20,代碼來源:lib.php


注:本文中的question_pluginfile函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。