public static function read_competency($id, $includerelated = false) {
        static::require_enabled();
        $competency = new competency($id);

        // First we do a permissions check.
        $context = $competency->get_context();
        if (!has_any_capability(array('moodle/competency:competencyview', 'moodle/competency:competencymanage'), $context)) {
             throw new required_capability_exception($context, 'moodle/competency:competencyview', 'nopermissions', '');
        }

        // OK - all set.
        if ($includerelated) {
            $relatedcompetency = new related_competency();
            if ($related = $relatedcompetency->list_relations($id)) {
                $competency->relatedcompetencies = $related;
            }
        }

        return $competency;
    }
public static function read_competency($id, $includerelated = false) {
        static::require_enabled();
        $competency = new competency($id);

        // First we do a permissions check.
        $context = $competency->get_context();
        if (!has_any_capability(array('moodle/competency:competencyview', 'moodle/competency:competencymanage'), $context)) {
             throw new required_capability_exception($context, 'moodle/competency:competencyview', 'nopermissions', '');
        }

        // OK - all set.
        if ($includerelated) {
            $relatedcompetency = new related_competency();
            if ($related = $relatedcompetency->list_relations($id)) {
                $competency->relatedcompetencies = $related;
            }
        }

        return $competency;
    }
public static function read_competency ( $ id , $ includerelated = false ) { static :: require_enabled ( ) ; $ competency = new competency ( $ id ) ; // First we do a permissions check. $ context = $ competency -> get_context ( ) ; if ( ! has_any_capability ( array ( 'moodle/competency:competencyview' , 'moodle/competency:competencymanage' ) , $ context ) ) { throw new required_capability_exception ( $ context , 'moodle/competency:competencyview' , 'nopermissions' , '' ) ; } // OK - all set. if ( $ includerelated ) { $ relatedcompetency = new related_competency ( ) ; if ( $ related = $ relatedcompetency -> list_relations ( $ id ) ) { $ competency -> relatedcompetencies = $ related ; } } return $ competency ; }
Read a the details for a single competency and return a record.

Requires moodle/competency:competencyview capability at the system context.

@param int $id The id of the competency to read.
@param bool $includerelated Include related tags or not.
@return stdClass
Read a the details for a single competency and return a record .