protected function _filterInputQuestion($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'term' => array(array('Alnum', array('allowwhitespace' => true))), 'description' => array(array('HtmlEntities'))), array('term' => array('NotEmpty'), 'description' => array('NotEmpty')), $params, array('presence' => 'required')); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputGroup($params) { $input = new Zend_Filter_Input(array('name' => array(), 'description' => array()), array('name' => array('NotEmpty', 'messages' => array('O Nome não pode ser vazio.')), 'description' => array('NotEmpty', 'messages' => array('A Descrição não pode ser vazia.'))), $params, array('presence' => 'required')); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputBlock($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'value' => array(array('Alnum', array('allowwhitespace' => true))), 'long_description' => array(), 'conclusion_text' => array(array('Alnum', array('allowwhitespace' => true)))), array('questionnaire_id' => array('NotEmpty'), 'designation' => array('allowEmpty' => true), 'value' => array('NotEmpty', 'messages' => array('O nome do bloco não pode ser vazio.')), 'long_description' => array('allowEmpty' => true), 'conclusion_text' => array('allowEmpty' => true)), $params, array('presence' => 'required')); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputAnnualResult($params) { $input = new Zend_Filter_Input(array('*' => array('StringTrim'), 'value' => array()), array('question_id' => array(), 'mask' => array('NotEmpty', 'messages' => array('Escolha a máscara do Resultado Anual.')), 'value' => array('NotEmpty', 'messages' => array('Escolha o nome do Resultado Anual.'))), $params, array('presence' => 'required')); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputServiceArea($params) { $input = new Zend_Filter_Input(array(), array('regional_id' => array('NotEmpty', 'presence' => 'required'), 'StateId' => array('allowEmpty' => true), 'CityId' => array('allowEmpty' => true), 'NeighborhoodId' => array('allowEmpty' => true)), $params); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputLogCadastroEmpresa($params) { $input = new Zend_Filter_Input(array(), array('user_id_log' => array('NotEmpty', 'presence' => 'required'), 'enterprise_id' => array('NotEmpty', 'messages' => array('Erro ao cadastrar empresa.'), 'presence' => 'required'), 'programa_id' => array('NotEmpty', 'messages' => array('Erro ao cadastrar empresa.'), 'presence' => 'required'), 'acao' => array('NotEmpty', 'messages' => array('Erro ao cadastrar empresa.'), 'presence' => 'required')), $params, array()); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputEnterpriseProgramaRank($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim')), array('enterprise_id_key' => array('allowEmpty' => true), 'user_id' => array('allowEmpty' => true), 'programa_id' => array('allowEmpty' => true), 'classificar' => array('allowEmpty' => true), 'desclassificar' => array('allowEmpty' => true), 'justificativa' => array('allowEmpty' => true), 'classificado_verificacao' => array('allowEmpty' => true), 'desclassificado_verificacao' => array('allowEmpty' => true), 'motivo_desclassificado_verificacao' => array('allowEmpty' => true), 'classificado_ouro' => array('allowEmpty' => true), 'classificado_prata' => array('allowEmpty' => true), 'classificado_bronze' => array('allowEmpty' => true), 'desclassificado_final' => array('allowEmpty' => true), 'motivo_desclassificado_final' => array('allowEmpty' => true), 'classificar_nacional' => array('allowEmpty' => true), 'desclassificar_nacional' => array('allowEmpty' => true), 'motivo_desclassificado_nacional' => array('allowEmpty' => true), 'classificar_fase2_nacional' => array('allowEmpty' => true), 'desclassificar_fase2_nacional' => array('allowEmpty' => true), 'motivo_desclassificado_fase2_nacional' => array('allowEmpty' => true), 'classificado_ouro_nacional' => array('allowEmpty' => true), 'classificado_prata_nacional' => array('allowEmpty' => true), 'classificado_bronze_nacional' => array('allowEmpty' => true), 'classificar_fase3_nacional' => array('allowEmpty' => true), 'desclassificar_fase3_nacional' => array('allowEmpty' => true), 'motivo_desclassificado_fase3_nacional' => array('allowEmpty' => true)), $params); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputAddressPresident($params) { $input = new Zend_Filter_Input(array('cep' => array(array('Alnum', array('allowwhitespace' => true)), array('StripTags', 'StringTrim')), 'street_name_full' => array(array('Alnum', array('allowwhitespace' => true)), array('StripTags', 'StringTrim'))), array('address_id' => array('allowEmpty' => true), 'president_id' => array('NotEmpty', 'presence' => 'required'), 'cep' => array('NotEmpty', 'messages' => array('Digite apenas números no CEP da candidata.'), 'presence' => 'required'), 'state_id' => array('NotEmpty', 'messages' => array('Escolha o estado da candidata.')), 'city_id' => array('NotEmpty', 'messages' => array('Escolha a cidade da candidata.')), 'neighborhood_id' => array('NotEmpty', 'messages' => array('Escolha o bairro da candidata.')), 'name_full_log' => array('NotEmpty', 'messages' => array('Digite o nome da Rua da candidata.')), 'street_number' => array('NotEmpty', 'messages' => array('Digite o Número da Rua da candidata.')), 'street_completion' => array('allowEmpty' => true)), $params); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputUserLocality($params) { $input = new Zend_Filter_Input(array(), array('user_id' => array('NotEmpty', 'presence' => 'required'), 'enterprise_id' => array('allowEmpty' => true), 'regional_id' => array('allowEmpty' => true)), $params); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputRoleQuestionnaire($params) { $input = new Zend_Filter_Input(array(), array('role_id' => array('NotEmpty', 'messages' => array('Escolha o Papel (perfil)')), 'questionnaire_id' => array('NotEmpty', 'messages' => array('Escolha o questionário')), 'start_date' => array('NotEmpty', new Zend_Validate_Date('dd/MM/yyyy')), 'end_date' => array('NotEmpty', new Zend_Validate_Date('dd/MM/yyyy'))), $params, array('presence' => 'required')); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputEmailQueue($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'answer_value' => array(array('Alnum', array('allowwhitespace' => true)))), array('alternative_id' => array('NotEmpty'), 'answer_value' => array('allowEmpty' => true), 'start_time' => array('allowEmpty' => true), 'end_time' => array('allowEmpty' => true), 'answer_date' => array('allowEmpty' => true), 'user_id' => array('NotEmpty'), 'logged_user_id' => array('NotEmpty')), $params, array('presence' => 'required')); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputPresident($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'name' => array(), 'cpf' => array('Digits')), array('enterprise_id' => array('NotEmpty', 'presence' => 'required'), 'education_id' => array('NotEmpty', 'messages' => array('Escolha o Nivel de Escolaridade.'), 'presence' => 'required'), 'position_id' => array('NotEmpty', 'messages' => array('Escolha o Cargo.'), 'presence' => 'required'), 'find_us_id' => array('NotEmpty', 'messages' => array('Selecione o item como nos conheceu.'), 'presence' => 'required'), 'name' => array('NotEmpty', 'messages' => array('Digite o Nome da candidata.'), 'presence' => 'required'), 'nick_name' => array('allowEmpty' => true), 'cpf' => array('NotEmpty', 'messages' => array('Digite o CPF.'), new Vtx_Validate_Cpf()), 'email' => array('allowEmpty' => true), 'phone' => array('allowEmpty' => true), 'cellphone' => array('allowEmpty' => true), 'born_date' => array('NotEmpty', 'messages' => array('Digite a Data de Nascimento.'), 'presence' => 'required', new Zend_Validate_Date('dd/MM/yyyy')), 'gender' => array('allowEmpty' => true), 'newsletter_email' => array('allowEmpty' => true), 'newsletter_mail' => array('allowEmpty' => true), 'newsletter_sms' => array('allowEmpty' => true), 'agree' => array('NotEmpty', 'messages' => array('É necessário aceitar o regulamento'), 'presence' => 'required'), 'created' => array('allowEmpty' => true)), $params, array()); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputConfiguration($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim')), array(), $params, array('presence' => 'required')); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputAnnualResultData($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'value' => array(array('Alnum', array('allowwhitespace' => true))), 'Year' => array(array('Digits', array('allowwhitespace' => true)))), array('annual_result_id' => array('NotEmpty'), 'year' => array('allowEmpty' => true), 'value' => array('allowEmpty' => true)), $params, array('presence' => 'required')); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputECAC($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim')), array('enterprise_id' => array('NotEmpty', 'messages' => array('Erro ao cadastrar empresa'), 'presence' => 'required'), 'competition_id' => array('NotEmpty', 'messages' => array('Erro ao cadastrar empresa'), 'presence' => 'required'), 'category_award_id' => array('NotEmpty', 'messages' => array('Escolha a categoria do premio'), 'presence' => 'required'), 'token' => array('allowEmpty' => true)), $params); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputAnswerFeedbackImprove($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim')), array('user_id' => array('NotEmpty'), 'answer_id' => array('NotEmpty'), 'feedback_improve' => array('NotEmpty')), $params, array('presence' => 'required')); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputAlternative($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'designation' => array(array('Alnum', array('allowwhitespace' => true))), 'value' => array(), 'feedback_default' => array(), 'dialogue_description' => array()), array('alternative_type_id' => array('allowEmpty' => true), 'question_id' => array('NotEmpty'), 'designation' => array('NotEmpty'), 'value' => array('NotEmpty', 'messages' => array('O nome da alternativa não pode ser vazio.')), 'version' => array(), 'status' => array(), 'score_level' => array('allowEmpty' => true), 'feedback_default' => array('allowEmpty' => true), 'dialogue_description' => array('allowEmpty' => true)), $params, array('presence' => 'required')); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputQuestion($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'question_type_id' => array(array('Alnum', array('allowwhitespace' => true))), 'parent_id' => array(array('Alnum', array('allowwhitespace' => true))), 'designation' => array(array('Alnum', array('allowwhitespace' => true))), 'supporting_text' => array(), 'value' => array(), 'version' => array(), 'status' => array(array('Alnum', array('allowwhitespace' => true)))), array('question_type_id' => array('NotEmpty'), 'parent_id' => array('NotEmpty'), 'designation' => array('NotEmpty'), 'supporting_text' => array('allowEmpty' => true), 'value' => array('NotEmpty', 'messages' => array('O nome da questão não pode ser vazia.')), 'version' => array(), 'status' => array('NotEmpty')), $params, array('presence' => 'required')); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputReport($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'report' => array(), 'title' => array()), array('enterprise_id' => array('allowEmpty' => true), 'competition_id' => array('allowEmpty' => true), 'report' => array('allowEmpty' => true), 'title' => array('allowEmpty' => true)), $params); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputUser($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim')), array('first_name' => array('NotEmpty', 'messages' => array('Digite o Nome da candidata.'), 'presence' => 'required'), 'surname' => array('allowEmpty' => true), 'email' => array('allowEmpty' => true), 'login' => array('allowEmpty' => true), 'password' => array(), 'position_id' => array('allowEmpty' => true), 'education_id' => array('allowEmpty' => true), 'born_date' => array('allowEmpty' => true), 'gender' => array('allowEmpty' => true), 'cpf' => array('allowEmpty' => true, new Vtx_Validate_Cpf()), 'password_hint' => array('allowEmpty' => true), 'status' => array('allowEmpty' => true)), $params); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputRole($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'roleName' => array('Alpha', array('StringToLower', 'encoding' => 'UTF-8'), new Vtx_Filter_Transliterate())), array('longDescription' => array('NotEmpty'), 'roleName' => array('NotEmpty', 'messages' => $this->_messagesError['roleNameExists'])), $params, array('presence' => 'required')); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
public function filterAnswerForm($parameters) { $filters = array('*' => 'StripTags', 'question_id' => 'StringTrim', 'alternative_id' => 'StringTrim', 'start_time' => 'StringTrim'); $validator = array('question_id' => array('NotEmpty', 'messages' => $this->_messagesError['AnswerFormError'] . 'Questão'), 'alternative_id' => array('NotEmpty', 'messages' => $this->_messagesError['AnswerFormError'] . 'Alternativa'), 'answer_value' => array('allowEmpty' => true), 'start_time' => array('NotEmpty', new Zend_Validate_Date('H:i:s'))); $options = array('presence' => 'required'); $input = new Zend_Filter_Input($filters, $validator, $parameters, $options); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputQuestionTip($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'question_id' => array(array('Alnum', array('allowwhitespace' => false))), 'question_tip_type_id' => array(array('Alnum', array('allowwhitespace' => false))), 'value' => array()), array('question_id' => array('NotEmpty'), 'question_tip_type_id' => array('NotEmpty'), 'value' => array('NotEmpty')), $params, array('presence' => 'required')); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputAppraiserToEnterprise($params) { $input = new Zend_Filter_Input(array('enterprise_id' => array()), array('enterprise_id' => array('NotEmpty', 'messages' => array('Empresa não informada.'))), $params, array('presence' => 'required')); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputIdentify($parameters) { $filters = array('*' => 'StripTags', 'operation_beginning' => 'StringTrim', 'operation_ending' => 'StringTrim'); $validator = array('title' => array('NotEmpty', 'messages' => $this->_messagesError['questionnaireFormError'] . 'Título'), 'description' => array('NotEmpty', 'messages' => $this->_messagesError['questionnaireFormError'] . 'Descrição'), 'long_description' => array('NotEmpty', 'messages' => $this->_messagesError['questionnaireFormError'] . 'Texto Complementar'), 'operation_beginning' => array('NotEmpty', new Zend_Validate_Date('dd/MM/yyyy')), 'operation_ending' => array('NotEmpty', new Zend_Validate_Date('dd/MM/yyyy')), 'public_subscription_ends_at' => array('allowEmpty' => true), 'internal_subscription_ends_at' => array('allowEmpty' => true), 'devolutive_id' => array('NotEmpty', 'messages' => $this->_messagesError['questionnaireFormError'] . 'Tipo de Devolutiva')); $options = array('presence' => 'required'); $input = new Zend_Filter_Input($filters, $validator, $parameters, $options); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }
protected function _filterInputIdentify($params) { $validators = array('aceitoTermo' => array('NotEmpty', 'messages' => array($this->error['termo']), 'presence' => 'required'), 'aceitoPolitica' => array('NotEmpty', 'messages' => array($this->error['politica']), 'presence' => 'required'), 'aceitoInfo' => array('allowEmpty' => true), 'aceitoPromo' => array('allowEmpty' => true), 'package' => array('allowEmpty' => false, 'presence' => 'required'), 'phone' => array('allowEmpty' => false, 'presence' => 'required'), 'password' => array('allowEmpty' => false, 'presence' => 'required')); if (!empty($params['aceitoInfo']) or !empty($params['aceitoPromo'])) { $validators['email'] = array('NotEmpty', 'messages' => array($this->error['email']), 'presence' => 'required'); $emailValidator = new Zend_Validate_EmailAddress(); } if (empty($params['aceitoInfo']) and empty($params['aceitoPromo'])) { $params['email'] = date('Ymdhis') . '@titans.com'; $validators['email'] = array('allowEmpty' => true); } $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim')), $validators, $params); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } if (isset($emailValidator) and !$emailValidator->isValid($params['email'])) { throw new Vtx_UserException($this->error['emailInvalid']); } if ((!empty($params['aceitoInfo']) or !empty($params['aceitoPromo'])) and DbTable::getInstance('PacoteAquisicao')->getPacoteAquisicaoByDsEmail($params['email'])->count()) { throw new Vtx_UserException($this->error['emailExists']); } return $input; }
protected function _filterInputEnterprise($params) { $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'cnpj' => array(array('Digits')), 'employees_quantity' => array(array('Digits'))), array('social_name' => array('NotEmpty', 'messages' => array('Digite a Razão Social'), 'presence' => 'required'), 'fantasy_name' => array('NotEmpty', 'messages' => array('Digite o Nome Fantasia'), 'presence' => 'required'), 'status' => array('allowEmpty' => true), 'cnpj' => array('allowEmpty' => true, new Vtx_Validate_Cnpj()), 'creation_date' => array('NotEmpty', new Zend_Validate_Date('dd/MM/yyyy')), 'employees_quantity' => array('NotEmpty', 'messages' => array('Número de colaboradores: Digite apenas números.'), 'Digits'), 'annual_revenue' => array('NotEmpty', 'messages' => array('Escolha o Porte da Empresa.'), 'presence' => 'required'), 'cnae' => array('allowEmpty' => true), 'email_default' => array('allowEmpty' => true), 'phone' => array('NotEmpty', 'messages' => array('Digite o telefone.'), 'presence' => 'required'), 'site' => array('allowEmpty' => true), 'company_history' => array('NotEmpty', 'messages' => array('Digite o Resumo da empresa.'), 'presence' => 'required'), 'category_sector_id' => array('NotEmpty', 'messages' => array('Escolha a Categoria setorial.'), 'presence' => 'required'), 'category_award_id' => array('NotEmpty', 'messages' => array('Escolha a Categoria do Premio.'), 'presence' => 'required'), 'state_registration' => array('allowEmpty' => true), 'dap' => array('allowEmpty' => true), 'register_ministry_fisher' => array('allowEmpty' => true), 'nirf' => array('allowEmpty' => true), 'farm_size' => array('allowEmpty' => true), 'register_ministry_fisher' => array('allowEmpty' => true), 'hasnt_email' => array('allowEmpty' => true)), $params); if ($input->hasInvalid() || $input->hasMissing()) { throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages())); } return $input; }