本文整理汇总了PHP中Zend_Controller_Request_Abstract::getModuleName方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Abstract::getModuleName方法的具体用法?PHP Zend_Controller_Request_Abstract::getModuleName怎么用?PHP Zend_Controller_Request_Abstract::getModuleName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Abstract
的用法示例。
在下文中一共展示了Zend_Controller_Request_Abstract::getModuleName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
$useModule = array('default', 'mice');
if (in_array($request->getModuleName(), $useModule) and $this->getRequest()->getParam('language') != 'scripts') {
Zend_Db_Table_Abstract::setDefaultAdapter(Zend_Registry::get('read'));
} else {
Zend_Db_Table_Abstract::setDefaultAdapter(Zend_Registry::get('write'));
}
if (in_array($request->getModuleName(), $useModule) and $this->getRequest()->getParam('language') != 'scripts') {
$language = $this->getRequest()->getParam('language');
if (empty($language)) {
$language = 'id';
}
// Model
$dictionaryDb = new Model_DbTable_Dictionary();
$languageDb = new Model_DbTable_Language();
// Data
$dictionary = $dictionaryDb->getDictionaryArray($language);
$languageId = $languageDb->getIdByName($language);
try {
// Translator Zend
$translate = new Zend_Translate('array', $dictionary, $language);
// Set registry
Zend_Registry::set('Zend_Translate', $translate);
Zend_Registry::set('language', $language);
Zend_Registry::set('languageId', $languageId['language_id']);
Zend_Registry::set('languageText', $languageId['language_text']);
} catch (Zend_Translate_Exception $zte) {
} catch (Zend_Exception $ze) {
}
}
}
示例2: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
if (!in_array($request->getModuleName(), array('qg', 'painel'))) {
return;
}
$controller = "";
$action = "";
$module = "";
if (!$this->_auth->hasIdentity()) {
$controller = $this->_notLoggedRoute['controller'];
$action = $this->_notLoggedRoute['action'];
$module = $request->getModuleName();
} else {
if (!$this->_isAuthorized($request->getModuleName(), $request->getControllerName(), $request->getActionName())) {
$controller = $this->_forbiddenRoute['controller'];
$action = $this->_forbiddenRoute['action'];
$module = $request->getModuleName();
} else {
$controller = $request->getControllerName();
$action = $request->getActionName();
$module = $request->getModuleName();
}
}
$request->setControllerName($controller);
$request->setActionName($action);
$request->setModuleName($module);
}
示例3: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
Zend_Layout::getMvcInstance()->setLayout($request->getModuleName());
Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/modules/" . $request->getModuleName() . "/layouts/scripts");
$eh = Zend_Controller_Front::getInstance()->getPlugin("Zend_Controller_Plugin_ErrorHandler");
$eh->setErrorHandlerModule($request->getModuleName());
}
示例4: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$this->_initAcl();
if ($this->_auth->hasIdentity()) {
$ident = $this->_auth->getIdentity();
$date = new Zend_Date();
$ident->last_login = $date->get(DATABASE_DATE_FORMAT);
$ident->save();
}
if ($request->getControllerName() != 'admin' && $request->getModuleName() != 'admin') {
return;
}
// if this is not admin skip the rest
if (!$this->_auth->hasIdentity() && !($request->getControllerName() == 'auth' && $request->getActionName() == 'login' && $request->getModuleName() == 'admin')) {
$redirect = new Zend_Controller_Action_Helper_Redirector();
$redirect->gotoSimple('login', 'auth', 'admin');
}
if ($request->getModuleName() == 'user' && $request->getControllerName() == 'admin' && $request->getActionName() == 'profile') {
return;
}
// the profile is a free resource
$resource = $request->getModuleName() . '_' . $request->getControllerName();
$hasResource = $this->_acl->has($resource);
if ($hasResource && !$this->_acl->isAllowed('fansubcms_user_custom_role_logged_in_user', $resource, $request->getActionName())) {
throw new FansubCMS_Exception_Denied('The user is not allowd to do this');
}
}
示例5: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$storage = new Zend_Auth_Storage_Session();
$data = $storage->read();
$role = $data['emprole'];
if ($role == 1) {
$role = 'admin';
}
$request->getModuleName();
$request->getControllerName();
$request->getActionName();
$module = $request->getModuleName();
$resource = $request->getControllerName();
$privilege = $request->getActionName();
$this->id_param = $request->getParam('id');
$allowed = false;
$acl = $this->_getAcl();
$moduleResource = "{$module}:{$resource}";
if ($resource == 'profile') {
$role = 'viewer';
}
if ($resource == 'services') {
$role = 'services';
}
if ($role != '') {
if ($acl->has($moduleResource)) {
$allowed = $acl->isAllowed($role, $moduleResource, $privilege);
}
if (!$allowed) {
$request->setControllerName('error');
$request->setActionName('error');
}
}
}
示例6: postDispatch
public function postDispatch(Zend_Controller_Request_Abstract $request)
{
$auth = Zend_Auth::getInstance();
$sessionName = $request->getModuleName() == 'site' ? 'siteSession' : 'painelSession';
$this->_moduleName = $request->getModuleName();
$auth->setStorage(new Zend_Auth_Storage_Session($sessionName));
}
示例7: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$auth = Zend_Auth::getInstance();
$publicPages = array();
$publicPages['controllers'] = array('login');
$publicPages['actions'] = array();
$controllerName = $request->getControllerName();
if ($auth->hasIdentity() || in_array($controllerName, $publicPages['controllers'])) {
return true;
}
throw new WebVista_App_AuthException('You must be authenticated to access the system.');
$roleId = $auth->getIdentity()->roleId;
$acl = WebVista_Acl::getInstance();
if (!$acl->hasRole($roleId)) {
$error = "Sorry, the requested user role '" . $roleId . "' does not exist";
}
if (!$acl->has($request->getModuleName() . '_' . $request->getControllerName())) {
$error = "Sorry, the requested controller '" . $request->getControllerName() . "' does not exist as an ACL resource";
}
if (!$acl->isAllowed($roleId, $request->getModuleName() . '_' . $request->getControllerName(), $request->getActionName())) {
$error = "Sorry, the page you requested does not exist or you do not have access";
}
if (isset($error)) {
throw new WebVista_App_AuthException('You must be authenticated to access the system.');
}
}
示例8: routeShutdown
/**
* Route shutdown hook -- Ccheck for router exceptions
*
* @param Zend_Controller_Request_Abstract $request
*/
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
$frontController = Zend_Controller_Front::getInstance();
if (in_array($request->getModuleName(), array('async', 'external', 'externalr12')) && $frontController->hasPlugin('Zend_Controller_Plugin_ErrorHandler')) {
$errorHandler = $frontController->getPlugin('Zend_Controller_Plugin_ErrorHandler');
$errorHandler->setErrorHandlerModule($request->getModuleName());
}
}
示例9: hasAccessUrl
function hasAccessUrl(Zend_Controller_Request_Abstract $request)
{
$acl = $this->getAcl();
$url1 = $request->getModuleName() . '::*';
$url2 = $request->getModuleName() . '::' . $request->getControllerName() . '::*';
$url3 = $request->getModuleName() . '::' . $request->getControllerName() . '::' . $request->getActionName();
return $acl->has($url1) && $acl->isAllowed($this->getRole(), $url1) || $acl->has($url2) && $acl->isAllowed($this->getRole(), $url2) || $acl->has($url3) && $acl->isAllowed($this->getRole(), $url3);
}
示例10: getModulesIdsByRequest
public static function getModulesIdsByRequest(Zend_Controller_Request_Abstract $request)
{
$map = self::getMapModules();
if (isset($map[$request->getModuleName()][$request->getControllerName()][$request->getActionName()])) {
return $map[$request->getModuleName()][$request->getControllerName()][$request->getActionName()];
} else {
return false;
}
}
示例11: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$frontController = Zend_Controller_Front::getInstance();
$config = $frontController->getParam('bootstrap')->getApplication()->getOptions();
if (isset($config[$request->getModuleName()]['resources']['layout']['layout'])) {
$layout = Zend_Layout::getMvcInstance();
$layout->setLayout($config[$request->getModuleName()]['resources']['layout']['layout']);
}
}
示例12: preDispatch
/**
* @author Phuc Duong <phuc.duong@kiss-concept.com>
* @desc set layout
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$this->getLayout()->setLayoutPath(Zend_Controller_Front::getInstance()->getModuleDirectory($request->getModuleName()) . '/layouts/scripts/');
$module = $request->getModuleName();
if (isset($module) && $module == "admin") {
$this->getLayout()->setLayout($module);
} else {
$this->getLayout()->setLayout('layout');
}
}
示例13: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$layoutDir = 'default';
if ($request->getModuleName() == 'admin') {
$layoutDir = 'admin';
}
$layout = Zend_Layout::getMvcInstance();
$layout->setLayoutPath(APPLICATION_PATH . DS . "layouts" . DS . $layoutDir)->setInflectorTarget(':script.:suffix')->setViewSuffix('inc');
$this->prepareNavigation($request->getModuleName());
}
示例14: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$front = Zend_Controller_Front::getInstance();
if ($front->getDefaultModule() == $request->getModuleName()) {
return;
}
$layout = Zend_Layout::getMvcInstance();
$layout->setLayoutPath($front->getModuleDirectory($request->getModuleName()) . '/views/layouts');
$layout->setLayout('default');
}
示例15: _includeCssController
/**
*
* @access protected
* @return void
*/
protected function _includeCssController()
{
$ds = '/';
//DIRECTORY_SEPARATOR;
$file = 'public' . $ds . 'styles' . $ds . $this->_request->getModuleName() . $ds . $this->_request->getControllerName() . '.css';
if (file_exists(APPLICATION_PATH . $ds . '..' . $ds . $file)) {
$view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');
$view->headLink()->appendStylesheet($view->baseUrl($file));
}
}