public function createAnnualResultDataByAlternative($annualResultId, $alternativeId) { // utilizar transaction externa. // Sandra - buscar ciclo atual do configuration //$currentYear = Zend_Registry::get('config')->util->currentYear; $Configuration = new Model_Configuration(); $currentYearRow = $Configuration->getConfigurationByConfKey('competitionIdKey'); $currentYear = $currentYearRow->getConfValue(); for ($i = 1; $i <= 3; $i++) { $annualResultRowData = DbTable_AnnualResultData::getInstance()->createRow()->setAnnualResultId($annualResultId)->setAlternativeId($alternativeId)->setYear($currentYear); $annualResultRowData->save(); $currentYear -= 1; } return array('status' => true); }
public function indexAction() { if (!$this->getRequest()->isPost()) { return; } $Configuration = new Model_Configuration(); $data = $this->getRequest()->getParams(); // Sandra - acessar ciclo atual $currentYearRow = $Configuration->getConfigurationByConfKey('competitionIdKey'); $this->view->ciclo = $currentYearRow->getConfValue(); $to = '*****@*****.**'; $subject = 'Mulher de Negócios 2014 :: Contado enviado pelo site'; $message = nl2br($data['contact']['message']); Model_EmailMessage::createQuicklyWithRecipients('contact_notification', $subject, $message, array($to)); $this->view->itemSendSuccess = true; }
public function errorAction() { // Sandra - acessar ciclo atual $Configuration = new Model_Configuration(); $currentYearRow = $Configuration->getConfigurationByConfKey('competitionIdKey'); $this->view->ciclo = $currentYearRow->getConfValue(); $errors = $this->_getParam('error_handler'); if (!$errors || !$errors instanceof ArrayObject) { $this->view->message = 'You have reached the error page'; return; } switch ($errors->type) { case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE: case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: // 404 error -- controller or action not found $this->getResponse()->setHttpResponseCode(404); $priority = Zend_Log::NOTICE; $this->view->message = 'Page not found'; break; default: // application error $this->getResponse()->setHttpResponseCode(500); $priority = Zend_Log::CRIT; $this->view->message = 'Application error'; break; } // Log exception, if logger available if ($log = $this->getLog()) { $log->log($this->view->message, $priority, $errors->exception); $log->log('Request Parameters', $priority, $errors->request->getParams()); } // conditionally display exceptions if ($this->getInvokeArg('displayExceptions') == true) { $this->view->exception = $errors->exception; } $this->view->request = $errors->request; $this->_helper->layout->disableLayout(); }
public function comunicacaoAction() { $filter = $this->_getParam('filter'); $filter['user_id'] = $this->userAuth->getUserId(); //if(!isset($filter['competition_id'])) $filter['competition_id'] = Zend_Registry::get('configDb')->competitionId; $filter['competition_id'] = Zend_Registry::get('configDb')->competitionId; $this->view->states = $this->State->getByUserLocality($filter['user_id']); // Sandra - acessar ciclo anterior $Configuration = new Model_Configuration(); $currentYearRow = $Configuration->getConfigurationByConfKey('competitionIdKey'); $this->view->ciclo = $currentYearRow->getConfValue(); $this->view->competition = $this->modelCompetition->getByYear($this->view->ciclo); //$this->view->competition = $this->modelCompetition->getByYear(2014); $this->view->filter = $filter; if ($this->getRequest()->isPost()) { $this->createWinningNotificationEmailMessages(); } else { if (isset($filter['state_id'])) { $this->view->stateId = $filter['state_id']; $this->view->competitionId = $filter['competition_id']; $winnersFilter = $enterprisesFilter = $filter; $winnersFilter['only_winners'] = $enterprisesFilter['exclude_winners'] = true; $this->view->defaultMessage = $this->winningNotificationDefaultMessage($this->view->competitionId); $this->view->hasFinalists = $this->State->hasFinalists($this->view->stateId, $this->view->competitionId); $this->view->winners = $this->Enterprise->getAllForParticipationNotification($winnersFilter); $this->view->enterprises = $this->Enterprise->getAllForParticipationNotification($enterprisesFilter); } } }
/** * Initializes default Configuration */ protected function _initSescoopConfiguration() { Zend_Registry::set('programaTipo', 'Psmn'); $configuration = new Model_Configuration(); Zend_Registry::set('configDb', $configuration->getSescoopConfiguration()); }
public function hasEligibilityRules($enterpriseIdKey) { $enterpriseRow = $this->getEnterpriseByIdKey($enterpriseIdKey); $creationDate = $enterpriseRow->getCreationDate(); $annualRevenue = $enterpriseRow->getAnnualRevenue(); $categoryAwardId = $enterpriseRow->getCategoryAwardId(); $employeesQuantity = intval($enterpriseRow->getEmployeesQuantity(), 10); $dataArray = explode('-', $creationDate); $creationDateTS = Vtx_Util_Date::format_dateToTimeStamp($creationDate); //$dtLimite = Vtx_Util_Date::format_dateToTimeStamp('2014-03-01'); // Sandra - data de inscrição não pode ser maior que um ano $Configuration = new Model_Configuration(); $currentYearRow = $Configuration->getConfigurationByConfKey('competitionIdKey'); $anteriorYear = $currentYearRow->getConfValue() - 1; $dtLimite = Vtx_Util_Date::format_dateToTimeStamp($anteriorYear . '-03-01'); $cDTS = date('d/m/Y', $creationDateTS); $rule = '0'; $dataInscricao = FALSE; if ($dtLimite < $creationDateTS) { $dataInscricao = TRUE; // indica data invalida } /* echo $dataInscricao; echo '<pre>'; var_dump($dtLimite, $creationDateTS, $creationDate,$cDTS,$employeesQuantity); die; if ($categoryAwardId == 3 and $annualRevenue >= 2) { var_dump($annualRevenue, $categoryAwardId); if ($annualRevenue >= 2) { echo 'passou >= 2<br>'; } } */ switch ($categoryAwardId) { case '1': // Pequenos negócios; somente 1 ano ou mais // if ($dataInscricao) { $rule = '2'; // data invalida } //faturamento menos que 3,6mi ok // sempre TRUE break; case '2': // Produtora Rural; somente 1 ano ou mais //faturamento menos que 3,6mi ok if ($dataInscricao) { $rule = '2'; // data invalida } break; case '3': // Microempreendedora individual; 1 ano ou mais e faturamento acima de 60k //1 empregado ou mais //faturamento 60k ou menos que 3,6 milhoes ok if ($annualRevenue >= 2 and $dataInscricao) { // annualRevenuePsmn $rule = '1'; // fat e data invalida } else { if ($dataInscricao) { $rule = '2'; // data invalida } else { if ($annualRevenue >= 2) { $rule = '3'; } } } break; default: //$rule = FALSE; break; } return $rule; /* */ }
public function indexAction() { $Acl = Zend_Registry::get('acl'); $auth = Zend_Auth::getInstance(); $this->view->getAllStates = $this->State->getAll(); $this->view->getAllPositions = $this->Position->getAll(); $this->view->getAllEducations = $this->Education->getAll(); $this->view->getAllMetier = $this->Metier->getAll(); $this->view->getAllPresidentProgramType = $this->modelPresidentProgramType->getAll(); $this->view->hasECAC = false; $this->view->editStatus = false; $this->view->subscriptionPeriodIsClosed = !$this->subscriptionPeriodIsOpen(); $Configuration = new Model_Configuration(); // Sandra - acessar ciclo atual $currentYearRow = $Configuration->getConfigurationByConfKey('competitionIdKey'); $this->view->ciclo = $currentYearRow->getConfValue(); $this->view->cicloAnt = $this->view->ciclo - 1; // caso primeiro cadastro apos busca do login if ($this->_getParam('forward', null) == 'true' and !$this->_getParam('id')) { $this->view->registerPresidentData = array('cpf' => $this->_getParam('cpf', null)); return; } if ($auth->hasIdentity()) { if ($Acl->isAllowed($auth->getIdentity()->getRole(), 'questionnaire:register', 'publisher')) { $this->view->editStatus = true; $logCadastroEmpresa['user_id_log'] = $this->userLogged->getUserId(); } } if (!$this->getRequest()->isPost()) { $this->_helper->_layout->setLayout('new-qstn'); return; } unset($this->view->getAllStates); unset($this->view->getAllPositions); unset($this->view->getAllEducations); unset($this->view->getAllMetier); unset($this->view->getAllPresidentProgramType); unset($this->view->hasECAC); unset($this->view->editStatus); if ($this->view->subscriptionPeriodIsClosed) { $this->view->messageError = 'Não é possível cadastrar uma nova candidata: As inscrições foram encerradas.'; return; } $ficha = $this->_getAllParams(); if (isset($logCadastroEmpresa)) { $ficha['log_cadastro_empresa'] = $logCadastroEmpresa; } $createEnterpriseTransaction = $this->Enterprise->createEnterpriseTransaction($ficha); if (!$createEnterpriseTransaction['status']) { $this->view->messageError = $createEnterpriseTransaction['messageError']; $this->view->errorCode = $createEnterpriseTransaction['errorCode']; return; } $this->view->enterpriseIdKey = $enterpriseIdKey = $createEnterpriseTransaction['lastInsertIdKey']; $this->view->itemSuccess = true; $emailEnterprise = isset($ficha['enterprise']['email_default']) ? $ficha['enterprise']['email_default'] : ''; $socialName = $ficha['enterprise']['social_name']; $cnpj = $ficha['enterprise']['cnpj']; if ($this->view->itemSuccess && ($emailEnterprise == null || $emailEnterprise == '')) { $stateId = $ficha['addressEnterprise']['state_id']; $this->sendWhiteListMail($stateId, $socialName, $cnpj); } $hasEligibility = $this->Enterprise->hasEligibilityRules($enterpriseIdKey); if (!$auth->hasIdentity()) { $this->view->loadUrlRegister = $this->view->baseUrl('/questionnaire/register/success/itemInsertSuccess/true/cpf/' . $ficha['president']['cpf'] . '/hasEligibility/' . $hasEligibility); //$this->view->redirectUrlRegister = $this->view->baseUrl('/login'); return; } if ($Acl->isAllowed($auth->getIdentity()->getRole(), 'questionnaire:register', 'publisher')) { $this->view->loadUrlRegister = $this->view->baseUrl('/management/enterprise/success/itemInsertSuccess/true/social_name/' . urlencode($ficha['enterprise']['social_name']) . '/enterpriseIdKey/' . $enterpriseIdKey . '/hasEligibility/' . $hasEligibility); return; } }