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); }
protected function userAuthentication($data) { $auth = $this->authService; $adapter = $auth->getAdapter(); $adapter->setIdentityValue($data['username']); $adapter->setCredentialValue($data['password']); $authResult = $auth->authenticate(); if ($authResult->isValid()) { $identity = $authResult->getIdentity(); $auth->getStorage()->write($identity); $sessionManager = new SessionManager(); if ($data['rememberme']) { $sessionManager->rememberMe(); } // store user roles in a session container $userContainer = new Container('User'); $userContainer->offsetSet('id', $identity->getUserId()); $userRoles = $identity->getRole()->toArray(); $roleNames = array(); foreach ($userRoles as $userRole) { $roleNames[] = $userRole->getRoleName(); } $userContainer->offsetSet('activeRole', $roleNames[0]); $userContainer->offsetSet('allRoles', $roleNames); $sessionManager->writeClose(); return true; } return false; }
public function getPickingStationByID($stationID) { $model = new PickingStationsModel($this->serviceLocator); $station = $model->getPickingStationByID($stationID); $session = new Container('warehouse'); $session->offsetSet('pickingStationID', $station[0]['ID']); $session->offsetSet('pickingStationName', $station[0]['StationName']); $session->offsetSet('pickingStationAlias', $station[0]['StationAlias']); if ($session->offsetExists('pickingStationID') && $session->offsetExists('pickingStationName') && $session->offsetExists('pickingStationAlias')) { return $station[0]; } else { return false; } }
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(); }
/** * 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(); }
public function setReferer($referer = "") { $sessionReferer = new Container('referer'); if (strlen($referer) > 0) { $sessionReferer->offsetSet('referer', $referer); } }
public function indexAction() { $request = $this->getRequest(); $view = new ViewModel(); $loginForm = new LoginForm('loginForm'); $loginForm->setInputFilter(new LoginFilter()); if ($request->isPost()) { $data = $request->getPost(); $loginForm->setData($data); if ($loginForm->isValid()) { $data = $loginForm->getData(); $userPassword = new UserPassword(); $encyptPass = $userPassword->create($data['password']); $this->getAuthService()->getAdapter()->setIdentity($data['email'])->setCredential($encyptPass); $result = $this->getAuthService()->authenticate(); if ($result->isValid()) { $session = new Container('User'); $session->offsetSet('email', $data['email']); $this->flashMessenger()->addMessage(array('success' => 'Login Success.')); // Redirect to page after successful login } else { $this->flashMessenger()->addMessage(array('error' => 'invalid credentials.')); // Redirect to page after login failure } return $this->redirect()->tourl('/application/login'); // Logic for login authentication } else { $errors = $loginForm->getMessages(); //prx($errors); } } $view->setVariable('loginForm', $loginForm); return $view; }
/** * Set search session * * @return \Zend\Http\Response */ public function indexAction() { if ($this->getRequest()->isPost()) { $request = $this->getRequest(); $post = array_merge_recursive($request->getPost()->toArray(), $request->getFiles()->toArray()); $inputFilter = new PostsFormSearchInputFilter(); $formSearch = new PostsFormSearch(); $formSearch->setInputFilter($inputFilter->getInputFilter()); $formSearch->setData($post); $currentClass = get_class($this); $sessionIdentifier = $currentClass::sessionIdentifier; if ($formSearch->isValid()) { $inputFilter->exchangeArray($formSearch->getData()); $formSearch->setData($post); $sessioContainer = new SessionContainer(); $sessioContainer->offsetSet($sessionIdentifier, array('testo' => $inputFilter->testo, 'categories' => $inputFilter->category)); $referer = $this->getRequest()->getHeader('Referer'); if (is_object($referer)) { return $this->redirect()->toUrl($referer->getUri()); } } $mainLayout = $this->initializeFrontendWebsite(); $referer = $this->getRequest()->getHeader('Referer'); $this->layout()->setVariables(array('formMessages' => $formSearch->getMessages(), 'refererUrl' => is_object($referer) ? $referer->getUri() : null, 'moduleLabel' => "Posts", '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'); } }
/** * @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'); } }
public function setAuthenticationExpirationTime() { $expirationTime = time() + $this->allowedIdleTimeInSeconds; $authSession = new Container(self::SESSION_CONTAINER_NAME); if ($authSession->offsetExists(self::SESSION_VARIABLE_NAME)) { $authSession->offsetUnset(self::SESSION_VARIABLE_NAME); } $authSession->offsetSet(self::SESSION_VARIABLE_NAME, $expirationTime); }
public function testExchangeArrayObject() { $this->container->offsetSet('old', 'old'); $this->assertTrue($this->container->offsetExists('old')); $old = $this->container->exchangeArray(new \Zend\Stdlib\ArrayObject(array('new' => 'new'))); $this->assertArrayHasKey('old', $old, "'exchangeArray' doesn't return an array of old items"); $this->assertFalse($this->container->offsetExists('old'), "'exchangeArray' doesn't remove old items"); $this->assertTrue($this->container->offsetExists('new'), "'exchangeArray' doesn't add the new array items"); }
/** * @param string $returnUrl * * @return string */ public function getLoginUrl($returnUrl) { $config = array('consumerKey' => $this->consumerKey, 'consumerSecret' => $this->consumerSecret, 'callbackUrl' => $returnUrl, 'siteUrl' => 'https://api.twitter.com/oauth', 'authorizeUrl' => 'https://api.twitter.com/oauth/authenticate'); $httpClientOptions = array('adapter' => 'Zend\\Http\\Client\\Adapter\\Curl', 'curloptions' => array(CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false)); $consumer = new Consumer($config); $consumer->setHttpClient($consumer->getHttpClient()->setOptions($httpClientOptions)); $token = $consumer->getRequestToken(); $tw_session = new Container('twitter'); $tw_session->offsetSet('request_token', serialize($token)); return $consumer->getRedirectUrl(); }
public function index05Action() { $ssUser = new Container("user"); $ssGroup = new Container("group"); $ssUser->offsetSet("fullname", "trongle"); $ssGroup->offsetSet("groupname", "sasfsaf"); $ssUser->getManager()->getStorage()->clear("group"); echo $ssUser->offsetGet("fullname"); echo $ssGroup->offsetGet("groupname"); return false; }
public function photosearchAction() { // TODO: set session searcch for pictures if ($this->getRequest()->isPost()) { $formSearch = new PostsFormSearch(); // $formSearch->setData(); $session = new SessionContainer(); $session->offsetSet('photoSearchSession', array('text' => '', 'category' => '')); } return $this->redirect()->toRoute('main'); }
public function languageAction() { $session = new Container('base'); // $session->offsetSet ( 'language', "es_ES" ); //$session->offsetSet ( 'language', "en_US" ); if ($this->getEvent()->getRouteMatch()->getParam('lang') != "") { $session->offsetSet('language', $this->getEvent()->getRouteMatch()->getParam('lang')); } $result = new JsonModel(array('language' => $session->offsetGet('language'), 'success' => true)); return $result; }
public function indexAction() { $cssname = $this->params()->fromRoute('cssname'); $sessionContainer = new SessionContainer(); switch ($cssname) { default: $sessionContainer->offsetSet('cssName', "default"); break; case "high-visibility": $sessionContainer->offsetSet('cssName', "high-visibility"); break; case "rosso-su-nero": $sessionContainer->offsetSet('cssName', "rosso-su-nero"); break; case "text": $sessionContainer->offsetSet('cssName', "text"); break; } return $this->redirect()->toRoute('main'); }
/** * {@inheritDoc} */ public function offsetSet($key, $value) { $class = $this->getName(); $om = $this->getObjectManager(); if (is_a($value, $class, true) && !$om->getMetadataFactory()->isTransient(get_class($value))) { if ($om->contains($value)) { $om->detach($value); } $this->sessionVars[$key] = $value; } parent::offsetSet($key, $value); }
/** * @return \Zend\Http\Response */ public function confirmAction() { $this->initializeFrontendWebsite(); $sitename = $this->layout()->getVariable('sitename'); $session = new SessionContainer(); $session->offsetSet('cookie-warning', array($sitename => 1)); $referer = $this->getRequest()->getHeader('Referer'); if ($referer) { return $this->redirect()->toUrl($referer->getUri()); } return $this->redirect()->toRoute('main', array('action' => 'index')); }
/** * Logout */ public function logoutAction() { $this->session->offsetSet('authenticated', false); $this->session->offsetSet('user', null); if ($Backend = $this->session->offsetGet('backend')) { if (is_object($Backend)) { $Backend->disconnect(); } else { $this->session->offsetSet('backend', null); } } return $this->doRedirect(); }
/** * @return array */ public function registerAction() { $form = new Register($this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager')); $form->get('primary')->setValue($this->getAuthenticationService()->getIdentity()->getId()); $status = null; // Step 3: Returned from PayPal if ($this->params()->fromRoute('payum_token')) { $status = $this->getDogService()->completePayment($this); $details = $status->getFirstModel(); if ($details instanceof DetailsAggregateInterface) { $details = $details->getDetails(); if ($details instanceof \Traversable) { $details = iterator_to_array($details); } } $form->setData($details['dogData']); if ($status->isCaptured()) { $this->getDogService()->registerNewDog($details['dogData']); return $this->redirect()->toRoute('home'); } // Step 2: Confirm dog information and redirect to PayPal } elseif ($dogData = $this->session->offsetGet('dogData')) { $this->session->offsetUnset('dogData'); $request = $this->getRequest(); if ($request->isPost() && $request->getPost('confirm') !== null) { $token = $this->getDogService()->preparePayment($dogData, $this->getAuthenticationService()->getIdentity()); return $this->redirect()->toUrl($token->getTargetUrl()); } $form->setData($dogData); // Step 1: Collect dog information } else { $request = $this->getRequest(); if ($request->isPost()) { if ($request->getPost('cancel') !== null) { return $this->redirect()->toRoute('home'); } $form->setData($request->getPost()); if ($form->isValid()) { $dogData = $form->getData(); $dogData['breedName'] = $this->getDogService()->getBreed($dogData['breed'])->getName(); $this->session->offsetSet('dogData', $dogData); $form = new Confirm(); } } } // Remove payum token from form action url if necessary $form->setAttribute('action', $this->url()->fromRoute('dog/register')); return array('form' => $form, 'status' => $status, 'dogData' => $this->session->offsetGet('dogData')); }
public function indexAction() { $mainLayout = $this->initializeAdminArea(); $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default'); $page = $this->params()->fromRoute('page'); $perPage = $this->params()->fromRoute('perpage'); $userDetails = $this->layout()->getVariable('userDetails'); $sessionContainer = new SessionContainer(); try { $formPostedValues = $sessionContainer->offsetGet('statoCivileFormSearch'); $request = $this->getRequest(); if ($request->isPost()) { $post = array_merge_recursive($request->getPost()->toArray(), $request->getFiles()->toArray()); } else { $post = $formPostedValues; } $statoCivileArticoliInput = 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'); $helper = new StatoCivileControllerHelper(); $yearsList = $helper->setupYears(new StatoCivileGetterWrapper(new StatoCivileGetter($em)), array_merge($statoCivileArticoliInput, array('fields' => 'DISTINCT(sca.anno) AS anno'))); $sezioniRecords = $helper->recoverWrapperRecords(new StatoCivileSezioniGetterWrapper(new StatoCivileSezioniGetter($em)), array()); $helper->checkRecords($sezioniRecords, "Nessuna sezione in archivio"); $sezioniRecordsForDropDown = $helper->formatForDropwdown($sezioniRecords, 'id', 'nome'); $formSearch = new StatoCivileFormSearch(); $formSearch->addTesto(); $formSearch->addProgressivo(); $formSearch->addNumeroAtto(); $formSearch->addMese(); $formSearch->addSezioni($sezioniRecordsForDropDown); $formSearch->addSubmitButton(); $formSearch->addCheckExpired(); $formSearch->addAnni($yearsList); if ($this->getRequest()->isPost()) { $formSearch->setBindOnValidate(false); $formSearch->setData($post); $sessionContainer->offsetSet('statoCivileFormSearch', $post); } elseif (!empty($formPostedValues)) { $formSearch->setData($formPostedValues); } $wrapper = $helper->recoverWrapperRecordsPaginator(new StatoCivileGetterWrapper(new StatoCivileGetter($em)), $statoCivileArticoliInput, $page, $perPage); $wrapper->setEntityManager($em); $attiRecords = $wrapper->addAttachmentsFromRecords($wrapper->setupRecords()); $paginator = $wrapper->getPaginator(); $paginatorCount = $paginator->getTotalItemCount(); $this->layout()->setVariables(array('tableTitle' => 'Stato civile', 'tableDescription' => $paginatorCount . ' atti stato civile in archivio', 'columns' => array("Titolo", "Numero / Anno", "Sezione", "Inserito il", "Scadenza", "Inserito da", " ", " ", " ", " ", " ", " "), 'formSearch' => $formSearch, 'records' => $this->formatRecords($attiRecords), 'paginator' => $paginator, 'templatePartial' => 'datatable/datatable_statocivile.phtml')); } catch (\Exception $e) { $this->layout()->setVariables(array('messageType' => 'warning', 'messageTitle' => 'Errore verificato', 'messageText' => $e->getMessage(), 'templatePartial' => 'message.phtml')); } $this->layout()->setTemplate($mainLayout); }
/** * @param string $uniqueId * @return bool */ public function removeItem($uniqueId) { $cart = $this->getCart(); /** @var ItemModel $item */ $this->getItemByUniqueId($uniqueId, $cart); /** @var ItemModel $cartItem */ foreach ($cart as $key => $cartItem) { if ($cartItem->getUniqueId() == $uniqueId) { unset($cart[$key]); continue; } } $this->container->offsetSet('cart', $cart); return true; }
/** * This action handles the selection of the language * * @return \Zend\Http\Response */ public function changelngAction() { $session = new Container('base'); $code = $this->params()->fromRoute('code'); if (!empty($code)) { $locale = $this->languagesService->findByCode($code)->getLocale(); $session->offsetSet('locale', $locale); } if ($this->getRequest()->getHeader('Referer')) { $url = $this->getRequest()->getHeader('Referer')->getUri(); return $this->redirect()->toUrl($url); } else { return $this->redirect()->toRoute('home'); } }
/** * TODO: delete this method, use ContenutiSearchController * * Set session search for the summary * * @return mixed */ public function summarysearchAction() { if ($this->getRequest()->isPost()) { $formSearch = new ContenutiFormSearch(); $formSearch->addAnno(); $formSearch->addInHome(); $formSearch->addCheckExpired(); $sessioContainer = new SessionContainer(); $sessioContainer->offsetSet(ContenutiSearchController::sessionIdentifier, array('testo' => $this->params()->fromPost('testo'), 'sottosezioni' => $this->params()->fromPost('sottosezioni'), 'inhome' => $this->params()->fromPost('inhome'))); $referer = $this->getRequest()->getHeader('Referer'); if (is_object($referer)) { return $this->redirect()->toUrl($referer->getUri()); } } return $this->redirect()->toRoute('main'); }
public function dbparamAction() { $this->dbAdapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter'); $usuario = new UsuarioTable($this->dbAdapter); $tsession = new SessionTable($this->dbAdapter); $id_db = $this->params()->fromRoute('id', 0); $sid = new Container('base'); $dbParam = $sid->offsetGet('dbParam'); for ($i = 0; $i < count($dbParam); $i++) { if ($id_db == $dbParam[$i]['id']) { $id_perfil = $dbParam[$i]['id_perfil']; $nro_session = $dbParam[$i]['nro_session']; $db_nombre = $dbParam[$i]['nombre_db']; $nombreComercial = $dbParam[$i]['nombre']; $perfil = $dbParam[$i]['perfil']; break; } } $id_usuario = $sid->offsetGet('id_usuario'); $nroSessionDB = count($tsession->obtenetSesion($id_usuario, $id_db)); if ($nro_session > 0 && $nroSessionDB >= $nro_session) { $sid->getManager()->getStorage()->clear(); if (isset($_COOKIE['usuario'])) { unset($_COOKIE['usuario']); } if (isset($_COOKIE['password'])) { unset($_COOKIE['password']); } //return $this->forward()->dispatch('Application\Controller\Login',array('action'=>'index','id'=>4)); return $this->redirect()->toUrl($this->getRequest()->getBaseUrl() . '/application/login/index/4'); } $sid->offsetSet('dbNombre', $db_nombre); $sid->offsetSet('nombreComercial', $nombreComercial); $sid->offsetSet('id_db', $id_db); $sid->offsetSet('perfil', $perfil); $valores = array('id_usuario' => $id_usuario, 'id_db' => $id_db, 'ip_cliente' => $_SERVER['REMOTE_ADDR'], 'port_cliente' => $_SERVER['REMOTE_PORT']); $sid->offsetSet('idSession', $tsession->crearSesion($valores)); //Mapeamos la base de datos $modulo = $usuario->getModulo($this->dbAdapter, $id_perfil); $sid->offsetSet('modulo', $modulo); if (count($modulo) > 1) { $urlHome = 'application'; } else { $urlHome = $modulo[0]['url']; } $sid->offsetSet('urlHome', $urlHome); return $this->redirect()->toUrl($this->getRequest()->getBaseUrl() . '/' . $urlHome); //return new ViewModel(); }
public function indexAction() { $this->layout('layout/conserje'); $sid = new Container('base'); $db_name = $sid->offsetGet('dbNombre'); $this->dbAdapter = $this->getServiceLocator()->get($db_name); $dpto = new UnidadTable($this->dbAdapter); $lista = $dpto->getDatosActivos(); $sDpto = "<select name='id_unidad' id='id_unidad' class='form-control'>"; foreach ($lista as $key => $value) { $sDpto = $sDpto . "<option value='" . $key . "'>" . $value . "</option>"; } $sDpto = $sDpto . "</select>"; //$sid->offsetSet('sDpto',$sDpto); $sid->offsetSet('dpto', $sDpto); return new ViewModel(array('rsptaOK' => SysFnc::rspOK(), 'imgView' => SysFnc::cargarVistaImagen())); }
public function indexAction() { $auth = new AuthenticationService(); $identity = null; $logged = null; if ($auth->hasIdentity()) { $identity = $auth->getIdentity(); $session = new Container('user'); $session->offsetUnset('username'); $session->offsetSet('username', $identity); $logged = $session->offsetGet('username'); } if ($logged === null) { $this->redirect()->toRoute('user', array('action' => 'signin')); } $user = $this->getUserTable()->getUserByName($logged); return array('user' => $user); }
/** * This action handles the selection of the language * * @return \Zend\Http\Response */ public function changelngAction() { $session = new Container('base'); $lang = $this->params()->fromRoute('lang'); if (!empty($lang)) { if ($this->languagesService->findByCode($lang)) { $locale = $this->languagesService->findByCode($lang)->getLocale(); $session->offsetSet('locale', $locale); $domain = str_replace("www", "", $_SERVER['HTTP_HOST']); $cookie = new \Zend\Http\Header\SetCookie('locale', $locale, time() + 365 * 60 * 60 * 24, '/', $domain); $this->getResponse()->getHeaders()->addHeader($cookie); } } if ($this->getRequest()->getHeader('Referer')) { $url = $this->getRequest()->getHeader('Referer')->getUri(); return $this->redirect()->toUrl($url); } else { return $this->redirect()->toRoute('home'); } }
/** * Set search session * * @return \Zend\Http\Response */ public function indexAction() { if ($this->getRequest()->isPost()) { $request = $this->getRequest(); $post = array_merge_recursive($request->getPost()->toArray(), $request->getFiles()->toArray()); $inputFilter = new AlboPretorioFormSearchInputFilter(); $formSearch = new AlboPretorioFormSearch(); $formSearch->setBindOnValidate(false); $formSearch->addYears(); $formSearch->addCheckExpired(); $formSearch->addSubmitButton(); $formSearch->addResetButton(); $formSearch->setInputFilter($inputFilter->getInputFilter()); $formSearch->addHomePage(); $formSearch->setData($post); if ($formSearch->isValid()) { $inputFilter->exchangeArray($formSearch->getData()); $formSearch->setData($post); $sessioContainer = new SessionContainer(); $sessioContainer->offsetSet(self::sessionIdentifier, array('numero_progressivo' => $inputFilter->numero_progressivo != 0 ? $inputFilter->numero_progressivo : null, 'numero_atto' => $inputFilter->numero_atto != 0 ? $inputFilter->numero_atto : null, 'testo' => $inputFilter->testo, 'mese' => $inputFilter->mese, 'anno' => $inputFilter->anno, 'sezione' => $inputFilter->sezione, 'home' => $inputFilter->home, 'expired' => $inputFilter->expired)); $referer = $this->getRequest()->getHeader('Referer'); if (is_object($referer)) { return $this->redirect()->toUrl($referer->getUri()); } } $mainLayout = $this->initializeFrontendWebsite(); $referer = $this->getRequest()->getHeader('Referer'); $alboUrl = $this->url()->fromRoute('albo-pretorio'); $refererUrl = is_object($referer) ? $referer->getUri() : $alboUrl; $this->layout()->setVariables(array('formMessages' => $formSearch->getMessages(), 'refererUrl' => $refererUrl, 'moduleUrl' => $alboUrl, 'moduleLabel' => "Albo pretorio", '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'); } }
/** * Set search session * * @return \Zend\Http\Response */ public function indexAction() { if ($this->getRequest()->isPost()) { $request = $this->getRequest(); $post = array_merge_recursive($request->getPost()->toArray(), $request->getFiles()->toArray()); $inputFilter = new ContrattiPubbliciFormSearchInputFilter(); $formSearch = new ContrattiPubbliciFormSearch(); $formSearch->setBindOnValidate(false); $formSearch->addMainFormElements(); //$formSearch->addYears(array()); //$formSearch->addSettori(); $formSearch->setInputFilter($inputFilter->getInputFilter()); $formSearch->setData($post); if ($formSearch->isValid()) { $inputFilter->exchangeArray($formSearch->getData()); $formSearch->setData($post); $sessioContainer = new SessionContainer(); $sessioContainer->offsetSet(self::sessionIdentifier, array('anno' => $inputFilter->anno, 'cig' => $inputFilter->cig, 'importo' => $inputFilter->importo, 'settore' => $inputFilter->settore)); $referer = $this->getRequest()->getHeader('Referer'); if (is_object($referer)) { return $this->redirect()->toUrl($referer->getUri()); } } var_dump($formSearch->getInputFilter()->getMessages()); $mainLayout = $this->initializeFrontendWebsite(); $referer = $this->getRequest()->getHeader('Referer'); $alboUrl = $this->url()->fromRoute('contratti-pubblici'); $refererUrl = is_object($referer) ? $referer->getUri() : $alboUrl; $this->layout()->setVariables(array('formMessages' => $formSearch->getMessages(), 'refererUrl' => $refererUrl, 'moduleUrl' => $alboUrl, 'moduleLabel' => "Bandi di gara e contratti", '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'); } }