当前位置: 首页>>代码示例>>PHP>>正文


PHP Session\Container类代码示例

本文整理汇总了PHP中Zend\Session\Container的典型用法代码示例。如果您正苦于以下问题:PHP Container类的具体用法?PHP Container怎么用?PHP Container使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Container类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validateChangePassword

 /**
  * Function for validating and changing the Password
  *
  * @param unknown $password            
  * @return boolean
  */
 public function validateChangePassword($password)
 {
     $userPassword = new UserEncryption();
     $session = new Container('User');
     $passMsg = array('passChange' => 0, 'passSame' => 0, 'passNotSame' => 0);
     try {
         // ////Checking the Old Password is valid or not//////
         $old_password = $userPassword->create($password['old_password']);
         $sql = new Sql($this->getAdapter());
         $select = $sql->select()->from($this->table)->columns(array('password'))->where(array('id' => $session->offsetGet('userId'), 'password' => $old_password));
         $statement = $sql->prepareStatementForSqlObject($select);
         $data = $this->resultSetPrototype->initialize($statement->execute())->toArray();
         if (count($data)) {
             // ///////Password is Valid now change the Password/////
             $userPasswordData['userId'] = $session->offsetGet('userId');
             $userPasswordData['password'] = $password['new_password'];
             if ($this->changeUserPassword($userPasswordData)) {
                 $passMsg['passChange'] = 1;
             } else {
                 $passMsg['passSame'] = 1;
             }
             return $passMsg;
         } else {
             // ///// Password is not valid ///////////
             $passMsg['passNotSame'] = 1;
             return $passMsg;
         }
     } catch (\Exception $e) {
         throw new \Exception($e->getPrevious()->getMessage());
     }
 }
开发者ID:kaushalkishorejaiswal,项目名称:users,代码行数:37,代码来源:UsersTable.php

示例2: boforeDispatch

 function boforeDispatch(MvcEvent $event)
 {
     include 'config/constant.php';
     $response = $event->getResponse();
     $controller = $event->getRouteMatch()->getParam('controller');
     $module_array = explode("\\", $controller);
     if ($module_array[0] == 'Admin') {
         $action = $event->getRouteMatch()->getParam('action');
         $requestedResourse = $controller . "\\" . $action;
         $session = new Container('User');
         if ($session->offsetExists('user')) {
             if (in_array($requestedResourse, $GLOBALS['PAGE_BEFORE_LOGIN'])) {
                 $url = $GLOBALS['SITE_ADMIN_URL'] . 'dashboard/add';
                 $response->setHeaders($response->getHeaders()->addHeaderLine('Location', $url));
                 $response->setStatusCode(302);
             }
         } else {
             if ($requestedResourse != 'Admin\\Controller\\Index\\index' && !in_array($requestedResourse, $GLOBALS['PAGE_BEFORE_LOGIN'])) {
                 $url = $GLOBALS['SITE_ADMIN_URL'] . 'index/login';
                 $response->setHeaders($response->getHeaders()->addHeaderLine('Location', $url));
                 $response->setStatusCode(302);
             }
             $response->sendHeaders();
         }
     }
 }
开发者ID:schoolMsoftware,项目名称:schoolm,代码行数:26,代码来源:Module.php

示例3: setTitleAndTranslation

 /**
  * Handle layout titles onDispatch.
  *
  * @param MvcEvent $event
  */
 public function setTitleAndTranslation(MvcEvent $event)
 {
     $route = $event->getRouteMatch();
     $title = $this->service->get('ControllerPluginManager')->get('systemsettings');
     $viewHelper = $this->service->get('ViewHelperManager');
     $lang = new Container('translations');
     $translator = $this->service->get('translator');
     /*
      * Load translations.
      */
     $renderer = $this->service->get('ViewManager')->getRenderer();
     $renderer->plugin('formRow')->setTranslator($translator, 'SD_Translations');
     $renderer->plugin('formCollection')->setTranslator($translator, 'SD_Translations');
     $renderer->plugin('formLabel')->setTranslator($translator, 'SD_Translations');
     $renderer->plugin('formSelect')->setTranslator($translator, 'SD_Translations');
     $renderer->plugin('formSubmit')->setTranslator($translator, 'SD_Translations');
     AbstractValidator::setDefaultTranslator($translator, 'formandtitle');
     $translator->setLocale($lang->offsetGet('languageName'))->setFallbackLocale('en');
     $viewModel = $event->getViewModel();
     $viewModel->setVariable('lang', $translator->getLocale());
     /*
      * Custom flash messenger.
      */
     $msg = $lang->offsetGet('flashMessages');
     $viewModel->setVariable('flashMessages', $msg);
     /*
      * Load page title
      */
     $action = $route->getParam('post') ? ' - ' . $route->getParam('post') : ucfirst($route->getParam('__CONTROLLER__'));
     $headTitleHelper = $viewHelper->get('headTitle');
     $headTitleHelper->append($title->__invoke('general', 'site_name') . ' ' . $action);
 }
