/** * {@inheritDoc} */ protected function validateFormData($request, $formBean) { // need specific view to go back to in case of validation errors $result = parent::validateFormData($request, $formBean); if (null != $result) { return $this->findView('edit'); } return null; }
/** * {@inheritDoc} */ public function getFormData($request, $formDef = null, $formId = null) { $updateUser = parent::getFormData($request, $formDef, $formId); if (!$this->isFormSubmit($request)) { // pre-populate with current data $user = $this->getUser(); $updateUser->setEmail($user->getEmail()); $updateUser->setUsername($user->getUsername()); } return $updateUser; }
/** * {@inheritDoc} */ protected function validateFormData($request, $formBean) { $this->preProcess(); $addressId = $request->request->get('addressId', null); if (null !== $addressId) { // selected existing address, so do not validate return null; } if (null != ($view = parent::validateFormData($request, $formBean))) { // validation failed, so let's add our required view data $view->setVariables($this->viewData); } return $view; }
/** * {@inheritDoc} */ public function getFormData($request, $formDef = null, $formId = null) { $adminUser = parent::getFormData($request, $formDef, $formId); if (!$this->isFormSubmit($request)) { if (0 < ($adminUserId = $request->query->get('adminUserId'))) { // pre-populate with data $user = $this->container->get('adminUserService')->getUserForId($adminUserId); if (null != $user) { $adminUser->setAdminUserId($user->getId()); $adminUser->setUsername($user->getUsername()); $adminUser->setEmail($user->getEmail()); $adminUser->setRoles($user->getRoles()); } } } return $adminUser; }
/** * Process a HTTP request. * * <p>This implementation will delegate request handling based on the method parameter in * the request. If no method is found, the default <em>parent</em> <code>process()</code> implementation * will be called.</p> * * <p>Also, if the passed method is not found, the controller will try to resolve the method by appending the * configured <em>ajaxFormat</em> string. So, if, for example, the method is <code>getCountries</code> and <em>ajaxFormat</em> is * <code>JSON</code>, the controller will first look for <code>getCountries</code> and then for <code>getCountriesJSON</code>.</p> * * @return View A <code>View</code> instance or <code>null</code>. */ public function processAction(Request $request) { $method = $sacsMethod = $request->getParameter('method'); if (!method_exists($this, $method)) { $method = $method . 'JSON'; } $sacsManager = $this->container->get('sacsManager'); // check access on controller level $sacsManager->authorize($request, $request->getRequestId(), $this->getUser()); // (re-)check on method level if mapping exists $methodRequestId = $request->getRequestId() . '#' . $sacsMethod; if ($sacsManager->hasMappingForRequestId($methodRequestId)) { $sacsManager->authorize($request, $methodRequestId, $this->getUser()); } if (method_exists($this, $method) || in_array($method, $this->getAttachedMethods())) { $this->{$method}($request); return null; } return parent::processAction($request); }
/** * Create new instance. */ public function __construct() { parent::__construct(); $this->autoSearch = true; }
/** * {@inheritDoc} * * <p>Adds special handling to <code>'catalog-redirect' == $id</code> to allow proper redirects after POST handling without * the subclass having to worry about details.<br> * All other parameters will be handled as always.</p> */ public function findView($id = null, $data = array(), $parameter = null) { if ('catalog-redirect' == $id) { // the property catalogRedirect tags the view as special redirect view... return Beans::getBean('redirect#requestId=catalog&catalogRedirect=true¶meter=' . urlencode($parameter) . '&catalogRequestId=' . $this->getCalogRequestId()); } return parent::findView($id, $data, $parameter); }
/** * Create new instance. */ public function __construct() { parent::__construct(); $this->createDefaultAddress = true; }
/** * Create new instance. */ public function __construct() { parent::__construct('multi_quantity_product_info'); }
/** * {@inheritDoc} */ public function processAction(Request $request) { $controllers = $this->getCatalogContentControllers($request); $controller = null; if (null == ($catalogRequestId = $request->query->get('catalogRequestId'))) { if (0 < count($controllers)) { $controller = $controllers[0]; $catalogRequestId = $controller->getCatalogRequestId(); $this->get('logger')->debug('defaulting to controller : ' . get_class($controller)); } } else { // let's see if we have a controller for this... $definition = Toolbox::className($catalogRequestId . 'Controller'); $controller = Beans::getBean($definition); $this->get('logger')->debug('delegating to controller : ' . get_class($controller)); } // check authorization as we'll need the follow up redirect point to the catalog URL, not a tab url $authorized = $this->container->get('sacsManager')->authorize($request, $request->getRequestId(), $this->getUser(), false); if (null == $controller || !$authorized) { // no controller found return parent::processAction($request); } // fake requestId $requestId = $request->getRequestId(); $request->setRequestId($catalogRequestId); // processAction $catalogViewContent = null; try { $catalogContentView = $controller->processAction($request); $catalogContentView->setLayout(null); $catalogViewContent = $catalogContentView->generate($request); } catch (Exception $e) { $catalogViewContent = null; } // restore for normal processing $request->setRequestId($requestId); // now do the normal thing $view = parent::processAction($request); // add catalog content view to be used in catalog view template $view->setVariable('catalogRequestId', $catalogRequestId); $view->setVariable('catalogViewContent', $catalogViewContent); $view->setVariable('controllers', $controllers); return $view; }
/** * Create a new instance. * * @param mixed plugin The parent plugin. */ public function __construct($plugin) { parent::__construct(); $this->plugin = $plugin; }