<?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_niveau_form extends moodleform {

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

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

        $mform->addElement('static', 'code_display', get_string('niveau_code', 'local_kid'));

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

        $mform->addElement('text', 'couleur', get_string('niveau_couleur', 'local_kid'), ['size' => 10]);
        $mform->setType('couleur', PARAM_TEXT);

        $mform->addElement('text', 'sortorder', get_string('niveau_sortorder', 'local_kid'), ['size' => 5]);
        $mform->setType('sortorder', PARAM_INT);

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

        $this->add_action_buttons();
    }
}
