Beispiel #1
0
 public static function isGestorNational($userLogged = null)
 {
     if (!$userLogged) {
         $userLogged = Zend_Auth::getInstance()->getIdentity();
     }
     if (!Model_User::isGestor($userLogged)) {
         return false;
     }
     $modelUserLocality = new Model_UserLocality();
     $modelRegional = new Model_Regional();
     $regionalId = $modelUserLocality->getUserLocalityByUserId($userLogged->getUserId())->getRegionalId();
     $regionalRow = $modelRegional->getRegionalById($regionalId);
     return $regionalRow->getNational() == 'S';
 }
 public function indexAction()
 {
     if (!isset($this->tipoRelatorio)) {
         $this->tipoRelatorio = 'inscricoes';
     }
     $State = new Model_State();
     $City = new Model_City();
     $model_Metier = new Model_Metier();
     $dbTable_Regional = new DbTable_Regional();
     $modelUserLocality = new Model_UserLocality();
     $modelRegional = new Model_Regional();
     $Neighborhood = new Model_Neighborhood();
     $Regiao = new Model_Regiao();
     $Configuration = new Model_Configuration();
     $modelEnterpriseCategoryAward = new Model_EnterpriseCategoryAward();
     $enterprise = new Model_Enterprise();
     $ApeEvaluationVerificador = new Model_ApeEvaluationVerificador();
     // Sandra - acessar ciclo atual
     $currentYearRow = $Configuration->getConfigurationByConfKey('competitionIdKey');
     $this->view->ciclo = $currentYearRow->getConfValue();
     $this->view->cicloAnt = $this->view->ciclo - 1;
     $format = $this->_getParam('format');
     $this->view->getAllEducations = $this->Education->getAll();
     if ($format == 'csv') {
         //$this->view->getAllPosition = $this->modelPosition->getAll();
         $this->_dorelatorio();
         $this->incluirJoinPontuacao = '1';
         $this->incluirJoinRegional = '1';
     }
     set_time_limit(720);
     //6 minutos
     $ns = new Zend_Session_Namespace('respond');
     $ns->enterpriseUserId = null;
     //constroi url para CSV
     $this->view->urlParaGerarCsv = $this->_construirUrlParaCsv();
     $this->view->getAllEnterpriseCategoryAward = $modelEnterpriseCategoryAward->getAll();
     //finalistas estaduais
     $this->view->getAllApeEvaluationVerificador = $ApeEvaluationVerificador->getAll();
     //$this->view->getAllAnswerVerificador = $modelAnswerVerificador->getAllScore();
     $this->view->getAllRegiao = $Regiao->getAll();
     $this->view->getAllMetier = $model_Metier->getAll();
     $this->view->isRanking = isset($this->view->isRanking) ? $this->view->isRanking : false;
     $this->filterAdditional = isset($this->filterAdditional) ? $this->filterAdditional : $this->_getParam('filter');
     $filter = $this->filterAdditional;
     $this->view->filter = $filter;
     $this->view->hasFilterRegional = true;
     $this->view->hasFilterStatus = true;
     $this->view->getAllStates = $State->getAll();
     if (isset($filter['state_id']) and !empty($filter['state_id'])) {
         $this->view->getAllCities = $City->getAllCityByStateId($filter['state_id']);
     }
     if (isset($filter['city_id']) and !empty($filter['city_id'])) {
         $this->view->getAllNeighborhoods = $Neighborhood->getAllNeighborhoodByCityId($filter['city_id']);
     }
     $this->view->competitionId = Zend_Registry::get('configDb')->competitionId;
     $this->view->getAllCompetition = $this->modelCompetition->getAllCompetition();
     $userLoggedRow = $this->userAuth;
     //$roleRow = $this->aclModel->getRoleById($userLoggedRow->getRoleId(), false);
     $page = $this->_getParam('page');
     $count = $this->_getParam('count', 10);
     $this->orderBy = isset($this->orderBy) ? $this->orderBy : null;
     $orderBy = $this->view->orderBy = $this->_getParam('orderBy', $this->orderBy);
     $filter['appraiser_id'] = isset($filter['appraiser_id']) ? $filter['appraiser_id'] : null;
     $filter['incluir_join_pontuacao'] = isset($this->incluirJoinPontuacao) ? $this->incluirJoinPontuacao : '0';
     $filter['incluir_join_regional'] = isset($this->incluirJoinRegionalForce) ? $this->incluirJoinRegionalForce : (isset($this->incluirJoinRegional) ? $this->incluirJoinRegional : '0');
     $this->view->regionalOption = 'Minha';
     // List Coop by Regional
     $regionalId = $modelUserLocality->getUserLocalityByUserId($userLoggedRow->getUserId())->getRegionalId();
     $this->view->getAllRegional = $getAllRegional = $dbTable_Regional->getAllRegionalByOneRegionalServiceArea(null, $regionalId, 'all', $filter);
     // $this->roleAppraiserId
     if (isset($filter['regional_id']) and $filter['regional_id']) {
         $regionalId = $filter['regional_id'];
     }
     if ($this->showAppraisersFilter) {
         //$filterAp['status'] = 'A'; ,$filterAp
         $this->view->getAllAppraisers = $this->dbTableUser->getAllAppraiserByRegionalServiceArea(null, $regionalId, array('appraiser_status' => 'able'));
     }
     if (!$format) {
         return;
     }
     $groupBy = in_array($this->tipoRelatorio, array('inscricoes', 'ranking', 'classificadas', 'finalistas', 'finalistas-nacional', 'candidatas-nacional', 'classificadas-nacional')) ? 'enterprise_id' : null;
     $this->regionalId = $regionalId;
     $this->filter = $filter;
     $this->paramsBuscaServiceArea = $regionalId ? $modelRegional->getServiceAreaByRegionalId($regionalId) : array(0 => null, 1 => null);
     $fetchReturn = isset($this->fetchReturnForce) ? $this->fetchReturnForce : (isset($this->fetchReturn) ? $this->fetchReturn : 'paginator');
     if ($this->tipoRelatorio != 'inscricoes' || $format == 'csv') {
         $this->view->getAllEnterprise = $this->Enterprise->getAllByColAE($this->paramsBuscaServiceArea[0], $this->paramsBuscaServiceArea[1], $this->autoavaliacaoId, $count, $page, $filter, $orderBy, $format, $fetchReturn, $this->tipoRelatorio, $groupBy);
     } else {
         $loggedUserId = $this->userAuth->getUserId();
         $this->view->getAllEnterprise = $this->Enterprise->getPaginatorForSubscriptions($loggedUserId, $filter, $count, $page);
     }
     $this->view->modelEntCategoryAward = new Model_EnterpriseCategoryAwardCompetition();
 }
