public function get_question_categories($parent=null, $sort="sortorder ASC") {
        global $COURSE, $DB;
        if (is_null($parent)) {
            $categories = $DB->get_records('question_categories', array('course' => $COURSE->id), $sort);
        } else {
            $select = "parent = ? AND course = ?";
            $categories = $DB->get_records_select('question_categories', $select, array($parent, $COURSE->id), $sort);
        }
        return $categories;
    }
public function get_question_categories($parent=null, $sort="sortorder ASC") {
        global $COURSE, $DB;
        if (is_null($parent)) {
            $categories = $DB->get_records('question_categories', array('course' => $COURSE->id), $sort);
        } else {
            $select = "parent = ? AND course = ?";
            $categories = $DB->get_records_select('question_categories', $select, array($parent, $COURSE->id), $sort);
        }
        return $categories;
    }
public function get_question_categories ( $ parent = null , $ sort = "sortorder ASC" ) { global $ COURSE , $ DB ; if ( is_null ( $ parent ) ) { $ categories = $ DB -> get_records ( 'question_categories' , array ( 'course' => $ COURSE -> id ) , $ sort ) ; } else { $ select = "parent = ? AND course = ?" ; $ categories = $ DB -> get_records_select ( 'question_categories' , $ select , array ( $ parent , $ COURSE -> id ) , $ sort ) ; } return $ categories ; }
Gets question categories

@param    int parent - if given, restrict records to those with this parent id.
@param    string sort - [[sortfield [,sortfield]] {ASC|DESC}]
@return   array categories
Gets question categories