MDL-32245 question bank: fix moving categories between contexts.

This commit is contained in:
Thanh Le
2012-12-15 10:40:59 +00:00
committed by Tim Hunt
parent 20751863e3
commit 87bee3bcfa
+11 -4
View File
@@ -61,10 +61,17 @@ $qcobject = new question_category_object($pagevars['cpage'], $thispageurl, $cont
$streditingcategories = get_string('editcategories', 'question');
if ($param->left || $param->right || $param->moveup || $param->movedown|| $param->moveupcontext || $param->movedowncontext){
require_sesskey();
foreach ($qcobject->editlists as $list){
//processing of these actions is handled in the method where appropriate and page redirects.
$list->process_actions($param->left, $param->right, $param->moveup, $param->movedown,
$param->moveupcontext, $param->movedowncontext, $param->tocontext);
if ($param->moveupcontext || $param->movedowncontext) {
$catid = ($param->moveupcontext > 0) ? $param->moveupcontext : $param->movedowncontext;
$oldcat = $DB->get_record('question_categories', array('id' => $catid));
$qcobject->update_category($catid, '0,'.$param->tocontext, $oldcat->name, $oldcat->info);
} else {
foreach ($qcobject->editlists as $list){
//processing of these actions is handled in the method where appropriate and page redirects.
$list->process_actions($param->left, $param->right, $param->moveup, $param->movedown,
$param->moveupcontext, $param->movedowncontext, $param->tocontext);
}
}
}
if ($param->delete && ($questionstomove = $DB->count_records("question", array("category" => $param->delete)))){