Added the quizzes_category_used() to detect the list of

quizzes that are using questions from one category.
It relies in the quizzes_question_used() function. Will
be use in the 'orphan_categories' bug (#2459)

(http://moodle.org/bugs/bug.php?op=show&bugid=2459)
This commit is contained in:
stronk7
2005-05-29 18:58:14 +00:00
parent 83c5e8f6b1
commit 6d85897f87
+19
View File
@@ -2465,6 +2465,25 @@ function quizzes_question_used($id) {
return $quizlist;
}
/**
* Array of names of quizzes a category appears in
*
* @return array Array of quiz names (with quiz->id as array keys)
* @param integer Quiz category id
*/
function quizzes_category_used($id) {
$quizlist = array();
if ($questions = get_records('quiz_questions', 'category', $id)) {
foreach ($questions as $question) {
$qlist = quizzes_question_used($question->id);
$quizlist = $quizlist + $qlist;
}
}
return $quizlist;
}
/**
* Parse field names used for the replace options on question edit forms
*/