Skip to content

Commit

Permalink
MDL-32245 question bank: fix moving categories between contexts.
Browse files Browse the repository at this point in the history
  • Loading branch information
dtle authored and timhunt committed Dec 15, 2012
1 parent 7d2c5cd commit 9923102
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions question/category.php
Expand Up @@ -61,10 +61,17 @@
$streditingcategories = get_string('editcategories', 'question'); $streditingcategories = get_string('editcategories', 'question');
if ($param->left || $param->right || $param->moveup || $param->movedown|| $param->moveupcontext || $param->movedowncontext){ if ($param->left || $param->right || $param->moveup || $param->movedown|| $param->moveupcontext || $param->movedowncontext){
require_sesskey(); require_sesskey();
foreach ($qcobject->editlists as $list){
//processing of these actions is handled in the method where appropriate and page redirects. if ($param->moveupcontext || $param->movedowncontext) {
$list->process_actions($param->left, $param->right, $param->moveup, $param->movedown, $catid = ($param->moveupcontext > 0) ? $param->moveupcontext : $param->movedowncontext;
$param->moveupcontext, $param->movedowncontext, $param->tocontext); $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)))){ if ($param->delete && ($questionstomove = $DB->count_records("question", array("category" => $param->delete)))){
Expand Down

0 comments on commit 9923102

Please sign in to comment.