开发者ID:samsonasik,项目名称:unnamed,代码行数:37,代码来源:Module.php

示例4: __invoke

 public function __invoke($redirect, $redirectToUrl = false)
 {
     $controller = $this->getController();
     $request = $controller->getRequest();
     $container = new Container('prg_post1');
     if ($request->isPost()) {
         $container->setExpirationHops(1, 'post');
         $container->post = $request->getPost()->toArray();
         if (method_exists($controller, 'getPluginManager')) {
             // get the redirect plugin from the plugin manager
             $redirector = $controller->getPluginManager()->get('Redirect');
         } else {
             /*
              * if the user wants to redirect to a route, the redirector has to come
              * from the plugin manager -- otherwise no router will be injected
              */
             if ($redirectToUrl === false) {
                 throw new RuntimeException('Could not redirect to a route without a router');
             }
             $redirector = new Redirect();
         }
         if ($redirectToUrl === false) {
             return $redirector->toRoute($redirect);
         }
         return $redirector->toUrl($redirect);
     } else {
         if ($container->post !== null) {
             $post = $container->post;
             unset($container->post);
             return $post;
         }
         return false;
     }
 }
开发者ID:ninahuanca,项目名称:zf2,代码行数:34,代码来源:PostRedirectGet.php

示例5: onDispatch

 /**
  * @param MvcEvent $e
  * @return mixed|void
  */
 public function onDispatch(MvcEvent $e)
 {
     $this->sessionContainer->getDefaultManager()->forgetMe();
     $this->sessionContainer->getDefaultManager()->expireSessionCookie();
     $this->sessionContainer->getDefaultManager()->destroy();
     $this->redirect()->toRoute('frontend');
 }
开发者ID:spalax,项目名称:ua-webchalange-instagram-collage,代码行数:11,代码来源:LogoutController.php

示例6: onBootstrap

 public function onBootstrap($e)
 {
     $e->getApplication()->getEventManager()->getSharedManager()->attach('Zend\\Mvc\\Controller\\AbstractActionController', 'dispatch', function ($e) {
         $controller = $e->getTarget();
         $controllerClass = get_class($controller);
         $moduleNamespace = substr($controllerClass, 0, strpos($controllerClass, '\\'));
         $config = $e->getApplication()->getServiceManager()->get('config');
         if (isset($config['module_layouts'][$moduleNamespace])) {
             $controller->layout($config['module_layouts'][$moduleNamespace]);
         }
     }, 100);
     $session = new Container('base');
     if (!$session->offsetExists('language')) {
         if (substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) == "es") {
             $session->offsetSet('language', "es_ES");
         } elseif (substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) == "en") {
             $session->offsetSet('language', "en_US");
         }
     }
     $e->getApplication()->getServiceManager()->get('translator')->setLocale($session->offsetGet('language'));
     $e->getApplication()->getServiceManager()->get('translator');
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
 }
开发者ID:tineo,项目名称:webapoyopublicitario,代码行数:25,代码来源:Module.php

示例7: boforeDispatch

 /**
  * Before Dispatch Function
  *
  * @param MvcEvent $event            
  */
 function boforeDispatch(MvcEvent $event)
 {
     $sm = $event->getApplication()->getServiceManager();
     $config = $sm->get('Config');
     $list = $config['whitelist'];
     $name = $sm->get('request')->getUri()->getPath();
     $controller = $event->getRouteMatch()->getParam('controller');
     $action = $event->getRouteMatch()->getParam('action');
     $session = new Container('User');
     $controller = $event->getRouteMatch()->getParam('controller');
     $action = $event->getRouteMatch()->getParam('action');
     if (!(strpos($name, 'reset-password') || in_array($name, $list)) && $session->offsetExists('userId')) {
         $serviceManager = $event->getApplication()->getServiceManager();
         $roleTable = $serviceManager->get('RoleTable');
         $userRoleTable = $serviceManager->get('UserRoleTable');
         $roleID = $userRoleTable->getUserRoles('user_id = ' . $session->offsetGet('userId'), array('role_id'));
         $roleName = $roleTable->getUserRoles('rid = ' . $roleID[0]['role_id'], array('role_name'));
         $userRole = $roleName[0]['role_name'];
         $acl = $serviceManager->get('Acl');
         $acl->initAcl();
         $status = $acl->isAccessAllowed($userRole, $controller, $action);
         if (!$status) {
             die('Permission denied');
         }
     }
 }
