public function preDispatch(Zend_Controller_Request_Abstract $request) { $view = Zend_Layout::getMvcInstance()->getView(); $baseUrl = $view->baseUrl(); $hr = new Ot_Layout_HeadRegister(); $registry = new Ot_Config_Register(); foreach ($hr->getCssFiles() as $position => $scripts) { foreach ($scripts as $s) { if (!preg_match('/\\/\\//', $s)) { $s = $baseUrl . '/' . $s; } if ($position == 'append') { $view->headLink()->appendStylesheet($s); } else { $view->headLink()->prependStylesheet($s); } } } foreach ($hr->getJsFiles() as $position => $scripts) { foreach ($scripts as $s) { if (!preg_match('/\\/\\//', $s)) { $s = $baseUrl . '/' . $s; } if ($position == 'append') { $view->headScript()->appendFile($s); } else { $view->headScript()->prependFile($s); } } } $acl = Zend_Registry::get('acl'); $auth = Zend_Auth::getInstance(); $role = !$auth->hasIdentity() ? $registry->defaultRole->getValue() : $auth->getIdentity()->role; if ($acl->isAllowed($role, 'ot_translate', 'index')) { $view->headScript()->appendFile($baseUrl . '/scripts/ot/translate.js'); } }
public function _initHead() { $this->bootstrap('registerThemes'); $hr = new Ot_Layout_HeadRegister(); $hr->registerCssFile('css/ot/common.css', 'prepend'); $hr->registerCssFile('//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap.min.css', 'prepend'); $hr->registerJsFile('scripts/ot/global.js', 'prepend'); $hr->registerJsFile('//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/js/bootstrap.min.js', 'prepend'); $hr->registerJsFile('//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js', 'prepend'); }