PageRenderTime 41ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/mod/assign/feedback/file/batchuploadfilesform.php

https://bitbucket.org/moodle/moodle
PHP | 87 lines | 42 code | 14 blank | 31 comment | 1 complexity | 84b3bbfb8d6f7adc104ee1090276ab35 MD5 | raw file
Possible License(s): Apache-2.0, LGPL-2.1, BSD-3-Clause, MIT, GPL-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_file
  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. require_once($CFG->dirroot . '/mod/assign/feedback/file/locallib.php');
  26. /**
  27. * Assignment grading options form
  28. *
  29. * @package assignfeedback_file
  30. * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
  31. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  32. */
  33. class assignfeedback_file_batch_upload_files_form extends moodleform {
  34. /**
  35. * Define this form - called by the parent constructor
  36. */
  37. public function definition() {
  38. global $COURSE, $USER;
  39. $mform = $this->_form;
  40. $params = $this->_customdata;
  41. $mform->addElement('header', 'batchuploadfilesforusers', get_string('batchuploadfilesforusers', 'assignfeedback_file',
  42. count($params['users'])));
  43. $mform->addElement('static', 'userslist', get_string('selectedusers', 'assignfeedback_file'), $params['usershtml']);
  44. $data = new stdClass();
  45. $fileoptions = array('subdirs'=>1,
  46. 'maxbytes'=>$COURSE->maxbytes,
  47. 'accepted_types'=>'*',
  48. 'return_types'=>FILE_INTERNAL);
  49. $data = file_prepare_standard_filemanager($data,
  50. 'files',
  51. $fileoptions,
  52. $params['context'],
  53. 'assignfeedback_file',
  54. ASSIGNFEEDBACK_FILE_BATCH_FILEAREA, $USER->id);
  55. $mform->addElement('filemanager', 'files_filemanager', '', null, $fileoptions);
  56. $this->set_data($data);
  57. $mform->addElement('hidden', 'id', $params['cm']);
  58. $mform->setType('id', PARAM_INT);
  59. $mform->addElement('hidden', 'operation', 'plugingradingbatchoperation_file_uploadfiles');
  60. $mform->setType('operation', PARAM_ALPHAEXT);
  61. $mform->addElement('hidden', 'action', 'viewpluginpage');
  62. $mform->setType('action', PARAM_ALPHA);
  63. $mform->addElement('hidden', 'pluginaction', 'uploadfiles');
  64. $mform->setType('pluginaction', PARAM_ALPHA);
  65. $mform->addElement('hidden', 'plugin', 'file');
  66. $mform->setType('plugin', PARAM_PLUGIN);
  67. $mform->addElement('hidden', 'pluginsubtype', 'assignfeedback');
  68. $mform->setType('pluginsubtype', PARAM_PLUGIN);
  69. $mform->addElement('hidden', 'selectedusers', implode(',', $params['users']));
  70. $mform->setType('selectedusers', PARAM_SEQUENCE);
  71. $this->add_action_buttons(true, get_string('uploadfiles', 'assignfeedback_file'));
  72. }
  73. }