public static function competency_criteria_review(\core\event\competency_evidence_created $event) {
        global $DB, $CFG;

        if (!empty($CFG->enablebadges)) {
            require_once($CFG->dirroot.'/lib/badgeslib.php');

            if (!get_config('core_competency', 'enabled')) {
                return;
            }

            $ucid = $event->other['usercompetencyid'];
            $cid = $event->other['competencyid'];
            $userid = $event->relateduserid;

            if ($rs = $DB->get_records('badge_criteria_param', array('name' => 'competency_' . $cid, 'value' => $cid))) {
                foreach ($rs as $r) {
                    $crit = $DB->get_record('badge_criteria', array('id' => $r->critid), 'badgeid, criteriatype', MUST_EXIST);
                    $badge = new badge($crit->badgeid);
                    // Only site badges are updated from site competencies.
                    if (!$badge->is_active() || $badge->is_issued($userid)) {
                        continue;
                    }

                    if ($badge->criteria[$crit->criteriatype]->review($userid)) {
                        $badge->criteria[$crit->criteriatype]->mark_complete($userid);

                        if ($badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->review($userid)) {
                            $badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->mark_complete($userid);
                            $badge->issue($userid);
                        }
                    }
                }
            }
        }
    }
public static function competency_criteria_review(\core\event\competency_evidence_created $event) {
        global $DB, $CFG;

        if (!empty($CFG->enablebadges)) {
            require_once($CFG->dirroot.'/lib/badgeslib.php');

            if (!get_config('core_competency', 'enabled')) {
                return;
            }

            $ucid = $event->other['usercompetencyid'];
            $cid = $event->other['competencyid'];
            $userid = $event->relateduserid;

            if ($rs = $DB->get_records('badge_criteria_param', array('name' => 'competency_' . $cid, 'value' => $cid))) {
                foreach ($rs as $r) {
                    $crit = $DB->get_record('badge_criteria', array('id' => $r->critid), 'badgeid, criteriatype', MUST_EXIST);
                    $badge = new badge($crit->badgeid);
                    // Only site badges are updated from site competencies.
                    if (!$badge->is_active() || $badge->is_issued($userid)) {
                        continue;
                    }

                    if ($badge->criteria[$crit->criteriatype]->review($userid)) {
                        $badge->criteria[$crit->criteriatype]->mark_complete($userid);

                        if ($badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->review($userid)) {
                            $badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->mark_complete($userid);
                            $badge->issue($userid);
                        }
                    }
                }
            }
        }
    }
public static function competency_criteria_review ( \ core \ event \ competency_evidence_created $ event ) { global $ DB , $ CFG ; if ( ! empty ( $ CFG -> enablebadges ) ) { require_once ( $ CFG -> dirroot . '/lib/badgeslib.php' ) ; if ( ! get_config ( 'core_competency' , 'enabled' ) ) { return ; } $ ucid = $ event -> other [ 'usercompetencyid' ] ; $ cid = $ event -> other [ 'competencyid' ] ; $ userid = $ event -> relateduserid ; if ( $ rs = $ DB -> get_records ( 'badge_criteria_param' , array ( 'name' => 'competency_' . $ cid , 'value' => $ cid ) ) ) { foreach ( $ rs as $ r ) { $ crit = $ DB -> get_record ( 'badge_criteria' , array ( 'id' => $ r -> critid ) , 'badgeid, criteriatype' , MUST_EXIST ) ; $ badge = new badge ( $ crit -> badgeid ) ; // Only site badges are updated from site competencies. if ( ! $ badge -> is_active ( ) || $ badge -> is_issued ( $ userid ) ) { continue ; } if ( $ badge -> criteria [ $ crit -> criteriatype ] -> review ( $ userid ) ) { $ badge -> criteria [ $ crit -> criteriatype ] -> mark_complete ( $ userid ) ; if ( $ badge -> criteria [ BADGE_CRITERIA_TYPE_OVERALL ] -> review ( $ userid ) ) { $ badge -> criteria [ BADGE_CRITERIA_TYPE_OVERALL ] -> mark_complete ( $ userid ) ; $ badge -> issue ( $ userid ) ; } } } } } }
Triggered when '\core\event\competency_evidence_created' event is triggered.

@param \core\event\competency_evidence_created $event
Triggered when \ core \ event \ competency_evidence_created event is triggered .