import_form.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.
  13. //
  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/>.
  16. /**
  17. * A form for group import.
  18. *
  19. * @package core_group
  20. * @copyright 2010 Toyomoyo (http://moodle.com)
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  22. */
  23. if (!defined('MOODLE_INTERNAL')) {
  24. die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
  25. }
  26. require_once($CFG->libdir.'/formslib.php');
  27. /**
  28. * Groups import form class
  29. *
  30. * @package core_group
  31. * @copyright 2010 Toyomoyo (http://moodle.com)
  32. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  33. */
  34. class groups_import_form extends moodleform {
  35. /**
  36. * Form definition
  37. */
  38. function definition() {
  39. $mform =& $this->_form;
  40. $data = $this->_customdata;
  41. //fill in the data depending on page params
  42. //later using set_data
  43. $mform->addElement('header', 'general', get_string('general'));
  44. $filepickeroptions = array();
  45. $filepickeroptions['filetypes'] = '*';
  46. $filepickeroptions['maxbytes'] = get_max_upload_file_size();
  47. $mform->addElement('filepicker', 'userfile', get_string('import'), null, $filepickeroptions);
  48. $mform->addElement('hidden', 'id');
  49. $mform->setType('id', PARAM_INT);
  50. $this->add_action_buttons(true, get_string('importgroups', 'core_group'));
  51. $this->set_data($data);
  52. }
  53. }