public function get_course_name(\context $context) {
        $courseid = $this->courseid;
        if (empty($courseid)) {
            return get_string('site');
        } else {
            try {
                $course = get_course($courseid);
                return format_string($course->fullname, true, array('context' => $context));
            } catch (\dml_exception $e) {
                return '-';
            }
        }
    }
public function get_course_name(\context $context) {
        $courseid = $this->courseid;
        if (empty($courseid)) {
            return get_string('site');
        } else {
            try {
                $course = get_course($courseid);
                return format_string($course->fullname, true, array('context' => $context));
            } catch (\dml_exception $e) {
                return '-';
            }
        }
    }
public function get_course_name ( \ context $ context ) { $ courseid = $ this -> courseid ; if ( empty ( $ courseid ) ) { return get_string ( 'site' ) ; } else { try { $ course = get_course ( $ courseid ) ; return format_string ( $ course -> fullname , true , array ( 'context' => $ context ) ) ; } catch ( \ dml_exception $ e ) { return '-' ; } } }
Get properly formatted name of the course associated.

@param \context $context context where this name would be displayed.
@return string Formatted name of the rule.
Get properly formatted name of the course associated .