Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
   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  /**
  18   * This file contains the forms to create and edit an instance of this module
  19   *
  20   * @package   assignfeedback_file
  21   * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
  22   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
  26  
  27  require_once($CFG->libdir.'/formslib.php');
  28  require_once($CFG->dirroot . '/mod/assign/feedback/file/locallib.php');
  29  
  30  /**
  31   * Assignment grading options form
  32   *
  33   * @package   assignfeedback_file
  34   * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
  35   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  36   */
  37  class assignfeedback_file_batch_upload_files_form extends moodleform {
  38      /**
  39       * Define this form - called by the parent constructor
  40       */
  41      public function definition() {
  42          global $COURSE, $USER;
  43  
  44          $mform = $this->_form;
  45          $params = $this->_customdata;
  46  
  47          $mform->addElement('header', 'batchuploadfilesforusers', get_string('batchuploadfilesforusers', 'assignfeedback_file',
  48              count($params['users'])));
  49          $mform->addElement('static', 'userslist', get_string('selectedusers', 'assignfeedback_file'), $params['usershtml']);
  50  
  51          $data = new stdClass();
  52          $fileoptions = array('subdirs'=>1,
  53                                  'maxbytes'=>$COURSE->maxbytes,
  54                                  'accepted_types'=>'*',
  55                                  'return_types'=>FILE_INTERNAL);
  56  
  57          $data = file_prepare_standard_filemanager($data,
  58                                                    'files',
  59                                                    $fileoptions,
  60                                                    $params['context'],
  61                                                    'assignfeedback_file',
  62                                                    ASSIGNFEEDBACK_FILE_BATCH_FILEAREA, $USER->id);
  63  
  64          $mform->addElement('filemanager', 'files_filemanager', '', null, $fileoptions);
  65  
  66          $this->set_data($data);
  67  
  68          $mform->addElement('hidden', 'id', $params['cm']);
  69          $mform->setType('id', PARAM_INT);
  70          $mform->addElement('hidden', 'operation', 'plugingradingbatchoperation_file_uploadfiles');
  71          $mform->setType('operation', PARAM_ALPHAEXT);
  72          $mform->addElement('hidden', 'action', 'viewpluginpage');
  73          $mform->setType('action', PARAM_ALPHA);
  74          $mform->addElement('hidden', 'pluginaction', 'uploadfiles');
  75          $mform->setType('pluginaction', PARAM_ALPHA);
  76          $mform->addElement('hidden', 'plugin', 'file');
  77          $mform->setType('plugin', PARAM_PLUGIN);
  78          $mform->addElement('hidden', 'pluginsubtype', 'assignfeedback');
  79          $mform->setType('pluginsubtype', PARAM_PLUGIN);
  80          $mform->addElement('hidden', 'selectedusers', implode(',', $params['users']));
  81          $mform->setType('selectedusers', PARAM_SEQUENCE);
  82          $this->add_action_buttons(true, get_string('uploadfiles', 'assignfeedback_file'));
  83  
  84      }
  85  
  86  }
  87