public static function create_competency($competency) {
        global $PAGE;

        $params = self::validate_parameters(self::create_competency_parameters(), array(
            'competency' => $competency
        ));

        $params = $params['competency'];
        $framework = api::read_framework($params['competencyframeworkid']);
        $context = $framework->get_context();
        self::validate_context($context);
        $output = $PAGE->get_renderer('core');

        $params = (object) $params;
        $result = api::create_competency($params);
        $exporter = new competency_exporter($result, array('context' => $context));
        $record = $exporter->export($output);
        return $record;
    }
public static function create_competency($competency) {
        global $PAGE;

        $params = self::validate_parameters(self::create_competency_parameters(), array(
            'competency' => $competency
        ));

        $params = $params['competency'];
        $framework = api::read_framework($params['competencyframeworkid']);
        $context = $framework->get_context();
        self::validate_context($context);
        $output = $PAGE->get_renderer('core');

        $params = (object) $params;
        $result = api::create_competency($params);
        $exporter = new competency_exporter($result, array('context' => $context));
        $record = $exporter->export($output);
        return $record;
    }
public static function create_competency ( $ competency ) { global $ PAGE ; $ params = self :: validate_parameters ( self :: create_competency_parameters ( ) , array ( 'competency' => $ competency ) ) ; $ params = $ params [ 'competency' ] ; $ framework = api :: read_framework ( $ params [ 'competencyframeworkid' ] ) ; $ context = $ framework -> get_context ( ) ; self :: validate_context ( $ context ) ; $ output = $ PAGE -> get_renderer ( 'core' ) ; $ params = ( object ) $ params ; $ result = api :: create_competency ( $ params ) ; $ exporter = new competency_exporter ( $ result , array ( 'context' => $ context ) ) ; $ record = $ exporter -> export ( $ output ) ; return $ record ; }
Create a new competency

@param array $competency All the fields for a competency record (including id)
@return array the competency
Create a new competency