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