<?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.

/**
 * CSV import for évaluation niveaux/commentaires — single file, semicolon
 * or comma auto-detected.
 *
 * @package    local_kid
 */

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

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

class local_kid_eval_import_form extends moodleform {

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

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

        $mform->addElement('filepicker', 'csvfile', get_string('eval_import_file', 'local_kid'), null, [
            'accepted_types' => ['.csv'],
        ]);
        $mform->addRule('csvfile', get_string('required'), 'required', null, 'client');
        $mform->addElement('static', 'formathelp', '', get_string('eval_import_format_help', 'local_kid'));

        $this->add_action_buttons(true, get_string('eval_import_submit', 'local_kid'));
    }
}
