public function get_name($fulltotal=false) {
        global $CFG;
        require_once($CFG->dirroot . '/course/lib.php');
        if (strval($this->itemname) !== '') {
            // MDL-10557

            // Make it obvious to users if the course module to which this grade item relates, is currently being removed.
            $deletionpending = course_module_instance_pending_deletion($this->courseid, $this->itemmodule, $this->iteminstance);
            $deletionnotice = get_string('gradesmoduledeletionprefix', 'grades');

            $options = ['context' => context_course::instance($this->courseid)];
            return $deletionpending ?
                format_string($deletionnotice . ' ' . $this->itemname, true, $options) :
                format_string($this->itemname, true, $options);

        } else if ($this->is_course_item()) {
            return get_string('coursetotal', 'grades');

        } else if ($this->is_category_item()) {
            if ($fulltotal) {
                $category = $this->load_parent_category();
                $a = new stdClass();
                $a->category = $category->get_name();
                return get_string('categorytotalfull', 'grades', $a);
            } else {
            return get_string('categorytotal', 'grades');
            }

        } else {
            return get_string('grade');
        }
    }
public function get_name($fulltotal=false) {
        global $CFG;
        require_once($CFG->dirroot . '/course/lib.php');
        if (strval($this->itemname) !== '') {
            // MDL-10557

            // Make it obvious to users if the course module to which this grade item relates, is currently being removed.
            $deletionpending = course_module_instance_pending_deletion($this->courseid, $this->itemmodule, $this->iteminstance);
            $deletionnotice = get_string('gradesmoduledeletionprefix', 'grades');

            $options = ['context' => context_course::instance($this->courseid)];
            return $deletionpending ?
                format_string($deletionnotice . ' ' . $this->itemname, true, $options) :
                format_string($this->itemname, true, $options);

        } else if ($this->is_course_item()) {
            return get_string('coursetotal', 'grades');

        } else if ($this->is_category_item()) {
            if ($fulltotal) {
                $category = $this->load_parent_category();
                $a = new stdClass();
                $a->category = $category->get_name();
                return get_string('categorytotalfull', 'grades', $a);
            } else {
            return get_string('categorytotal', 'grades');
            }

        } else {
            return get_string('grade');
        }
    }
public function get_name ( $ fulltotal = false ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/course/lib.php' ) ; if ( strval ( $ this -> itemname ) !== '' ) { // MDL-10557 // Make it obvious to users if the course module to which this grade item relates, is currently being removed. $ deletionpending = course_module_instance_pending_deletion ( $ this -> courseid , $ this -> itemmodule , $ this -> iteminstance ) ; $ deletionnotice = get_string ( 'gradesmoduledeletionprefix' , 'grades' ) ; $ options = [ 'context' => context_course :: instance ( $ this -> courseid ) ] ; return $ deletionpending ? format_string ( $ deletionnotice . ' ' . $ this -> itemname , true , $ options ) : format_string ( $ this -> itemname , true , $ options ) ; } else if ( $ this -> is_course_item ( ) ) { return get_string ( 'coursetotal' , 'grades' ) ; } else if ( $ this -> is_category_item ( ) ) { if ( $ fulltotal ) { $ category = $ this -> load_parent_category ( ) ; $ a = new stdClass ( ) ; $ a -> category = $ category -> get_name ( ) ; return get_string ( 'categorytotalfull' , 'grades' , $ a ) ; } else { return get_string ( 'categorytotal' , 'grades' ) ; } } else { return get_string ( 'grade' ) ; } }
Returns the most descriptive field for this object.

Determines what type of grade item it is then returns the appropriate string

@param bool $fulltotal If the item is a category total, returns $categoryname."total" instead of "Category total" or "Course total"
@return string name
Returns the most descriptive field for this object .