开发者ID:tsens,项目名称:UsersACL,代码行数:31,代码来源:Module.php

示例8: indexAction

 public function indexAction()
 {
     $mainLayout = $this->initializeFrontendWebsite();
     $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     $page = $this->params()->fromRoute('page');
     $perPage = $this->params()->fromRoute('perpage');
     $sessionContainer = new SessionContainer();
     $sessionSearch = $sessionContainer->offsetGet(StatoCivileSearchController::sessionIdentifier);
     try {
         $helper = new StatoCivileControllerHelper();
         $sezioniRecords = $helper->recoverWrapperRecords(new StatoCivileSezioniGetterWrapper(new StatoCivileSezioniGetter($em)), array());
         $helper->checkRecords($sezioniRecords, 'Nessuna sezione stato civile in archivio');
         $sezioniRecordsForDropdown = $helper->formatForDropwdown($sezioniRecords, 'id', 'nome');
         $wrapper = $helper->recoverWrapperRecordsPaginator(new StatoCivileGetterWrapper(new StatoCivileGetter($em)), array_merge(array('textSearch' => isset($sessionSearch['testo']) ? $sessionSearch['testo'] : null, 'mese' => isset($sessionSearch['mese']) ? $sessionSearch['mese'] : null, 'anno' => isset($sessionSearch['anno']) ? $sessionSearch['anno'] : null, 'sezione' => isset($sessionSearch['sezine']) ? $sessionSearch['sezine'] : null), array('attivo' => 1, 'noScaduti' => 1, 'orderBy' => 'sca.data DESC')), $page, $perPage);
         $wrapper->setEntityManager($em);
         $wrapper->addAttachmentsToPaginatorRecords($wrapper->setupRecords(), array('moduleId' => ModulesContainer::stato_civile_id, 'noScaduti' => 1, 'orderBy' => 'a.position'));
         $paginator = $wrapper->getPaginator();
         $form = new StatoCivileFormSearch();
         $form->addTesto();
         $form->addSezioni($sezioniRecordsForDropdown);
         $form->addMese();
         $form->addAnni();
         $form->addCheckExpired();
         $form->addSubmitButton();
         $form->setData(array('testo' => isset($sessionSearch['testo']) ? $sessionSearch['testo'] : null, 'mese' => isset($sessionSearch['mese']) ? $sessionSearch['mese'] : null, 'anno' => isset($sessionSearch['anno']) ? $sessionSearch['anno'] : null, 'sezione' => isset($sessionSearch['sezione']) ? $sessionSearch['sezione'] : null));
     } catch (\Exception $e) {
         $paginator = null;
     }
     $this->layout()->setVariables(array('sessionSearch' => $sessionSearch, 'paginator' => !empty($paginator) ? $paginator : null, 'emptyRecords' => count($paginator), 'records' => !empty($paginator) ? $paginator : null, 'form' => !empty($form) ? $form : null, 'templatePartial' => 'stato-civile/stato-civile.phtml'));
     $this->layout()->setTemplate($mainLayout);
 }
开发者ID:usban,项目名称:entilocali,代码行数:31,代码来源:StatoCivileController.php

