本文整理匯總了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;
}
示例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'));
}