本文整理汇总了PHP中Zend_Controller_Request_Abstract::getControllerKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Abstract::getControllerKey方法的具体用法?PHP Zend_Controller_Request_Abstract::getControllerKey怎么用?PHP Zend_Controller_Request_Abstract::getControllerKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Abstract
的用法示例。
在下文中一共展示了Zend_Controller_Request_Abstract::getControllerKey方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _changeDispatch
private function _changeDispatch(Zend_Controller_Request_Abstract &$request, Zend_Controller_Response_Abstract $response)
{
$module = $request->getParam($request->getModuleKey());
$controller = $request->getParam($request->getControllerKey());
$action = $request->getParam($request->getActionKey());
$submodule = '';
$subcontroller = '';
$subaction = '';
if ('admin' != $module) {
$submodule = $module;
$subcontroller = $controller ? $controller : 'index';
$subaction = $action ? $action : 'index';
$controller = 'index';
$action = 'subroute';
$module = 'default';
} else {
$submodule = $controller;
$subcontroller = $action ? $action : 'index';
//долно быть настроено в route
//$subaction = ( $action ) ? $action : 'index';
$controller = 'index';
$action = 'subroute';
}
$request->setParam($request->getModuleKey(), $module);
$request->setModuleName($module);
$request->setParam($request->getControllerKey(), $controller);
$request->setControllerName($controller);
$request->setParam($request->getActionKey(), $action);
$request->setActionName($action);
$request->setParam('submodule', $submodule);
$request->setParam('subcontroller', $subcontroller);
$request->setParam('subaction', $subaction);
}
示例2: displayToken
public function displayToken($token)
{
if ($token) {
$url = new \MUtil_Html_HrefArrayAttribute(array($this->request->getControllerKey() => 'track', $this->request->getActionKey() => 'show', \MUtil_Model::REQUEST_ID => $token));
return \MUtil_Html::create('a', $url, $token);
}
}
示例3: getHtmlOutput
/**
* Create the snippets content
*
* This is a stub function either override getHtmlOutput() or override render()
*
* @param \Zend_View_Abstract $view Just in case it is needed here
* @return \MUtil_Html_HtmlInterface Something that can be rendered
*/
public function getHtmlOutput(\Zend_View_Abstract $view)
{
$html = $this->getHtmlSequence();
$html->h3($this->_('Choose an organization'));
$user = $this->loader->getCurrentUser();
$url[$this->request->getControllerKey()] = 'organization';
$url[$this->request->getActionKey()] = 'change-ui';
if ($orgs = $user->getRespondentOrganizations()) {
$html->pInfo($this->_('This organization cannot have any respondents, please choose one that does:'));
foreach ($orgs as $orgId => $name) {
$url['org'] = $orgId;
$html->pInfo()->actionLink($url, $name)->appendAttrib('class', 'larger');
}
} else {
$html->pInfo($this->_('This organization cannot have any respondents.'));
}
return $html;
}
示例4: getHtmlOutput
/**
* Create the snippets content
*
* This is a stub function either override getHtmlOutput() or override render()
*
* @param \Zend_View_Abstract $view Just in case it is needed here
* @return \MUtil_Html_HtmlInterface Something that can be rendered
*/
public function getHtmlOutput(\Zend_View_Abstract $view)
{
$div = \Mutil_Html::create('p');
$div->append($this->getQuestion());
$div->append(' ');
$div->a(array($this->confirmParameter => 1), $this->_('Yes'), array('class' => $this->buttonYesClass));
$div->append(' ');
$div->a(array($this->request->getControllerKey() => $this->abortController ?: $this->request->getControllerName(), $this->request->getActionKey() => $this->abortAction ?: $this->request->getActionName()), $this->_('No'), array('class' => $this->buttonNoClass));
return $div;
}
示例5: init
/**
* 初始化
*
* @return void
*/
public function init()
{
//request和response对象获取
$this->request = $this->getRequest();
$this->response = $this->getResponse();
$this->modKey = $this->request->getModuleKey();
$this->modName = $this->request->getModuleName();
$this->ctlKey = $this->request->getControllerKey();
$this->ctlName = $this->request->getControllerName();
$this->actKey = $this->request->getActionKey();
$this->actName = $this->request->getActionName();
//smarty模板设置
$this->view = Common_View::getInstance();
//重新设置模板目录
$_viewBaseDir = implode(DS, array(APP_NOPUBLIC_MODULES_PATH, $this->modName, 'views'));
$params = array('template_dir' => $_viewBaseDir . DS . 'html', 'compile_dir' => $_viewBaseDir . DS . 'compile', 'cache_dir' => $_viewBaseDir . DS . 'cache');
$this->view->setViewParams($params);
unset($_viewBaseDir);
}
示例6: _setRequestKeys
/**
* Set request keys based on values in request object
*
* @return void
*/
protected function _setRequestKeys()
{
if (null !== $this->_request) {
$this->_moduleKey = $this->_request->getModuleKey();
$this->_controllerKey = $this->_request->getControllerKey();
$this->_actionKey = $this->_request->getActionKey();
}
if (null !== $this->_dispatcher) {
$this->_defaults += array($this->_controllerKey => $this->_dispatcher->getDefaultControllerName(), $this->_actionKey => $this->_dispatcher->getDefaultAction(), $this->_moduleKey => $this->_dispatcher->getDefaultModule());
}
$this->_keysSet = true;
}
示例7: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
try {
// Set Request Object
$_request[$request->getModuleKey()] = $request->getModuleName();
$_request[$request->getControllerKey()] = $request->getControllerName();
$_request[$request->getActionKey()] = $request->getActionName();
if (PHP_SAPI != 'cli' && $request->getModuleName() != 'cronjob') {
$_request['url'] = $_SERVER['REQUEST_URI'];
}
Monitor_Request::getInstance()->setRequest($_request);
} catch (Zend_Exception $e) {
throw $e;
}
}
示例8: routeStartup
/**
* Called before Zend_Controller_Front begins evaluating the
* request against its routes.
*
* @param Zend_Controller_Request_Abstract $request
* @return void
*/
public function routeStartup(Zend_Controller_Request_Abstract $request)
{
$frontController = Zend_Controller_Front::getInstance();
// Request keys
$moduleKey = $request->getModuleKey();
$controllerKey = $request->getControllerKey();
$actionKey = $request->getActionKey();
// Defaults
$moduleName = $frontController->getDefaultModule();
$controllerName = $frontController->getDefaultControllerName();
$actionName = $frontController->getDefaultAction();
// Set a url path
$module = $request->getQuery($moduleKey, $moduleName);
$controller = $request->getQuery($controllerKey, $controllerName);
$action = $request->getQuery($actionKey, $actionName);
// Assemble
if ($request->getPathInfo() == '/') {
$modulePart = $module == $moduleName ? $module : '/' . $module;
$controllerPart = $controller == $controllerName && $action == $actionName ? '' : '/' . $controller;
$actionPart = $action == $actionName && $controller ? '' : '/' . $action;
$request->setPathInfo($modulePart . $controllerPart . $actionPart);
}
}
示例9: checkConsent
/**
* Check if we have the 'Unknown' consent, and present a warning. The project default consent is
* normally 'Unknown' but this can be overruled in project.ini so checking for default is not right
*
* @static boolean $warned We need only one warning in case of multiple consents
* @param string $consent
*/
public function checkConsent($consent)
{
static $warned;
if ($warned) {
return $consent;
}
$unknown = $this->util->getConsentUnknown();
// Value is translated by now if in bridge
if ($consent == $unknown || $consent == $this->_($unknown)) {
$warned = true;
$msg = $this->_('Please settle the informed consent form for this respondent.');
if ($this->view instanceof \Zend_View) {
$url[$this->request->getControllerKey()] = 'respondent';
$url[$this->request->getActionKey()] = 'edit';
$url[\MUtil_Model::REQUEST_ID1] = $this->request->getParam(\MUtil_Model::REQUEST_ID1);
$url[\MUtil_Model::REQUEST_ID2] = $this->request->getParam(\MUtil_Model::REQUEST_ID2);
$urlString = $this->view->url($url) . '#tabContainer-frag-4';
$this->addMessage(\MUtil_Html::create()->a($urlString, $msg));
} else {
$this->addMessage($msg);
}
}
return $consent;
}
示例10: jsonAction
public function jsonAction()
{
$id = $this->_request->getParam('id');
$jsonData = array($this->_request->getControllerKey() => $this->_request->getControllerName(), 'role' => Zend_Auth::getInstance()->getIdentity()->role);
if ($id) {
$entry = $this->_modelMapper->find($id, new Catalog_Model_Products());
if (!is_null($entry)) {
$jsonData = array_merge($jsonData, $entry->getOptions());
$category = $this->_modelMapper->findCategoryRel($id, new Catalog_Model_Categories());
if (!is_null($category)) {
$jsonData['categoryId'] = $category->getId();
$breadcrumbs = $this->breadcrumbs($category->getId(), true);
$jsonData = array_merge($jsonData, $breadcrumbs);
}
$select = $this->_paramsMapper->getDbTable()->select()->order('order ASC');
$properties = $this->_modelMapper->findProductParams($id, $select, true);
if (!empty($properties)) {
$jsonData['properties'] = $properties;
}
}
}
return $this->_helper->json->sendJson($jsonData);
//Zend_Debug::dump($jsonData);
}
示例11: _setRequestParams
/**
* Sets parameters for request object
*
* Module name, controller name and action name
*
* @param Zend_Controller_Request_Abstract $request
* @param array $params
*/
protected function _setRequestParams($request, $params)
{
foreach ($params as $param => $value) {
$request->setParam($param, $value);
if ($param === $request->getModuleKey()) {
$request->setModuleName($value);
}
if ($param === $request->getControllerKey()) {
$request->setControllerName($value);
}
if ($param === $request->getActionKey()) {
$request->setActionName($value);
}
}
}
示例12: route
/**
* Processes a request and sets its controller and action. If
* no route was possible, an exception is thrown.
*
* @param \Zend_Controller_Request_Abstract
* @throws \Zend_Controller_Router_Exception
* @return \Zend_Controller_Request_Abstract|boolean
*/
public function route(\Zend_Controller_Request_Abstract $request)
{
$options = array('help|h' => 'Show this help', 'org|o=i' => 'The user organization number', 'pwd|p=s' => 'User password', 'user|u=s' => 'The user name');
$getopt = new \Zend_Console_Getopt($options);
try {
$getopt->parse();
} catch (\Zend_Console_Getopt_Exception $e) {
echo $this->_expandMessage($e);
exit;
}
if ($getopt->getOption('h')) {
// $getopt->s
echo $this->_expandMessage($getopt);
exit;
}
if ($request instanceof \MUtil_Controller_Request_Cli) {
$request->setUserLogin($getopt->getOption('u'), $getopt->getOption('o'), $getopt->getOption('p'));
}
$arguments = $getopt->getRemainingArgs();
if ($arguments) {
$controller = array_shift($arguments);
$action = array_shift($arguments);
if (!$action) {
$action = 'index';
}
if (preg_match('/^\\w+(-\\w+)*$/', $controller) && preg_match('/^\\w+(-\\w+)*$/', $action)) {
$request->setControllerName($controller);
$request->setActionName($action);
$params[$request->getControllerKey()] = $controller;
$params[$request->getActionKey()] = $action;
foreach ($arguments as $arg) {
if (\MUtil_String::contains($arg, '=')) {
list($name, $value) = explode('=', $arg, 2);
} else {
$name = $arg;
$value = '';
}
$params[$name] = $value;
}
$request->setParams($params);
return $request;
}
echo "Invalid command: {$controller}/{$action}.\n", exit;
}
echo "No command given.\n\n";
echo $this->_expandMessage($getopt), exit;
}
示例13: applyRequest
/**
* Filters a request for use with applyParameters.
*
* @param \Zend_Controller_Request_Abstract $request
* @param boolean $removePost Optional
* @param boolean $includeNumericFilters When true numeric filter keys (0, 1, 2...) are added to the filter as well
* @return \MUtil_Model_ModelAbstract
*/
public function applyRequest(\Zend_Controller_Request_Abstract $request, $removePost = true, $includeNumericFilters = false)
{
$parameters = $request->getParams();
// Remove MVC fields
unset($parameters[$request->getModuleKey()], $parameters[$request->getControllerKey()], $parameters[$request->getActionKey()]);
if ($removePost) {
// Do not use POST fields for filter
$parameters = array_diff_key($parameters, $_POST);
}
// Remove all empty values (but not arrays) from the filter
$parameters = array_filter($parameters, function ($i) {
return is_array($i) || strlen($i);
});
$this->applyParameters($parameters, $includeNumericFilters);
return $this;
}