private function category($item) {
        global $DB;

        if (empty($item->categoryid)) {

            if ($item->itemtype == 'course') {
                return $this->course->fullname;
            }

            $params = array('id' => $item->iteminstance);
            $elem = $DB->get_record('grade_categories', $params);

            return $elem->fullname;
        }

        if (!isset($this->categories[$item->categoryid])) {
            $category = $item->get_parent_category();

            $this->categories[$category->id] = $category;
        }

        return $this->categories[$item->categoryid]->get_name();
    }
private function category($item) {
        global $DB;

        if (empty($item->categoryid)) {

            if ($item->itemtype == 'course') {
                return $this->course->fullname;
            }

            $params = array('id' => $item->iteminstance);
            $elem = $DB->get_record('grade_categories', $params);

            return $elem->fullname;
        }

        if (!isset($this->categories[$item->categoryid])) {
            $category = $item->get_parent_category();

            $this->categories[$category->id] = $category;
        }

        return $this->categories[$item->categoryid]->get_name();
    }
private function category ( $ item ) { global $ DB ; if ( empty ( $ item -> categoryid ) ) { if ( $ item -> itemtype == 'course' ) { return $ this -> course -> fullname ; } $ params = array ( 'id' => $ item -> iteminstance ) ; $ elem = $ DB -> get_record ( 'grade_categories' , $ params ) ; return $ elem -> fullname ; } if ( ! isset ( $ this -> categories [ $ item -> categoryid ] ) ) { $ category = $ item -> get_parent_category ( ) ; $ this -> categories [ $ category -> id ] = $ category ; } return $ this -> categories [ $ item -> categoryid ] -> get_name ( ) ; }
Helper to get the category for an item.

@param grade_item $item
@return grade_category
Helper to get the category for an item .