PageRenderTime 40ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/mod/assignment/type/uploadsingle/upload_form.php

https://bitbucket.org/synergylearning/campusconnect
PHP | 46 lines | 17 code | 5 blank | 24 comment | 0 complexity | a1cde3de225531ed4a7d744f0e63f8c4 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-3.0, GPL-3.0, LGPL-2.1, Apache-2.0, BSD-3-Clause, AGPL-3.0
  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 1999 onwards Martin Dougiamas {@link http://moodle.com}
  20. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  21. */
  22. class mod_assignment_uploadsingle_form extends moodleform {
  23. function definition() {
  24. $mform = $this->_form;
  25. $instance = $this->_customdata;
  26. // visible elements
  27. //$mform->addElement('filemanager', 'newfile', get_string('uploadafile'));
  28. //$mform->addElement('filemanager', 'files_filemanager', get_string('uploadafile'), null, $instance['options']);
  29. $mform->addElement('filepicker', 'assignment_file', get_string('uploadafile'), null, $instance['options']);
  30. $mform->addRule('assignment_file', get_string('uploadnofilefound'), 'required', null, 'client');
  31. // hidden params
  32. $mform->addElement('hidden', 'contextid', $instance['contextid']);
  33. $mform->setType('contextid', PARAM_INT);
  34. $mform->addElement('hidden', 'userid', $instance['userid']);
  35. $mform->setType('userid', PARAM_INT);
  36. $mform->addElement('hidden', 'action', 'uploadfile');
  37. $mform->setType('action', PARAM_ALPHA);
  38. // buttons
  39. $this->add_action_buttons(true, get_string('savechanges', 'admin'));
  40. }
  41. }