示例9: indexAction

 public function indexAction()
 {
     $mainLayout = $this->initializeAdminArea();
     $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     $configurations = $this->layout()->getVariable('configurations');
     $page = $this->params()->fromRoute('page');
     $languageSelection = $this->params()->fromRoute('languageSelection');
     $modulename = $this->params()->fromRoute('modulename');
     $sessionContainer = new SessionContainer();
     $sessionSearch = $sessionContainer->offsetGet(SottoSezioniSearchController::sessionIdentifier);
     $helper = new SezioniControllerHelper();
     try {
         $wrapper = $helper->recoverWrapperRecordsPaginator(new SottoSezioniGetterWrapper(new SottoSezioniGetter($em)), array('isAmmTrasparente' => $modulename == 'amministrazione-trasparente' ? 1 : 0, 'languageAbbreviation' => $languageSelection, 'freeSearch' => isset($sessionSearch['testo']) ? $sessionSearch['testo'] : null), $page, null);
         $sezioniRecords = $helper->recoverWrapperRecords(new SezioniGetterWrapper(new SezioniGetter($em)), array('languageAbbreviation' => $languageSelection, 'fields' => 'sezioni.id, sezioni.nome', 'orderBy' => 'sezioni.posizione ASC'));
         $helper->checkRecordset($sezioniRecords, 'Nessuna sezione presente');
         if (!empty($configurations['isMultiLanguage']) == 1) {
             $helper->setLanguagesGetterWrapper(new LanguagesGetterWrapper(new LanguagesGetter($em)));
             $formLanguage = $helper->setupLanguageFormSearch(new LanguagesFormSearch(), array('status' => 1), $languageSelection);
         }
         $formSearch = new SottoSezioniFormSearch();
         $formSearch->addSezioni($helper->formatForDropwdown($sezioniRecords, 'id', 'nome'));
         $formSearch->addSubmitButton();
         $formSearch->setData(!empty($sessionSearch) ? $sessionSearch : array());
         $this->layout()->setVariables(array('tableTitle' => 'Sottosezioni ' . ucfirst(str_replace('-', ' ', $modulename)), 'tableDescription' => $wrapper->getPaginator()->getTotalItemCount() . ' sottosezioni in archivio', 'columns' => array("Nome", "Sezione", " ", " ", " "), 'sessionSearch' => $sessionSearch, 'formLanguage' => isset($formLanguage) ? $formLanguage : null, 'paginator' => $wrapper->getPaginator(), 'records' => $this->formatRecordsToShowOnTable($wrapper->setupRecords()), 'formSearch' => $formSearch, 'templatePartial' => 'datatable/datatable_sottosezioni.phtml'));
     } catch (\Exception $e) {
         $this->layout()->setVariables(array('messageText' => $e->getMessage(), 'templatePartial' => 'message-exception.phtml'));
     }
     $this->layout()->setTemplate($mainLayout);
 }
开发者ID:usban,项目名称:entilocali,代码行数:29,代码来源:SottoSezioniSummaryController.php

示例10: getdptoAction

 public function getdptoAction()
 {
     /*$sid = new Container('base');
          $db_name = $sid->offsetGet('dbNombre');
          $id_db = $sid->offsetGet('id_db');
          $this->dbAdapter=$this->getServiceLocator()->get($db_name);
      
          //Obtenemos datos POST
          $lista = $this->request->getPost();
          $dpto = new UnidadTable($this->dbAdapter);
          $unidad = $dpto->getIdUnidad($lista['dpto']);
          
            
          $result = new ViewModel(array('unidad'=>$unidad));
          $result->setTerminal(true);
          return $result*/
     $status = "nok";
     $error = "";
     $msj = "";
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     //$id_db = $sid->offsetGet('id_db');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     $id_usuario = $sid->offsetGet('id_usuario');
     $parametro = $this->request->getPost();
     if (isset($id_usuario) && !empty($parametro['dpto'])) {
         $dpto = new UnidadTable($this->dbAdapter);
         $lista = $dpto->getListarDptoByNombre($this->dbAdapter, $parametro['dpto']);
         $nombre = "";
         $titular = "";
         $contacto = "";
         $condicion = "";
         $tabla = "";
         if (count($lista) > 0) {
             $status = "ok";
             $tabla = "<table class='table table-hover'><thead><tr><th>Nombres</th><th>Contacto</th><th></th></tr></thead><tbody>";
             $nombre = $lista[0]['dpto'];
             for ($i = 0; $i < count($lista); $i++) {
                 if ($lista[$i]['titular'] == "1") {
                     $titular = isset($lista[$i]['nombre']) ? $lista[$i]['nombre'] : "";
                     if (isset($lista[$i]['condicion'])) {
                         $condicion = $lista[$i]['condicion'] == "A" ? "Arrendatario" : "Copropetario";
                     }
                     $contacto = isset($lista[$i]['contacto']) ? $lista[$i]['contacto'] : "";
                 } else {
                     $tabla = $tabla . "<tr><td>" . $lista[$i]['nombre'] . "</td><td>" . $lista[$i]['contacto'] . "</td><td>" . $lista[$i]['condicion'] . "</td></tr>";
                 }
             }
             $tabla = $tabla . "</tbody></table>";
         } else {
             $status = "nok";
             $error = "No hay informacion para el departamento: " . $parametro['dpto'];
         }
     } else {
         $error = "La sesion ha finalizado, vuelve a conectarse al sistema";
     }
     $datos = array('status' => $status, 'error' => $error, 'message' => $msj, 'nombre' => $nombre, 'titular' => $titular, 'contacto' => $contacto, 'condicion' => $condicion, 'tabla' => $tabla);
     $result = new JsonModel($datos);
     return $result;
 }
