MDL-9506 MDL-9137 MDL-9629
Added a number of small getters and setters to grade_item and grade_category, to hide the structural differences between the two, and provide a common interface for cases when we are not sure whether an $object is of one type or another.
The grade_tree::renumber() method now adds complete objects to the need_update array, because both grade_category and grade_item need to update their parent field when moved to a different parent. Amazingly, these important changes worked straight away (after 1 hour of coding without testing anything), and all the unit tests passed!