Merge branch 'MDL-57742_master' of git://github.com/markn86/moodle
[moodle.git] / group / import_form.php
blobe877b5f7bbf0881d61ab8b18dcaa21422f049b8f
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * A form for group import.
20 * @package core_group
21 * @copyright 2010 Toyomoyo (http://moodle.com)
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 if (!defined('MOODLE_INTERNAL')) {
26 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
29 require_once($CFG->libdir.'/formslib.php');
31 /**
32 * Groups import form class
34 * @package core_group
35 * @copyright 2010 Toyomoyo (http://moodle.com)
36 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
38 class groups_import_form extends moodleform {
40 /**
41 * Form definition
43 function definition() {
44 $mform =& $this->_form;
45 $data = $this->_customdata;
47 //fill in the data depending on page params
48 //later using set_data
49 $mform->addElement('header', 'general', get_string('general'));
51 $filepickeroptions = array();
52 $filepickeroptions['filetypes'] = '*';
53 $filepickeroptions['maxbytes'] = get_max_upload_file_size();
54 $mform->addElement('filepicker', 'userfile', get_string('import'), null, $filepickeroptions);
56 $mform->addElement('hidden', 'id');
57 $mform->setType('id', PARAM_INT);
59 $this->add_action_buttons(true, get_string('importgroups', 'core_group'));
61 $this->set_data($data);