function question_move_questions_to_category in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/lib/questionlib.php \question_move_questions_to_category()
This function should be considered private to the question bank, it is called from question/editlib.php question/contextmoveq.php and a few similar places to to the work of acutally moving questions and associated data. However, callers of this function also have to do other work, which is why you should not call this method directly from outside the questionbank.
Parameters
string $questionids a comma-separated list of question ids.:
integer $newcategory the id of the category to move to.:
1 call to question_move_questions_to_category()
- question_save_from_deletion in includes/
moodle/ lib/ questionlib.php - Enter description here...
File
- includes/
moodle/ lib/ questionlib.php, line 720
Code
function question_move_questions_to_category($questionids, $newcategory) {
$result = true;
// Move the questions themselves.
$result = $result && set_field_select('question', 'category', $newcategory, "id IN ({$questionids})");
// Move any subquestions belonging to them.
$result = $result && set_field_select('question', 'category', $newcategory, "parent IN ({$questionids})");
// TODO Deal with datasets.
return $result;
}