public static function grade_competency($userid, $competencyid, $grade, $note = null) {
        global $USER, $PAGE;
        $params = self::validate_parameters(self::grade_competency_parameters(), array(
            'userid' => $userid,
            'competencyid' => $competencyid,
            'grade' => $grade,
            'note' => $note
        ));

        $uc = api::get_user_competency($params['userid'], $params['competencyid']);
        self::validate_context($uc->get_context());

        $output = $PAGE->get_renderer('core');
        $evidence = api::grade_competency(
                $uc->get('userid'),
                $uc->get('competencyid'),
                $params['grade'],
                $params['note']
        );

        $scale = $uc->get_competency()->get_scale();
        $exporter = new evidence_exporter($evidence, [
            'actionuser' => $USER,
            'scale' => $scale,
            'usercompetency' => $uc,
            'usercompetencyplan' => null,
            'context' => $evidence->get_context()
        ]);
        return $exporter->export($output);
    }
public static function grade_competency($userid, $competencyid, $grade, $note = null) {
        global $USER, $PAGE;
        $params = self::validate_parameters(self::grade_competency_parameters(), array(
            'userid' => $userid,
            'competencyid' => $competencyid,
            'grade' => $grade,
            'note' => $note
        ));

        $uc = api::get_user_competency($params['userid'], $params['competencyid']);
        self::validate_context($uc->get_context());

        $output = $PAGE->get_renderer('core');
        $evidence = api::grade_competency(
                $uc->get('userid'),
                $uc->get('competencyid'),
                $params['grade'],
                $params['note']
        );

        $scale = $uc->get_competency()->get_scale();
        $exporter = new evidence_exporter($evidence, [
            'actionuser' => $USER,
            'scale' => $scale,
            'usercompetency' => $uc,
            'usercompetencyplan' => null,
            'context' => $evidence->get_context()
        ]);
        return $exporter->export($output);
    }
public static function grade_competency ( $ userid , $ competencyid , $ grade , $ note = null ) { global $ USER , $ PAGE ; $ params = self :: validate_parameters ( self :: grade_competency_parameters ( ) , array ( 'userid' => $ userid , 'competencyid' => $ competencyid , 'grade' => $ grade , 'note' => $ note ) ) ; $ uc = api :: get_user_competency ( $ params [ 'userid' ] , $ params [ 'competencyid' ] ) ; self :: validate_context ( $ uc -> get_context ( ) ) ; $ output = $ PAGE -> get_renderer ( 'core' ) ; $ evidence = api :: grade_competency ( $ uc -> get ( 'userid' ) , $ uc -> get ( 'competencyid' ) , $ params [ 'grade' ] , $ params [ 'note' ] ) ; $ scale = $ uc -> get_competency ( ) -> get_scale ( ) ; $ exporter = new evidence_exporter ( $ evidence , [ 'actionuser' => $ USER , 'scale' => $ scale , 'usercompetency' => $ uc , 'usercompetencyplan' => null , 'context' => $ evidence -> get_context ( ) ] ) ; return $ exporter -> export ( $ output ) ; }
Grade a competency.

@param int $userid The user ID.
@param int $competencyid The competency id
@param int $grade The new grade value
@param string $note A note to attach to the evidence
@return bool
Grade a competency .