/** * Action to invoke the model wizard * @param string $action Name of the model to reset the wizard with, 'reset' to restart the wizard * @return null */ public function indexAction($action = null, $actionArgument = null, $modelAction = null, $modelActionArgument = null) { $modelName = null; $fieldName = null; if ($action == self::ACTION_MODEL) { $modelName = $actionArgument; if ($modelAction == self::ACTION_FIELD) { if (!$modelActionArgument) { $fieldName = true; } else { $fieldName = $modelActionArgument; } } } $wizard = new BuilderWizard($this->request->getBasePath(), $modelName); if ($fieldName !== null) { $wizard->limitToField($fieldName); } elseif ($modelAction == self::ACTION_LIMIT) { switch ($modelActionArgument) { case BuilderWizard::LIMIT_MODEL: $wizard->limitToModel(); break; case BuilderWizard::LIMIT_DATA_FORMAT: $wizard->limitToDataFormats(); break; case BuilderWizard::LIMIT_INDEX: $wizard->limitToIndex(); break; } $this->response->setRedirect($this->request->getBasePath()); return; } $cancelUrl = $this->request->getBaseUrl() . '/' . Module::ROUTE_ADMIN; if (!$wizard->isNewModel()) { $modelTable = $wizard->getModelTable(); $cancelUrl .= '/' . BuilderController::ACTION_DETAIL . '/' . $modelTable->getName(); } $wizard->setCancelUrl($cancelUrl); if ($action == self::ACTION_RESET) { $wizard->reset(); $this->response->setRedirect($this->request->getBasePath()); return; } $wizard->invoke($this->request, $this->response); $view = $this->response->getView(); if ($view instanceof HtmlView) { $view = new BuilderWizardView($view); $sidebar = $view->getSidebar(); $sidebar->addPanel(new SidebarView($wizard)); $sidebar->setInformation(self::TRANSLATION_INFORMATION, true); } $this->response->setView($view); }