MDL-29846 qbehaviours admin: correct $needed logic.

Also, fix a notice.

Conflicts:

	admin/qbehaviours.php
This commit is contained in:
Tim Hunt
2011-12-19 14:37:11 +00:00
parent f2b2978c26
commit f976adcd67
+4 -3
View File
@@ -61,9 +61,10 @@ foreach ($behaviours as $behaviour => $notused) {
}
foreach ($counts as $behaviour => $count) {
if (!array_key_exists($behaviour, $behaviours)) {
$counts['missingtype'] += $count;
$counts['missing'] += $count;
}
}
$needed['missing'] = true;
// Work of the correct sort order.
$config = get_config('question');
@@ -181,7 +182,7 @@ if (($delete = optional_param('delete', '', PARAM_SAFEDIR)) && confirm_sesskey()
unset($disabledbehaviours[$key]);
set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
}
$behaviourorder = explode(',', $config->behavioursortorder);
$behaviourorder = array_keys($sortedbehaviours);
if (($key = array_search($delete, $behaviourorder)) !== false) {
unset($behaviourorder[$key]);
set_config('behavioursortorder', implode(',', $behaviourorder), 'question');
@@ -249,7 +250,7 @@ foreach ($sortedbehaviours as $behaviour => $behaviourname) {
$row[] = '';
}
// Are people allowed to create new questions of this type?
// Are people allowed to select this behaviour?
$rowclass = '';
if ($archetypal[$behaviour]) {
$enabled = array_search($behaviour, $disabledbehaviours) === false;