admin.class.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. require_once dirname(__DIR__) . '/index.class.php';
  3. /**
  4. * The name of the controller is based on the path (home) and the
  5. * namespace (clientconfig). This home controller is the main client view.
  6. */
  7. class ClientConfigAdminManagerController extends ClientConfigManagerController {
  8. /**
  9. * Any specific processing we need on the Admin controller.
  10. * @param array $scriptProperties
  11. */
  12. public function process(array $scriptProperties = array()) {
  13. if (!$this->clientconfig->hasAdminPermission()) {
  14. $url = $this->modx->getOption('manager_url') . '?a=' . $_GET['a'];
  15. $this->modx->sendRedirect($url);
  16. }
  17. }
  18. /**
  19. * The pagetitle to put in the <title> attribute.
  20. * @return null|string
  21. */
  22. public function getPageTitle() {
  23. return $this->modx->lexicon('clientconfig.adminpanel');
  24. }
  25. /**
  26. * Register all the needed javascript files. Using this method, it will automagically
  27. * combine and compress them if enabled in system settings.
  28. */
  29. public function loadCustomCssJs() {
  30. $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/widgets/grid.groups.js');
  31. $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/widgets/grid.settings.js');
  32. $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/widgets/window.groups.js');
  33. $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/widgets/window.settings.js');
  34. $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/widgets/window.import.js');
  35. $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/widgets/combos.js');
  36. $this->addLastJavascript($this->clientconfig->config['jsUrl'].'mgr/sections/admin.js');
  37. $this->addHtml('<script type="text/javascript">
  38. Ext.onReady(function() {
  39. MODx.config.help_url = "https://www.modmore.com/extras/clientconfig/documentation/?embed=1";
  40. MODx.load({ xtype: "clientconfig-page-admin" });
  41. });
  42. </script>');
  43. }
  44. /**
  45. * The name for the template file to load.
  46. * @return string
  47. */
  48. public function getTemplateFile() {
  49. return $this->clientconfig->config['templatesPath'].'home.tpl';
  50. }
  51. }