Created
June 13, 2011 15:30
-
-
Save splittingred/1022993 to your computer and use it in GitHub Desktop.
Revo 2.2 New Manager Controllers Interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* this goes in core/components/batcher/controllers/home.class.php - note the class name: "Home" matches the file name */ | |
class BatcherHomeManagerController extends BatcherManagerController { | |
/* Do any controller logic here. Can also return an array of placeholders to set, or use $this->setPlaceholder($k,$v); */ | |
public function process(array $scriptProperties = array()) { | |
} | |
/* set the page title */ | |
public function getPageTitle() { return $this->modx->lexicon('batcher'); } | |
/* use this to load page-specific js/css/html... addJavascript, addHtml, addCss, etc */ | |
public function loadCustomCssJs() { | |
$this->addJavascript($this->modx->getOption('manager_url').'assets/modext/util/datetime.js'); | |
$this->addJavascript($this->batcher->config['jsUrl'].'widgets/template.grid.js'); | |
$this->addJavascript($this->batcher->config['jsUrl'].'widgets/resource.grid.js'); | |
$this->addJavascript($this->batcher->config['jsUrl'].'widgets/home.panel.js'); | |
/* last javascript is always added "last" - after any addHtml() is added */ | |
$this->addLastJavascript($this->batcher->config['jsUrl'].'sections/home.js'); | |
} | |
/* tell MODX where the template file is */ | |
public function getTemplateFile() { return $this->batcher->config['templatesPath'].'home.tpl'; } | |
/* if you have any ACL permission checks */ | |
public function checkPermissions() { return true;} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* this class goes in core/components/batcher/index.class.php */ | |
require_once dirname(__FILE__) . '/model/batcher/batcher.class.php'; | |
class IndexManagerController extends modExtraManagerController { | |
/* tell MODX what the default controller is; defaults to "index" */ | |
public static function getDefaultController() { return 'home'; } | |
} | |
/* base class so you can load header CSS/JS for every Batcher controller and auto-add language topic (not needed, but fun!) */ | |
abstract class BatcherManagerController extends modManagerController { | |
public function initialize() { | |
$this->batcher = new Batcher($this->modx); | |
$this->addCss($this->batcher->config['cssUrl'].'mgr.css'); | |
$this->addJavascript($this->batcher->config['jsUrl'].'batcher.js'); | |
$this->addHtml('<script type="text/javascript"> | |
Ext.onReady(function() { | |
Batcher.config = '.$this->modx->toJSON($this->batcher->config).'; | |
Batcher.config.connector_url = "'.$this->batcher->config['connectorUrl'].'"; | |
}); | |
</script>'); | |
} | |
public function getLanguageTopics() { | |
return array('batcher:default'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment