[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/admin/tool/lp/classes/form/ -> template.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   * This file contains the form add/update a competency framework.
  19   *
  20   * @package   tool_lp
  21   * @copyright 2015 Damyon Wiese
  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   * Learning plan template form.
  30   *
  31   * @package   tool_lp
  32   * @copyright 2015 Damyon Wiese
  33   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  34   */
  35  class template extends persistent {
  36  
  37      protected static $persistentclass = 'core_competency\\template';
  38  
  39      /**
  40       * Define the form - called by parent constructor
  41       */
  42      public function definition() {
  43          $mform = $this->_form;
  44  
  45          $context = $this->_customdata['context'];
  46  
  47          $mform->addElement('hidden', 'contextid');
  48          $mform->setType('contextid', PARAM_INT);
  49          $mform->setConstant('contextid', $context->id);
  50  
  51          $mform->addElement('header', 'generalhdr', get_string('general'));
  52  
  53          // Name.
  54          $mform->addElement('text', 'shortname', get_string('shortname', 'tool_lp'), 'maxlength="100"');
  55          $mform->setType('shortname', PARAM_TEXT);
  56          $mform->addRule('shortname', null, 'required', null, 'client');
  57          $mform->addRule('shortname', get_string('maximumchars', '', 100), 'maxlength', 100, 'client');
  58          // Description.
  59          $mform->addElement('editor', 'description',
  60                             get_string('description', 'tool_lp'), array('rows' => 4));
  61          $mform->setType('description', PARAM_RAW);
  62          $mform->addElement('selectyesno', 'visible',
  63                             get_string('visible', 'tool_lp'));
  64          $mform->addElement('date_time_selector',
  65                             'duedate',
  66                             get_string('duedate', 'tool_lp'),
  67                             array('optional' => true));
  68          $mform->addHelpButton('duedate', 'duedate', 'tool_lp');
  69  
  70          $mform->setDefault('visible', true);
  71          $mform->addHelpButton('visible', 'visible', 'tool_lp');
  72  
  73          $mform->addElement('static', 'context', get_string('category', 'tool_lp'));
  74          $mform->setDefault('context', $context->get_context_name(false));
  75          // Disable short forms.
  76          $mform->setDisableShortforms();
  77  
  78          $this->add_action_buttons(true, get_string('savechanges', 'tool_lp'));
  79  
  80      }
  81  
  82  }


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