Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 99231022af446812a68aa718a02b8c4c870812ea 1 parent 7d2c5cd
@dtle dtle authored timhunt committed
Showing with 11 additions and 4 deletions.
  1. +11 −4 question/category.php
View
15 question/category.php
@@ -61,10 +61,17 @@
$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)))){
Please sign in to comment.
Something went wrong with that request. Please try again.