Index: questiontype.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/type/questiontype.php,v retrieving revision 1.74 diff -u -r1.74 questiontype.php --- questiontype.php 27 Sep 2007 07:41:58 -0000 1.74 +++ questiontype.php 6 Oct 2007 03:57:08 -0000 @@ -375,6 +375,24 @@ } /** + * Move question to another category + * + * The default function set the question fiel parent to the new category id. + * Question types with complex structure could set other parameters to + * reflect the category change i.e. for multianswer qtype the subquestion question records + * + * + * @param object $question The question that is moved + * @param integer $tocategoryid The id of the new category + */ + function move_question_to_category($question, $tocategoryid){ + if (!set_field('question', 'category', $tocategoryid, 'id', $question->id)) { + return false; // error('Could not update category field'); + } + return true; + } + + /** * Changes all states for the given attempts over to a new question * * This is used by the versioning code if the teacher requests that a question