function question_add_tops in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/lib/questionlib.php \question_add_tops()
1 call to question_add_tops()
- question_category_options in includes/
moodle/ lib/ questionlib.php - Output an array of question categories.
File
- includes/
moodle/ lib/ questionlib.php, line 2004
Code
function question_add_tops($categories, $pcontexts) {
$topcats = array();
foreach ($pcontexts as $context) {
$newcat = new object();
$newcat->id = "0,{$context}";
$newcat->name = get_string('top');
$newcat->parent = -1;
$newcat->contextid = $context;
$topcats["0,{$context}"] = $newcat;
}
//put topcats in at beginning of array - they'll be sorted into different contexts later.
return array_merge($topcats, $categories);
}