public function get_contextvisibility($context) {
        global $USER;

        if ($context->contextlevel == CONTEXT_COURSE) {
            return $this->_options['enablecourseinstances'];
        }

        if ($context->contextlevel == CONTEXT_USER) {
            return $this->_options['enableuserinstances'];
        }

        //the context is SITE
        return true;
    }
public function get_contextvisibility($context) {
        global $USER;

        if ($context->contextlevel == CONTEXT_COURSE) {
            return $this->_options['enablecourseinstances'];
        }

        if ($context->contextlevel == CONTEXT_USER) {
            return $this->_options['enableuserinstances'];
        }

        //the context is SITE
        return true;
    }
public function get_contextvisibility ( $ context ) { global $ USER ; if ( $ context -> contextlevel == CONTEXT_COURSE ) { return $ this -> _options [ 'enablecourseinstances' ] ; } if ( $ context -> contextlevel == CONTEXT_USER ) { return $ this -> _options [ 'enableuserinstances' ] ; } //the context is SITE return true ; }
Return if the instance is visible in a context

@todo check if the context visibility has been overwritten by the plugin creator
(need to create special functions to be overvwritten in repository class)
@param stdClass $context context
@return bool
Return if the instance is visible in a context