开发者ID:sonny-one,项目名称:zero,代码行数:60,代码来源:IndexController.php

示例11: csvAction

 /**
  * CSV export
  *
  * @return \Zend\Http\Response|\Zend\Stdlib\ResponseInterface
  * @throws \ModelModule\Model\NullException
  */
 public function csvAction()
 {
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest();
         $post = array_merge_recursive($request->getPost()->toArray(), $request->getFiles()->toArray());
         $form = new StatoCivileFormSearch();
         $form->setBindOnValidate(false);
         $form->setData($post);
         if ($form->isValid()) {
             $sessionContainer = new SessionContainer();
             $sessionContainer->offsetSet('statoCivileFormSearch', $post);
             $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
             $wrapper = new StatoCivileGetterWrapper(new StatoCivileGetter($em));
             $wrapper->setInput(array('numero' => isset($post['numero']) ? $post['numero'] : null, 'anno' => isset($post['anno']) ? $post['anno'] : null, 'sezioneId' => isset($post['sezione']) ? $post['sezione'] : null, 'noScaduti' => isset($post['expired']) ? $post['expired'] : null, 'textSearch' => isset($post['testo']) ? $post['testo'] : null, 'orderBy' => 'sca.id DESC', 'limit' => 1500));
             $wrapper->setupQueryBuilder();
             $records = $wrapper->getRecords();
             if (!empty($records)) {
                 $arrayContent = array();
                 $arrayContent[] = array('Titolo', 'Numero \\ Anno', 'Inserito il', 'Scadenza');
                 foreach ($records as $record) {
                     $arrayContent[] = array($record['titolo'], $record['progressivo'] . ' / ' . $record['anno'], $record['data']->format("d-m-Y"), $record['scadenza']->format("d-m-Y"));
                 }
                 $csvExportHelper = new CsvExportHelper();
                 $content = $csvExportHelper->makeCsvLine($arrayContent);
                 $response = $this->getResponse();
                 $response->getHeaders()->addHeaderLine('Content-Type', 'text/csv')->addHeaderLine('Content-Disposition', 'attachment; filename="stato_civile_' . date("dmYHis") . '.csv"')->addHeaderLine('Accept-Ranges', 'bytes')->addHeaderLine('Content-Length', strlen($content));
                 $response->setContent($content);
                 return $response;
             }
         }
     }
     return $this->redirectForUnvalidAccess();
 }
开发者ID:usban,项目名称:entilocali,代码行数:39,代码来源:StatoCivileExportController.php

示例12: boforeDispatch

 function boforeDispatch(MvcEvent $event)
 {
     $request = $event->getRequest();
     $response = $event->getResponse();
     $target = $event->getTarget();
     $whiteList = array('Auth\\Controller\\Index-index', 'Auth\\Controller\\Index-logout');
     $requestUri = $request->getRequestUri();
     $controller = $event->getRouteMatch()->getParam('controller');
     $action = $event->getRouteMatch()->getParam('action');
     $requestedResourse = $controller . "-" . $action;
     $session = new Container('User');
     if ($session->offsetExists('email')) {
         if ($requestedResourse == 'Auth\\Controller\\Index-index' || in_array($requestedResourse, $whiteList)) {
             $url = '/';
             $response->setHeaders($response->getHeaders()->addHeaderLine('Location', $url));
             $response->setStatusCode(302);
         } else {
             $serviceManager = $event->getApplication()->getServiceManager();
             $userRole = $session->offsetGet('roleName');
             $acl = $serviceManager->get('Acl');
             $acl->initAcl();
             $status = $acl->isAccessAllowed($userRole, $controller, $action);
             if (!$status) {
                 die('Permission denied');
             }
         }
     } else {
         if ($requestedResourse != 'Auth\\Controller\\Index-index' && !in_array($requestedResourse, $whiteList)) {
             $url = '/login';
             $response->setHeaders($response->getHeaders()->addHeaderLine('Location', $url));
             $response->setStatusCode(302);
         }
         $response->sendHeaders();
     }
 }
