index.class.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. * This file is part of the Fred package.
  4. *
  5. * Copyright (c) MODX, LLC
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. require_once dirname(__FILE__) . '/model/fred/fred.class.php';
  11. /**
  12. * @package fred
  13. */
  14. abstract class FredBaseManagerController extends modExtraManagerController
  15. {
  16. /** @var Fred $fred */
  17. public $fred;
  18. public function initialize()
  19. {
  20. $corePath = $this->modx->getOption('fred.core_path', null, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/fred/');
  21. $this->fred = $this->modx->getService(
  22. 'fred',
  23. 'Fred',
  24. $corePath . 'model/fred/',
  25. array(
  26. 'core_path' => $corePath
  27. )
  28. );
  29. $this->addCss($this->fred->getOption('cssUrl') . 'fred.css');
  30. $this->addJavascript($this->fred->getOption('jsUrl') . 'fred.js');
  31. $this->addHtml('<script type="text/javascript">
  32. Ext.onReady(function() {
  33. fred.config = ' . $this->modx->toJSON($this->fred->options) . ';
  34. fred.config.connector_url = "' . $this->fred->getOption('connectorUrl') . '";
  35. });
  36. </script>');
  37. parent::initialize();
  38. }
  39. public function getLanguageTopics()
  40. {
  41. return array('fred:default');
  42. }
  43. public function checkPermissions()
  44. {
  45. return $this->modx->hasPermission('fred');
  46. }
  47. }