settings.class.php 2.3 KB

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