public static function delete_user_evidence_competency($userevidenceorid, $competencyid) {
        global $USER;
        static::require_enabled();

        $userevidence = $userevidenceorid;
        if (!is_object($userevidence)) {
            $userevidence = self::read_user_evidence($userevidence);
        }

        // Perform user evidence capability checks.
        if (!$userevidence->can_manage()) {
            $context = $userevidence->get_context();
            throw new required_capability_exception($context, 'moodle/competency:userevidencemanage', 'nopermissions', '');
        }

        // Get (and delete) the relation.
        $relation = user_evidence_competency::get_relation($userevidence->get('id'), $competencyid);
        if (!$relation->get('id')) {
            return true;
        }

        $success = $relation->delete();
        if ($success) {
            self::add_evidence(
                $userevidence->get('userid'),
                $competencyid,
                $userevidence->get_context(),
                evidence::ACTION_LOG,
                'evidence_evidenceofpriorlearningunlinked',
                'core_competency',
                $userevidence->get('name'),
                false,
                null,
                null,
                $USER->id
            );
        }

        return $success;
    }
public static function delete_user_evidence_competency($userevidenceorid, $competencyid) {
        global $USER;
        static::require_enabled();

        $userevidence = $userevidenceorid;
        if (!is_object($userevidence)) {
            $userevidence = self::read_user_evidence($userevidence);
        }

        // Perform user evidence capability checks.
        if (!$userevidence->can_manage()) {
            $context = $userevidence->get_context();
            throw new required_capability_exception($context, 'moodle/competency:userevidencemanage', 'nopermissions', '');
        }

        // Get (and delete) the relation.
        $relation = user_evidence_competency::get_relation($userevidence->get('id'), $competencyid);
        if (!$relation->get('id')) {
            return true;
        }

        $success = $relation->delete();
        if ($success) {
            self::add_evidence(
                $userevidence->get('userid'),
                $competencyid,
                $userevidence->get_context(),
                evidence::ACTION_LOG,
                'evidence_evidenceofpriorlearningunlinked',
                'core_competency',
                $userevidence->get('name'),
                false,
                null,
                null,
                $USER->id
            );
        }

        return $success;
    }
public static function delete_user_evidence_competency ( $ userevidenceorid , $ competencyid ) { global $ USER ; static :: require_enabled ( ) ; $ userevidence = $ userevidenceorid ; if ( ! is_object ( $ userevidence ) ) { $ userevidence = self :: read_user_evidence ( $ userevidence ) ; } // Perform user evidence capability checks. if ( ! $ userevidence -> can_manage ( ) ) { $ context = $ userevidence -> get_context ( ) ; throw new required_capability_exception ( $ context , 'moodle/competency:userevidencemanage' , 'nopermissions' , '' ) ; } // Get (and delete) the relation. $ relation = user_evidence_competency :: get_relation ( $ userevidence -> get ( 'id' ) , $ competencyid ) ; if ( ! $ relation -> get ( 'id' ) ) { return true ; } $ success = $ relation -> delete ( ) ; if ( $ success ) { self :: add_evidence ( $ userevidence -> get ( 'userid' ) , $ competencyid , $ userevidence -> get_context ( ) , evidence :: ACTION_LOG , 'evidence_evidenceofpriorlearningunlinked' , 'core_competency' , $ userevidence -> get ( 'name' ) , false , null , null , $ USER -> id ) ; } return $ success ; }
Delete a relationship between a user evidence and a competency.

@param  user_evidence|int $userevidenceorid User evidence or its ID.
@param  int $competencyid Competency ID.
@return bool
Delete a relationship between a user evidence and a competency .