PageRenderTime 41ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/blocks/navigation/edit_form.php

https://bitbucket.org/synergylearning/campusconnect
PHP | 71 lines | 31 code | 7 blank | 33 comment | 0 complexity | 9346032837cb0b4747817252d69be83b MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-3.0, GPL-3.0, LGPL-2.1, Apache-2.0, BSD-3-Clause, AGPL-3.0
  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. * Form for editing global navigation instances.
  18. *
  19. * @since 2.0
  20. * @package block_navigation
  21. * @copyright 2009 Sam Hemelryk
  22. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23. */
  24. /**
  25. * Form for editing global navigation instances.
  26. *
  27. * @package block_navigation
  28. * @category navigation
  29. * @copyright 2009 Sam Hemelryk
  30. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  31. */
  32. class block_navigation_edit_form extends block_edit_form {
  33. /**
  34. * @param MoodleQuickForm $mform
  35. */
  36. protected function specific_definition($mform) {
  37. global $CFG;
  38. $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
  39. $mods = array('enabledock'=>'yes', 'linkcategories'=>'no');
  40. $yesnooptions = array('yes'=>get_string('yes'), 'no'=>get_string('no'));
  41. foreach ($mods as $modname=>$default) {
  42. $mform->addElement('select', 'config_'.$modname, get_string($modname.'desc', $this->block->blockname), $yesnooptions);
  43. $mform->setDefault('config_'.$modname, $default);
  44. }
  45. $options = array(
  46. block_navigation::TRIM_RIGHT => get_string('trimmoderight', $this->block->blockname),
  47. block_navigation::TRIM_LEFT => get_string('trimmodeleft', $this->block->blockname),
  48. block_navigation::TRIM_CENTER => get_string('trimmodecenter', $this->block->blockname)
  49. );
  50. $mform->addElement('select', 'config_trimmode', get_string('trimmode', $this->block->blockname), $options);
  51. $mform->setType('config_trimmode', PARAM_INT);
  52. $mform->addElement('text', 'config_trimlength', get_string('trimlength', $this->block->blockname));
  53. $mform->setDefault('config_trimlength', 50);
  54. $mform->setType('config_trimlength', PARAM_INT);
  55. $options = array(
  56. 0 => get_string('everything', $this->block->blockname),
  57. global_navigation::TYPE_COURSE => get_string('courses', $this->block->blockname),
  58. global_navigation::TYPE_SECTION => get_string('coursestructures', $this->block->blockname),
  59. global_navigation::TYPE_ACTIVITY => get_string('courseactivities', $this->block->blockname)
  60. );
  61. $mform->addElement('select', 'config_expansionlimit', get_string('expansionlimit', $this->block->blockname), $options);
  62. $mform->setType('config_expansionlimit', PARAM_INT);
  63. }
  64. }