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'); } }