public function get_course_module() {
        if ($this->coursemodule) {
            return $this->coursemodule;
        }
        if (!$this->context) {
            return null;
        }

        if ($this->context->contextlevel == CONTEXT_MODULE) {
            $modinfo = get_fast_modinfo($this->get_course());
            $this->coursemodule = $modinfo->get_cm($this->context->instanceid);
            return $this->coursemodule;
        }
        return null;
    }
public function get_course_module() {
        if ($this->coursemodule) {
            return $this->coursemodule;
        }
        if (!$this->context) {
            return null;
        }

        if ($this->context->contextlevel == CONTEXT_MODULE) {
            $modinfo = get_fast_modinfo($this->get_course());
            $this->coursemodule = $modinfo->get_cm($this->context->instanceid);
            return $this->coursemodule;
        }
        return null;
    }
public function get_course_module ( ) { if ( $ this -> coursemodule ) { return $ this -> coursemodule ; } if ( ! $ this -> context ) { return null ; } if ( $ this -> context -> contextlevel == CONTEXT_MODULE ) { $ modinfo = get_fast_modinfo ( $ this -> get_course ( ) ) ; $ this -> coursemodule = $ modinfo -> get_cm ( $ this -> context -> instanceid ) ; return $ this -> coursemodule ; } return null ; }
Get the current course module.

@return cm_info|null The course module or null if not known
Get the current course module .