开发者ID:ChristianKolling,项目名称:projeto-frotas,代码行数:35,代码来源:Module.php

示例13: authorize

 /**
  * @throws BadAuthenticationException
  */
 public function authorize()
 {
     if (!$this->sessionContainer->offsetExists('data')) {
         throw new BadAuthenticationException('You must be first authenticated');
     }
     $this->instagramWrapper->setAccessToken($this->sessionContainer->data);
 }
开发者ID:spalax,项目名称:ua-webchalange-instagram-collage,代码行数:10,代码来源:AuthorizationService.php

示例14: csvAction

 public function csvAction()
 {
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest();
         $post = array_merge_recursive($request->getPost()->toArray(), $request->getFiles()->toArray());
         $form = new ContenutiFormSearch();
         $form->addSubmitButton();
         $form->setBindOnValidate(false);
         $form->setData($post);
         if ($form->isValid()) {
             $sessionContainer = new SessionContainer();
             $sessionContainer->offsetSet('contenutiFormSearch', $post);
             $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
             $wrapper = new ContenutiGetterWrapper(new ContenutiGetter($em));
             $wrapper->setInput(array('limit' => 1500));
             $wrapper->setupQueryBuilder();
             $records = $wrapper->getRecords();
             $csvExportHelper = new CsvExportHelper();
             if (!empty($records)) {
                 $arrayContent = array();
                 $arrayContent[] = array('Titolo', 'Sottotitolo', 'Testo');
                 foreach ($records as $record) {
                     $arrayContent[] = array($record['titolo'], $record['sommario'], $record['testo']);
                 }
                 $content = $csvExportHelper->makeCsvLine($arrayContent);
                 $response = $this->getResponse();
                 $response->getHeaders()->addHeaderLine('Content-Type', 'text/csv')->addHeaderLine('Content-Disposition', 'attachment; filename="contenuti_' . date("dmYHis") . '.csv"')->addHeaderLine('Accept-Ranges', 'bytes')->addHeaderLine('Content-Length', strlen($content));
                 $response->setContent($content);
                 return $response;
             }
         }
     }
     return $this->redirectForUnvalidAccess();
 }
开发者ID:usban,项目名称:entilocali,代码行数:34,代码来源:ContenutiExportController.php

示例15: indexAction

 /**
  * @return mixed
  */
 public function indexAction()
 {
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest();
         $post = $request->getPost()->toArray();
         $inputFilter = new SottoSezioniFormSearchInputFilter();
         $formSearch = new SottoSezioniFormSearch();
         $formSearch->setData($post);
         if ($formSearch->isValid()) {
             $inputFilter->exchangeArray($formSearch->getData());
             $sessioContainer = new SessionContainer();
             $sessioContainer->offsetSet(self::sessionIdentifier, array('testo' => $inputFilter->testo, 'sottosezioni' => $inputFilter->sezioni));
             $referer = $this->getRequest()->getHeader('Referer');
             if (is_object($referer)) {
                 return $this->redirect()->toUrl($referer->getUri());
             }
         }
         $mainLayout = $this->initializeFrontendWebsite();
         $moduleUrl = $this->url()->fromRoute('main', array('lang' => 'it'));
         $referer = $this->getRequest()->getHeader('Referer');
         $refererUrl = is_object($referer) ? $referer->getUri() : $moduleUrl;
         $this->layout()->setVariables(array('formMessages' => $formSearch->getMessages(), 'refererUrl' => $refererUrl, 'moduleUrl' => $moduleUrl, 'moduleLabel' => "Contenuti", 'templatePartial' => 'form-message.phtml'));
         $this->layout()->setTemplate($mainLayout);
     } else {
         $referer = $this->getRequest()->getHeader('Referer');
         if (is_object($referer)) {
             return $this->redirect()->toUrl($referer->getUri());
         }
         return $this->redirect()->toRoute('main');
     }
 }
开发者ID:usban,项目名称:entilocali,代码行数:34,代码来源:SottoSezioniSearchController.php


注:本文中的Zend\Session\Container类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。