coursefilesedit_form.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. require_once($CFG->libdir.'/formslib.php');
  17. class coursefiles_edit_form extends moodleform {
  18. function definition() {
  19. global $CFG;
  20. $maxfiles = 0;
  21. $subdirs = 0;
  22. if ($CFG->legacyfilesaddallowed) {
  23. $maxfiles = -1;
  24. $subdirs = 1;
  25. }
  26. $mform =& $this->_form;
  27. $contextid = $this->_customdata['contextid'];
  28. $options = array('subdirs' => $subdirs, 'maxfiles' => $maxfiles, 'accepted_types'=>'*');
  29. $mform->addElement('filemanager', 'files_filemanager', '', null, $options);
  30. $mform->addElement('hidden', 'contextid', $this->_customdata['contextid']);
  31. $mform->setType('contextid', PARAM_INT);
  32. $this->set_data($this->_customdata['data']);
  33. $this->add_action_buttons(true);
  34. }
  35. }