settings.class.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. /*
  3. * This file is part of MODX Revolution.
  4. *
  5. * Copyright (c) MODX, LLC. All Rights Reserved.
  6. *
  7. * For complete copyright and license information, see the COPYRIGHT and LICENSE
  8. * files found in the top-level directory of this distribution.
  9. */
  10. /**
  11. * Loads the system settings page
  12. *
  13. * @package modx
  14. * @subpackage manager.controllers
  15. */
  16. class SystemSettingsManagerController extends modManagerController {
  17. public $onSiteSettingsRender = '';
  18. /**
  19. * Check for any permissions or requirements to load page
  20. * @return bool
  21. */
  22. public function checkPermissions() {
  23. return $this->modx->hasPermission('settings');
  24. }
  25. /**
  26. * Register custom CSS/JS for the page
  27. * @return void
  28. */
  29. public function loadCustomCssJs() {
  30. $this->addHtml('<script type="text/javascript">
  31. // <[!CDATA[
  32. Ext.onReady(function() {
  33. MODx.add("modx-page-system-settings");
  34. });
  35. MODx.onSiteSettingsRender = "'.$this->onSiteSettingsRender.'";
  36. // ]]>
  37. </script>');
  38. $this->addJavascript($this->modx->getOption('manager_url').'assets/modext/widgets/core/modx.grid.settings.js');
  39. $this->addJavascript($this->modx->getOption('manager_url').'assets/modext/widgets/system/modx.grid.system.event.js');
  40. $this->addJavascript($this->modx->getOption('manager_url').'assets/modext/widgets/system/modx.panel.system.settings.js');
  41. $this->addJavascript($this->modx->getOption('manager_url').'assets/modext/sections/system/settings.js');
  42. }
  43. /**
  44. * Custom logic code here for setting placeholders, etc
  45. * @param array $scriptProperties
  46. * @return mixed
  47. */
  48. public function process(array $scriptProperties = array()) {
  49. $onSiteSettingsRender = $this->modx->invokeEvent('OnSiteSettingsRender');
  50. if (is_array($onSiteSettingsRender)) {
  51. $this->onSiteSettingsRender = implode("\"\n+ \"",$onSiteSettingsRender);
  52. }
  53. }
  54. /**
  55. * Return the pagetitle
  56. *
  57. * @return string
  58. */
  59. public function getPageTitle() {
  60. return $this->modx->lexicon('system_settings');
  61. }
  62. /**
  63. * Return the location of the template file
  64. * @return string
  65. */
  66. public function getTemplateFile() {
  67. return '';
  68. }
  69. /**
  70. * Specify the language topics to load
  71. * @return array
  72. */
  73. public function getLanguageTopics() {
  74. return array('setting','events');
  75. }
  76. /**
  77. * Get the Help URL
  78. * @return string
  79. */
  80. public function getHelpUrl() {
  81. return 'Settings';
  82. }
  83. }