public function onDispatch(MvcEvent $e)
 {
     /*
      $admin_session = new Container('admin');
      $username = $admin_session->username;
      if(empty($username)) {
     
      return $this->redirect()->toRoute('adminlogin');
      }
     */
     /* Set Default layout for all the actions */
     $this->layout('layout/layout');
     $em = $this->getEntityManager();
     $cities = $em->getRepository('\\Admin\\Entity\\City')->findBy(array('countryId' => 2));
     $categories = $em->getRepository('\\Admin\\Entity\\Categories')->findBy(array('status' => 1));
     $signupForm = new Forms\SignupForm();
     $loginForm = new Forms\LoginForm();
     $forgotpassForm = new Forms\ForgotPasswordForm();
     $this->layout()->signupForm = $signupForm;
     $this->layout()->loginForm = $loginForm;
     $this->layout()->forgotpassForm = $forgotpassForm;
     $this->layout()->cities = $cities;
     $this->layout()->categories = $categories;
     $user_session = new Container('user');
     $userid = $user_session->userId;
     $city = "";
     $searchSession = new Container("searchsess");
     $searchType = "";
     $searchTerm = "";
     if ($searchSession->offsetExists("type")) {
         $searchType = $searchSession->offsetGet("type");
         $searchTerm = $searchSession->offsetGet("searchTerm");
     }
     if ($searchType == "category" && $searchTerm != "") {
         $this->layout()->searchedCategory = $searchTerm;
     }
     if ($searchType == "city" && $searchTerm != "") {
         $this->layout()->userCity = $searchTerm;
     }
     if (!empty($userid)) {
         $msg = 'You are already logged in.';
         $status = 1;
         $this->layout()->setVariable('userId', $user_session->userId);
         $this->layout()->setVariable('username', $user_session->userName);
         $username = $user_session->userName;
         $tmp_user = $em->getRepository('\\Admin\\Entity\\Users')->find($user_session->userId);
         $city = $tmp_user->getCity();
         if ($searchType == "city" && $searchTerm != "") {
             $this->layout()->userCity = $searchTerm;
         } else {
             if (!empty($city)) {
                 $cityObj = $em->getRepository('\\Admin\\Entity\\City')->find($city);
                 $this->layout()->userCity = $cityObj->getCityName();
             }
         }
     } else {
         $this->layout()->setVariable('userId', '');
     }
     return parent::onDispatch($e);
 }
 /**
  * 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());
     }
 }
示例#3
0
 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;
 }
示例#4
0
 /**
  * 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);
 }
示例#5
0
 public function indexAction()
 {
     //Cargamos Layout
     $this->layout('layout/admin');
     //Instancias
     $this->dbAdapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter');
     $sid = new Container('base');
     //Obtenemos Datos de sesion
     $nombre = $sid->offsetGet('nombreComercial');
     $dbNombre = $sid->offsetGet('dbNombre');
     //Buscamos direccion del condominio para mostrar
     $valores = array('agua' => "804369", 'luz' => "2854633", 'mantenciones' => "854666", 'remuneraciones' => "6456997", 'insumos' => "1269322");
     return new ViewModel(array("nombre" => $nombre, "direccion" => $direccion, 'valores' => $valores));
 }
示例#6
0
 /**
  * @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'));
 }
示例#7
0
 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()
 {
     $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);
 }
 public function indexAction()
 {
     $view = new ViewModel();
     $username = $this->params()->fromPost('username');
     $password = $this->params()->fromPost('password');
     if (empty($username) && empty($password)) {
         $session = new Container('user_session');
         $pattern = $session->offsetGet('session_status');
         if (!empty($pattern)) {
             $adminContent = new ViewModel(array('posts' => $this->formatTargetPosts($this->postService->findAllPosts('', 'php'), true)));
             $adminContent->setTemplate('template/content/adminContent.phtml');
             $view->addChild($adminContent, '_admin_content');
             return $view;
         } else {
             echo "<h1>Forbidden No Session stored!</h1>\r\n                    <button id=\"retry_1\" type=\"button\" class=\"btn btn-success\">To login Site</button>";
         }
     } else {
         $result = $this->postService->userMapping($username, $password);
         if ($result) {
             $this->sessionAction($username);
             $adminContent = new ViewModel(array('posts' => $this->formatTargetPosts($this->postService->findAllPosts('', 'php'), true)));
             //
             $adminContent->setTemplate('template/content/adminContent.phtml');
             $view->addChild($adminContent, '_admin_content');
             //        TODO: Implement Admin Content.
         } else {
             $error_message = new ViewModel(array());
             $error_message->setTemplate('template/error/error_admin_login.phtml');
             $view->addChild($error_message, '_error_message');
         }
         return $view;
     }
 }
示例#10
0
 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();
     }
 }
 public function indexAction()
 {
     $mainLayout = $this->initializeFrontendWebsite();
     $page = $this->params()->fromRoute('page');
     $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     $templateDir = $this->layout()->getVariable('templateDir');
     $basicLayout = $this->layout()->getVariable('atti_concessione_basiclayout');
     $sessionContainer = new SessionContainer();
     $sessionSearch = $sessionContainer->offsetGet(AttiConcessioneSearchController::sessionIdentifier);
     try {
         $helper = new AttiConcessioneControllerHelper();
         $yearsRecords = $helper->recoverWrapperRecords(new AttiConcessioneGetterWrapper(new AttiConcessioneGetter($em)), array('fields' => 'DISTINCT(atti.anno) AS year', 'orderBy' => 'atti.id DESC'), $page, null);
         $wrapperArticoli = $helper->recoverWrapperRecordsPaginator(new AttiConcessioneGetterWrapper(new AttiConcessioneGetter($em)), array('anno' => isset($sessionSearch['anno']) ? $sessionSearch['anno'] : null, 'codice' => isset($sessionSearch['codice']) ? $sessionSearch['codice'] : null, 'beneficiarioSearch' => isset($sessionSearch['beneficiario']) ? $sessionSearch['beneficiario'] : null, 'importo' => isset($sessionSearch['importo']) ? $sessionSearch['importo'] : null, 'settore' => isset($sessionSearch['settore']) ? $sessionSearch['settore'] : null, 'attivo' => 1, 'orderBy' => 'atti.id DESC'), $page, null);
         $settoriRecords = $helper->recoverWrapperRecords(new UsersSettoriGetterWrapper(new UsersSettoriGetter($em)), array('orderBy' => 'settore.nome'));
         $wrapperArticoli->setEntityManager($em);
         $articoliRecords = $wrapperArticoli->addAttachmentsToPaginatorRecords($wrapperArticoli->setupRecords(), array('moduleId' => ModulesContainer::atti_concessione, 'noScaduti' => 1, 'orderBy' => 'a.position'));
         $form = new AttiConcessioneFormSearch();
         $form->addAnno($helper->formatYears($yearsRecords));
         $form->addMainElements();
         $form->addUfficio($helper->formatForDropwdown($settoriRecords, 'id', 'nome'));
         $form->addSubmitSearchButton();
         if (!empty($sessionSearch)) {
             $form->setData(array('anno' => $sessionSearch['anno'], 'codice' => $sessionSearch['codice'], 'beneficiario' => $sessionSearch['beneficiario'], 'importo' => $sessionSearch['importo'], 'settore' => $sessionSearch['settore']));
         }
         $articoliPaginator = $wrapperArticoli->getPaginator();
         $this->layout()->setVariables(array('records' => $articoliRecords, 'form' => $form, 'sessionSearch' => $sessionSearch, 'paginator' => $articoliPaginator, 'paginator_total_item_count' => $articoliPaginator->getTotalItemCount(), 'templatePartial' => 'atti-concessione/atti-concessione.phtml'));
     } catch (NullException $e) {
         $this->layout()->setVariables(array('messageType' => 'secondary', 'messageText' => "Si &egrave; verificato un problema o una mancanza di dati necessari per visualizzare la pagina richiesta", 'templatePartial' => 'atti-concessione/atti-concessione.phtml'));
     }
     $this->layout()->setTemplate(isset($basicLayout) ? $templateDir . $basicLayout : $mainLayout);
 }
 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", "&nbsp;", "&nbsp;", "&nbsp;"), '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);
 }
示例#13
0
 public function indexAction()
 {
     $mainLayout = $this->initializeFrontendWebsite();
     $page = $this->params()->fromRoute('page');
     $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     $sessionContainer = new SessionContainer();
     $sessionSearch = $sessionContainer->offsetGet(AlboPretorioSearchController::sessionIdentifier);
     try {
         $helper = new AlboPretorioControllerHelper();
         $sezioniRecords = $helper->recoverWrapperRecords(new AlboPretorioSezioniGetterWrapper(new AlboPretorioSezioniGetter($em)), array());
         $articoliWrapper = $helper->recoverWrapperRecordsPaginator(new AlboPretorioArticoliGetterWrapper(new AlboPretorioArticoliGetter($em)), array('freeSearch' => isset($sessionSearch['testo']) ? $sessionSearch['testo'] : null, 'sezioneId' => isset($sessionSearch['sezine']) ? $sessionSearch['sezine'] : null, 'numeroProgressivo' => isset($sessionSearch['numero_progressivo']) ? $sessionSearch['numero_progressivo'] : null, 'numeroAtto' => isset($sessionSearch['numero_atto']) ? $sessionSearch['numero_atto'] : null, 'mese' => isset($sessionSearch['mese']) ? $sessionSearch['mese'] : null, 'anno' => isset($sessionSearch['anno']) ? $sessionSearch['anno'] : null, 'noScaduti' => 1, 'orderBy' => 'alboArticoli.id DESC', 'pubblicare' => 1), $page, null);
         $articoliWrapper->setEntityManager($em);
         $mainRecords = $articoliWrapper->addAttachmentsToPaginatorRecords($articoliWrapper->setupRecords(), array('moduleId' => ModulesContainer::albo_pretorio_id, 'noScaduti' => 1, 'orderBy' => 'a.position'));
         $formSearch = new AlboPretorioFormSearch();
         $formSearch->addYears();
         $formSearch->addSezioni($helper->formatForDropwdown($sezioniRecords, 'id', 'nome'));
         $formSearch->addCheckExpired();
         $formSearch->addSubmitButton();
         if (!empty($sessionSearch)) {
             $formSearch->setData(array('numero_progressivo' => $sessionSearch['numero_progressivo'], 'numero_atto' => $sessionSearch['numero_atto'], 'mese' => $sessionSearch['mese'], 'anno' => $sessionSearch['anno'], 'sezione' => $sessionSearch['sezione'], 'testo' => $sessionSearch['testo'], 'expired' => $sessionSearch['expired']));
         }
         $this->layout()->setVariables(array('sessionSearch' => $sessionSearch, 'form' => $formSearch, 'paginator' => $articoliWrapper->getPaginator(), 'emptyRecords' => count($mainRecords), 'records' => $mainRecords, 'templatePartial' => 'albo-pretorio/albo-pretorio.phtml'));
     } catch (\Exception $e) {
         $this->layout()->setVariables(array('messageTitle' => 'Si &egrave; verificato un problema:', 'messageText' => $e->getMessage(), 'moduleLabel' => 'Albo pretorio', 'templatePartial' => 'message.phtml'));
     }
     $this->layout()->setTemplate($mainLayout);
 }
示例#14
0
 public function loginAction()
 {
     // 		$crypt	= new Cryptography\Service();
     $form = new Login();
     $request = $this->getRequest();
     if ($request->isPost()) {
         //Validate the form
         $formValidator = new LoginValidator();
         $form->setInputFilter($formValidator->getInputFilter());
         $form->setData($request->getPost());
         if ($form->isValid()) {
             $formData = $form->getData();
             //                 $dbAdapter = $this->authService->getAdapter();
             $authAdapter = $this->authService->getAdapter();
             $authAdapter->setIdentity($formData['email_address']);
             $authAdapter->setCredential($formData['password']);
             // Perform the authentication query, saving the result
             $result = $this->authService->authenticate($authAdapter);
             if ($result->isValid()) {
                 $data = $authAdapter->getResultRowObject(null, 'password');
                 $this->authService->getStorage()->write($data);
                 $sessionContainer = new Container('base');
                 $redirectUrl = $sessionContainer->offsetExists('lastRequest') ? $sessionContainer->offsetGet('lastRequest') : 'home';
                 return $this->redirect()->toRoute($redirectUrl);
             }
         }
         $this->flashMessenger()->addErrorMessage('Validation failed');
     }
     $viewModel = new ViewModel(array('form' => $form, 'errorMessages' => $this->flashMessenger()->getErrorMessages(), 'successMessages' => $this->flashMessenger()->getCurrentSuccessMessages()));
     //         $viewModel->setTerminal(true-); //Remove this if you want your layout to be shown
     return $viewModel;
 }
 /**
  * {@inheritDoc}
  */
 public function getIdentityRoles()
 {
     $authService = $this->userService;
     //         $definedRoles = $this->config['role_providers']['BjyAuthorize\Provider\Role\Config']['user']['children'];
     $roleKey = $this->config['ldap_role_key'];
     //         $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     //         $definedRoles = $em->getRepository("ZfcUserLdap\Entity\Role")->findAll();
     //         var_dump($role);
     //         exit();
     if (!$authService->getAuthService()->hasIdentity()) {
         return array($this->getDefaultRole());
     }
     $session = new Container('ZfcUserLdap');
     if (!$session->offsetExists('ldapObj')) {
         return array($this->getDefaultRole());
     }
     //         var_dump($roleKey);
     $user = $session->offsetGet('ldapObj');
     $roles = array();
     //         var_dump($user);
     //         var_dump($definedRoles);
     //         exit();
     foreach ($user->getRoles() as $role) {
         //             if (isset($definedRoles[$role]))
         $roles[] = $role->getRoleId();
     }
     return $roles;
     //         $session = new Container('ZfcUserLdap');
     //         $user = $session->offsetGet('ldapObj');
     // 		$em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     // // 		$Roles = $em->getRepository("ZfcUserLdap\Entity\User")->find();
     // // 		var_dump($authService->getAuthService()->getIdentity());
     // 		var_dump($user);
     // 		exit();
 }
