Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php defined('BASEPATH') || exit('No direct script access allowed');
- class Seja_um_franqueado_model extends WT_Module_Model {
- protected $after_insert = array('send_email');
- public function setupCrud($context = null) {
- //Dados Pessoais
- $this->wtche->form->addField('char')
- ->setFieldName('nome')
- ->setLabel('Nome')
- ->setMaxLength(255)
- ->setValidationRules('required');
- $this->wtche->form->addField('char')
- ->setFieldName('cidade_de_interesse')
- ->setLabel('Cidade de Interesse')
- ->setMaxLength(255)
- ->setValidationRules('required');
- $this->wtche->form->addField('char')
- ->setFieldName('data_de_nascimento')
- ->setLabel('Data de Nascimento')
- ->setMaxLength(255)
- ->setValidationRules('required');
- $this->wtche->form->addField('char')
- ->setFieldName('local_de_nascimento')
- ->setLabel('Local de Nascimento')
- ->setMaxLength(255)
- ->setValidationRules('required');
- $this->wtche->form->addField('char')
- ->setFieldName('rg')
- ->setLabel('RG')
- ->setMaxLength(255)
- ->setValidationRules('required');
- $this->wtche->form->addField('char')
- ->setFieldName('cpf')
- ->setLabel('CPF')
- ->setMaxLength(255)
- ->setValidationRules('required');
- $this->wtche->form->addField('char')
- ->setFieldName('estado_civil')
- ->setLabel('Estado Civil')
- ->setMaxLength(255)
- ->setValidationRules('required');
- $this->wtche->form->addField('char')
- ->setFieldName('regime_de_casamento')
- ->setLabel('Regime de Casamento')
- ->setMaxLength(255)
- ->setValidationRules('required');
- $this->wtche->form->addField('char')
- ->setFieldName('ddd')
- ->setLabel('DDD')
- ->setMaxLength(255)
- ->setValidationRules('required');
- $this->wtche->form->addField('char')
- ->setFieldName('telefone_celular')
- ->setLabel('Telefone Celular')
- ->setMaxLength(255)
- ->setValidationRules('required');
- $this->wtche->form->addField('char')
- ->setFieldName('email')
- ->setLabel('Email')
- ->setMaxLength(255)
- ->setValidationRules('required|valid_email');
- $this->wtche->form->addField('char')
- ->setFieldName('telefone_residencial')
- ->setLabel('Telefone Residencial')
- ->setMaxLength(255)
- ->setValidationRules('required');
- $this->wtche->form->addField('char')
- ->setFieldName('telefone_comercial')
- ->setLabel('Telefone Comercial')
- ->setMaxLength(255)
- ->setValidationRules('required');
- $this->wtche->form->addField('char')
- ->setFieldName('fonte_de_renda')
- ->setLabel('Fonte de renda')
- ->setMaxLength(255)
- ->setValidationRules('required');
- // $this->wtche->form->addField('char')
- // ->setFieldName('cep')
- // ->setLabel('CEP')
- // ->setMaxLength(255)
- // ->setValidationRules('required')
- // ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('endereco')
- ->setLabel('Endereço')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- // $this->wtche->form->addField('char')
- // ->setFieldName('numero')
- // ->setLabel('Número')
- // ->setMaxLength(255)
- // ->setValidationRules('required')
- // ->hideFrom('list');
- // $this->wtche->form->addField('char')
- // ->setFieldName('complemento')
- // ->setLabel('Complemento')
- // ->setMaxLength(255)
- // ->hideFrom('list');
- $this->wtche->form->addField('select')
- ->setFieldName('address_states_id')
- ->setRelation('id', 'address_states', 'name')
- ->setLabel('Estado')
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('select')
- ->setFieldName('address_cities_id')
- ->setRelation('id', 'address_cities', 'name')
- ->setLabel('Cidade')
- ->setDependency('address_states_id', 'address_states_id')
- ->hideFrom('list')
- ->setDependencyTextHelper('Selecione o estado primeiro!');
- //Dados Côjuge
- $this->wtche->form->addField('char')
- ->setFieldName('conjuge_nome')
- ->setLabel('Nome Completo')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('conjuge_data_de_nascimento')
- ->setLabel('Data de Nascimento')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('conjuge_local_de_nascimento')
- ->setLabel('Local de Nascimento')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('conjuge_local_de_nascimento')
- ->setLabel('Local de Nascimento')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('conjuge_rg')
- ->setLabel('RG')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('conjuge_cpf')
- ->setLabel('CPF')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('conjuge_ocupacao')
- ->setLabel('Ocupação')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('conjuge_dependentes')
- ->setLabel('Dependentes')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('conjuge_idade')
- ->setLabel('Idade')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('conjuge_fonte_de_renda')
- ->setLabel('Fonte de Renda')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- //Histórico Profissional
- $this->wtche->form->addField('char')
- ->setFieldName('profissao')
- ->setLabel('Profissão')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('empresa')
- ->setLabel('Empresa')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('ramo')
- ->setLabel('Ramo')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('remuneracao')
- ->setLabel('Remuneração')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('outras_fontes_renda')
- ->setLabel('Outras Fontes de Renda')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('arquivo')
- ->setLabel('Arquivo')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- //Formação Academica
- $this->wtche->form->addField('char')
- ->setFieldName('formacao_academica')
- ->setLabel('Formação Academica')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('instituicao')
- ->setLabel('Instituição')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('curso')
- ->setLabel('Curso')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('ano_de_conclusao')
- ->setLabel('Ano de Conclusão')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- // Investimento
- $this->wtche->form->addField('char')
- ->setFieldName('disponibilidade_financeira')
- ->setLabel('Disponibilidade Financeira')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('rendimento_mensal')
- ->setLabel('Rendimento Mensal')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('tempo_estimado')
- ->setLabel('Tempo Estimado de Retorno')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- //Dados Financeiros
- $this->wtche->form->addField('char')
- ->setFieldName('financiamento_especie')
- ->setLabel('Rendimento Mensal')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('hipoteca')
- ->setLabel('Hipoteca')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- // Dados Bancários
- $this->wtche->form->addField('char')
- ->setFieldName('banco')
- ->setLabel('Banco')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('agencia')
- ->setLabel('Agência')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('cic')
- ->setLabel('CIC')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('contato')
- ->setLabel('Contato')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('telefone')
- ->setLabel('Telefone')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- //Dados Para Franquia
- $this->wtche->form->addField('char')
- ->setFieldName('experiencias_varejo')
- ->setLabel('Experiências Varejo')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('marcas')
- ->setLabel('Marcas')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('disponibilidade_mudanca')
- ->setLabel('Disponibilidade de Mudança')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('operador')
- ->setLabel('Operador')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('disponibilidade_operacao')
- ->setLabel('Disponibilidade de operação')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('manter_atividade')
- ->setLabel('Pretende manter a atividade')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('pontos_comerciais')
- ->setLabel('Pontos Comerciais')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- //Informações Complementares
- $this->wtche->form->addField('char')
- ->setFieldName('suporte')
- ->setLabel('Tipo de Suporte')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('percentual_marca')
- ->setLabel('Percentual Marca')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('percentual_operacao')
- ->setLabel('Percentual Operação')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('percentual_franqueador')
- ->setLabel('Percentual Franqueador')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('pontos_fracos')
- ->setLabel('Pontos Fracos')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('posicionamento')
- ->setLabel('Posicionamento')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('perfil')
- ->setLabel('Perfil')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('char')
- ->setFieldName('visao')
- ->setLabel('Visão')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- /*
- Locais de Interesse
- */
- $this->wtche->form->addField('select')
- ->setFieldName('interesse_address_states_id_1')
- ->setRelation('id', 'address_states', 'name')
- ->setLabel('Estado de Interesse 1')
- ->hideFrom('list');
- $this->wtche->form->addField('select')
- ->setFieldName('interesse_address_cities_id_1')
- ->setRelation('id', 'address_cities', 'name')
- ->setLabel('Cidade de Interesse 1')
- ->setDependency('interesse_address_states_id_1', 'address_states_id')
- ->hideFrom('list')
- ->setDependencyTextHelper('Selecione o estado primeiro!');
- $this->wtche->form->addField('char')
- ->setFieldName('descricao_interesse_1')
- ->setLabel('Descrição Interesse 1')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('select')
- ->setFieldName('interesse_address_states_id_2')
- ->setRelation('id', 'address_states', 'name')
- ->setLabel('Estado de Interesse 2')
- ->hideFrom('list');
- $this->wtche->form->addField('select')
- ->setFieldName('interesse_address_cities_id_2')
- ->setRelation('id', 'address_cities', 'name')
- ->setLabel('Cidade de Interesse 2')
- ->setDependency('interesse_address_states_id_2', 'address_states_id')
- ->hideFrom('list')
- ->setDependencyTextHelper('Selecione o estado primeiro!');
- $this->wtche->form->addField('char')
- ->setFieldName('descricao_interesse_2')
- ->setLabel('Descrição Interesse 2')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- $this->wtche->form->addField('select')
- ->setFieldName('interesse_address_states_id_3')
- ->setRelation('id', 'address_states', 'name')
- ->setLabel('Estado de Interesse 3')
- ->hideFrom('list');
- $this->wtche->form->addField('select')
- ->setFieldName('interesse_address_cities_id_3')
- ->setRelation('id', 'address_cities', 'name')
- ->setLabel('Cidade de Interesse 3')
- ->setDependency('interesse_address_states_id_3', 'address_states_id')
- ->hideFrom('list')
- ->setDependencyTextHelper('Selecione o estado primeiro!');
- $this->wtche->form->addField('char')
- ->setFieldName('descricao_interesse_3')
- ->setLabel('Descrição Interesse 3')
- ->setMaxLength(255)
- ->setValidationRules('required')
- ->hideFrom('list');
- }
- public function send($data) {
- $inserted_id = $this->insert($data);
- if ($inserted_id) {
- //Envia o email
- $this->load->library('emailer/emailer');
- $email_data['nome'] = $data['nome'];
- $email_data['email'] = $data['email'];
- $email_data['telefone'] = $data['telefone'];
- $email_data['relato'] = $data['relato'];
- $email_data['contato'] = $data['contato'];
- $email_data['vinculo'] = $data['vinculo'];
- if(!empty($data['vinculo_outros'])){
- $email_data['vinculo_outros'] = $data['vinculo_outros'];
- }
- $email_data['cpf'] = $data['cpf'];
- $settings = $this->settings_lib->find_all();
- $data = array(
- //'to' => $settings['cadastros.email_destino'],
- 'to' => 'juca@juca.com.br',
- 'reply_to' => $data['email'],
- 'subject' => 'Site Usaflex - Ouvidoria',
- 'message' => $this->load->view('emailer/email/_generic', array('email_data' => $email_data), TRUE)
- );
- if ($this->emailer->send($data)) {
- return TRUE;
- } else {
- return FALSE;
- }
- }
- return FALSE;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement