/mod/assignment/type/upload/upload_form.php

https://bitbucket.org/synergylearning/campusconnect · PHP · 44 lines · 17 code · 5 blank · 22 comment · 0 complexity · 79be157c95447bf015fb2239dcc05d71 MD5 · raw file

  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');//putting this is as a safety as i got a class not found error.
  17. /**
  18. * @package mod-assignment
  19. * @copyright 2010 Dongsheng Cai <dongsheng@moodle.com>
  20. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  21. */
  22. class mod_assignment_upload_form extends moodleform {
  23. function definition() {
  24. $mform = $this->_form;
  25. $instance = $this->_customdata;
  26. // visible elements
  27. $mform->addElement('filemanager', 'files_filemanager', get_string('uploadafile'), null, $instance['options']);
  28. $mform->addRule('files_filemanager', get_string('uploadnofilefound'), 'required', null, 'client');
  29. // hidden params
  30. $mform->addElement('hidden', 'contextid', $instance['contextid']);
  31. $mform->setType('contextid', PARAM_INT);
  32. $mform->addElement('hidden', 'userid', $instance['userid']);
  33. $mform->setType('userid', PARAM_INT);
  34. $mform->addElement('hidden', 'action', 'uploadfile');
  35. $mform->setType('action', PARAM_ALPHA);
  36. // buttons
  37. $this->add_action_buttons(true, get_string('savechanges', 'admin'));
  38. }
  39. }