示例#16
0
文件: UsoFnc.php 项目: sonny-one/zero
     <table class="table ' . $clase . '">
            <thead>
               <tr>
               <th><i class="fa fa-cutlery"> - ' . $alias . '</i></th>
            </tr>                                                
           </thead>
           <tbody>
           <tr>
           <td>' . $titulo . '<br/>
           <span>Cap. nejo
           </span>' . $cupo . '<br/>
           <strong>' . $estado . '</strong><br/>
           G: $ ' . $garantia . '<br/>
           R: $ ' . $reserva . '<br/>
           ' . $flag . '
           </td>
           </tr>
     </tbody>
     </table>       
     </div>
     </div></a>';
 }
 public static function detalleRsvQuincho($fecha, $titulo, $alias, $cap, $rsv, $gar, $horario)
 {
     $sid = new Container('base');
     $dpto = $sid->offsetGet('dpto');
     $botones = '';
     $cnt = 0;
     for ($j = 0; $j < count($horario); $j++) {
         $marcar = "class='A1 btn btn-outline btn-success'";
         $unidad = $horario[$j]['unidad'] == "" ? "" : $horario[$j]['unidad'];
         $status = $horario[$j]['valor'] == "" ? "Disponible" : $horario[$j]['valor'];
         $resta = "-";
         if ($status == "Reserva") {
示例#17
0
 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);
 }
示例#18
0
文件: Module.php 项目: tsens/UsersACL
 /**
  * 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');
         }
     }
 }
示例#19
0
 public function membreAction()
 {
     $return = null;
     $identifiantMembre = (int) $this->params()->fromRoute('id', 0);
     $auth = new AuthenticationService();
     $logged = null;
     if ($auth->hasIdentity()) {
         $session = new Container('user');
         $logged = $session->offsetGet('id');
     }
     $like = array();
     $images = $this->getImageTable()->fetchAllById($identifiantMembre);
     if ($logged != null) {
         foreach ($images as $image) {
             $isLike = $this->getLikeTable()->fetchCorrespondance($logged, $image->id);
             foreach ($isLike as $isLikeTest) {
                 if ($isLikeTest->id != null) {
                     array_push($like, 'FALSE');
                 } else {
                     array_push($like, 'TRUE');
                 }
             }
         }
     }
     return new ViewModel(array('images' => $this->getImageTable()->fetchAllById($identifiantMembre), 'user' => $this->getUserTable()->getUser($identifiantMembre), 'like' => $like));
 }
 public function getCurrentPickingStation()
 {
     $session = new Container('warehouse');
     if ($session->offsetExists('pickingStationID') && $session->offsetExists('pickingStationName') && $session->offsetExists('pickingStationAlias')) {
         $this->currentPickingStation['ID'] = $session->offsetGet('pickingStationID');
         $this->currentPickingStation['StationName'] = $session->offsetGet('pickingStationName');
         $this->currentPickingStation['StationAlias'] = $session->offsetGet('pickingStationAlias');
     } else {
         $this->currentPickingStation = $this->pickingStations[0];
         $session->offsetSet('pickingStationID', $this->currentPickingStation['ID']);
         $session->offsetSet('pickingStationName', $this->currentPickingStation['StationName']);
         $session->offsetSet('pickingStationAlias', $this->currentPickingStation['StationAlias']);
     }
     // else
     return $this->currentPickingStation;
 }
 public function __construct(TableGateway $tableGateway)
 {
     $this->tableGateway = $tableGateway;
     $session = new Container('base');
     $user = $session->offsetGet('user');
     $this->user_id = $user['user_id'];
     $this->date_now = date('Y-m-d H:i:s');
 }
示例#22
0
 /**
  * @return array
  */
 public function getCart()
 {
     $cart = $this->container->offsetGet('cart');
     if (!$cart) {
         $cart = [];
     }
     return $cart;
 }
 public function checkAuthentication($page_url)
 {
     $session = new Container('base');
     if (!$session->offsetExists('logged_in') || $session->offsetGet('logged_in') !== true) {
         return $this->redirect()->toRoute('employee', array('action' => 'signin', 'controller' => 'employee'));
     }
     $session->setExpirationSeconds(28800);
     return true;
 }
 public function init()
 {
     # For manually check for logged-in user
     $fb_session = new Container('fbloginbase');
     $uId = $fb_session->offsetGet('uid');
     if (!$uId) {
         return $this->redirect()->toRoute('application', array('controller' => 'index', 'action' => 'index'));
     }
 }
 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();
     $sessionSearch = $sessionContainer->offsetGet(ContrattiPubbliciSearchController::sessionIdentifier);
     try {
         $helper = new ContrattiPubbliciControllerHelper();
         $wrapper = $helper->recoverWrapperRecordsPaginator(new ContrattiPubbliciGetterWrapper(new ContrattiPubbliciGetter($em)), array('cig' => isset($sessionSearch['cig']) ? $sessionSearch['cig'] : null, 'anno' => isset($sessionSearch['anno']) ? $sessionSearch['anno'] : null, 'importo' => isset($sessionSearch['importo']) ? $sessionSearch['importo'] : null, 'settoreId' => isset($sessionSearch['settore']) ? $sessionSearch['settore'] : null, 'orderBy' => 'cc.id DESC'), $page, $perPage);
         $yearsRecords = $helper->recoverWrapperRecords(new ContrattiPubbliciGetterWrapper(new ContrattiPubbliciGetter($em)), array('fields' => 'DISTINCT(cc.anno) AS anno', 'orderBy' => 'cc.anno'));
         $helper->checkRecords($yearsRecords, 'Nessun contratto pubblico in archivio');
         if (!empty($yearsRecords)) {
             $yearsArray = array();
             foreach ($yearsRecords as $year) {
                 if (isset($year['anno'])) {
                     $yearsArray[$year['anno']] = $year['anno'];
                 }
             }
         }
         $wrapperSettori = new UsersSettoriGetterWrapper(new UsersSettoriGetter($em));
         $wrapperSettori->setInput(array());
         $wrapperSettori->setupQueryBuilder();
         $settoriRecords = $wrapperSettori->getRecords();
         $settori = array();
         foreach ($settoriRecords as $settore) {
             if (isset($settore['id']) and isset($settore['nome']) and isset($settore['surname'])) {
                 $settori[$settore['id']] = $settore['nome'] . ' ' . $settore['name'] . ' ' . $settore['surname'];
             }
         }
         $formSearch = new ContrattiPubbliciFormSearch();
         $formSearch->addMainFormElements();
         $formSearch->addYears($yearsArray);
         $formSearch->addSettori($settori);
         $formSearch->addSubmit();
         if ($sessionSearch) {
             $formSearch->setData(array('cig' => isset($sessionSearch['cig']) ? $sessionSearch['cig'] : null, 'anno' => isset($sessionSearch['anno']) ? $sessionSearch['anno'] : null, 'importo' => isset($sessionSearch['importo']) ? $sessionSearch['importo'] : null, 'settore' => isset($sessionSearch['settore']) ? $sessionSearch['settore'] : null));
         }
         $paginator = $wrapper->getPaginator();
         $helper = new ContrattiPubbliciControllerHelper();
         $wrapperDisattivati = $helper->recoverWrapperRecords(new ContrattiPubbliciGetterWrapper(new ContrattiPubbliciGetter($em)), array('fields' => '(SELECT COUNT(contratti.id) FROM Application\\Entity\\ZfcmsComuniContratti contratti WHERE contratti.attivo = 0) AS disattivati', 'cig' => isset($sessionSearch['cig']) ? $sessionSearch['cig'] : null, 'anno' => isset($sessionSearch['anno']) ? $sessionSearch['anno'] : null, 'importo' => isset($sessionSearch['importo']) ? $sessionSearch['importo'] : null, 'settoreId' => isset($sessionSearch['settore']) ? $sessionSearch['settore'] : null, 'orderBy' => 'cc.id DESC'), $page, $perPage);
         if (!empty($wrapperDisattivati)) {
             $disattivati = $wrapperDisattivati[0]['disattivati'];
         } else {
             $disattivati = 0;
         }
         $wrapper->setEntityManager($em);
         $wrapperRecords = $wrapper->addAttachmentsFromRecords($wrapper->setupRecords(), array('moduleId' => ModulesContainer::contratti_pubblici_id));
         $paginatorRecords = $this->formatArticoliRecords($wrapperRecords);
         $this->layout()->setVariables(array('tableTitle' => 'Contratti pubblici', 'tableDescription' => $paginator->getTotalItemCount() . " contratti in archivio. " . $disattivati . ' disattivati \\ non visibili online.', 'formSearch' => $formSearch, 'columns' => array("Oggetto del bando", "Struttura proponente \\ responsabili", "Aggiudicatario", "Scelta del contraente", "Importo somme liquidate Euro", "Tempi", "&nbsp;", $userDetails->acl->hasResource("contratti_pubblici_operatori_management") ? "&nbsp;" : null, $userDetails->acl->hasResource("contratti_pubblici_update") ? "&nbsp;" : null, $userDetails->acl->hasResource("contratti_pubblici_delete") ? "&nbsp;" : null, $userDetails->acl->hasResource("contratti_pubblici_home") ? "&nbsp;" : null, $userDetails->acl->hasResource("contratti_pubblici_attachments") ? "&nbsp;" : null), 'paginator' => $paginator, 'sessionSearch' => $sessionSearch, 'records' => $paginatorRecords, 'templatePartial' => 'datatable/datatable_contratti_pubblici.phtml'));
     } catch (\Exception $e) {
         $this->layout()->setVariables(array('messageType' => 'warning', 'messageTitle' => 'Problema verificato', 'messageText' => $e->getMessage(), 'templatePartial' => 'message.phtml'));
     }
     $this->layout()->setTemplate($mainLayout);
 }
 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;
 }
