MDL-31830 course: several small code improvements

* I can rebase this for you/the integrator before it goes in for sure no probs :)
* Fixed double phpdoc block of course_change_visibility
* Moved permission checks out of course_move_after_course and into helper function.
* Reviewed setType calls for editcategory_form.php.
* Reviewed all uses of can_resort and added more specific methods.
* Fixed method mentioned in exception for resort methods.
* Converted calls to fetch courses to call get_course.
* Exceptions now thrown when trying to move courses and problems arise.
* Fixed unnecessary namespace hinting in core_course_management_renderer.
* Abstracted common logic of can_resort_any and can_change_parent_any.
* Removed check for system level capability from has_manage_capability_on_any.
* Reviewed debugging calls I've introduced.
MDL-31830 course: renamed functions for consistency

* course_move_by_one => course_change_sortorder_by_one
* course_move_after_course => course_move_after_course
* helper::action_course_move_after_course  => helper::action_course_change_sortorder_after_course
* helper::action_course_moveup 		   => helper::action_course_change_sortorder_up_one
* helper::action_course_movedown 	   => helper::action_course_change_sortorder_down_one
* helper::action_course_moveup_by_record   => helper::action_course_change_sortorder_up_one_by_record
* helper::action_course_movedown_by_record => helper::action_course_change_sortorder_down_one_by_record
* helper::action_category_movedown         => helper::action_category_change_sortorder_down_one
* helper::action_category_movedown_by_id   => helper::action_category_change_sortorder_down_one_by_id
* helper::action_category_moveup 	   => helper::action_category_change_sortorder_up_one
* helper::action_category_moveup_by_id     => helper::action_category_change_sortorder_up_one_by_id
* coursecat::move_by_one 	           => coursecat::change_sortorder_by_one