protected function calculate_category_path($categoryid) {

        if (!array_key_exists($categoryid, $this->categoryparent)) {
            throw new moodle1_convert_exception('gradebook_unknown_categoryid', null, $categoryid);
        }

        $path = array($categoryid);
        $parent = $this->categoryparent[$categoryid];
        while (!is_null($parent)) {
            array_unshift($path, $parent);
            $parent = $this->categoryparent[$parent];
            if (in_array($parent, $path)) {
                throw new moodle1_convert_exception('circular_reference_in_categories_tree');
            }
        }

        return $path;
    }
protected function calculate_category_path($categoryid) {

        if (!array_key_exists($categoryid, $this->categoryparent)) {
            throw new moodle1_convert_exception('gradebook_unknown_categoryid', null, $categoryid);
        }

        $path = array($categoryid);
        $parent = $this->categoryparent[$categoryid];
        while (!is_null($parent)) {
            array_unshift($path, $parent);
            $parent = $this->categoryparent[$parent];
            if (in_array($parent, $path)) {
                throw new moodle1_convert_exception('circular_reference_in_categories_tree');
            }
        }

        return $path;
    }
protected function calculate_category_path ( $ categoryid ) { if ( ! array_key_exists ( $ categoryid , $ this -> categoryparent ) ) { throw new moodle1_convert_exception ( 'gradebook_unknown_categoryid' , null , $ categoryid ) ; } $ path = array ( $ categoryid ) ; $ parent = $ this -> categoryparent [ $ categoryid ] ; while ( ! is_null ( $ parent ) ) { array_unshift ( $ path , $ parent ) ; $ parent = $ this -> categoryparent [ $ parent ] ; if ( in_array ( $ parent , $ path ) ) { throw new moodle1_convert_exception ( 'circular_reference_in_categories_tree' ) ; } } return $ path ; }
Calculates the path to the grade_category

Moodle 1.9 backup does not store the grade_category's depth and path. This method is used
to repopulate this information using the $this->categoryparent values.

@param int $categoryid
@return array of ids including the categoryid
Calculates the path to the grade_category