/** * Push actions into application actions stack * @param int $id * @param Templater_Api_Interface_Widget $widget * @param string $placeholder * @param array $params */ protected function _pushStack($id, \Zend\Controller\Request\AbstractRequest $request, $placeholder, $params = array()) { $params[$this->_widgetIdName] = md5($id); $camelFilter = new \Zend\Filter\Word\CamelCaseToDash('-'); $blockRequest = new \Zend\Controller\Request\Simple(strtolower($camelFilter->filter($request->getActionName())), strtolower($camelFilter->filter($request->getControllerName())), strtolower($camelFilter->filter($request->getModuleName())), array_merge($params, array($this->_marker => $placeholder))); $this->_stack->pushStack($blockRequest); }
public function routeShutdown(Zend_Controller_Request_Abstract $request) { if (!in_array(Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName(), array('admin', 'admin_language'))) { return; } $resource = new User_Model_Acl_Resource(); $resource->getAdminPrivileges(); if ($resource->admin_privileges) { //$actionStack = Zend_Controller_Action_HelperBroker::getStaticHelper('ActionStack'); $actionStack = new Zend_Controller_Plugin_ActionStack(); foreach ($resource->admin_privileges as $module => $actions) { $class = ucfirst($module) . '_AdminController'; if (!class_exists($class)) { Zend_Loader::loadFile(APPLICATION_PATH . '/modules/' . $module . '/controllers/AdminController.php'); } $reflection = new Zend_Reflection_Class($class); $method = null; try { if ($method = $reflection->getMethod('menuAction')) { $actionStack->pushStack(new Zend_Controller_Request_Simple('menu', 'admin', $module, array('admin_actions' => array_flip($actions)))); } } catch (Exception $e) { } } } }
/** * Push onto the stack * * @param Zend_Controller_Request_Abstract $next * @return Zend_Controller_Action_Helper_ActionStack Provides a fluent interface */ public function pushStack(Zend_Controller_Request_Abstract $next) { $this->_actionStack->pushStack($next); return $this; }
public function testPostDispatchDoesNothingWithExistingForwardRequest() { $plugin = new Zend_Controller_Plugin_ActionStack(); $request = new Zend_Controller_Request_Simple(); $request->setDispatched(false); $plugin->setRequest($request); $request1 = new Zend_Controller_Request_Simple(); $request2 = new Zend_Controller_Request_Simple(); $request3 = new Zend_Controller_Request_Simple(); $plugin->pushStack($request1)->pushStack($request2)->pushStack($request3); $plugin->postDispatch($request); $stack = $plugin->getStack(); $this->assertEquals(3, count($stack)); }