<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

defined('MOODLE_INTERNAL') || die();

require_once($CFG->libdir . '/formslib.php');

class local_kid_competency_form extends moodleform {

    protected function definition() {
        $mform = $this->_form;

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);
        $mform->addElement('hidden', 'promotionid');
        $mform->setType('promotionid', PARAM_INT);

        $mform->addElement('text', 'libelle', get_string('competency_libelle', 'local_kid'), ['size' => 60]);
        $mform->setType('libelle', PARAM_TEXT);
        $mform->addRule('libelle', get_string('required'), 'required', null, 'client');

        $mform->addElement('text', 'codeadesi', get_string('competency_codeadesi', 'local_kid'), ['size' => 40]);
        $mform->setType('codeadesi', PARAM_TEXT);
        $mform->addHelpButton('codeadesi', 'competency_codeadesi', 'local_kid');

        if ($this->_customdata['showactive'] ?? false) {
            $mform->addElement('advcheckbox', 'active', get_string('competency_active', 'local_kid'));
        }

        $this->add_action_buttons();
    }
}