示例#27
0
 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;
 }
示例#28
0
 private function verifierConnexion($redirection = true)
 {
     // Récupération de la session utilisateur
     $utilisateur = new Container('utilisateur');
     if ($utilisateur->offsetGet('connecte', false)) {
         return true;
     } elseif ($redirection) {
         $this->redirect()->toRoute('application_login');
     } else {
         return false;
     }
 }
示例#29
0
 public function getAllMesAction()
 {
     $sender = $this->getRequest()->getPost('sender');
     $sessionContainer = new Container();
     $userData = $sessionContainer->offsetGet("user");
     $getter = $userData['username'];
     $res = $this->getChatMesTable()->getAllMesByGetter($getter, $sender);
     $jsonData = Json::encode($res);
     $view = new ViewModel(array('jsonData' => $jsonData));
     $view->setTerminal(true);
     return $view;
 }
示例#30
0
 public function nuevoAction()
 {
     $this->layout('layout/usuario');
     $this->layout()->reclamo = "active";
     $this->layout()->reclamonuevo = "active";
     //Conectamos con BBDD
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     $reclamo = new ReclamoTable($this->dbAdapter);
     //id =0 [Insertar  Reclamo]
     // id > 0 [Actualizar Reclamo]
     $id = (int) $this->params()->fromRoute('id', 0);
     if ($this->getRequest()->isPost()) {
         $lista = $this->request->getPost();
         //valor fijo, debe ser dinamico o recuperado de la sesion
         $lista['id_usuario'] = '1';
         $id_pk = (int) $lista['id_pk'];
         //Inserta o Actualizar Reclamo
         if ($id_pk > 0) {
             $reclamo->actualizarReclamo($id_pk, $lista);
         } else {
             $reclamo->nuevoReclamo($lista);
         }
         return $this->forward()->dispatch('Usuario\\Controller\\Reclamo', array('action' => 'respuesta'));
         //return $this->redirect()->toUrl($this->getRequest()->getBaseUrl().'/conserje/reclamo/consultar');
     } else {
         $form = new ReclamoForm("form");
         //cargamos el combobox de dpto
         $sid = new Container('base');
         $usuario_id = $sid->offsetGet('id_usuario');
         $dpto = new UnidadTable($this->dbAdapter);
         $nmrodpto = $dpto->getDatosId($usuario_id);
         $form->get('id_dpto')->setAttribute('value', $nmrodpto['0']['nombre']);
         //cargamod el combobox de tipo asunto
         $asunto = new TipoAsuntoTable($this->dbAdapter);
         $form->get('id_tipo_asunto')->setAttribute('options', array('Olores', 'Ruidos Molestos', 'Gastos Comunes'));
         if ($id > 0) {
             $titulo = "Actualizar Reclamo";
             $recuperaDatos = $reclamo->getReclamos($this->dbAdapter, $id);
             $form->get('id_pk')->setAttribute('value', $id);
             $form->get('id_dpto')->setAttribute('value', $recuperaDatos[0]['id_dpto']);
             $form->get('id_tipo_asunto')->setAttribute('value', $recuperaDatos[0]['id_tipo_asunto']);
             $form->get('receptor')->setAttribute('value', $recuperaDatos[0]['receptor']);
             $form->get('descripcion')->setAttribute('value', $recuperaDatos[0]['descripcion']);
         } else {
             $titulo = "Nuevo Reclamo";
         }
     }
     $valores = array('form' => $form, 'url' => $this->getRequest()->getBaseUrl(), "titulo" => $titulo);
     return new ViewModel($valores);
 }