public function process_user_competency_course($data) {
        global $USER, $DB;
        $data = (object) $data;

        $data->competencyid = $this->get_mappingid(\core_competency\competency::TABLE, $data->competencyid);
        if (!$data->competencyid) {
            // This is strange, the competency does not belong to the course.
            return;
        } else if ($data->grade === null) {
            // We do not need to do anything when there is no grade.
            return;
        }

        $data->userid = $this->get_mappingid('user', $data->userid);
        $shortname = $DB->get_field('course', 'shortname', array('id' => $this->task->get_courseid()), MUST_EXIST);

        // The method add_evidence also sets the course rating.
        \core_competency\api::add_evidence($data->userid,
                                           $data->competencyid,
                                           $this->task->get_contextid(),
                                           \core_competency\evidence::ACTION_OVERRIDE,
                                           'evidence_courserestored',
                                           'core_competency',
                                           $shortname,
                                           false,
                                           null,
                                           $data->grade,
                                           $USER->id);
    }
public function process_user_competency_course($data) {
        global $USER, $DB;
        $data = (object) $data;

        $data->competencyid = $this->get_mappingid(\core_competency\competency::TABLE, $data->competencyid);
        if (!$data->competencyid) {
            // This is strange, the competency does not belong to the course.
            return;
        } else if ($data->grade === null) {
            // We do not need to do anything when there is no grade.
            return;
        }

        $data->userid = $this->get_mappingid('user', $data->userid);
        $shortname = $DB->get_field('course', 'shortname', array('id' => $this->task->get_courseid()), MUST_EXIST);

        // The method add_evidence also sets the course rating.
        \core_competency\api::add_evidence($data->userid,
                                           $data->competencyid,
                                           $this->task->get_contextid(),
                                           \core_competency\evidence::ACTION_OVERRIDE,
                                           'evidence_courserestored',
                                           'core_competency',
                                           $shortname,
                                           false,
                                           null,
                                           $data->grade,
                                           $USER->id);
    }
public function process_user_competency_course ( $ data ) { global $ USER , $ DB ; $ data = ( object ) $ data ; $ data -> competencyid = $ this -> get_mappingid ( \ core_competency \ competency :: TABLE , $ data -> competencyid ) ; if ( ! $ data -> competencyid ) { // This is strange, the competency does not belong to the course. return ; } else if ( $ data -> grade === null ) { // We do not need to do anything when there is no grade. return ; } $ data -> userid = $ this -> get_mappingid ( 'user' , $ data -> userid ) ; $ shortname = $ DB -> get_field ( 'course' , 'shortname' , array ( 'id' => $ this -> task -> get_courseid ( ) ) , MUST_EXIST ) ; // The method add_evidence also sets the course rating. \ core_competency \ api :: add_evidence ( $ data -> userid , $ data -> competencyid , $ this -> task -> get_contextid ( ) , \ core_competency \ evidence :: ACTION_OVERRIDE , 'evidence_courserestored' , 'core_competency' , $ shortname , false , null , $ data -> grade , $ USER -> id ) ; }
Process the user competency course.

@param array $data The data.
Process the user competency course .