Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are 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   * Form for editing global navigation instances.
  19   *
  20   * @since     Moodle 2.0
  21   * @package   block_navigation
  22   * @copyright 2009 Sam Hemelryk
  23   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  /**
  27   * Form for editing global navigation instances.
  28   *
  29   * @package   block_navigation
  30   * @category  navigation
  31   * @copyright 2009 Sam Hemelryk
  32   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  33   */
  34  class block_navigation_edit_form extends block_edit_form {
  35      /**
  36       * @param MoodleQuickForm $mform
  37       */
  38      protected function specific_definition($mform) {
  39          global $CFG;
  40          $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
  41  
  42          $mods = array('enabledock'=>'yes', 'linkcategories'=>'no');
  43          $yesnooptions = array('yes'=>get_string('yes'), 'no'=>get_string('no'));
  44          foreach ($mods as $modname=>$default) {
  45              $mform->addElement('select', 'config_'.$modname, get_string($modname.'desc', $this->block->blockname), $yesnooptions);
  46              $mform->setDefault('config_'.$modname, $default);
  47          }
  48  
  49          $options = array(
  50              block_navigation::TRIM_RIGHT => get_string('trimmoderight', $this->block->blockname),
  51              block_navigation::TRIM_LEFT => get_string('trimmodeleft', $this->block->blockname),
  52              block_navigation::TRIM_CENTER => get_string('trimmodecenter', $this->block->blockname)
  53          );
  54          $mform->addElement('select', 'config_trimmode', get_string('trimmode', $this->block->blockname), $options);
  55          $mform->setType('config_trimmode', PARAM_INT);
  56  
  57          $mform->addElement('text', 'config_trimlength', get_string('trimlength', $this->block->blockname));
  58          $mform->setDefault('config_trimlength', 50);
  59          $mform->setType('config_trimlength', PARAM_INT);
  60  
  61          $options = array(
  62              0 => get_string('everything', $this->block->blockname),
  63              global_navigation::TYPE_COURSE => get_string('courses', $this->block->blockname),
  64              global_navigation::TYPE_SECTION => get_string('coursestructures', $this->block->blockname),
  65              global_navigation::TYPE_ACTIVITY => get_string('courseactivities', $this->block->blockname)
  66          );
  67          $mform->addElement('select', 'config_expansionlimit', get_string('expansionlimit', $this->block->blockname), $options);
  68          $mform->setType('config_expansionlimit', PARAM_INT);
  69  
  70      }
  71  }