[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/admin/tool/lp/classes/form/ -> user_evidence.php (source)

   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   * User evidence form.
  19   *
  20   * @package    tool_lp
  21   * @copyright  2015 Frédéric Massart - FMCorz.net
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  namespace tool_lp\form;
  26  defined('MOODLE_INTERNAL') || die();
  27  
  28  /**
  29   * User evidence form class.
  30   *
  31   * @package    tool_lp
  32   * @copyright  2015 Frédéric Massart - FMCorz.net
  33   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  34   */
  35  class user_evidence extends persistent {
  36  
  37      protected static $persistentclass = 'core_competency\\user_evidence';
  38  
  39      protected static $foreignfields = array('files');
  40  
  41      public function definition() {
  42          $mform = $this->_form;
  43  
  44          $mform->addElement('hidden', 'userid');
  45          $mform->setType('userid', PARAM_INT);
  46          $mform->setConstant('userid', $this->_customdata['userid']);
  47  
  48          $mform->addElement('header', 'generalhdr', get_string('general'));
  49  
  50          // Name.
  51          $mform->addElement('text', 'name', get_string('userevidencename', 'tool_lp'), 'maxlength="100"');
  52          $mform->setType('name', PARAM_TEXT);
  53          $mform->addRule('name', null, 'required', null, 'client');
  54          $mform->addRule('name', get_string('maximumchars', '', 100), 'maxlength', 100, 'client');
  55          // Description.
  56          $mform->addElement('editor', 'description', get_string('userevidencedescription', 'tool_lp'), array('rows' => 10));
  57          $mform->setType('description', PARAM_RAW);
  58  
  59          $mform->addElement('url', 'url', get_string('userevidenceurl', 'tool_lp'), array(), array('usefilepicker' => false));
  60          $mform->setType('url', PARAM_RAW_TRIMMED);      // Can not use PARAM_URL, it silently converts bad URLs to ''.
  61          $mform->addHelpButton('url', 'userevidenceurl', 'tool_lp');
  62  
  63          $mform->addElement('filemanager', 'files', get_string('userevidencefiles', 'tool_lp'), array(),
  64              $this->_customdata['fileareaoptions']);
  65          // Disable short forms.
  66          $mform->setDisableShortforms();
  67  
  68          $this->add_action_buttons();
  69      }
  70  
  71  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1