Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.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   * Bulk user picture upload form
  19   *
  20   * @package    tool
  21   * @subpackage uploaduser
  22   * @copyright  (C) 2007 Inaki Arenaza
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  defined('MOODLE_INTERNAL') || die();
  27  
  28  require_once $CFG->libdir.'/formslib.php';
  29  
  30  class admin_uploadpicture_form extends moodleform {
  31      function definition (){
  32          global $CFG, $USER;
  33  
  34          $mform =& $this->_form;
  35  
  36          $mform->addElement('header', 'settingsheader', get_string('upload'));
  37  
  38  
  39          $options = array();
  40          $options['accepted_types'] = array('.zip');
  41          $mform->addElement('filepicker', 'userpicturesfile', get_string('file'), 'size="40"', $options);
  42          $mform->addRule('userpicturesfile', null, 'required');
  43  
  44          $choices =& $this->_customdata;
  45          $mform->addElement('select', 'userfield', get_string('uploadpicture_userfield', 'tool_uploaduser'), $choices);
  46          $mform->setType('userfield', PARAM_INT);
  47  
  48          $choices = array( 0 => get_string('no'), 1 => get_string('yes') );
  49          $mform->addElement('select', 'overwritepicture', get_string('uploadpicture_overwrite', 'tool_uploaduser'), $choices);
  50          $mform->setType('overwritepicture', PARAM_INT);
  51  
  52          $this->add_action_buttons(false, get_string('uploadpictures', 'tool_uploaduser'));
  53      }
  54  }
  55