mirror of
https://github.com/moodle/moodle.git
synced 2025-02-13 12:34:28 +01:00
Fixed the problem reported in bug 2900 that the question count on the category page also counted old questions.
This commit is contained in:
parent
33b3562d00
commit
fdf49de1ca
@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php // $Id$
|
||||
// quiz.php - created with Moodle 1.4 development (2004080300)
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ $string['category'] = 'Category';
|
||||
$string['categoryadded'] = 'The category \'$a\' was added';
|
||||
$string['categorydeleted'] = 'The category \'$a\' was deleted';
|
||||
$string['categoryinfo'] = 'Category info';
|
||||
$string['categorymove'] = 'The category \'$a->name\' contains $a->count questions. Please choose another category to move them to.';
|
||||
$string['categorymove'] = 'The category \'$a->name\' contains $a->count questions (some of them may be old, hidden, questions that are still in use in some existing quizzes).<br />Please choose another category to move them to.';
|
||||
$string['categorymoveto'] = 'Move them to this category';
|
||||
$string['categorynoedit'] = 'You do not have editing privileges in the category \'$a\'.';
|
||||
$string['categoryupdated'] = 'The category was successfully updated';
|
||||
|
@ -490,7 +490,7 @@ class quiz_category_object {
|
||||
|
||||
|
||||
/**
|
||||
* Arranges the categories into a heirarchical tree
|
||||
* Arranges the categories into a hierarchical tree
|
||||
*
|
||||
* If a category has children, it's "children" property holds an array of children
|
||||
* The questioncount for each category is also calculated
|
||||
@ -516,17 +516,17 @@ class quiz_category_object {
|
||||
}
|
||||
$parents = $children;
|
||||
}
|
||||
// if there is no heirarchy (e.g., if all records have parent == 0), set level[0] to these keys
|
||||
// if there is no hierarchy (e.g., if all records have parent == 0), set level[0] to these keys
|
||||
if (empty($levels)) {
|
||||
$levels[0] = array_keys($records);
|
||||
}
|
||||
|
||||
// build a heirarchical array that depicts the parent-child relationships of the categories
|
||||
// build a hierarchical array that depicts the parent-child relationships of the categories
|
||||
$categorytree = array();
|
||||
for ($index = count($levels) - 1; $index >= 0; $index--) {
|
||||
foreach($levels[$index] as $key) {
|
||||
$parentkey = $records[$key]->parent;
|
||||
if (!($records[$key]->questioncount = count_records('quiz_questions', 'category', $records[$key]->id))) {
|
||||
if (!($records[$key]->questioncount = count_records('quiz_questions', 'category', $records[$key]->id, 'hidden', 0))) {
|
||||
$records[$key]->questioncount = 0;
|
||||
}
|
||||
if ($parentkey == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user