PageRenderTime 57ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 0ms

/mod/assign/feedback/offline/uploadgradesform.php

https://bitbucket.org/synergylearning/campusconnect
PHP | 76 lines | 32 code | 13 blank | 31 comment | 1 complexity | 0f5407576c8b7bafd14a407aa2a13d59 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. /**
  17. * This file contains the forms to create and edit an instance of this module
  18. *
  19. * @package assignfeedback_offline
  20. * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  22. */
  23. defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
  24. require_once($CFG->libdir.'/formslib.php');
  25. /**
  26. * Upload modified grading worksheet
  27. *
  28. * @package assignfeedback_offline
  29. * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
  30. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  31. */
  32. class assignfeedback_offline_upload_grades_form extends moodleform {
  33. /**
  34. * Define this form - called by the parent constructor
  35. */
  36. public function definition() {
  37. global $COURSE, $USER;
  38. $mform = $this->_form;
  39. $params = $this->_customdata;
  40. $mform->addElement('header', 'uploadgrades', get_string('uploadgrades', 'assignfeedback_offline'));
  41. $fileoptions = array('subdirs'=>0,
  42. 'maxbytes'=>$COURSE->maxbytes,
  43. 'accepted_types'=>'csv',
  44. 'maxfiles'=>1,
  45. 'return_types'=>FILE_INTERNAL);
  46. $mform->addElement('filepicker', 'gradesfile', get_string('uploadafile'), null, $fileoptions);
  47. $mform->addRule('gradesfile', get_string('uploadnofilefound'), 'required', null, 'client');
  48. $mform->addHelpButton('gradesfile', 'gradesfile', 'assignfeedback_offline');
  49. $mform->addElement('checkbox', 'ignoremodified', '', get_string('ignoremodified', 'assignfeedback_offline'));
  50. $mform->addHelpButton('ignoremodified', 'ignoremodified', 'assignfeedback_offline');
  51. $mform->addElement('hidden', 'id', $params['cm']);
  52. $mform->setType('id', PARAM_INT);
  53. $mform->addElement('hidden', 'action', 'viewpluginpage');
  54. $mform->setType('action', PARAM_ALPHA);
  55. $mform->addElement('hidden', 'pluginaction', 'uploadgrades');
  56. $mform->setType('pluginaction', PARAM_ALPHA);
  57. $mform->addElement('hidden', 'plugin', 'offline');
  58. $mform->setType('plugin', PARAM_PLUGIN);
  59. $mform->addElement('hidden', 'pluginsubtype', 'assignfeedback');
  60. $mform->setType('pluginsubtype', PARAM_PLUGIN);
  61. $this->add_action_buttons(true, get_string('uploadgrades', 'assignfeedback_offline'));
  62. }
  63. }