Beispiel #3
0
 private function getRegionalFilterAccordWithUserPermission($userId, $requestedRegionalIdFilter)
 {
     $filterRegionalId = intval($requestedRegionalIdFilter);
     $regionalModel = new Model_Regional();
     $userRegional = $regionalModel->getRegionalByUser($userId);
     if (!$userRegional) {
         throw new Exception('access denied');
     }
     $isAdmin = $userRegional->getNational() === 'S';
     $userRegionalId = $userRegional->getId();
     if (!$isAdmin) {
         if ($filterRegionalId == null) {
             $filterRegionalId = $userRegionalId;
         }
         $this->validateUserPrivilegesAtRegional($userRegionalId, $filterRegionalId);
     }
     return $filterRegionalId;
 }
Beispiel #4
0
 public function getAllRegionalByOneRegionalServiceArea($roleId = null, $userLoggedRegionalId, $filter = null, $orderBy = null, $count = null, $offset = null)
 {
     if (isset($userLoggedRegionalId) and $userLoggedRegionalId) {
         $modelRegional = new Model_Regional();
         $regionalRow = $modelRegional->getRegionalById($userLoggedRegionalId);
         $filter['regional_national'] = $regionalRow->getNational();
     }
     $query = $this->dbTable_Regional->getAllRegionalByOneRegionalServiceArea($roleId, $userLoggedRegionalId, 'select', $filter, $orderBy);
     return Zend_Paginator::factory($query)->setItemCountPerPage($count ? $count : null)->setCurrentPageNumber($offset ? $offset : 1);
 }