/** * * funcao que executa Esqueci minha Senha * * @author ersilva * * @return type */ public function lostAction() { if (!$this->getRequest()->isPost()) { return; } $data = $this->_getAllParams(); $enterprise = new Model_Enterprise(); $result = $enterprise->lostPassword($data); switch ($result) { case "usuario_nao_existe": $this->view->messageError = "Usuário não encontrado com os dados informados"; break; case "senha_enviada_para_email_cadastrado": $this->view->itemSuccess = true; break; default: $this->view->messageError = "Requisição não efetuada"; break; } /* $createEnterpriseTransaction = $this->Enterprise ->createEnterpriseTransaction($data); if (!$createEnterpriseTransaction['status']) { $this->view->itemSuccess = true; $this->view->messageError = $createEnterpriseTransaction['messageError']; return; } */ //$this->view->itemSuccess = false; //$this->view->messageError = "teste"; //$createEnterpriseTransaction['messageError']; return; }
public function enterpriseHasVerifiedECAC($enterpriseId, $enterpriseIdKey = null) { if ($enterpriseIdKey) { $enterpriseModel = new Model_Enterprise(); $enterpriseId = $enterpriseModel->getEnterpriseByIdKey($enterpriseIdKey)->getId(); } return count($this->dbTable_EnterpriseCategoryAwardCompetition->getVerifiedECACsForEnterprise($enterpriseId)) > 0; }
public function getEnterpriseRow() { $modelUserLocality = new Model_UserLocality(); $modelEnterprise = new Model_Enterprise(); //$userRow = $this->getUserRow(); $userLocalityRow = $modelUserLocality->getUserLocalityByUserId($this->getUserId()); return ($userLocalityRow and $userLocalityRow->getEnterpriseId()) ? $modelEnterprise->getEnterpriseById($userLocalityRow->getEnterpriseId()) : null; }
/** * informa se a empresa preencheu o relato * * @param type $enterpriseId * @return boolean */ function getCurrentEnterpriseReportByEnterpriseIdKey($enterpriseIdKey, $programaId) { $modelEnterprise = new Model_Enterprise(); $enterpriseId = $modelEnterprise->getEnterpriseByIdKey($enterpriseIdKey)->getId(); $return = true; $report = $this->dbTable_EnterpriseReport->fetchRow(array('EnterpriseId = ?' => $enterpriseId, 'CompetitionId = ?' => $programaId)); if (!$report) { $return = false; } return $return; }
private function createPendingCandidatureWarningEmails() { $Execution = new Model_Execution(); $Enterprise = new Model_Enterprise(); $executions = $Execution->getPendingExecutionsByProgramaId($this->competitionId); foreach ($executions as $execution) { $enterprise = $Enterprise->getEnterpriseByUserId($execution->getUserId()); $email = $enterprise->getEmailDefault(); $config = $this->pendingCandidatureWarningEmailConfigurations($execution->getUserId()); if ($email and $email != '') { $recipients = array(array('Address' => $email)); $this->EmailMessage->createWithRecipients($config['Context'], $config['SenderName'], $config['SenderAddress'], $config['Subject'], $config['Body'], $recipients); } } }
public function varEnterpriseRowAndUserId() { $request = Zend_Controller_Front::getInstance()->getRequest(); $key = $request->getParam('id_key', $request->getParam('enterprise-id-key', $request->getParam('enterprise_id_key'))); if ($key) { //echo "-----1----"; $modelEnterprise = new Model_Enterprise(); $UserLocality = new Model_UserLocality(); $enterpriseIdKey = $key; $enterpriseRow = $modelEnterprise->getEnterpriseByIdKey($enterpriseIdKey); $enterpriseId = $enterpriseRow->getId(); $userLocalityGetEnterprise = $UserLocality->getUserLocalityByEnterpriseId($enterpriseRow->getId()); if (!$userLocalityGetEnterprise) { throw new Exception('Nenhum usuário relacionado nesta empresa.'); } $userId = $userLocalityGetEnterprise->getUserId(); } else { $enterpriseRow = Zend_Auth::getInstance()->getIdentity()->getEnterpriseRow(); $enterpriseId = $enterpriseRow['Id']; $userId = $enterpriseRow = Zend_Auth::getInstance()->getIdentity()->getUserId(); } return array('enterpriseId' => $enterpriseId, 'userId' => $userId); }
/** * * @param type $userId * @return type */ public function getEnterpriseData($userId) { $User = new Model_User(); $President = new Model_President(); $Enterprise = new Model_Enterprise(); $UserLocality = new Model_UserLocality(); $AddressEnterprise = new Model_AddressEnterprise(); //$userId = 81; $userRow = $User->getUserById($userId); $userLocalityRow = $UserLocality->getUserLocalityByUserId($userRow->getId()); $enterpriseRow = $Enterprise->getEnterpriseById($userLocalityRow->getEnterpriseId()); $presidentRow = $President->getPresidentByEnterpriseId($enterpriseRow->getId()); $addressEnterpriseRow = $AddressEnterprise->getAddressEnterpriseByEnterpriseId($enterpriseRow->getId()); $arrAnnualRevenue = Vtx_Util_Array::annualRevenue(); $neighborhood = $addressEnterpriseRow->findParentNeighborhood(); $arrEnterprise = array('Registro OCB' => $enterpriseRow->getOcbRegister() != '' ? $enterpriseRow->getOcbRegister() : '', 'Razão Social' => $enterpriseRow->getSocialName() != '' ? $enterpriseRow->getSocialName() : '', 'E-mail' => $enterpriseRow->getEmailDefault() != '' ? $enterpriseRow->getEmailDefault() : '', 'Nome Fantasia' => $enterpriseRow->getFantasyName() != '' ? $enterpriseRow->getFantasyName() : '', 'Ramo de Atividade' => $enterpriseRow->getMetierId() ? DbTable_Metier::getInstance()->getById($enterpriseRow->getMetierId())->getDescription() : '', 'Atividade Econômica(CNAE)' => $enterpriseRow->getCnae() != '' ? $enterpriseRow->getCnae() : '', 'CPF/CNPJ' => $enterpriseRow->getCnpj() != '' ? Vtx_Util_Formatting::maskFormat($enterpriseRow->getCnpj(), '##.###.###/####-##') : '', 'Porte da Empresa' => $enterpriseRow->getAnnualRevenue() != '' && isset($arrAnnualRevenue[$enterpriseRow->getAnnualRevenue()]) ? $arrAnnualRevenue[$enterpriseRow->getAnnualRevenue()] : '', 'Número de Colaboradores' => $enterpriseRow->getEmployeesQuantity() != '' ? $enterpriseRow->getEmployeesQuantity() : '', 'Data de Abertura' => $enterpriseRow->getCreationDate() != '' ? Vtx_Util_Date::format_dma($enterpriseRow->getCreationDate()) : '', 'Endereço' => is_object($addressEnterpriseRow) ? $addressEnterpriseRow->getStreetNameFull() : '', 'Número' => is_object($addressEnterpriseRow) ? $addressEnterpriseRow->getStreetNumber() : '', 'Complemento' => is_object($addressEnterpriseRow) ? $addressEnterpriseRow->getStreetCompletion() : '', 'Bairro' => $neighborhood ? $addressEnterpriseRow->findParentNeighborhood()->getName() : '', 'Cidade/Estado' => is_object($addressEnterpriseRow) ? DbTable_City::getInstance()->getById($addressEnterpriseRow->getCityId())->getName() . "/" . DbTable_State::getInstance()->getById($addressEnterpriseRow->getStateId())->getUf() : '', 'CEP' => is_object($addressEnterpriseRow) ? Vtx_Util_Formatting::maskFormat($addressEnterpriseRow->getCep(), '#####-###') : ''); $arrContact = array('Nome' => is_object($presidentRow) ? $presidentRow->getName() : '', 'Cargo' => is_object($presidentRow) ? 'Presidente' : '', 'Telefone' => is_object($presidentRow) ? $presidentRow->getPhone() : '', 'E-mail' => is_object($presidentRow) ? $presidentRow->getEmail() : '', 'Cpf' => Vtx_Util_Formatting::maskFormat($presidentRow->getCpf(), '###.###.###-##')); $arrIssues = array('0' => array('Q' => '1. É uma Matriz?', 'R' => $enterpriseRow->getHeadOfficeStatus() == '1' ? 'Sim' : 'Não'), '1' => array('Q' => '2. É uma Singular?', 'R' => $enterpriseRow->getSingularStatus() == '1' ? 'Sim' : 'Não'), '2' => array('Q' => '3. A empresa está vinculada a alguma Central?', 'R' => $enterpriseRow->getCentralName() != '' ? $enterpriseRow->getCentralName() : 'Não'), '3' => array('Q' => '4. A empresa está vinculada a alguma Federação?', 'R' => $enterpriseRow->getFederationName() != '' ? $enterpriseRow->getFederationName() : 'Não'), '4' => array('Q' => '5. A empresa está vinculada a alguma Confederação?', 'R' => $enterpriseRow->getConfederationName() != '' ? $enterpriseRow->getConfederationName() : 'Não')); return array($arrEnterprise, $arrContact, $arrIssues); }
public function getHasEligibility() { $modelEnterprise = new Model_Enterprise(); return $modelEnterprise->hasEligibilityRules($this->getIdKey()); }
public function verificacaoAction() { $seconds = 360; //3 minutos set_time_limit($seconds); $limit = $this->_getParam('limit'); $enterpriseProgramaIdMaiorQue = $this->_getParam('maiorque'); //mpe9 / mpe9 if (isset($limit) && isset($enterpriseProgramaIdMaiorQue)) { /**************************************************************/ //Ex: http://site-ambiente/questionnaire/devolutive/index/?limit=10&maiorque=96 $QUEM_FARA_PROCESSAMENTO = "Pontuacao_Em_Massa"; //Devolutiva_Em_Massa $this->Devolutive->setStartProcessamentoEmMassa(true); //execucao em massa de geracao devolutiva $this->cligrava($limit, $enterpriseProgramaIdMaiorQue, $QUEM_FARA_PROCESSAMENTO); exit; } /*if (!$this->getRequest()->isPost()) { return; } * */ $this->questionnaire_id = $this->_getParam('qstn'); if (!$this->questionnaire_id) { $this->questionnaire_id = $this->Questionnaire->getCurrentExecution()->getId(); } //////////////////////// // Calcula Pontuacao Caracteristica Empreendedora // $n = new Model_BlockEnterpreneurGrade(); // $QuestionnaireId=50; // $BlockId=60; // $UserId=2; // $CompetitionId = 2013; // $x = $n->execProcPontuacaoGrade($QuestionnaireId, $BlockId, $UserId, $CompetitionId ); // //$x = $n->getBlockById(105); // var_dump($x); // die; //////////////////////// $questionnaire_id = $this->questionnaire_id; //$user_id = Zend_Auth::getInstance()->getIdentity()->getUserId(); $user_id = $this->enterprise->getUserIdByIdKey($this->_getParam('enterprise-id-key')); //$user_id = $this->_getParam('enterprise-user'); $enterprise = $this->enterprise->getEnterpriseByUserId($user_id); $enterpriseId = $enterprise->getId(); //desabilita layout $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); //recupera e valida questionario if (!$this->recuperaValidaQuestionario($questionnaire_id)) { $this->view->questionnaire_id = ""; throw new Exception($this->_messagesError['questionnaireNotExists']); return; } //relatoNotAnswered if (!$this->report->getCurrentEnterpriseReportByEnterpriseId($enterpriseId)) { $this->view->questionnaire_id = ""; $this->view->messageError = $this->_messagesError['relatoNotAnswered']; //echo 'relato nao respondido: '.$this->view->messageError; return; } //verifica se questoes foram respondidas if (!$this->verificaQuestoesRespondidas($questionnaire_id, $user_id)) { $this->view->questionnaire_id = ""; $this->view->messageError = $this->_messagesError['questionnaireNotFullyAnswered']; return; } //permissoes de acesso $userLogged = Zend_Auth::getInstance()->getIdentity(); $this->loggedUserId = $userLogged->getUserId(); $permissionEvaluationOfResponse = $this->Acl->isAllowed($userLogged->getRole(), 'management:questionnaire', 'evaluation-of-response'); //seta dados para objeto Devolutive $this->Devolutive->setDevolutiveId($this->devolutive_id); $this->Devolutive->setIsRA($permissionEvaluationOfResponse); $this->Devolutive->setQuestionnaireId($questionnaire_id); $this->Devolutive->setUserId($user_id); //ids dos blocos sao setados $this->validaBlocosQuestionario($questionnaire_id); $competitionId = Zend_Registry::get('configDb')->competitionId; //exec procedures $this->processaCaracteristicaEmpreendedora($questionnaire_id, $user_id, $this->Devolutive->getBlockIdEmpreendedorismo(), $competitionId); /** faz geracao e processamento do Protocolo Id da devolutiva **/ $geraProtocolo = $this->modelProtocolo->geracaoDoProtocolo($this->view, $this->Devolutive, $this->Execution, new Model_User(), $questionnaire_id, $user_id, $this->loggedUserId, $competitionId, $permissionEvaluationOfResponse); /** * model responsavel pelas regras negocio de geracao da devolutiva */ $devolutiveAlreadyExists = $this->Devolutive->devolutivaJaExiste(); $devolutivePath = $this->Devolutive->makePdfDevolutive(); if ($geraProtocolo) { //se protocolo foi gerado //grava caminho da devolutiva gerada na tabela de protocolo devolutiva $this->modelProtocolo->updateDevolutivaPath($devolutivePath, $this->Devolutive->getProtocoloIdDevolutiva()); } //valores default para Pontuacao $this->Devolutive->configuraGravaPontuacaoExecution($user_id); //recupera pontuacao e processa pontuacao $this->Devolutive->processaPontuacaoBlocosDeUmQuestionario(); if (!$devolutiveAlreadyExists) { $pdf = new Report_Devolutive_PDF($this->Devolutive, APPLICATION_PATH . '/../htdocs' . $devolutivePath); $pdf->saveToFile(); } if ($devolutivePath and $geraProtocolo) { $modelLogCadastroEmpresa = new Model_LogCadastroEmpresa(); // Insere LOG de quem gerou o PDF. $modelLogCadastroEmpresa->createLogDevolutiva($this->loggedUserId, $enterpriseId); } //informa url onde o pdf da devolutiva foi gravado if ($devolutivePath) { $this->view->itemSuccess = true; $this->view->devolutive = $devolutivePath; //link para regerar a devolutive $this->view->regerar_devolutive = $this->view->baseUrl('questionnaire/respond') . "/index/geraDevolutiva/1/regerar/1/enterprise-id-key/" . $this->_getParam('enterprise-id-key'); $this->view->permissaoCadastrar = $this->Acl->isAllowed($this->auth->getIdentity()->getRole(), 'management:enterprise', 'cadastro'); return; } $this->view->messageError = 'Náo foi possível a geração da devolutiva.'; }
/** * dados da empresa * * @param type $userId * @return type */ public function getEnterpriseData($userId) { $User = new Model_User(); //$President = new Model_President(); $Enterprise = new Model_Enterprise(); $UserLocality = new Model_UserLocality(); $AddressEnterprise = new Model_AddressEnterprise(); $Position = new Model_Position(); $userRow = $User->getUserById($userId); $userLocalityRow = $UserLocality->getUserLocalityByUserId($userRow->getId()); $enterpriseRow = $Enterprise->getEnterpriseById($userLocalityRow->getEnterpriseId()); //var_dump('EnterpriseId: ',$enterpriseRow->getId()); //$presidentRow = $President->getPresidentByEnterpriseId($enterpriseRow->getId()); $addressEnterpriseRow = $AddressEnterprise->getAddressEnterpriseByEnterpriseId($enterpriseRow->getId()); $arrAnnualRevenue = Vtx_Util_Array::annualRevenue(); $arrCategoria = Vtx_Util_Array::categoriaMpe(); $idCategoria = $enterpriseRow->getCategoriaId(); $nomeCategoria = ""; if (is_int($idCategoria)) { $nomeCategoria = $arrCategoria[$idCategoria]; } $arrTipoEmpresa = Vtx_Util_Array::tipoEmpresaMPE(); $idTipoEmpresa = $enterpriseRow->getEnterpriseTypeId(); $tipoEmpresa = ""; if (is_int($idTipoEmpresa)) { $tipoEmpresa = $arrTipoEmpresa[$idTipoEmpresa]; } // var_dump('addressEnterpriseRow: ',$addressEnterpriseRow); // exit; $neighborhood = $addressEnterpriseRow->findParentNeighborhood(); //var_dump('neighborhood: ',$neighborhood); $idUf = $addressEnterpriseRow->getStateId(); $idCidade = $addressEnterpriseRow->getCityId(); //var_dump($idCidade); //var_dump($idUf); if (is_int($idUf)) { $uf = DbTable_State::getInstance()->getById($idUf)->getUf(); } else { $uf = ""; } if (is_int($idCidade)) { $cidade = DbTable_City::getInstance()->getById($idCidade)->getName(); } else { $cidade = ""; } $cidadeEstado = $cidade . "/" . $uf; //var_dump ($cidadeEstado); exit; //var_dump($cidadeEstado); //exit; $cnpj = $enterpriseRow->getCnpj(); if (is_string($cnpj)) { $cpfCnpj = $cnpj; } else { $cpfCnpj = ""; } //$cnpjMask = Vtx_Util_Formatting::maskFormat($getcnpj,'##.###.###/####-##'); //$cnpj = null; //var_dump($cnpj); //exit; $arrEnterprise = array('Razão Social' => $enterpriseRow->getSocialName() != '' ? $enterpriseRow->getSocialName() : '', 'E-mail' => $enterpriseRow->getEmailDefault() != '' ? $enterpriseRow->getEmailDefault() : '', 'Nome Fantasia' => $enterpriseRow->getFantasyName() != '' ? $enterpriseRow->getFantasyName() : '', 'Atividade Econômica(CNAE)' => $enterpriseRow->getCnae() != '' ? $enterpriseRow->getCnae() : '', 'CPF/CNPJ' => $cpfCnpj, 'Faturamento Anual' => $enterpriseRow->getAnnualRevenue() != '' && isset($arrAnnualRevenue[$enterpriseRow->getAnnualRevenue()]) ? $arrAnnualRevenue[$enterpriseRow->getAnnualRevenue()] : '', 'Número de Colaboradores' => $enterpriseRow->getEmployeesQuantity() != '' ? $enterpriseRow->getEmployeesQuantity() : '0', 'Data de Abertura' => $enterpriseRow->getCreationDate() != '' ? Vtx_Util_Date::format_dma($enterpriseRow->getCreationDate()) : '', 'Endereço' => is_object($addressEnterpriseRow) ? $addressEnterpriseRow->getStreetNameFull() : '', 'Número' => is_object($addressEnterpriseRow) ? $addressEnterpriseRow->getStreetNumber() : '', 'Complemento' => is_object($addressEnterpriseRow) ? $addressEnterpriseRow->getStreetCompletion() : '', 'Bairro' => $neighborhood ? $addressEnterpriseRow->findParentNeighborhood()->getName() : '', 'Cidade/Estado' => $cidadeEstado, 'CEP' => is_object($addressEnterpriseRow) ? Vtx_Util_Formatting::maskFormat($addressEnterpriseRow->getCep(), '#####-###') : '', 'Categoria' => $nomeCategoria, 'Tipo Empresa' => $tipoEmpresa); $idPosition = $userRow->getPositionId(); $cargo = ""; if (is_int($idPosition)) { $posicao = $Position->getPosition($idPosition); $cargo = $posicao ? $posicao->getDescription() : ''; } $arrContact = array('Nome' => is_object($userRow) ? $userRow->getNomeCompleto() : '', 'Cargo' => is_object($userRow) ? $cargo : '', 'Telefone' => is_object($userRow) ? $userRow->getTelefone() : '', 'Celular' => is_object($userRow) ? $userRow->getCelular() : '', 'E-mail' => is_object($userRow) ? $userRow->getEmail() : ''); $arrIssues = array(); return array($arrEnterprise, $arrContact, $arrIssues); }
/** * envia msg de email apos geracao da devolutiva * * @param type $arrEnterprise * @param type $userId * @param type $caminhoDevolutiva */ public function enviaEmailAposGeracaoDevolutiva($arrEnterprise, $userId, $caminhoDevolutiva = '') { $modelEnterprise = new Model_Enterprise(); $objEnterprise = $modelEnterprise->getEnterpriseByUserId($userId); // Envia o e-mail com o link da devolutiva para download. $to = $arrEnterprise['E-mail']; $r = $this->msgMpeSendMailDevolutive($caminhoDevolutiva); $eQueue = new Model_EmailQueue(false); //para não rodar select no statusQueue $eQueue->setEmailQueue($to, $r['from'], $r['subject'], $r['message'], '', 'ESPERA'); // Email 6 // $modelEnterprise->sendMailToGestor($objEnterprise->getId(), 'email6'); }