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


PHP question_engine::questions_in_use方法代碼示例

本文整理匯總了PHP中question_engine::questions_in_use方法的典型用法代碼示例。如果您正苦於以下問題:PHP question_engine::questions_in_use方法的具體用法?PHP question_engine::questions_in_use怎麽用?PHP question_engine::questions_in_use使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在question_engine的用法示例。


在下文中一共展示了question_engine::questions_in_use方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: questions_in_use

/**
 * @param array $questionids of question ids.
 * @return boolean whether any of these questions are being used by any part of Moodle.
 */
function questions_in_use($questionids)
{
    global $CFG;
    if (question_engine::questions_in_use($questionids)) {
        return true;
    }
    foreach (core_component::get_plugin_list('mod') as $module => $path) {
        $lib = $path . '/lib.php';
        if (is_readable($lib)) {
            include_once $lib;
            $fn = $module . '_questions_in_use';
            if (function_exists($fn)) {
                if ($fn($questionids)) {
                    return true;
                }
            } else {
                // Fallback for legacy modules.
                $fn = $module . '_question_list_instances';
                if (function_exists($fn)) {
                    foreach ($questionids as $questionid) {
                        $instances = $fn($questionid);
                        if (!empty($instances)) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
開發者ID:tyleung,項目名稱:CMPUT401MoodleExams,代碼行數:35,代碼來源:questionlib.php

示例2: quiz_questions_in_use

/**
 * @param array $questionids of question ids.
 * @return bool whether any of these questions are used by any instance of this module.
 */
function quiz_questions_in_use($questionids) {
    global $DB, $CFG;
    require_once($CFG->libdir . '/questionlib.php');
    list($test, $params) = $DB->get_in_or_equal($questionids);
    return $DB->record_exists_select('quiz_question_instances',
            'question ' . $test, $params) || question_engine::questions_in_use(
            $questionids, new qubaid_join('{quiz_attempts} quiza',
            'quiza.uniqueid', 'quiza.preview = 0'));
}
開發者ID:nutanrajmalanai,項目名稱:moodle,代碼行數:13,代碼來源:lib.php


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