Commit 5d4080e4f17cb425d82e2c38674bca68ce1f4891
Exists in
master
Merge branch 'master' of github.com:portabilis/ieducar
Showing
49 changed files
with
918 additions
and
568 deletions
Show diff stats
ieducar/intranet/atendidos_cad.php
... | ... | @@ -94,7 +94,6 @@ class indice extends clsCadastro |
94 | 94 | var $ddd_telefone_fax; |
95 | 95 | var $telefone_fax; |
96 | 96 | var $email; |
97 | - var $http; | |
98 | 97 | var $tipo_pessoa; |
99 | 98 | var $sexo; |
100 | 99 | var $busca_pessoa; |
... | ... | @@ -110,8 +109,6 @@ class indice extends clsCadastro |
110 | 109 | var $caminho_det; |
111 | 110 | var $caminho_lst; |
112 | 111 | |
113 | - var $alterado; | |
114 | - | |
115 | 112 | function Inicializar() |
116 | 113 | { |
117 | 114 | $this->cod_pessoa_fj = @$_GET['cod_pessoa_fj']; |
... | ... | @@ -125,7 +122,7 @@ class indice extends clsCadastro |
125 | 122 | $this->ddd_telefone_1, $this->telefone_1, $this->ddd_telefone_2, |
126 | 123 | $this->telefone_2, $this->ddd_telefone_mov, $this->telefone_mov, |
127 | 124 | $this->ddd_telefone_fax, $this->telefone_fax, $this->email, |
128 | - $this->http, $this->tipo_pessoa, $this->sexo, $this->cidade, | |
125 | + $this->tipo_pessoa, $this->sexo, $this->cidade, | |
129 | 126 | $this->bairro, $this->logradouro, $this->cep, $this->idlog, $this->idbai, |
130 | 127 | $this->idtlog, $this->sigla_uf, $this->complemento, $this->numero, |
131 | 128 | $this->bloco, $this->apartamento, $this->andar, $this->zona_localizacao, $this->estado_civil, |
... | ... | @@ -136,7 +133,7 @@ class indice extends clsCadastro |
136 | 133 | $objPessoa->queryRapida( |
137 | 134 | $this->cod_pessoa_fj, 'nome', 'cpf', 'data_nasc', 'ddd_1', 'fone_1', |
138 | 135 | 'ddd_2', 'fone_2', 'ddd_mov', 'fone_mov', 'ddd_fax', 'fone_fax', 'email', |
139 | - 'url', 'tipo', 'sexo', 'cidade', 'bairro', 'logradouro', 'cep', 'idlog', | |
136 | + 'tipo', 'sexo', 'cidade', 'bairro', 'logradouro', 'cep', 'idlog', | |
140 | 137 | 'idbai', 'idtlog', 'sigla_uf', 'complemento', 'numero', 'bloco', 'apartamento', |
141 | 138 | 'andar', 'zona_localizacao', 'ideciv', 'idpes_pai', 'idpes_mae', 'nacionalidade', |
142 | 139 | 'idpais_estrangeiro', 'idmun_nascimento', 'letra' |
... | ... | @@ -170,11 +167,27 @@ class indice extends clsCadastro |
170 | 167 | $this->campoOculto('cod_pessoa_fj', $this->cod_pessoa_fj); |
171 | 168 | $this->campoTexto('nm_pessoa', 'Nome', $this->nm_pessoa, '50', '255', TRUE); |
172 | 169 | |
170 | + | |
171 | + // ao cadastrar pessoa do pai ou mãe apartir do cadastro de outra pessoa, | |
172 | + // é enviado o tipo de cadastro (pai ou mae). | |
173 | + $parentType = isset($_REQUEST['parent_type']) ? $_REQUEST['parent_type'] : ''; | |
174 | + | |
175 | + | |
173 | 176 | // sexo |
174 | 177 | |
178 | + $sexo = $this->sexo; | |
179 | + | |
180 | + // sugere sexo quando cadastrando o pai ou mãe | |
181 | + | |
182 | + if (! $sexo && $parentType == 'pai') | |
183 | + $sexo = 'M'; | |
184 | + elseif (! $sexo && $parentType == 'mae') | |
185 | + $sexo = 'F'; | |
186 | + | |
187 | + | |
175 | 188 | $options = array( |
176 | 189 | 'label' => 'Sexo / Estado civil', |
177 | - 'value' => $this->sexo, | |
190 | + 'value' => $sexo, | |
178 | 191 | 'resources' => array( |
179 | 192 | '' => 'Sexo', |
180 | 193 | 'M' => 'Masculino', |
... | ... | @@ -187,14 +200,15 @@ class indice extends clsCadastro |
187 | 200 | |
188 | 201 | // estado civil |
189 | 202 | |
190 | - $this->inputsHelper()->estadoCivil(array('label' => '')); | |
203 | + $this->inputsHelper()->estadoCivil(array('label' => '', 'required' => empty($parentType))); | |
191 | 204 | |
192 | 205 | |
193 | 206 | // data nascimento |
194 | 207 | |
195 | 208 | $options = array( |
196 | 209 | 'label' => 'Data nascimento', |
197 | - 'value' => $this->data_nasc | |
210 | + 'value' => $this->data_nasc, | |
211 | + 'required' => empty($parentType) | |
198 | 212 | ); |
199 | 213 | |
200 | 214 | $this->inputsHelper()->date('data_nasc', $options); |
... | ... | @@ -214,14 +228,22 @@ class indice extends clsCadastro |
214 | 228 | |
215 | 229 | // rg |
216 | 230 | |
231 | + // o rg é obrigatorio ao cadastrar pai ou mãe, exceto se configurado como opcional. | |
232 | + | |
233 | + $required = (! empty($parentType)); | |
234 | + | |
235 | + if ($required && $GLOBALS['coreExt']['Config']->app->rg_pessoa_fisica_pais_opcional) { | |
236 | + $required = false; | |
237 | + } | |
238 | + | |
217 | 239 | $options = array( |
218 | - 'required' => false, | |
219 | - 'label' => 'RG / Data emissão', | |
240 | + 'required' => $required, | |
241 | + 'label' => 'RG / Data emissão', | |
220 | 242 | 'placeholder' => 'Documento identidade', |
221 | - 'value' => $documentos['rg'], | |
222 | - 'max_length' => 20, | |
223 | - 'size' => 27, | |
224 | - 'inline' => true | |
243 | + 'value' => $documentos['rg'], | |
244 | + 'max_length' => 20, | |
245 | + 'size' => 27, | |
246 | + 'inline' => true | |
225 | 247 | ); |
226 | 248 | |
227 | 249 | $this->inputsHelper()->integer('rg', $options); |
... | ... | @@ -570,6 +592,10 @@ class indice extends clsCadastro |
570 | 592 | $this->campoOculto('id_cidade', $this->cidade); |
571 | 593 | |
572 | 594 | |
595 | + // o endereçamento é opcional ao cadastrar pai ou mãe. | |
596 | + $enderecamentoObrigatorio = empty($parentType); | |
597 | + | |
598 | + | |
573 | 599 | // considera como endereço localizado por CEP quando alguma das variaveis de instancia |
574 | 600 | // idbai (bairro) ou idlog (logradouro) estão definidas, neste caso desabilita a edição |
575 | 601 | // dos campos definidos via CEP. |
... | ... | @@ -579,7 +605,7 @@ class indice extends clsCadastro |
579 | 605 | 'cep_', |
580 | 606 | 'CEP', |
581 | 607 | $this->cep, |
582 | - TRUE, | |
608 | + $enderecamentoObrigatorio, | |
583 | 609 | '-', |
584 | 610 | " <img id='lupa' src=\"imagens/lupa.png\" border=\"0\" onclick=\"showExpansivel(500, 550, '<iframe name=\'miolo\' id=\'miolo\' frameborder=\'0\' height=\'100%\' width=\'500\' marginheight=\'0\' marginwidth=\'0\' src=\'educar_pesquisa_cep_log_bairro.php?campo1=bairro&campo2=idbai&campo3=cep&campo4=logradouro&campo5=idlog&campo6=ref_sigla_uf&campo7=cidade&campo8=ref_idtlog&campo9=isEnderecoExterno&campo10=cep_&campo11=sigla_uf&campo12=idtlog&campo13=id_cidade&campo14=zona_localizacao\'></iframe>');\">", |
585 | 611 | $desativarCamposDefinidosViaCep |
... | ... | @@ -592,7 +618,8 @@ class indice extends clsCadastro |
592 | 618 | 'label' => 'Estado / Cidade', |
593 | 619 | 'value' => $this->sigla_uf, |
594 | 620 | 'disabled' => $desativarCamposDefinidosViaCep, |
595 | - 'inline' => true | |
621 | + 'inline' => true, | |
622 | + 'required' => $enderecamentoObrigatorio | |
596 | 623 | ); |
597 | 624 | |
598 | 625 | $helperOptions = array( |
... | ... | @@ -609,7 +636,8 @@ class indice extends clsCadastro |
609 | 636 | 'placeholder' => 'Cidade', |
610 | 637 | 'value' => $this->cidade, |
611 | 638 | 'max_length' => 60, |
612 | - 'disabled' => $desativarCamposDefinidosViaCep | |
639 | + 'disabled' => $desativarCamposDefinidosViaCep, | |
640 | + 'required' => $enderecamentoObrigatorio | |
613 | 641 | ); |
614 | 642 | |
615 | 643 | $this->inputsHelper()->text('cidade', $options); |
... | ... | @@ -623,7 +651,8 @@ class indice extends clsCadastro |
623 | 651 | 'value' => $this->bairro, |
624 | 652 | 'max_length' => 40, |
625 | 653 | 'disabled' => $desativarCamposDefinidosViaCep, |
626 | - 'inline' => true | |
654 | + 'inline' => true, | |
655 | + 'required' => $enderecamentoObrigatorio | |
627 | 656 | ); |
628 | 657 | |
629 | 658 | $this->inputsHelper()->text('bairro', $options); |
... | ... | @@ -640,7 +669,8 @@ class indice extends clsCadastro |
640 | 669 | 'placeholder' => 'Zona localização', |
641 | 670 | 'value' => $this->zona_localizacao, |
642 | 671 | 'disabled' => $desativarCamposDefinidosViaCep, |
643 | - 'resources' => $zonas | |
672 | + 'resources' => $zonas, | |
673 | + 'required' => $enderecamentoObrigatorio | |
644 | 674 | ); |
645 | 675 | |
646 | 676 | $this->inputsHelper()->select('zona_localizacao', $options); |
... | ... | @@ -652,7 +682,8 @@ class indice extends clsCadastro |
652 | 682 | 'label' => 'Tipo / Logradouro', |
653 | 683 | 'value' => $this->idtlog, |
654 | 684 | 'disabled' => $desativarCamposDefinidosViaCep, |
655 | - 'inline' => true | |
685 | + 'inline' => true, | |
686 | + 'required' => $enderecamentoObrigatorio | |
656 | 687 | ); |
657 | 688 | |
658 | 689 | $helperOptions = array( |
... | ... | @@ -669,7 +700,8 @@ class indice extends clsCadastro |
669 | 700 | 'placeholder' => 'Logradouro', |
670 | 701 | 'value' => $this->logradouro, |
671 | 702 | 'max_length' => 150, |
672 | - 'disabled' => $desativarCamposDefinidosViaCep | |
703 | + 'disabled' => $desativarCamposDefinidosViaCep, | |
704 | + 'required' => $enderecamentoObrigatorio | |
673 | 705 | ); |
674 | 706 | |
675 | 707 | $this->inputsHelper()->text('logradouro', $options); |
... | ... | @@ -763,22 +795,13 @@ class indice extends clsCadastro |
763 | 795 | $this->inputTelefone('2', 'Telefone adicional'); |
764 | 796 | $this->inputTelefone('fax', 'Fax'); |
765 | 797 | |
766 | - $this->campoTexto('http', 'Site', $this->http, '50', '255', FALSE); | |
767 | - | |
768 | 798 | $this->campoTexto('email', 'E-mail', $this->email, '50', '255', FALSE); |
769 | 799 | |
770 | - /*if ($this->cod_pessoa_fj) { | |
771 | - $this->campoRotulo('documentos', '<b><i>Documentos</i></b>', | |
772 | - "<a href='#' onclick=\"windowUtils.open('adicionar_documentos_cad.php?id_pessoa={$this->cod_pessoa_fj}'); \"><img src='imagens/nvp_bot_ad_doc.png' border='0'></a>"); | |
773 | - | |
774 | - $this->campoCheck('alterado', 'Alterado', $this->alterado); | |
775 | - }*/ | |
776 | - | |
777 | 800 | |
778 | 801 | // after change pessoa pai / mae |
779 | 802 | |
780 | - if (isset($_REQUEST['parent_type'])) | |
781 | - $this->inputsHelper()->hidden('parent_type', array('value' => $_REQUEST['parent_type'])); | |
803 | + if ($parentType) | |
804 | + $this->inputsHelper()->hidden('parent_type', array('value' => $parentType)); | |
782 | 805 | |
783 | 806 | |
784 | 807 | $styles = array( |
... | ... | @@ -793,189 +816,15 @@ class indice extends clsCadastro |
793 | 816 | Portabilis_View_Helper_Application::loadJavascript($this, $script); |
794 | 817 | } |
795 | 818 | |
796 | - function Novo() | |
797 | - { | |
798 | - | |
799 | - if (! $this->validatesCpf($this->id_federal)) | |
800 | - return false; | |
801 | - | |
802 | - // pessoa | |
803 | - | |
804 | - $objPessoa = new clsPessoa_(FALSE, $this->nm_pessoa, $this->currentUserId(), $this->http, | |
805 | - 'F', FALSE, FALSE, $this->email); | |
806 | - | |
807 | - $idpes = $objPessoa->cadastra(); | |
808 | - | |
809 | - // pessoa fisica | |
810 | - | |
811 | - $fisica = new clsFisica(); | |
812 | - | |
813 | - $fisica->idpes = $idpes; | |
814 | - $fisica->data_nasc = Portabilis_Date_Utils::brToPgSQL($this->data_nasc); | |
815 | - $fisica->sexo = $this->sexo; | |
816 | - $fisica->ref_cod_sistema = 'NULL'; | |
817 | - $fisica->cpf = idFederal2int($this->id_federal); | |
818 | - $fisica->ideciv = $this->estado_civil_id; | |
819 | - $fisica->idpes_pai = $this->pai_id; | |
820 | - $fisica->idpes_mae = $this->mae_id; | |
821 | - $fisica->nacionalidade = $_REQUEST['tipo_nacionalidade']; | |
822 | - $fisica->idpais_estrangeiro = $_REQUEST['pais_origem_id']; | |
823 | - $fisica->idmun_nascimento = $_REQUEST['naturalidade_id']; | |
824 | - | |
825 | - $fisica->cadastra(); | |
826 | - | |
827 | - $this->createOrUpdateDocumentos($idpes); | |
828 | - | |
829 | - $objTelefone = new clsPessoaTelefone($idpes, 1, $this->telefone_1, $this->ddd_telefone_1); | |
830 | - $objTelefone->cadastra(); | |
831 | - | |
832 | - $objTelefone = new clsPessoaTelefone($idpes, 2, $this->telefone_2, $this->ddd_telefone_2); | |
833 | - $objTelefone->cadastra(); | |
834 | - | |
835 | - $objTelefone = new clsPessoaTelefone($idpes, 3, $this->telefone_mov, $this->ddd_telefone_mov); | |
836 | - $objTelefone->cadastra(); | |
837 | - | |
838 | - $objTelefone = new clsPessoaTelefone($idpes, 4, $this->telefone_fax, $this->ddd_telefone_fax); | |
839 | - $objTelefone->cadastra(); | |
840 | - | |
841 | - if ($this->cep && $this->idbai && $this->idlog) { | |
842 | - $this->cep = idFederal2Int($this->cep); | |
843 | - $objEndereco = new clsPessoaEndereco($idpes); | |
844 | - $objEndereco2 = new clsPessoaEndereco($idpes, $this->cep, $this->idlog, | |
845 | - $this->idbai, $this->numero, $this->complemento, FALSE, $this->letra, | |
846 | - $this->bloco, $this->apartamento, $this->andar); | |
847 | - | |
848 | - if ($objEndereco->detalhe()) { | |
849 | - $objEndereco2->edita(); | |
850 | - } | |
851 | - else { | |
852 | - $objEndereco2->cadastra(); | |
853 | - } | |
854 | - } | |
855 | - elseif($this->cep_) { | |
856 | - $this->cep_ = idFederal2int($this->cep_); | |
857 | - | |
858 | - $objEnderecoExterno = new clsEnderecoExterno($idpes); | |
859 | - $objEnderecoExterno2 = new clsEnderecoExterno($idpes, '1', $this->idtlog, | |
860 | - $this->logradouro, $this->numero, $this->letra, $this->complemento, | |
861 | - $this->bairro, $this->cep_, $this->cidade, $this->sigla_uf, FALSE, | |
862 | - $this->bloco, $this->apartamento, $this->andar, FALSE, FALSE, | |
863 | - $this->zona_localizacao); | |
864 | - | |
865 | - if ($objEnderecoExterno->detalhe()) { | |
866 | - $objEnderecoExterno2->edita(); | |
867 | - } | |
868 | - else { | |
869 | - $objEnderecoExterno2->cadastra(); | |
870 | - } | |
871 | - } | |
872 | - | |
873 | - // Cadastra raça. | |
874 | - $this->_cadastraRaca($idpes, $this->cor_raca); | |
875 | - | |
876 | - $this->afterChangePessoa($idpes); | |
877 | - return TRUE; | |
819 | + function Novo() { | |
820 | + return $this->createOrUpdate(); | |
878 | 821 | } |
879 | 822 | |
880 | - function Editar() | |
881 | - { | |
882 | - if (! $this->validatesCpf($this->id_federal)) | |
883 | - return false; | |
884 | - | |
885 | - // pessoa | |
886 | - | |
887 | - $objPessoa = new clsPessoa_($this->cod_pessoa_fj, $this->nm_pessoa, FALSE, | |
888 | - $this->p_http, FALSE, $this->currentUserId(), | |
889 | - date('Y-m-d H:i:s', time()), $this->email); | |
890 | - | |
891 | - $objPessoa->edita(); | |
892 | - | |
893 | - // pessoa fisica | |
894 | - | |
895 | - $fisica = new clsFisica(); | |
896 | - | |
897 | - $fisica->idpes = $this->cod_pessoa_fj; | |
898 | - $fisica->data_nasc = Portabilis_Date_Utils::brToPgSQL($this->data_nasc); | |
899 | - $fisica->sexo = $this->sexo; | |
900 | - $fisica->ref_cod_sistema = 'NULL'; | |
901 | - $fisica->cpf = $this->id_federal ? idFederal2int($this->id_federal) : 'NULL'; | |
902 | - $fisica->ideciv = $this->estado_civil_id; | |
903 | - $fisica->idpes_pai = $this->pai_id ? $this->pai_id : "NULL"; | |
904 | - $fisica->idpes_mae = $this->mae_id ? $this->mae_id : "NULL"; | |
905 | - $fisica->nacionalidade = $_REQUEST['tipo_nacionalidade']; | |
906 | - $fisica->idpais_estrangeiro = $_REQUEST['pais_origem_id']; | |
907 | - $fisica->idmun_nascimento = $_REQUEST['naturalidade_id']; | |
908 | - | |
909 | - $fisica->edita(); | |
910 | - | |
911 | - $this->createOrUpdateDocumentos($this->cod_pessoa_fj); | |
912 | - | |
913 | - if ($this->alterado) { | |
914 | - $db = new clsBanco(); | |
915 | - $db->Consulta("UPDATE cadastro.fisica SET alterado = 'TRUE' WHERE idpes = '$this->cod_pessoa_fj'"); | |
916 | - } | |
917 | - | |
918 | - $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 1, | |
919 | - $this->telefone_1, $this->ddd_telefone_1); | |
920 | - $objTelefone->cadastra(); | |
921 | - | |
922 | - $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 2, | |
923 | - $this->telefone_2, $this->ddd_telefone_2); | |
924 | - $objTelefone->cadastra(); | |
925 | - | |
926 | - $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 3, | |
927 | - $this->telefone_mov, $this->ddd_telefone_mov); | |
928 | - $objTelefone->cadastra(); | |
929 | - | |
930 | - $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 4, | |
931 | - $this->telefone_fax, $this->ddd_telefone_fax); | |
932 | - $objTelefone->cadastra(); | |
933 | - | |
934 | - $objEndereco = new clsPessoaEndereco($this->cod_pessoa_fj); | |
935 | - | |
936 | - $this->cep = idFederal2Int($this->cep); | |
937 | - | |
938 | - $objEndereco2 = new clsPessoaEndereco($this->cod_pessoa_fj, $this->cep, | |
939 | - $this->idlog, $this->idbai, $this->numero, $this->complemento, FALSE, | |
940 | - $this->letra, $this->bloco, $this->apartamento,$this->andar); | |
941 | - | |
942 | - if ($objEndereco->detalhe() && $this->cep && $this->idlog && $this->idbai) { | |
943 | - $objEndereco2->edita(); | |
944 | - } | |
945 | - elseif ($this->cep && $this->idlog && $this->idbai) { | |
946 | - $objEndereco2->cadastra(); | |
947 | - } | |
948 | - elseif ($objEndereco->detalhe()) { | |
949 | - $objEndereco2->exclui(); | |
950 | - } | |
951 | - else { | |
952 | - $this->cep_ = idFederal2int($this->cep_); | |
953 | - $objEnderecoExterno = new clsEnderecoExterno($this->cod_pessoa_fj); | |
954 | - | |
955 | - $objEnderecoExterno2 = new clsEnderecoExterno($this->cod_pessoa_fj, '1', | |
956 | - $this->idtlog, $this->logradouro, $this->numero, $this->letra, | |
957 | - $this->complemento, $this->bairro, $this->cep_, $this->cidade, | |
958 | - $this->sigla_uf, FALSE, $this->bloco, $this->apartamento, $this->andar, | |
959 | - FALSE, FALSE, $this->zona_localizacao); | |
960 | - | |
961 | - if ($objEnderecoExterno->detalhe()) { | |
962 | - $objEnderecoExterno2->edita(); | |
963 | - } | |
964 | - else { | |
965 | - $objEnderecoExterno2->cadastra(); | |
966 | - } | |
967 | - } | |
968 | - | |
969 | - // Atualizada raça. | |
970 | - $this->_cadastraRaca($this->cod_pessoa_fj, $this->cor_raca); | |
971 | - | |
972 | - $this->afterChangePessoa($this->cod_pessoa_fj); | |
973 | - | |
974 | - return TRUE; | |
823 | + function Editar() { | |
824 | + return $this->createOrUpdate($this->cod_pessoa_fj); | |
975 | 825 | } |
976 | 826 | |
977 | - function Excluir() | |
978 | - { | |
827 | + function Excluir() { | |
979 | 828 | echo '<script>document.location="atendidos_lst.php";</script>'; |
980 | 829 | return TRUE; |
981 | 830 | } |
... | ... | @@ -997,28 +846,6 @@ class indice extends clsCadastro |
997 | 846 | ", $afterReady = true); |
998 | 847 | } |
999 | 848 | |
1000 | - /** | |
1001 | - * Cadastra ou atualiza a raça de uma pessoa. | |
1002 | - * | |
1003 | - * @access protected | |
1004 | - * @param int $pessoaId | |
1005 | - * @param int $corRaca | |
1006 | - * @return bool | |
1007 | - * @since Método disponível desde a versão 1.2.0 | |
1008 | - */ | |
1009 | - function _cadastraRaca($pessoaId, $corRaca) | |
1010 | - { | |
1011 | - $pessoaId = (int) $pessoaId; | |
1012 | - $corRaca = (int) $corRaca; | |
1013 | - | |
1014 | - $raca = new clsCadastroFisicaRaca($pessoaId, $corRaca); | |
1015 | - if ($raca->existe()) { | |
1016 | - return $raca->edita(); | |
1017 | - } | |
1018 | - | |
1019 | - return $raca->cadastra(); | |
1020 | - } | |
1021 | - | |
1022 | 849 | protected function loadAlunoByPessoaId($id) { |
1023 | 850 | $aluno = new clsPmieducarAluno(); |
1024 | 851 | $aluno->ref_idpes = $id; |
... | ... | @@ -1092,6 +919,79 @@ class indice extends clsCadastro |
1092 | 919 | return $isValid; |
1093 | 920 | } |
1094 | 921 | |
922 | + protected function createOrUpdate($pessoaIdOrNull = null) { | |
923 | + if (! $this->validatesCpf($this->id_federal)) | |
924 | + return false; | |
925 | + | |
926 | + $pessoaId = $this->createOrUpdatePessoa($pessoaIdOrNull); | |
927 | + | |
928 | + $this->createOrUpdatePessoaFisica($pessoaId); | |
929 | + $this->createOrUpdateDocumentos($pessoaId); | |
930 | + $this->createOrUpdateTelefones($pessoaId); | |
931 | + $this->createOrUpdateEndereco($pessoaId); | |
932 | + | |
933 | + $this->afterChangePessoa($pessoaId); | |
934 | + return true; | |
935 | + } | |
936 | + | |
937 | + protected function createOrUpdatePessoa($pessoaId = null) { | |
938 | + $pessoa = new clsPessoa_(); | |
939 | + $pessoa->idpes = $pessoaId; | |
940 | + $pessoa->nome = addslashes($this->nm_pessoa); | |
941 | + $pessoa->email = addslashes($this->email); | |
942 | + | |
943 | + $sql = "select 1 from cadastro.pessoa WHERE idpes = $1 limit 1"; | |
944 | + | |
945 | + if (! $pessoaId || Portabilis_Utils_Database::selectField($sql, $pessoaId) != 1) { | |
946 | + $pessoa->tipo = 'F'; | |
947 | + $pessoa->idpes_cad = $this->currentUserId(); | |
948 | + $pessoaId = $pessoa->cadastra(); | |
949 | + } | |
950 | + else { | |
951 | + $pessoa->idpes_rev = $this->currentUserId(); | |
952 | + $pessoa->data_rev = date('Y-m-d H:i:s', time()); | |
953 | + $pessoa->edita(); | |
954 | + } | |
955 | + | |
956 | + return $pessoaId; | |
957 | + } | |
958 | + | |
959 | + protected function createOrUpdatePessoaFisica($pessoaId) { | |
960 | + $fisica = new clsFisica(); | |
961 | + $fisica->idpes = $pessoaId; | |
962 | + $fisica->data_nasc = Portabilis_Date_Utils::brToPgSQL($this->data_nasc); | |
963 | + $fisica->sexo = $this->sexo; | |
964 | + $fisica->ref_cod_sistema = 'NULL'; | |
965 | + $fisica->cpf = $this->id_federal ? idFederal2int($this->id_federal) : 'NULL'; | |
966 | + $fisica->ideciv = $this->estado_civil_id; | |
967 | + $fisica->idpes_pai = $this->pai_id ? $this->pai_id : "NULL"; | |
968 | + $fisica->idpes_mae = $this->mae_id ? $this->mae_id : "NULL"; | |
969 | + $fisica->nacionalidade = $_REQUEST['tipo_nacionalidade']; | |
970 | + $fisica->idpais_estrangeiro = $_REQUEST['pais_origem_id']; | |
971 | + $fisica->idmun_nascimento = $_REQUEST['naturalidade_id']; | |
972 | + | |
973 | + $sql = "select 1 from cadastro.fisica WHERE idpes = $1 limit 1"; | |
974 | + | |
975 | + if (Portabilis_Utils_Database::selectField($sql, $pessoaId) != 1) | |
976 | + $fisica->cadastra(); | |
977 | + else | |
978 | + $fisica->edita(); | |
979 | + | |
980 | + $this->createOrUpdateRaca($pessoaId, $this->cor_raca); | |
981 | + } | |
982 | + | |
983 | + function createOrUpdateRaca($pessoaId, $corRaca) { | |
984 | + $pessoaId = (int) $pessoaId; | |
985 | + $corRaca = (int) $corRaca; | |
986 | + | |
987 | + $raca = new clsCadastroFisicaRaca($pessoaId, $corRaca); | |
988 | + | |
989 | + if ($raca->existe()) | |
990 | + return $raca->edita(); | |
991 | + | |
992 | + return $raca->cadastra(); | |
993 | + } | |
994 | + | |
1095 | 995 | protected function createOrUpdateDocumentos($pessoaId) { |
1096 | 996 | $documentos = new clsDocumento(); |
1097 | 997 | $documentos->idpes = $pessoaId; |
... | ... | @@ -1136,8 +1036,7 @@ class indice extends clsCadastro |
1136 | 1036 | ); |
1137 | 1037 | |
1138 | 1038 | $documentos->sigla_uf_cert_civil = $_REQUEST['uf_emissao_certidao_civil']; |
1139 | - $documentos->cartorio_cert_civil = $_REQUEST['cartorio_emissao_certidao_civil']; | |
1140 | - | |
1039 | + $documentos->cartorio_cert_civil = addslashes($_REQUEST['cartorio_emissao_certidao_civil']); | |
1141 | 1040 | |
1142 | 1041 | |
1143 | 1042 | // carteira de trabalho |
... | ... | @@ -1172,6 +1071,77 @@ class indice extends clsCadastro |
1172 | 1071 | $documentos->edita(); |
1173 | 1072 | } |
1174 | 1073 | |
1074 | + protected function _createOrUpdatePessoaEndereco($pessoaId) { | |
1075 | + $endereco = new clsPessoaEndereco( | |
1076 | + $pessoaId, | |
1077 | + idFederal2Int($this->cep), | |
1078 | + $this->idlog, | |
1079 | + $this->idbai, | |
1080 | + $this->numero, | |
1081 | + addslashes($this->complemento), | |
1082 | + FALSE, | |
1083 | + addslashes($this->letra), | |
1084 | + addslashes($this->bloco), | |
1085 | + $this->apartamento, | |
1086 | + $this->andar | |
1087 | + ); | |
1088 | + | |
1089 | + // forçado exclusão, assim ao cadastrar endereco_pessoa novamente, | |
1090 | + // será excluido endereco_externo (por meio da trigger fcn_aft_ins_endereco_pessoa). | |
1091 | + $endereco->exclui(); | |
1092 | + $endereco->cadastra(); | |
1093 | + } | |
1094 | + | |
1095 | + protected function _createOrUpdateEnderecoExterno($pessoaId) { | |
1096 | + $endereco = new clsEnderecoExterno( | |
1097 | + $pessoaId, | |
1098 | + '1', | |
1099 | + $this->idtlog, | |
1100 | + addslashes($this->logradouro), | |
1101 | + $this->numero, | |
1102 | + addslashes($this->letra), | |
1103 | + addslashes($this->complemento), | |
1104 | + addslashes($this->bairro), | |
1105 | + idFederal2int($this->cep_), | |
1106 | + addslashes($this->cidade), | |
1107 | + $this->sigla_uf, | |
1108 | + FALSE, | |
1109 | + addslashes($this->bloco), | |
1110 | + $this->apartamento, | |
1111 | + $this->andar, | |
1112 | + FALSE, | |
1113 | + FALSE, | |
1114 | + $this->zona_localizacao | |
1115 | + ); | |
1116 | + | |
1117 | + // forçado exclusão, assim ao cadastrar endereco_externo novamente, | |
1118 | + // será excluido endereco_pessoa (por meio da trigger fcn_aft_ins_endereco_externo). | |
1119 | + $endereco->exclui(); | |
1120 | + $endereco->cadastra(); | |
1121 | + } | |
1122 | + | |
1123 | + protected function createOrUpdateEndereco($pessoaId) { | |
1124 | + $enderecoExterno = ! empty($this->cep_); | |
1125 | + | |
1126 | + if (! $enderecoExterno && $this->cep && $this->idbai && $this->idlog) | |
1127 | + $this->_createOrUpdatePessoaEndereco($pessoaId); | |
1128 | + | |
1129 | + elseif($enderecoExterno) | |
1130 | + $this->_createOrUpdateEnderecoExterno($pessoaId); | |
1131 | + } | |
1132 | + | |
1133 | + protected function createOrUpdateTelefones($pessoaId) { | |
1134 | + $telefones = array(); | |
1135 | + | |
1136 | + $telefones[] = new clsPessoaTelefone($pessoaId, 1, $this->telefone_1, $this->ddd_telefone_1); | |
1137 | + $telefones[] = new clsPessoaTelefone($pessoaId, 2, $this->telefone_2, $this->ddd_telefone_2); | |
1138 | + $telefones[] = new clsPessoaTelefone($pessoaId, 3, $this->telefone_mov, $this->ddd_telefone_mov); | |
1139 | + $telefones[] = new clsPessoaTelefone($pessoaId, 4, $this->telefone_fax, $this->ddd_telefone_fax); | |
1140 | + | |
1141 | + foreach ($telefones as $telefone) | |
1142 | + $telefone->cadastra(); | |
1143 | + } | |
1144 | + | |
1175 | 1145 | // inputs usados em Gerar, |
1176 | 1146 | // implementado estes metodos para não duplicar código |
1177 | 1147 | // uma vez que estes campos são usados várias vezes em Gerar. | ... | ... |
ieducar/intranet/educar_aluno_cad.php
... | ... | @@ -262,11 +262,6 @@ class indice extends clsCadastro |
262 | 262 | $this->campoOculto('ref_idpes', $this->ref_idpes); |
263 | 263 | $this->campoAdicionaTab('Dados Pessoais', $this->tab_habilitado); |
264 | 264 | |
265 | - if ($this->cod_aluno) { | |
266 | - $obj_matricula = new clsPmieducarMatricula(); | |
267 | - $lst_matricula = $obj_matricula->lista(NULL, NULL, NULL, NULL, NULL, NULL, $this->cod_aluno); | |
268 | - } | |
269 | - | |
270 | 265 | if (!empty($this->ref_idpes)) { |
271 | 266 | $obj_aluno = new clsPmieducarAluno(); |
272 | 267 | $lista_aluno = $obj_aluno->lista(NULL, NULL, NULL, NULL, NULL, | ... | ... |
ieducar/intranet/educar_ano_letivo_modulo_cad.php
... | ... | @@ -35,6 +35,8 @@ require_once 'include/pmieducar/geral.inc.php'; |
35 | 35 | |
36 | 36 | require_once 'App/Date/Utils.php'; |
37 | 37 | |
38 | +require_once 'ComponenteCurricular/Model/TurmaDataMapper.php'; | |
39 | + | |
38 | 40 | /** |
39 | 41 | * clsIndexBase class. |
40 | 42 | * |
... | ... | @@ -281,8 +283,11 @@ class indice extends clsCadastro |
281 | 283 | $this->ano_letivo_modulo = unserialize(urldecode($this->ano_letivo_modulo)); |
282 | 284 | |
283 | 285 | if ($this->ano_letivo_modulo) { |
286 | + | |
287 | + $this->copiarTurmasUltimoAno($this->ref_ref_cod_escola, $this->ref_ano); | |
288 | + | |
284 | 289 | $obj = new clsPmieducarEscolaAnoLetivo($this->ref_ref_cod_escola, |
285 | - $this->ref_ano, $this->pessoa_logada, NULL, 0, NULL, NULL, 1 | |
290 | + $this->ref_ano, $this->pessoa_logada, NULL, 0, NULL, NULL, 1, 1 | |
286 | 291 | ); |
287 | 292 | |
288 | 293 | $cadastrou = $obj->cadastra(); |
... | ... | @@ -434,6 +439,122 @@ class indice extends clsCadastro |
434 | 439 | |
435 | 440 | return TRUE; |
436 | 441 | } |
442 | + | |
443 | + function copiarTurmasUltimoAno($escolaId, $anoDestino) { | |
444 | + $sql = 'select ano, turmas_por_ano from pmieducar.escola_ano_letivo where ref_cod_escola = $1 ' . | |
445 | + 'and ativo = 1 and ano in (select max(ano) from pmieducar.escola_ano_letivo where ' . | |
446 | + 'ref_cod_escola = $1 and ativo = 1)'; | |
447 | + | |
448 | + $ultimoAnoLetivo = Portabilis_Utils_Database::selectRow($sql, $escolaId); | |
449 | + | |
450 | + $anoTurmasPorAno = $ultimoAnoLetivo['turmas_por_ano'] == 1 ? $ultimoAnoLetivo['ano'] : null; | |
451 | + | |
452 | + $turmasEscola = new clsPmieducarTurma(); | |
453 | + $turmasEscola = $turmasEscola->lista(null, null, null, null, $escolaId, null, null, null, | |
454 | + null, null, null, null, null, null, 1, null, null, | |
455 | + null, null, null, null, null, null, null, null, null, | |
456 | + null, null, null, null, null, false, null, true, null, | |
457 | + null, $anoTurmasPorAno); | |
458 | + | |
459 | + foreach ($turmasEscola as $turma) | |
460 | + $this->copiarTurma($turma, $ultimoAnoLetivo['ano'], $anoDestino); | |
461 | + } | |
462 | + | |
463 | + function copiarTurma($turmaOrigem, $anoOrigem, $anoDestino) { | |
464 | + $sql = "select 1 from turma where ativo = 1 and visivel = true | |
465 | + and ref_ref_cod_escola = $1 and nm_turma = $2 and ref_ref_cod_serie = $3 and ano = $4 limit 1"; | |
466 | + | |
467 | + $params = array( | |
468 | + $turmaOrigem['ref_ref_cod_escola'], | |
469 | + $turmaOrigem['nm_turma'], | |
470 | + $turmaOrigem['ref_ref_cod_serie'], | |
471 | + $anoDestino | |
472 | + ); | |
473 | + | |
474 | + $existe = Portabilis_Utils_Database::selectField($sql, $params); | |
475 | + | |
476 | + if ($existe != 1) { | |
477 | + $fields = array('ref_usuario_exc', 'ref_usuario_cad', 'ref_ref_cod_serie', 'ref_ref_cod_escola', | |
478 | + 'ref_cod_infra_predio_comodo', 'nm_turma', 'sgl_turma', 'max_aluno', 'multiseriada', | |
479 | + 'data_cadastro', 'data_exclusao', 'ativo', 'ref_cod_turma_tipo', 'hora_inicial', 'hora_final', | |
480 | + 'hora_inicio_intervalo', 'hora_fim_intervalo', 'ref_cod_regente', 'ref_cod_instituicao_regente', | |
481 | + 'ref_cod_instituicao', 'ref_cod_curso', 'ref_ref_cod_serie_mult', 'ref_ref_cod_escola_mult', | |
482 | + 'visivel', 'turma_turno_id', 'tipo_boletim', 'ano'); | |
483 | + | |
484 | + $turmaDestino = new clsPmieducarTurma(); | |
485 | + | |
486 | + foreach ($fields as $fieldName) | |
487 | + $turmaDestino->$fieldName = $turmaOrigem[$fieldName]; | |
488 | + | |
489 | + $turmaDestino->ano = $anoDestino; | |
490 | + $turmaDestinoId = $turmaDestino->cadastra(); | |
491 | + | |
492 | + $this->copiarComponenteCurricularTurma($turmaOrigem['cod_turma'], $turmaDestinoId); | |
493 | + $this->copiarModulosTurma($turmaOrigem['cod_turma'], $turmaDestinoId, $anoOrigem, $anoDestino); | |
494 | + $this->copiarDiasSemanaTurma($turmaOrigem['cod_turma'], $turmaDestinoId); | |
495 | + } | |
496 | + } | |
497 | + | |
498 | + function copiarComponenteCurricularTurma($turmaOrigemId, $turmaDestinoId) { | |
499 | + $dataMapper = new ComponenteCurricular_Model_TurmaDataMapper(); | |
500 | + $componentesTurmaOrigem = $dataMapper->findAll(array(), array('turma' => $turmaOrigemId)); | |
501 | + | |
502 | + foreach ($componentesTurmaOrigem as $componenteTurmaOrigem) { | |
503 | + $data = array( | |
504 | + 'componenteCurricular' => $componenteTurmaOrigem->get('componenteCurricular'), | |
505 | + 'escola' => $componenteTurmaOrigem->get('escola'), | |
506 | + 'cargaHoraria' => $componenteTurmaOrigem->get('cargaHoraria'), | |
507 | + 'turma' => $turmaDestinoId, | |
508 | + | |
509 | + // está sendo mantido o mesmo ano_escolar_id, uma vez que não foi | |
510 | + // foi encontrado de onde o valor deste campo é obtido. | |
511 | + 'anoEscolar' => $componenteTurmaOrigem->get('anoEscolar') | |
512 | + ); | |
513 | + | |
514 | + $componenteTurmaDestino = $dataMapper->createNewEntityInstance($data); | |
515 | + $dataMapper->save($componenteTurmaDestino); | |
516 | + } | |
517 | + } | |
518 | + | |
519 | + function copiarModulosTurma($turmaOrigemId, $turmaDestinoId, $anoOrigem, $anoDestino) { | |
520 | + $modulosTurmaOrigem = new clsPmieducarTurmaModulo(); | |
521 | + $modulosTurmaOrigem = $modulosTurmaOrigem->lista($turmaOrigemId); | |
522 | + | |
523 | + foreach ($modulosTurmaOrigem as $moduloOrigem) { | |
524 | + $moduloDestino = new clsPmieducarTurmaModulo(); | |
525 | + | |
526 | + $moduloDestino->ref_cod_modulo = $moduloOrigem['ref_cod_modulo']; | |
527 | + $moduloDestino->sequencial = $moduloOrigem['sequencial']; | |
528 | + $moduloDestino->ref_cod_turma = $turmaDestinoId; | |
529 | + | |
530 | + $moduloDestino->data_inicio = str_replace( | |
531 | + $anoOrigem, $anoDestino, $moduloOrigem['data_inicio'] | |
532 | + ); | |
533 | + | |
534 | + $moduloDestino->data_fim = str_replace( | |
535 | + $anoOrigem, $anoDestino, $moduloOrigem['data_fim'] | |
536 | + ); | |
537 | + | |
538 | + $moduloDestino->cadastra(); | |
539 | + } | |
540 | + } | |
541 | + | |
542 | + function copiarDiasSemanaTurma($turmaOrigemId, $turmaDestinoId) { | |
543 | + $diasSemanaTurmaOrigem = new clsPmieducarTurmaDiaSemana(); | |
544 | + $diasSemanaTurmaOrigem = $diasSemanaTurmaOrigem->lista(null, $turmaOrigemId); | |
545 | + | |
546 | + $fields = array('dia_semana', 'hora_inicial', 'hora_final'); | |
547 | + | |
548 | + foreach ($diasSemanaTurmaOrigem as $diaSemanaOrigem) { | |
549 | + $diaSemanaDestino = new clsPmieducarTurmaDiaSemana(); | |
550 | + | |
551 | + foreach ($fields as $fieldName) | |
552 | + $diaSemanaDestino->$fieldName = $diaSemanaOrigem[$fieldName]; | |
553 | + | |
554 | + $diaSemanaDestino->ref_cod_turma = $turmaDestinoId; | |
555 | + $diaSemanaDestino->cadastra(); | |
556 | + } | |
557 | + } | |
437 | 558 | } |
438 | 559 | |
439 | 560 | // Instancia objeto de página |
... | ... | @@ -450,7 +571,7 @@ $pagina->MakeAll(); |
450 | 571 | ?> |
451 | 572 | <script type="text/javascript"> |
452 | 573 | /** |
453 | - * Realiza validação client-side do formulário. | |
574 | + * Realiza validação client-side do forComponenteCurricular_Model_TurmaDataMappermulário. | |
454 | 575 | */ |
455 | 576 | function incluir() |
456 | 577 | { | ... | ... |
ieducar/intranet/educar_escola_cad.php
... | ... | @@ -402,7 +402,7 @@ class indice extends clsCadastro |
402 | 402 | } |
403 | 403 | else |
404 | 404 | { |
405 | - $this->inputsHelper()->integer('escola_inep_id', array('label' => 'Código inep', 'required' => false)); | |
405 | + $this->inputsHelper()->integer('escola_inep_id', array('label' => 'Código inep', 'required' => false, 'max_length' => 14)); | |
406 | 406 | |
407 | 407 | if( $_POST ) |
408 | 408 | foreach( $_POST AS $campo => $val ) | ... | ... |
ieducar/intranet/educar_exemplar_lst.php
... | ... | @@ -85,7 +85,7 @@ class indice extends clsListagem |
85 | 85 | var $ref_cod_biblioteca; |
86 | 86 | var $ref_cod_instituicao; |
87 | 87 | var $ref_cod_escola; |
88 | - | |
88 | + | |
89 | 89 | var $ref_cod_acervo_colecao; |
90 | 90 | var $ref_cod_acervo_editora; |
91 | 91 | |
... | ... | @@ -157,7 +157,7 @@ class indice extends clsListagem |
157 | 157 | |
158 | 158 | } |
159 | 159 | } |
160 | - | |
160 | + | |
161 | 161 | $obj_colecao = new clsPmieducarAcervoColecao(); |
162 | 162 | $obj_colecao->setOrderby("nm_colecao ASC"); |
163 | 163 | $obj_colecao->setCamposLista("cod_acervo_colecao, nm_colecao"); |
... | ... | @@ -169,7 +169,7 @@ class indice extends clsListagem |
169 | 169 | $opcoes_colecao[$colecao["cod_acervo_colecao"]] = $colecao["nm_colecao"]; |
170 | 170 | } |
171 | 171 | } |
172 | - | |
172 | + | |
173 | 173 | $obj_editora = new clsPmieducarAcervoEditora(); |
174 | 174 | $obj_editora->setCamposLista("cod_acervo_editora, nm_editora"); |
175 | 175 | $obj_editora->setOrderby("nm_editora ASC"); |
... | ... | @@ -182,7 +182,7 @@ class indice extends clsListagem |
182 | 182 | $opcoes_editora[$editora["cod_acervo_editora"]] = $editora["nm_editora"]; |
183 | 183 | } |
184 | 184 | } |
185 | - | |
185 | + | |
186 | 186 | $obj_fonte = new clsPmieducarFonte(); |
187 | 187 | $obj_fonte->setOrderby("nm_fonte ASC"); |
188 | 188 | $obj_fonte->setCamposLista("cod_fonte, nm_fonte"); |
... | ... | @@ -197,12 +197,12 @@ class indice extends clsListagem |
197 | 197 | } |
198 | 198 | |
199 | 199 | $this->campoLista( "ref_cod_exemplar_tipo", "Exemplar Tipo", $opcoes, $this->ref_cod_exemplar_tipo,null,null,null,null,null,false ); |
200 | - | |
200 | + | |
201 | 201 | $this->campoLista("ref_cod_acervo_colecao", "Acervo Coleção", $opcoes_colecao, $this->ref_cod_acervo_colecao, "", false, "", "", false, false); |
202 | 202 | $this->campoLista("ref_cod_acervo_editora", "Editora", $opcoes_editora, $this->ref_cod_acervo_editora, "", false, "", "", false, false); |
203 | 203 | $this->campoLista("ref_cod_fonte", "Fonte", $opcoes_fonte, $this->ref_cod_fonte, "", false, "", "", false, false); |
204 | - | |
205 | - | |
204 | + | |
205 | + | |
206 | 206 | $this->campoTexto("titulo_livro","Título da Obra",$this->titulo_livro,25,255,false); |
207 | 207 | $this->campoNumero("cod_exemplar","Tombo",$this->cod_exemplar,10,50,false); |
208 | 208 | |
... | ... | @@ -228,7 +228,7 @@ class indice extends clsListagem |
228 | 228 | $obj_exemplar->setLimite( $this->limite, $this->offset ); |
229 | 229 | |
230 | 230 | $lista = $obj_exemplar->lista_com_acervos( |
231 | - $this->cod_exemplar, | |
231 | + null, | |
232 | 232 | $this->ref_cod_fonte, |
233 | 233 | null, |
234 | 234 | null, |
... | ... | @@ -247,11 +247,11 @@ class indice extends clsListagem |
247 | 247 | $this->ref_cod_exemplar_tipo, |
248 | 248 | $this->titulo_livro, |
249 | 249 | $this->ref_cod_biblioteca, |
250 | - null, | |
251 | 250 | $this->ref_cod_instituicao, |
252 | 251 | $this->ref_cod_escola, |
253 | 252 | $this->ref_cod_acervo_colecao, |
254 | - $this->ref_cod_acervo_editora | |
253 | + $this->ref_cod_acervo_editora, | |
254 | + $this->cod_exemplar | |
255 | 255 | ); |
256 | 256 | |
257 | 257 | $total = $obj_exemplar->_total; |
... | ... | @@ -472,7 +472,7 @@ function getAcervoEditora(xml_acervo_editora) |
472 | 472 | } |
473 | 473 | } |
474 | 474 | else |
475 | - campoEditora.options[0].text = 'A biblioteca não possui nenhuma editora'; | |
475 | + campoEditora.options[0].text = 'A biblioteca não possui nenhuma editora'; | |
476 | 476 | } |
477 | 477 | |
478 | 478 | |
... | ... | @@ -492,7 +492,7 @@ function getFonte(xml_fonte) |
492 | 492 | } |
493 | 493 | } |
494 | 494 | else |
495 | - campoFonte.options[0].text = 'A biblioteca não possui nenhuma editora'; | |
495 | + campoFonte.options[0].text = 'A biblioteca não possui nenhuma editora'; | |
496 | 496 | } |
497 | 497 | |
498 | 498 | document.getElementById('ref_cod_biblioteca').onchange = function() |
... | ... | @@ -508,29 +508,29 @@ document.getElementById('ref_cod_biblioteca').onchange = function() |
508 | 508 | |
509 | 509 | var xml_exemplar_tipo = new ajax( getExemplarTipo ); |
510 | 510 | xml_exemplar_tipo.envia( "educar_exemplar_tipo_xml.php?bib="+campoBiblioteca ); |
511 | - | |
512 | - | |
511 | + | |
512 | + | |
513 | 513 | var campoColecao = document.getElementById('ref_cod_acervo_colecao'); |
514 | 514 | campoColecao.length = 1; |
515 | 515 | campoColecao.disabled = true; |
516 | 516 | campoColecao.options[0].text = 'Carregando coleção'; |
517 | 517 | var xml_acervo_colecao = new ajax(getAcervoColecao); |
518 | 518 | xml_acervo_colecao.envia("educar_acervo_colecao_xml.php?bib="+campoBiblioteca); |
519 | - | |
519 | + | |
520 | 520 | var campoEditora = document.getElementById('ref_cod_acervo_editora'); |
521 | 521 | campoEditora.length = 1; |
522 | 522 | campoEditora.disabled = true; |
523 | 523 | campoEditora.options[0].text = 'Carregando editora'; |
524 | 524 | var xml_acervo_editora = new ajax(getAcervoEditora); |
525 | 525 | xml_acervo_editora.envia("educar_acervo_editora_xml.php?bib="+campoBiblioteca); |
526 | - | |
526 | + | |
527 | 527 | var campoFonte = document.getElementById('ref_cod_fonte'); |
528 | 528 | campoFonte.length = 1; |
529 | 529 | campoFonte.disabled = true; |
530 | 530 | campoFonte.options[0].text = 'Carregando fonte'; |
531 | 531 | var xml_acervo_fonte = new ajax(getFonte); |
532 | 532 | xml_acervo_fonte.envia("educar_fonte_xml.php?bib="+campoBiblioteca); |
533 | - | |
533 | + | |
534 | 534 | }; |
535 | 535 | |
536 | 536 | function pesquisa() | ... | ... |
ieducar/intranet/educar_matricula_det.php
... | ... | @@ -33,6 +33,9 @@ require_once 'include/clsDetalhe.inc.php'; |
33 | 33 | require_once 'include/clsBanco.inc.php'; |
34 | 34 | require_once 'include/pmieducar/geral.inc.php'; |
35 | 35 | |
36 | +require_once 'App/Model/MatriculaSituacao.php'; | |
37 | +require_once 'Portabilis/View/Helper/Application.php'; | |
38 | + | |
36 | 39 | /** |
37 | 40 | * clsIndexBase class. |
38 | 41 | * |
... | ... | @@ -80,6 +83,12 @@ class indice extends clsDetalhe |
80 | 83 | |
81 | 84 | function Gerar() |
82 | 85 | { |
86 | + | |
87 | + // carrega estilo para feedback messages, exibindo msgs da api. | |
88 | + | |
89 | + $style = "/modules/Portabilis/Assets/Stylesheets/Frontend.css"; | |
90 | + Portabilis_View_Helper_Application::loadStylesheet($this, $style); | |
91 | + | |
83 | 92 | @session_start(); |
84 | 93 | $this->pessoa_logada = $_SESSION['id_pessoa']; |
85 | 94 | session_write_close(); |
... | ... | @@ -285,14 +294,25 @@ class indice extends clsDetalhe |
285 | 294 | $this->array_botao_url_script[] = "go(\"educar_transferencia_solicitacao_cad.php?ref_cod_matricula={$registro['cod_matricula']}&ref_cod_aluno={$registro['ref_cod_aluno']}&cancela=true&reabrir_matricula=true\")"; |
286 | 295 | } |
287 | 296 | |
288 | - if ($registro['aprovado'] == 4 || $det_transferencia) { | |
289 | - $this->array_botao[] = 'Imprimir Atestado Frequência'; | |
290 | - $this->array_botao_url_script[] = "showExpansivelImprimir(400, 200, \"educar_relatorio_atestado_frequencia.php?cod_matricula={$registro['cod_matricula']}\",[], \"Relatório Atestado de Freqüência\")"; | |
297 | + if ($registro['aprovado'] == App_Model_MatriculaSituacao::ABANDONO) { | |
298 | + $this->array_botao[] = "Desfazer abandono"; | |
299 | + $this->array_botao_url_script[] = "deleteAbandono({$registro['cod_matricula']})"; | |
291 | 300 | } |
292 | 301 | } |
293 | 302 | |
294 | 303 | $this->url_cancelar = 'educar_aluno_det.php?cod_aluno=' . $registro['ref_cod_aluno']; |
295 | 304 | $this->largura = '100%'; |
305 | + | |
306 | + // js | |
307 | + Portabilis_View_Helper_Application::loadJQueryLib($this); | |
308 | + | |
309 | + $scripts = array( | |
310 | + '/modules/Portabilis/Assets/Javascripts/Utils.js', | |
311 | + '/modules/Portabilis/Assets/Javascripts/ClientApi.js', | |
312 | + '/modules/Cadastro/Assets/Javascripts/MatriculaShow.js' | |
313 | + ); | |
314 | + | |
315 | + Portabilis_View_Helper_Application::loadJavascript($this, $scripts); | |
296 | 316 | } |
297 | 317 | |
298 | 318 | ... | ... |
ieducar/intranet/educar_matricula_turma_det.php
... | ... | @@ -204,6 +204,15 @@ class indice extends clsDetalhe |
204 | 204 | $this->possuiEnturmacaoTurmaDestino = false; |
205 | 205 | $this->turmaOrigemMesmaDestino = false; |
206 | 206 | |
207 | + $this->addDetalhe(array('<b>Turma selecionada</b>' , '<b>' . $registro['nm_turma'] . '</b>')); | |
208 | + | |
209 | + $this->addDetalhe(array('Total de vagas', $registro['max_aluno'])); | |
210 | + | |
211 | + if (is_numeric($total_alunos)) { | |
212 | + $this->addDetalhe(array('Alunos enturmados', $total_alunos)); | |
213 | + $this->addDetalhe(array('Vagas disponíveis', $registro['max_aluno'] - $total_alunos)); | |
214 | + } | |
215 | + | |
207 | 216 | if ($this->possuiEnturmacao) { |
208 | 217 | //se possui uma enturmacao mostra o nome, se mais de uma mostra select para selecionar |
209 | 218 | if (count($enturmacoes) > 1) { |
... | ... | @@ -227,23 +236,7 @@ class indice extends clsDetalhe |
227 | 236 | $selectEnturmacoes = "<input id='ref_cod_turma_origem' type='hidden' value = '{$enturmacoes[0]['ref_cod_turma']}'/>{$enturmacoes[0]['nm_turma']}"; |
228 | 237 | } |
229 | 238 | |
230 | - $this->addDetalhe(array('Turma atual (origem)', $selectEnturmacoes)); | |
231 | - } | |
232 | - else | |
233 | - $this->addDetalhe(array('Turma atual (origem)', 'Sem enturmações')); | |
234 | - | |
235 | - | |
236 | - if ($registro['nm_turma']) { | |
237 | - $this->addDetalhe(array('Turma destino' , $registro['nm_turma'])); | |
238 | - } | |
239 | - | |
240 | - if ($registro['max_aluno']) { | |
241 | - $this->addDetalhe(array('Total de vagas', $registro['max_aluno'])); | |
242 | - } | |
243 | - | |
244 | - if (is_numeric($total_alunos)) { | |
245 | - $this->addDetalhe(array('Alunos nesta turma', $total_alunos)); | |
246 | - $this->addDetalhe(array('Vagas restantes', $registro['max_aluno'] - $total_alunos)); | |
239 | + $this->addDetalhe(array('<b>Enturmação</b>', $selectEnturmacoes)); | |
247 | 240 | } |
248 | 241 | |
249 | 242 | $this->addDetalhe(array( |
... | ... | @@ -287,7 +280,7 @@ class indice extends clsDetalhe |
287 | 280 | if (turmaOrigemId && turmaOrigemId.value) |
288 | 281 | document.formcadastro.ref_cod_turma_origem.value = turmaOrigemId.value; |
289 | 282 | else { |
290 | - alert("Por favor selecione a turma atual (que será transferida)."); | |
283 | + alert("Por favor, selecione a enturmação a ser transferida."); | |
291 | 284 | return false; |
292 | 285 | } |
293 | 286 | } |
... | ... | @@ -301,7 +294,7 @@ class indice extends clsDetalhe |
301 | 294 | |
302 | 295 | function removerEnturmacao(ref_cod_matricula, ref_cod_turma_destino) { |
303 | 296 | |
304 | - if (! confirm("Tem certeza que deseja remover a enturmação (da turma destino)?")) | |
297 | + if (! confirm("Confirma remoção da enturmação?")) | |
305 | 298 | return false; |
306 | 299 | |
307 | 300 | document.formcadastro.ref_cod_turma_origem.value = "remover-enturmacao-destino"; |
... | ... | @@ -314,22 +307,25 @@ class indice extends clsDetalhe |
314 | 307 | |
315 | 308 | print $script; |
316 | 309 | |
317 | - $obj_permissoes = new clsPermissoes(); | |
318 | - if (! $this->turmaOrigemMesmaDestino && $obj_permissoes->permissao_cadastra(578, $this->pessoa_logada, 7)) { | |
310 | + $canCreate = new clsPermissoes(); | |
311 | + $canCreate = $canCreate->permissao_cadastra(578, $this->pessoa_logada, 7); | |
312 | + | |
313 | + if ($this->possuiEnturmacaoTurmaDestino && $canCreate){ | |
314 | + $this->array_botao = array('Remover (enturmação) da turma selecionada'); | |
315 | + $this->array_botao_url_script = array("removerEnturmacao({$this->ref_cod_matricula}, {$this->ref_cod_turma})"); | |
316 | + } | |
319 | 317 | |
318 | + if (! $this->turmaOrigemMesmaDestino && $canCreate) { | |
319 | + //mover enturmação | |
320 | 320 | if ($this->possuiEnturmacao) { |
321 | - //mover enturmação | |
322 | - $this->array_botao = array('Transferir (turma atual) para turma destino'); | |
323 | - $this->array_botao_url_script = array("enturmar({$this->ref_cod_matricula}, {$this->ref_cod_turma}, \"transferir\")"); | |
321 | + $this->array_botao[] = 'Transferir para turma selecionada'; | |
322 | + $this->array_botao_url_script[] = "enturmar({$this->ref_cod_matricula}, {$this->ref_cod_turma}, \"transferir\")"; | |
324 | 323 | } |
325 | 324 | |
326 | 325 | //nova enturmação |
327 | - $this->array_botao[] = 'Nova enturmação (na turma destino)'; | |
328 | - $this->array_botao_url_script[] = "enturmar({$this->ref_cod_matricula}, {$this->ref_cod_turma}, \"nova\")"; | |
329 | - | |
330 | - if ($this->possuiEnturmacaoTurmaDestino){ | |
331 | - $this->array_botao[] = 'Remover enturmação (turma destino)'; | |
332 | - $this->array_botao_url_script[] = "removerEnturmacao({$this->ref_cod_matricula}, {$this->ref_cod_turma})"; | |
326 | + if (! $this->possuiEnturmacaoTurmaDestino && $canCreate) { | |
327 | + $this->array_botao[] = 'Enturmar na turma selecionada'; | |
328 | + $this->array_botao_url_script[] = "enturmar({$this->ref_cod_matricula}, {$this->ref_cod_turma}, \"nova\")"; | |
333 | 329 | } |
334 | 330 | } |
335 | 331 | ... | ... |
ieducar/intranet/educar_pesquisa_cep_log_bairro.php
... | ... | @@ -108,27 +108,28 @@ class miolo1 extends clsListagem |
108 | 108 | $this->campoTexto('nm_logradouro', 'Logradouro', $_GET['nm_logradouro'], 50, 255); |
109 | 109 | $this->campoTexto('cidade', 'Cidade', $_GET['cidade'], 60, 60); |
110 | 110 | |
111 | - $obj_uf = new clsUf(FALSE, FALSE, 1); | |
112 | - $lst_uf = $obj_uf->lista(FALSE, FALSE, FALSE, FALSE, FALSE, 'sigla_uf'); | |
111 | + // uf | |
113 | 112 | |
114 | - $array_uf; | |
115 | - foreach ($lst_uf as $uf) { | |
116 | - $array_uf[$uf['sigla_uf']] = $uf['nome']; | |
117 | - } | |
118 | - if (! $_GET['ref_sigla_uf']) { | |
119 | - $_GET['ref_sigla_uf'] = $coreExt['Config']->app->locale->province; | |
120 | - } | |
121 | - /* Portabilis: Foi comentada a linha abaixo e adicionado 'SC' no lugar de $_GET['ref_sigla_uf'], | |
122 | - para trazer o estado como defaut */ | |
123 | - /*$this->campoLista('ref_sigla_uf', 'UF', $array_uf, $_GET['ref_sigla_uf'], | |
124 | - '', FALSE, '');*/ | |
125 | - | |
126 | - $this->campoLista('ref_sigla_uf', 'UF', $array_uf, 'SC', | |
127 | - '', FALSE, ''); | |
113 | + $defaultProvince = isset($_GET['ref_sigla_uf']) ? $_GET['ref_sigla_uf'] : $coreExt['Config']->app->locale->province; | |
114 | + | |
115 | + $options = array( | |
116 | + 'required' => false, | |
117 | + 'label' => 'Estado', | |
118 | + 'value' => $defaultProvince | |
119 | + ); | |
120 | + | |
121 | + $helperOptions = array( | |
122 | + 'attrName' => 'ref_sigla_uf' | |
123 | + ); | |
124 | + | |
125 | + $this->inputsHelper()->uf($options, $helperOptions); | |
128 | 126 | |
129 | 127 | |
130 | 128 | $this->addCabecalhos(array('Bairro', 'CEP', 'Logradouro', 'UF', 'Cidade')); |
131 | 129 | |
130 | + | |
131 | + // consulta dados | |
132 | + | |
132 | 133 | $select = ' |
133 | 134 | SELECT |
134 | 135 | c.idlog, c.cep, c.idbai, u.sigla_uf, m.nome, t.idtlog, m.idmun, b.zona_localizacao |
... | ... | @@ -143,111 +144,71 @@ class miolo1 extends clsListagem |
143 | 144 | l.idtlog = t.idtlog AND |
144 | 145 | m.sigla_uf = u.sigla_uf'; |
145 | 146 | |
146 | - $select_count = ' | |
147 | - SELECT | |
148 | - COUNT(*) | |
149 | - FROM | |
150 | - urbano.cep_logradouro_bairro c, public.bairro b, public.logradouro l, | |
151 | - public.municipio m, public.uf u, urbano.tipo_logradouro t | |
152 | - WHERE | |
153 | - c.idlog = l.idlog AND | |
154 | - c.idbai = b.idbai AND | |
155 | - l.idmun = b.idmun AND | |
156 | - l.idmun = m.idmun AND | |
157 | - l.idtlog = t.idtlog AND | |
158 | - m.sigla_uf = u.sigla_uf'; | |
147 | + $params = array(); | |
148 | + | |
149 | + if (isset($_GET['nr_cep'])) | |
150 | + $params['c.cep'] = idFederal2int($_GET['nr_cep']); | |
151 | + | |
152 | + if (isset($_GET['nm_bairro'])) | |
153 | + $params['b.nome'] = $_GET['nm_bairro']; | |
159 | 154 | |
160 | - if ( | |
161 | - $_GET['nm_bairro'] || $_GET['nr_cep'] || $_GET['nm_logradouro'] || | |
162 | - $_GET['ref_sigla_uf'] || $_GET['cidade'] | |
163 | - ) { | |
164 | - if ($_GET['nr_cep']) { | |
165 | - $num_cep = idFederal2int($_GET['nr_cep']); | |
166 | - $select .= sprintf(' AND c.cep ILIKE \'%%%s%%\'', $num_cep); | |
167 | - $select_count .= sprintf(' AND c.cep ILIKE \'%%%s%%\'', $num_cep); | |
168 | - } | |
169 | - | |
170 | - if ($_GET['nm_bairro']) { | |
171 | - $select .= sprintf(' AND b.nome ILIKE \'%%%s%%\'', $_GET['nm_bairro']); | |
172 | - $select_count .= sprintf(' AND b.nome ILIKE \'%%%s%%\'', $_GET['nm_bairro']); | |
173 | - } | |
174 | - | |
175 | - if ($_GET['nm_logradouro']) { | |
176 | - $select .= sprintf(' AND l.nome ILIKE \'%%%s%%\'', $_GET['nm_logradouro']); | |
177 | - $select_count .= sprintf(' AND l.nome ILIKE \'%%%s%%\'', $_GET['nm_logradouro']); | |
178 | - } | |
179 | - | |
180 | - if ($_GET['ref_sigla_uf']) { | |
181 | - $select .= sprintf(' AND u.sigla_uf ILIKE \'%%%s%%\'', $_GET['ref_sigla_uf']); | |
182 | - $select_count .= sprintf(' AND u.sigla_uf ILIKE \'%%%s%%\'', $_GET['ref_sigla_uf']); | |
183 | - } | |
184 | - | |
185 | - if ($_GET['cidade']) { | |
186 | - $select .= sprintf(' AND m.nome ILIKE \'%%%s%%\'', $_GET['cidade']); | |
187 | - $select_count .= sprintf(' AND m.nome ILIKE \'%%%s%%\'', $_GET['cidade']); | |
188 | - } | |
155 | + if (isset($_GET['nm_logradouro'])) | |
156 | + $params['l.nome'] = $_GET['nm_logradouro']; | |
157 | + | |
158 | + if (isset($_GET['ref_sigla_uf'])) | |
159 | + $params['u.sigla_uf'] = $_GET['ref_sigla_uf']; | |
160 | + | |
161 | + if (isset($_GET['cidade'])) | |
162 | + $params['m.nome'] = $_GET['cidade']; | |
163 | + | |
164 | + $paramCount = 1; | |
165 | + | |
166 | + foreach ($params as $name => $value) { | |
167 | + $select .= " AND $name ILIKE '%'||\$$paramCount||'%'"; | |
168 | + $paramCount++; | |
189 | 169 | } |
190 | 170 | |
191 | 171 | $select .= sprintf(' LIMIT %s OFFSET %s', $limite, $iniciolimit); |
192 | 172 | |
193 | - $db = new clsBanco(); | |
194 | - $total = $db->CampoUnico($select_count); | |
173 | + $result = Portabilis_Utils_Database::fetchPreparedQuery($select, array('params' => array_values($params))); | |
174 | + $total = count($result); | |
195 | 175 | |
196 | - $db->Consulta($select); | |
176 | + foreach ($result as $record) { | |
177 | + list($idlog, $cep, $idbai, $uf, $cidade, $tipoLogradouroId, $id_mun, $zona) = $record; | |
197 | 178 | |
198 | - while ($db->ProximoRegistro()) { | |
199 | - list($idlog, $cep, $idbai, $uf, $cidade, $descricao,$id_mun, $zona) = | |
200 | - array('', '', '', '', '', '', '', ''); | |
179 | + $cidade = addslashes($cidade); | |
201 | 180 | |
202 | - list($idlog, $cep, $idbai, $uf, $cidade, $descricao, $id_mun, $zona) = $db->Tupla(); | |
181 | + $logradouro = new clsLogradouro($idlog); | |
182 | + $logradouro = $logradouro->detalhe(); | |
183 | + $logradouro = addslashes($logradouro['nome']); | |
203 | 184 | |
204 | - $logradouro = new clsLogradouro($idlog); | |
205 | - $detalhe_logradouro = $logradouro->detalhe(); | |
206 | - | |
207 | - $bairro = new clsBairro($idbai); | |
208 | - $detalhe_bairro = $bairro->detalhe(); | |
185 | + $bairro = new clsBairro($idbai); | |
186 | + $bairro = $bairro->detalhe(); | |
187 | + $bairro = addslashes($bairro['nome']); | |
209 | 188 | |
210 | 189 | $cep2 = int2CEP($cep); |
211 | 190 | $s_end = '0'; |
212 | 191 | |
213 | - $descricao = urlencode($descricao); | |
214 | - | |
215 | - if ($_GET['param']) { | |
216 | - $url = sprintf( | |
217 | - '<a href="javascript:void(0);" onclick="setaCamposOuvidoria(\'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\')">%%s</a>', | |
218 | - $cep, $cep2, $uf, $uf, $id_mun, $cidade, $detalhe_bairro['idbai'], $detalhe_bairro['nome'], $descricao, $descricao, $detalhe_logradouro['idlog'], $detalhe_logradouro['nome'] | |
219 | - ); | |
220 | - | |
221 | - $this->addLinhas(array( | |
222 | - sprintf($url, $detalhe_bairro['nome']), | |
223 | - sprintf($url, $cep2), | |
224 | - sprintf($url, $detalhe_logradouro["nome"]), | |
225 | - sprintf($url, $uf), | |
226 | - sprintf($url, $cidade) | |
227 | - )); | |
228 | - } | |
229 | - else { | |
230 | - $url = sprintf( | |
231 | - '<a href="javascript:void(0);" onclick="cv_set_campo(\'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\');">%%s</a>', | |
232 | - $_SESSION['campo1'], $detalhe_bairro["nome"], $_SESSION['campo2'], | |
233 | - $detalhe_bairro["idbai"], $_SESSION['campo3'], $cep, | |
234 | - $_SESSION['campo4'], $detalhe_logradouro["nome"], | |
235 | - $_SESSION['campo5'], $detalhe_logradouro["idlog"], | |
236 | - $_SESSION['campo6'], $uf, $_SESSION['campo7'], $cidade, | |
237 | - $_SESSION['campo8'], $descricao, $_SESSION['campo9'], $s_end, | |
238 | - $_SESSION['campo10'], $cep2, $_SESSION['campo11'], $uf, | |
239 | - $_SESSION['campo12'], $_SESSION['campo13'], $id_mun, | |
240 | - $_SESSION['campo14'], $zona | |
241 | - ); | |
242 | - | |
243 | - $this->addLinhas(array( | |
244 | - sprintf($url, $detalhe_bairro['nome']), | |
245 | - sprintf($url, $cep2), | |
246 | - sprintf($url, $detalhe_logradouro['nome']), | |
247 | - sprintf($url, $uf), | |
248 | - sprintf($url, $cidade) | |
249 | - )); | |
250 | - } | |
192 | + $url = sprintf( | |
193 | + '<a href="javascript:void(0);" onclick="cv_set_campo(\'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\');">%%s</a>', | |
194 | + $_SESSION['campo1'], $bairro, $_SESSION['campo2'], | |
195 | + $idbai, $_SESSION['campo3'], $cep, | |
196 | + $_SESSION['campo4'], $logradouro, | |
197 | + $_SESSION['campo5'], $idlog, | |
198 | + $_SESSION['campo6'], $uf, $_SESSION['campo7'], $cidade, | |
199 | + $_SESSION['campo8'], $tipoLogradouroId, $_SESSION['campo9'], $s_end, | |
200 | + $_SESSION['campo10'], $cep2, $_SESSION['campo11'], $uf, | |
201 | + $_SESSION['campo12'], $_SESSION['campo13'], $id_mun, | |
202 | + $_SESSION['campo14'], $zona | |
203 | + ); | |
204 | + | |
205 | + $this->addLinhas(array( | |
206 | + sprintf($url, $bairro), | |
207 | + sprintf($url, $cep2), | |
208 | + sprintf($url, $logradouro), | |
209 | + sprintf($url, $uf), | |
210 | + sprintf($url, $cidade) | |
211 | + )); | |
251 | 212 | } |
252 | 213 | |
253 | 214 | $this->largura = '100%'; | ... | ... |
ieducar/intranet/educar_turma_cad.php
... | ... | @@ -226,6 +226,10 @@ class indice extends clsCadastro |
226 | 226 | $this->campoLista('ref_ref_cod_serie', 'Série', $opcoes_serie, $this->ref_ref_cod_serie, |
227 | 227 | '', FALSE, '', $script); |
228 | 228 | |
229 | + // o campo ano somente é exibido para turmas novas ou cadastradas após inclusão deste campo. | |
230 | + if (! isset($this->cod_turma) || isset($this->ano)) | |
231 | + $this->inputsHelper()->dynamic('anoLetivo'); | |
232 | + | |
229 | 233 | // Infra prédio cômodo |
230 | 234 | $opcoes = array('' => 'Selecione'); |
231 | 235 | |
... | ... | @@ -302,7 +306,8 @@ class indice extends clsCadastro |
302 | 306 | |
303 | 307 | $this->campoNumero('max_aluno', 'Máximo de Alunos', $this->max_aluno, 3, 3, TRUE); |
304 | 308 | |
305 | - $this->campoCheck('visivel', 'Ativo', dbBool($this->visivel)); | |
309 | + $ativo = isset($this->cod_turma) ? dbBool($this->visivel) : true; | |
310 | + $this->campoCheck('visivel', 'Ativo', $ativo); | |
306 | 311 | |
307 | 312 | $this->campoCheck('multiseriada', 'Multi-Seriada', $this->multiseriada, '', |
308 | 313 | FALSE, FALSE); |
... | ... | @@ -687,7 +692,7 @@ class indice extends clsCadastro |
687 | 692 | $this->hora_inicio_intervalo, $this->hora_fim_intervalo, $this->ref_cod_regente, |
688 | 693 | $this->ref_cod_instituicao_regente, $this->ref_cod_instituicao, |
689 | 694 | $this->ref_cod_curso, $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, |
690 | - $this->visivel, $this->turma_turno_id, $this->tipo_boletim); | |
695 | + $this->visivel, $this->turma_turno_id, $this->tipo_boletim, $this->ano); | |
691 | 696 | |
692 | 697 | $cadastrou = $obj->cadastra(); |
693 | 698 | |
... | ... | @@ -753,7 +758,7 @@ class indice extends clsCadastro |
753 | 758 | $this->ref_cod_regente, $this->ref_cod_instituicao_regente, |
754 | 759 | $this->ref_cod_instituicao, $this->ref_cod_curso, |
755 | 760 | $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, $this->visivel, |
756 | - $this->turma_turno_id, $this->tipo_boletim); | |
761 | + $this->turma_turno_id, $this->tipo_boletim, $this->ano); | |
757 | 762 | |
758 | 763 | $cadastrou = $obj->cadastra(); |
759 | 764 | |
... | ... | @@ -814,7 +819,8 @@ class indice extends clsCadastro |
814 | 819 | $this->ref_cod_curso, $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, |
815 | 820 | $this->visivel, |
816 | 821 | $this->turma_turno_id, |
817 | - $this->tipo_boletim); | |
822 | + $this->tipo_boletim, | |
823 | + $this->ano); | |
818 | 824 | |
819 | 825 | $editou = $obj->edita(); |
820 | 826 | |
... | ... | @@ -885,7 +891,7 @@ class indice extends clsCadastro |
885 | 891 | $this->hora_inicio_intervalo, $this->hora_fim_intervalo, $this->ref_cod_regente, |
886 | 892 | $this->ref_cod_instituicao_regente, $this->ref_cod_instituicao, |
887 | 893 | $this->ref_cod_curso, $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, |
888 | - $this->visivel, $this->turma_turno_id, $this->tipo_boletim); | |
894 | + $this->visivel, $this->turma_turno_id, $this->tipo_boletim, $this->ano); | |
889 | 895 | |
890 | 896 | $editou = $obj->edita(); |
891 | 897 | } | ... | ... |
ieducar/intranet/educar_turma_lst.php
... | ... | @@ -109,6 +109,7 @@ class indice extends clsListagem |
109 | 109 | $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); |
110 | 110 | |
111 | 111 | $lista_busca = array( |
112 | + "Ano", | |
112 | 113 | "Turma", |
113 | 114 | "Turno", |
114 | 115 | "Série", |
... | ... | @@ -121,7 +122,7 @@ class indice extends clsListagem |
121 | 122 | if ($nivel_usuario == 1) |
122 | 123 | { |
123 | 124 | $lista_busca[] = "Escola"; |
124 | - $lista_busca[] = "Instituição"; | |
125 | + //$lista_busca[] = "Instituição"; | |
125 | 126 | } |
126 | 127 | else if ($nivel_usuario == 2) |
127 | 128 | { |
... | ... | @@ -142,8 +143,11 @@ class indice extends clsListagem |
142 | 143 | $this->ref_ref_cod_escola = $this->ref_cod_escola; |
143 | 144 | } |
144 | 145 | |
146 | + $helperOptions = array(); | |
147 | + $this->inputsHelper()->dynamic('anoLetivo', array(), $helperOptions); | |
148 | + | |
145 | 149 | $this->campoTexto( "nm_turma", "Turma", $this->nm_turma, 30, 255, false ); |
146 | - $this->campoLista("visivel", "Situação", array("" => "Selecione", "1" => "Visível", "2" => "Invisível"), $this->visivel); | |
150 | + $this->campoLista("visivel", "Situação", array("" => "Selecione", "1" => "Ativo", "2" => "Inativo"), $this->visivel); | |
147 | 151 | // Paginador |
148 | 152 | $this->limite = 20; |
149 | 153 | $this->offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->limite-$this->limite: 0; |
... | ... | @@ -187,7 +191,7 @@ class indice extends clsListagem |
187 | 191 | null, |
188 | 192 | $this->ref_cod_curso, |
189 | 193 | $this->ref_cod_instituicao, |
190 | - null, null, null, null, null, $visivel | |
194 | + null, null, null, null, null, $visivel, null, null, $this->ano | |
191 | 195 | ); |
192 | 196 | |
193 | 197 | $total = $obj_turma->_total; |
... | ... | @@ -250,6 +254,7 @@ class indice extends clsListagem |
250 | 254 | |
251 | 255 | |
252 | 256 | $lista_busca = array( |
257 | + "<a href=\"educar_turma_det.php?cod_turma={$registro["cod_turma"]}\">{$registro["ano"]}</a>", | |
253 | 258 | "<a href=\"educar_turma_det.php?cod_turma={$registro["cod_turma"]}\">{$registro["nm_turma"]}</a>" |
254 | 259 | ); |
255 | 260 | |
... | ... | @@ -276,7 +281,7 @@ class indice extends clsListagem |
276 | 281 | else |
277 | 282 | $lista_busca[] = "<a href=\"educar_turma_det.php?cod_turma={$registro["cod_turma"]}\">-</a>"; |
278 | 283 | |
279 | - $lista_busca[] = "<a href=\"educar_turma_det.php?cod_turma={$registro["cod_turma"]}\">{$registro["nm_instituicao"]}</a>"; | |
284 | + //$lista_busca[] = "<a href=\"educar_turma_det.php?cod_turma={$registro["cod_turma"]}\">{$registro["nm_instituicao"]}</a>"; | |
280 | 285 | } |
281 | 286 | else if ($nivel_usuario == 2) |
282 | 287 | { |
... | ... | @@ -291,7 +296,7 @@ class indice extends clsListagem |
291 | 296 | } |
292 | 297 | else |
293 | 298 | { |
294 | - $lista_busca[] = "<a href=\"educar_turma_det.php?cod_turma={$registro["cod_turma"]}\">Desativo</a>"; | |
299 | + $lista_busca[] = "<a href=\"educar_turma_det.php?cod_turma={$registro["cod_turma"]}\">Inativo</a>"; | |
295 | 300 | } |
296 | 301 | $this->addLinhas($lista_busca); |
297 | 302 | } | ... | ... |
ieducar/intranet/include/clsCadastro.inc.php
... | ... | @@ -726,7 +726,7 @@ class clsCadastro extends clsCampos |
726 | 726 | } |
727 | 727 | |
728 | 728 | |
729 | - public function inputsHelper() { | |
729 | + protected function inputsHelper() { | |
730 | 730 | if (! isset($this->_inputsHelper)) |
731 | 731 | $this->_inputsHelper = new Portabilis_View_Helper_Inputs($this); |
732 | 732 | ... | ... |
ieducar/intranet/include/clsListagem.inc.php
... | ... | @@ -35,6 +35,7 @@ if (class_exists('clsPmiajudaPagina')) { |
35 | 35 | } |
36 | 36 | |
37 | 37 | require_once 'Portabilis/View/Helper/Application.php'; |
38 | +require_once 'Portabilis/View/Helper/Inputs.php'; | |
38 | 39 | |
39 | 40 | define('alTopLeft', 'valign=top align=left'); |
40 | 41 | define('alTopCenter', 'valign=top align=center'); |
... | ... | @@ -745,4 +746,11 @@ class clsListagem extends clsCampos |
745 | 746 | { |
746 | 747 | die("<div style='width: 300px; height: 100px; font: 700 11px Arial,Helv,Sans; background-color: #f6f6f6; color: #e11; position: absolute; left: 50%; top: 50%; margin-top: -20px; margin-left: -100px; text-align: center; border: solid 1px #a1a1f1;'>{$msg}</div><script>setTimeout('window.location=\'$redir\'',5000);</script>"); |
747 | 748 | } |
749 | + | |
750 | + public function inputsHelper() { | |
751 | + if (! isset($this->_inputsHelper)) | |
752 | + $this->_inputsHelper = new Portabilis_View_Helper_Inputs($this); | |
753 | + | |
754 | + return $this->_inputsHelper; | |
755 | + } | |
748 | 756 | } | ... | ... |
ieducar/intranet/include/pessoa/clsPessoaFisica.inc.php
... | ... | @@ -153,13 +153,17 @@ class clsPessoaFisica extends clsPessoaFj |
153 | 153 | $where = ''; |
154 | 154 | |
155 | 155 | if (is_string($str_nome) && $str_nome != '') { |
156 | + $str_nome = addslashes($str_nome); | |
156 | 157 | $str_nome = str_replace(' ', '%', $str_nome); |
157 | - $where .= "{$whereAnd} nome ILIKE '%{$str_nome}%' "; | |
158 | + | |
159 | + $where .= "{$whereAnd} nome ILIKE E'%{$str_nome}%' "; | |
158 | 160 | $whereAnd = ' AND '; |
159 | 161 | } |
160 | 162 | |
161 | 163 | if (is_string($numeric_cpf)) { |
162 | - $where .= "{$whereAnd} cpf ILIKE '%{$numeric_cpf}%' "; | |
164 | + $numeric_cpf = addslashes($numeric_cpf); | |
165 | + | |
166 | + $where .= "{$whereAnd} cpf ILIKE E'%{$numeric_cpf}%' "; | |
163 | 167 | $whereAnd = ' AND '; |
164 | 168 | } |
165 | 169 | ... | ... |
ieducar/intranet/include/pessoa/clsPessoa_.inc.php
... | ... | @@ -84,13 +84,11 @@ class clsPessoa_ |
84 | 84 | $valores .= ", '$this->idpes_cad' "; |
85 | 85 | } |
86 | 86 | |
87 | - $this->nome = str_replace("'", "", $this->nome); | |
88 | - | |
89 | 87 | $db = new clsBanco(); |
90 | 88 | |
91 | 89 | $db->Consulta("INSERT INTO {$this->schema_cadastro}.{$this->tabela_pessoa} (nome, data_cad,tipo,situacao,origem_gravacao, idsis_cad, operacao $campos) VALUES ('$this->nome', NOW(), '$this->tipo', 'P', 'U', 17, 'I' $valores)"); |
92 | 90 | $this->idpes = $db->InsertId("{$this->schema_cadastro}.seq_pessoa"); |
93 | - | |
91 | + | |
94 | 92 | return $this->idpes; |
95 | 93 | } |
96 | 94 | } |
... | ... | @@ -115,7 +113,6 @@ class clsPessoa_ |
115 | 113 | } |
116 | 114 | if($this->nome || $this->nome==="") |
117 | 115 | { |
118 | - $this->nome = eregi_replace( " +\$", "", $this->nome ); | |
119 | 116 | $set .= "$gruda nome = '$this->nome' "; |
120 | 117 | $gruda = ", "; |
121 | 118 | } |
... | ... | @@ -390,7 +387,7 @@ class clsPessoa_ |
390 | 387 | list($this->idpes, $this->nome, $this->idpes_cad, $this->data_cad, $this->url, $this->tipo, $this->idpes_rev, $this->data_rev, $this->situacao, $this->origem_gravacao, $this->email ) = $tupla; |
391 | 388 | return $tupla; |
392 | 389 | } |
393 | - } | |
390 | + } | |
394 | 391 | return false; |
395 | 392 | } |
396 | 393 | } | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarAluno.inc.php
... | ... | @@ -759,6 +759,8 @@ class clsPmieducarAluno |
759 | 759 | } |
760 | 760 | |
761 | 761 | if (is_string($str_nome_aluno)) { |
762 | + $str_nome_aluno = addslashes($str_nome_aluno); | |
763 | + | |
762 | 764 | $filtros .= "{$whereAnd} EXISTS ( |
763 | 765 | SELECT |
764 | 766 | 1 |
... | ... | @@ -868,18 +870,24 @@ class clsPmieducarAluno |
868 | 870 | $and_where = ''; |
869 | 871 | |
870 | 872 | if (!empty($str_nm_pai2)) { |
873 | + $str_nm_pai2 = addslashes($str_nm_pai2); | |
874 | + | |
871 | 875 | $complemento_sql .= ' LEFT OUTER JOIN cadastro.pessoa AS pessoa_pai ON (pessoa_pai.idpes = f.idpes_pai)'; |
872 | 876 | $complemento_where .= "{$and_where} (nm_pai ILIKE ('%{$str_nm_pai2}%') OR pessoa_pai.nome ILIKE ('%{$str_nm_pai2}%'))"; |
873 | 877 | $and_where = ' AND '; |
874 | 878 | } |
875 | 879 | |
876 | 880 | if (!empty($str_nm_mae2)) { |
881 | + $str_nm_mae2 = addslashes($str_nm_mae2); | |
882 | + | |
877 | 883 | $complemento_sql .= ' LEFT OUTER JOIN cadastro.pessoa AS pessoa_mae ON (pessoa_mae.idpes = f.idpes_mae)'; |
878 | 884 | $complemento_where .= "{$and_where} (nm_mae ILIKE ('%{$str_nm_mae2}%') OR pessoa_mae.nome ILIKE ('%{$str_nm_mae2}%'))"; |
879 | 885 | $and_where = ' AND '; |
880 | 886 | } |
881 | 887 | |
882 | 888 | if (!empty($str_nm_responsavel2)) { |
889 | + $str_nm_responsavel2 = addslashes($str_nm_responsavel2); | |
890 | + | |
883 | 891 | $complemento_sql .= " LEFT OUTER JOIN cadastro.pessoa AS pessoa_responsavel ON (pessoa_responsavel.idpes = f.idpes_responsavel)"; |
884 | 892 | $complemento_where .= "{$and_where} (pessoa_responsavel.nome ILIKE ('%{$str_nm_responsavel2}%'))"; |
885 | 893 | $and_where = " AND "; | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarEscolaAnoLetivo.inc.php
... | ... | @@ -107,13 +107,13 @@ class clsPmieducarEscolaAnoLetivo |
107 | 107 | * |
108 | 108 | * @return object |
109 | 109 | */ |
110 | - function clsPmieducarEscolaAnoLetivo( $ref_cod_escola = null, $ano = null, $ref_usuario_cad = null, $ref_usuario_exc = null, $andamento = null, $data_cadastro = null, $data_exclusao = null, $ativo = null ) | |
110 | + function clsPmieducarEscolaAnoLetivo( $ref_cod_escola = null, $ano = null, $ref_usuario_cad = null, $ref_usuario_exc = null, $andamento = null, $data_cadastro = null, $data_exclusao = null, $ativo = null, $turmas_por_ano = null ) | |
111 | 111 | { |
112 | 112 | $db = new clsBanco(); |
113 | 113 | $this->_schema = "pmieducar."; |
114 | 114 | $this->_tabela = "{$this->_schema}escola_ano_letivo"; |
115 | 115 | |
116 | - $this->_campos_lista = $this->_todos_campos = "ref_cod_escola, ano, ref_usuario_cad, ref_usuario_exc, andamento, data_cadastro, data_exclusao, ativo"; | |
116 | + $this->_campos_lista = $this->_todos_campos = "ref_cod_escola, ano, ref_usuario_cad, ref_usuario_exc, andamento, data_cadastro, data_exclusao, ativo, turmas_por_ano"; | |
117 | 117 | |
118 | 118 | if( is_numeric( $ref_usuario_exc ) ) |
119 | 119 | { |
... | ... | @@ -222,6 +222,7 @@ class clsPmieducarEscolaAnoLetivo |
222 | 222 | $this->ativo = $ativo; |
223 | 223 | } |
224 | 224 | |
225 | + $this->turmas_por_ano = $turmas_por_ano; | |
225 | 226 | } |
226 | 227 | |
227 | 228 | /** |
... | ... | @@ -263,13 +264,21 @@ class clsPmieducarEscolaAnoLetivo |
263 | 264 | $valores .= "{$gruda}'{$this->andamento}'"; |
264 | 265 | $gruda = ", "; |
265 | 266 | } |
267 | + | |
266 | 268 | $campos .= "{$gruda}data_cadastro"; |
267 | 269 | $valores .= "{$gruda}NOW()"; |
268 | 270 | $gruda = ", "; |
271 | + | |
269 | 272 | $campos .= "{$gruda}ativo"; |
270 | 273 | $valores .= "{$gruda}'1'"; |
271 | 274 | $gruda = ", "; |
272 | 275 | |
276 | + if( is_numeric( $this->turmas_por_ano ) ) | |
277 | + { | |
278 | + $campos .= "{$gruda}turmas_por_ano"; | |
279 | + $valores .= "{$gruda}'{$this->turmas_por_ano}'"; | |
280 | + $gruda = ", "; | |
281 | + } | |
273 | 282 | |
274 | 283 | $db->Consulta( "INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )" ); |
275 | 284 | return true; | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarExemplar.inc.php
... | ... | @@ -700,7 +700,7 @@ class clsPmieducarExemplar |
700 | 700 | * |
701 | 701 | * @return array |
702 | 702 | */ |
703 | - function lista_com_acervos( $int_cod_exemplar = null, $int_ref_cod_fonte = null, $int_ref_cod_motivo_baixa = null, $int_ref_cod_acervo = null, $int_ref_cod_situacao = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_permite_emprestimo = null, $int_preco = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $date_data_aquisicao_ini = null, $date_data_aquisicao_fim = null, $int_ref_exemplar_tipo = null, $str_titulo_livro = null,$int_ref_cod_biblioteca = null, $str_titulo = null, $int_ref_cod_instituicao = null, $int_ref_cod_escola = null, $int_ref_cod_acervo_colecao = null, $int_ref_cod_acervo_editora = null) { | |
703 | + function lista_com_acervos( $int_cod_exemplar = null, $int_ref_cod_fonte = null, $int_ref_cod_motivo_baixa = null, $int_ref_cod_acervo = null, $int_ref_cod_situacao = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_permite_emprestimo = null, $int_preco = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $date_data_aquisicao_ini = null, $date_data_aquisicao_fim = null, $int_ref_exemplar_tipo = null, $str_titulo_livro = null,$int_ref_cod_biblioteca = null, $int_ref_cod_instituicao = null, $int_ref_cod_escola = null, $int_ref_cod_acervo_colecao = null, $int_ref_cod_acervo_editora = null, $tombo) { | |
704 | 704 | $sql = "SELECT {$this->_campos_lista}, a.ref_cod_biblioteca, a.titulo FROM {$this->_tabela} e, {$this->_schema}acervo a, {$this->_schema}biblioteca b"; |
705 | 705 | |
706 | 706 | $whereAnd = " AND"; |
... | ... | @@ -791,12 +791,16 @@ class clsPmieducarExemplar |
791 | 791 | $filtros .= "{$whereAnd} e.data_aquisicao <= '{$date_data_aquisicao_fim}'"; |
792 | 792 | $whereAnd = " AND "; |
793 | 793 | } |
794 | - if( is_string( $str_titulo ) ) | |
794 | + if( is_string( $str_titulo_livro ) ) | |
795 | 795 | { |
796 | - $filtros .= "{$whereAnd} a.titulo LIKE '%{$str_titulo}%'"; | |
796 | + $filtros .= "{$whereAnd} to_ascii(a.titulo) LIKE to_ascii('%{$str_titulo_livro}%')"; | |
797 | 797 | $whereAnd = " AND "; |
798 | 798 | } |
799 | 799 | |
800 | + if (is_numeric($tombo)) { | |
801 | + $filtros .= "{$whereAnd} e.tombo = $tombo"; | |
802 | + $whereAnd = " AND "; | |
803 | + } | |
800 | 804 | |
801 | 805 | /** |
802 | 806 | * INICIO - PESQUISAS EXTRAS |
... | ... | @@ -804,12 +808,6 @@ class clsPmieducarExemplar |
804 | 808 | $whereAnd2 = " AND "; |
805 | 809 | $filtros_extra = null; |
806 | 810 | |
807 | - if( is_string( $str_titulo_livro ) ) | |
808 | - { | |
809 | - $filtros_extra .= "{$whereAnd2} to_ascii(a.titulo) ilike to_ascii('%{$date_data_aquisicao_fim}%') "; | |
810 | - $whereAnd2 = " AND "; | |
811 | - } | |
812 | - | |
813 | 811 | if( is_numeric( $int_ref_exemplar_tipo ) ) |
814 | 812 | { |
815 | 813 | $filtros_extra .= "{$whereAnd} a.ref_cod_exemplar_tipo = $int_ref_exemplar_tipo"; | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarTurma.inc.php
... | ... | @@ -126,13 +126,13 @@ class clsPmieducarTurma |
126 | 126 | * |
127 | 127 | * @return object |
128 | 128 | */ |
129 | - function clsPmieducarTurma( $cod_turma = null, $ref_usuario_exc = null, $ref_usuario_cad = null, $ref_ref_cod_serie = null, $ref_ref_cod_escola = null, $ref_cod_infra_predio_comodo = null, $nm_turma = null, $sgl_turma = null, $max_aluno = null, $multiseriada = null, $data_cadastro = null, $data_exclusao = null, $ativo = null, $ref_cod_turma_tipo = null, $hora_inicial = null, $hora_final = null, $hora_inicio_intervalo = null, $hora_fim_intervalo = null, $ref_cod_regente = null, $ref_cod_instituicao_regente = null, $ref_cod_instituicao = null, $ref_cod_curso = null, $ref_ref_cod_serie_mult = null, $ref_ref_cod_escola_mult = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null) | |
129 | + function clsPmieducarTurma( $cod_turma = null, $ref_usuario_exc = null, $ref_usuario_cad = null, $ref_ref_cod_serie = null, $ref_ref_cod_escola = null, $ref_cod_infra_predio_comodo = null, $nm_turma = null, $sgl_turma = null, $max_aluno = null, $multiseriada = null, $data_cadastro = null, $data_exclusao = null, $ativo = null, $ref_cod_turma_tipo = null, $hora_inicial = null, $hora_final = null, $hora_inicio_intervalo = null, $hora_fim_intervalo = null, $ref_cod_regente = null, $ref_cod_instituicao_regente = null, $ref_cod_instituicao = null, $ref_cod_curso = null, $ref_ref_cod_serie_mult = null, $ref_ref_cod_escola_mult = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null, $ano = null) | |
130 | 130 | { |
131 | 131 | $db = new clsBanco(); |
132 | 132 | $this->_schema = "pmieducar."; |
133 | 133 | $this->_tabela = "{$this->_schema}turma"; |
134 | 134 | |
135 | - $this->_campos_lista = $this->_todos_campos = "t.cod_turma, t.ref_usuario_exc, t.ref_usuario_cad, t.ref_ref_cod_serie, t.ref_ref_cod_escola, t.ref_cod_infra_predio_comodo, t.nm_turma, t.sgl_turma, t.max_aluno, t.multiseriada, t.data_cadastro, t.data_exclusao, t.ativo, t.ref_cod_turma_tipo, t.hora_inicial, t.hora_final, t.hora_inicio_intervalo, t.hora_fim_intervalo, t.ref_cod_regente, t.ref_cod_instituicao_regente,t.ref_cod_instituicao, t.ref_cod_curso, t.ref_ref_cod_serie_mult, t.ref_ref_cod_escola_mult, t.visivel, t.turma_turno_id, t.tipo_boletim"; | |
135 | + $this->_campos_lista = $this->_todos_campos = "t.cod_turma, t.ref_usuario_exc, t.ref_usuario_cad, t.ref_ref_cod_serie, t.ref_ref_cod_escola, t.ref_cod_infra_predio_comodo, t.nm_turma, t.sgl_turma, t.max_aluno, t.multiseriada, t.data_cadastro, t.data_exclusao, t.ativo, t.ref_cod_turma_tipo, t.hora_inicial, t.hora_final, t.hora_inicio_intervalo, t.hora_fim_intervalo, t.ref_cod_regente, t.ref_cod_instituicao_regente,t.ref_cod_instituicao, t.ref_cod_curso, t.ref_ref_cod_serie_mult, t.ref_ref_cod_escola_mult, t.visivel, t.turma_turno_id, t.tipo_boletim, t.ano"; | |
136 | 136 | |
137 | 137 | if( is_numeric( $ref_cod_turma_tipo ) ) |
138 | 138 | { |
... | ... | @@ -455,7 +455,7 @@ class clsPmieducarTurma |
455 | 455 | |
456 | 456 | $this->turma_turno_id = $turma_turno_id; |
457 | 457 | $this->tipo_boletim = $tipo_boletim; |
458 | - | |
458 | + $this->ano = $ano; | |
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
... | ... | @@ -610,6 +610,12 @@ class clsPmieducarTurma |
610 | 610 | $gruda = ", "; |
611 | 611 | } |
612 | 612 | |
613 | + if(is_numeric($this->ano)){ | |
614 | + $campos .= "{$gruda}ano"; | |
615 | + $valores .= "{$gruda}'{$this->ano}'"; | |
616 | + $gruda = ", "; | |
617 | + } | |
618 | + | |
613 | 619 | $db->Consulta( "INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )" ); |
614 | 620 | return $db->InsertId( "{$this->_tabela}_cod_turma_seq"); |
615 | 621 | } |
... | ... | @@ -762,7 +768,7 @@ class clsPmieducarTurma |
762 | 768 | $set .= "{$gruda}visivel = TRUE"; |
763 | 769 | $gruda = ", "; |
764 | 770 | } |
765 | - else | |
771 | + else | |
766 | 772 | { |
767 | 773 | $set .= "{$gruda}visivel = FALSE"; |
768 | 774 | $gruda = ", "; |
... | ... | @@ -786,6 +792,15 @@ class clsPmieducarTurma |
786 | 792 | $gruda = ", "; |
787 | 793 | } |
788 | 794 | |
795 | + if(is_numeric($this->ano)) { | |
796 | + $set .= "{$gruda}ano = '{$this->ano}'"; | |
797 | + $gruda = ", "; | |
798 | + } | |
799 | + else { | |
800 | + $set .= "{$gruda}ano = NULL"; | |
801 | + $gruda = ", "; | |
802 | + } | |
803 | + | |
789 | 804 | if( $set ) |
790 | 805 | { |
791 | 806 | $db->Consulta( "UPDATE {$this->_tabela} SET $set WHERE cod_turma = '{$this->cod_turma}'" ); |
... | ... | @@ -1131,7 +1146,7 @@ class clsPmieducarTurma |
1131 | 1146 | * |
1132 | 1147 | * @return array |
1133 | 1148 | */ |
1134 | - function lista( $int_cod_turma = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $int_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $bool_verifica_serie_multiseriada = false, $bool_tem_alunos_aguardando_nota = null, $visivel = null, $turma_turno_id = null) | |
1149 | + function lista( $int_cod_turma = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $int_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $bool_verifica_serie_multiseriada = false, $bool_tem_alunos_aguardando_nota = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null, $ano = null) | |
1135 | 1150 | { |
1136 | 1151 | |
1137 | 1152 | $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela} t"; |
... | ... | @@ -1335,7 +1350,7 @@ class clsPmieducarTurma |
1335 | 1350 | $filtros .= "{$whereAnd} t.visivel = TRUE"; |
1336 | 1351 | $whereAnd = " AND "; |
1337 | 1352 | } |
1338 | - else | |
1353 | + else | |
1339 | 1354 | { |
1340 | 1355 | $filtros .= "{$whereAnd} t.visivel = FALSE"; |
1341 | 1356 | $whereAnd = " AND "; |
... | ... | @@ -1346,17 +1361,27 @@ class clsPmieducarTurma |
1346 | 1361 | $filtros .= "{$whereAnd} t.visivel IN (".implode(",", $visivel).")"; |
1347 | 1362 | $whereAnd = " AND "; |
1348 | 1363 | } |
1349 | - else | |
1364 | + else | |
1350 | 1365 | { |
1351 | 1366 | $filtros .= "{$whereAnd} t.visivel = TRUE"; |
1352 | 1367 | $whereAnd = " AND "; |
1353 | 1368 | } |
1354 | - if( is_numeric( $turma_turno_id ) ) | |
1355 | - { | |
1369 | + | |
1370 | + if( is_numeric( $turma_turno_id ) ) { | |
1356 | 1371 | $filtros .= "{$whereAnd} t.turma_turno_id = '{$turma_turno_id}'"; |
1357 | 1372 | $whereAnd = " AND "; |
1358 | 1373 | } |
1359 | 1374 | |
1375 | + if( is_numeric( $tipo_boletim ) ) { | |
1376 | + $filtros .= "{$whereAnd} t.tipo_boletim = '{$tipo_boletim}'"; | |
1377 | + $whereAnd = " AND "; | |
1378 | + } | |
1379 | + | |
1380 | + if( is_numeric( $ano ) ) { | |
1381 | + $filtros .= "{$whereAnd} t.ano = '{$ano}'"; | |
1382 | + $whereAnd = " AND "; | |
1383 | + } | |
1384 | + | |
1360 | 1385 | $db = new clsBanco(); |
1361 | 1386 | $countCampos = count( explode( ",", $this->_campos_lista ) ); |
1362 | 1387 | $resultado = array(); |
... | ... | @@ -1398,7 +1423,7 @@ class clsPmieducarTurma |
1398 | 1423 | * |
1399 | 1424 | * @return array |
1400 | 1425 | */ |
1401 | - function lista2( $int_cod_turma = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $int_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $visivel = null ) | |
1426 | + function lista2( $int_cod_turma = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $int_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null, $ano = null ) | |
1402 | 1427 | { |
1403 | 1428 | |
1404 | 1429 | /*$nm_escola = "( |
... | ... | @@ -1595,7 +1620,7 @@ and e.cod_escola = t.ref_ref_cod_escola |
1595 | 1620 | $filtros .= "{$whereAnd} t.visivel = TRUE"; |
1596 | 1621 | $whereAnd = " AND "; |
1597 | 1622 | } |
1598 | - else | |
1623 | + else | |
1599 | 1624 | { |
1600 | 1625 | $filtros .= "{$whereAnd} t.visivel = FALSE"; |
1601 | 1626 | $whereAnd = " AND "; |
... | ... | @@ -1606,12 +1631,26 @@ and e.cod_escola = t.ref_ref_cod_escola |
1606 | 1631 | $filtros .= "{$whereAnd} t.visivel IN (".implode(",", $visivel).")"; |
1607 | 1632 | $whereAnd = " AND "; |
1608 | 1633 | } |
1609 | - else | |
1634 | + else | |
1610 | 1635 | { |
1611 | 1636 | $filtros .= "{$whereAnd} t.visivel = TRUE"; |
1612 | 1637 | $whereAnd = " AND "; |
1613 | 1638 | } |
1614 | 1639 | |
1640 | + if( is_numeric( $turma_turno_id ) ) { | |
1641 | + $filtros .= "{$whereAnd} t.turma_turno_id = '{$turma_turno_id}'"; | |
1642 | + $whereAnd = " AND "; | |
1643 | + } | |
1644 | + | |
1645 | + if( is_numeric( $tipo_boletim ) ) { | |
1646 | + $filtros .= "{$whereAnd} t.tipo_boletim = '{$tipo_boletim}'"; | |
1647 | + $whereAnd = " AND "; | |
1648 | + } | |
1649 | + | |
1650 | + if( is_numeric( $ano ) ) { | |
1651 | + $filtros .= "{$whereAnd} t.ano = '{$ano}'"; | |
1652 | + $whereAnd = " AND "; | |
1653 | + } | |
1615 | 1654 | |
1616 | 1655 | $db = new clsBanco(); |
1617 | 1656 | $countCampos = count( explode( ",", $this->_campos_lista ) ); | ... | ... |
ieducar/intranet/include/public/clsPublicBairro.inc.php
... | ... | @@ -319,7 +319,7 @@ class clsPublicBairro |
319 | 319 | |
320 | 320 | if (is_string($this->nome)) { |
321 | 321 | $campos .= "{$gruda}nome"; |
322 | - $valores .= "{$gruda}'{$this->nome}'"; | |
322 | + $valores .= "{$gruda}'" . addslashes($this->nome) . "'"; | |
323 | 323 | $gruda = ', '; |
324 | 324 | } |
325 | 325 | |
... | ... | @@ -407,7 +407,7 @@ class clsPublicBairro |
407 | 407 | } |
408 | 408 | |
409 | 409 | if (is_string($this->nome)) { |
410 | - $set .= "{$gruda}nome = '{$this->nome}'"; | |
410 | + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'"; | |
411 | 411 | $gruda = ', '; |
412 | 412 | } |
413 | 413 | |
... | ... | @@ -522,7 +522,7 @@ class clsPublicBairro |
522 | 522 | } |
523 | 523 | |
524 | 524 | if (is_string($str_nome)) { |
525 | - $filtros .= "{$whereAnd} b.nome LIKE '%{$str_nome}%'"; | |
525 | + $filtros .= "{$whereAnd} b.nome LIKE E'%" . addslashes($str_nome) . "%'"; | |
526 | 526 | $whereAnd = ' AND '; |
527 | 527 | } |
528 | 528 | ... | ... |
ieducar/intranet/include/public/clsPublicLogradouro.inc.php
... | ... | @@ -110,7 +110,7 @@ class clsPublicLogradouro |
110 | 110 | |
111 | 111 | /** |
112 | 112 | * Construtor (PHP 4) |
113 | - * | |
113 | + * | |
114 | 114 | * @param integer idlog |
115 | 115 | * @param string idtlog |
116 | 116 | * @param string nome |
... | ... | @@ -341,7 +341,7 @@ class clsPublicLogradouro |
341 | 341 | if( is_string( $this->nome ) ) |
342 | 342 | { |
343 | 343 | $campos .= "{$gruda}nome"; |
344 | - $valores .= "{$gruda}'{$this->nome}'"; | |
344 | + $valores .= "{$gruda}'" . addslashes($this->nome) . "'"; | |
345 | 345 | $gruda = ", "; |
346 | 346 | } |
347 | 347 | if( is_numeric( $this->idmun ) ) |
... | ... | @@ -435,7 +435,7 @@ class clsPublicLogradouro |
435 | 435 | } |
436 | 436 | if( is_string( $this->nome ) ) |
437 | 437 | { |
438 | - $set .= "{$gruda}nome = '{$this->nome}'"; | |
438 | + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'"; | |
439 | 439 | $gruda = ", "; |
440 | 440 | } |
441 | 441 | if( is_numeric( $this->idmun ) ) |
... | ... | @@ -506,7 +506,7 @@ class clsPublicLogradouro |
506 | 506 | |
507 | 507 | /** |
508 | 508 | * Retorna uma lista filtrados de acordo com os parametros |
509 | - * | |
509 | + * | |
510 | 510 | * @param string str_idtlog |
511 | 511 | * @param string str_nome |
512 | 512 | * @param integer int_idmun |
... | ... | @@ -529,7 +529,7 @@ class clsPublicLogradouro |
529 | 529 | { |
530 | 530 | $select = ", m.nome AS nm_municipio, m.sigla_uf, u.nome AS nm_estado, u.idpais, p.nome AS nm_pais "; |
531 | 531 | $from = "l, public.municipio m, public.uf u, public.pais p "; |
532 | - | |
532 | + | |
533 | 533 | $sql = "SELECT {$this->_campos_lista}{$select} FROM {$this->_tabela} {$from}"; |
534 | 534 | $whereAnd = " AND "; |
535 | 535 | |
... | ... | @@ -547,7 +547,7 @@ class clsPublicLogradouro |
547 | 547 | } |
548 | 548 | if( is_string( $str_nome ) ) |
549 | 549 | { |
550 | - $filtros .= "{$whereAnd} l.nome LIKE '%{$str_nome}%'"; | |
550 | + $filtros .= "{$whereAnd} l.nome LIKE E'%" . addslashes($str_nome) . "%'"; | |
551 | 551 | $whereAnd = " AND "; |
552 | 552 | } |
553 | 553 | if( is_numeric( $int_idmun ) ) | ... | ... |
ieducar/intranet/include/public/clsPublicMunicipio.inc.php
... | ... | @@ -114,7 +114,7 @@ class clsPublicMunicipio |
114 | 114 | |
115 | 115 | /** |
116 | 116 | * Construtor (PHP 4) |
117 | - * | |
117 | + * | |
118 | 118 | * @param integer idmun |
119 | 119 | * @param string nome |
120 | 120 | * @param string sigla_uf |
... | ... | @@ -407,7 +407,7 @@ class clsPublicMunicipio |
407 | 407 | if( is_string( $this->nome ) ) |
408 | 408 | { |
409 | 409 | $campos .= "{$gruda}nome"; |
410 | - $valores .= "{$gruda}'{$this->nome}'"; | |
410 | + $valores .= "{$gruda}'" . addslashes($this->nome) . "'"; | |
411 | 411 | $gruda = ", "; |
412 | 412 | } |
413 | 413 | if( is_string( $this->sigla_uf ) ) |
... | ... | @@ -526,7 +526,7 @@ class clsPublicMunicipio |
526 | 526 | |
527 | 527 | if( is_string( $this->nome ) ) |
528 | 528 | { |
529 | - $set .= "{$gruda}nome = '{$this->nome}'"; | |
529 | + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'"; | |
530 | 530 | $gruda = ", "; |
531 | 531 | } |
532 | 532 | if( is_string( $this->sigla_uf ) ) |
... | ... | @@ -622,7 +622,7 @@ class clsPublicMunicipio |
622 | 622 | |
623 | 623 | /** |
624 | 624 | * Retorna uma lista filtrados de acordo com os parametros |
625 | - * | |
625 | + * | |
626 | 626 | * @param string str_nome |
627 | 627 | * @param string str_sigla_uf |
628 | 628 | * @param integer int_area_km2 |
... | ... | @@ -659,7 +659,7 @@ class clsPublicMunicipio |
659 | 659 | } |
660 | 660 | if( is_string( $str_nome ) ) |
661 | 661 | { |
662 | - $filtros .= "{$whereAnd} nome LIKE '%{$str_nome}%'"; | |
662 | + $filtros .= "{$whereAnd} nome LIKE E'%" . addslashes($str_nome) . "%'"; | |
663 | 663 | $whereAnd = " AND "; |
664 | 664 | } |
665 | 665 | if( is_string( $str_sigla_uf ) ) | ... | ... |
ieducar/intranet/include/public/clsPublicPais.inc.php
... | ... | @@ -99,7 +99,7 @@ class clsPublicPais |
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Construtor (PHP 4) |
102 | - * | |
102 | + * | |
103 | 103 | * @param integer idpais |
104 | 104 | * @param string nome |
105 | 105 | * @param string geom |
... | ... | @@ -149,7 +149,7 @@ class clsPublicPais |
149 | 149 | if( is_string( $this->nome ) ) |
150 | 150 | { |
151 | 151 | $campos .= "{$gruda}nome"; |
152 | - $valores .= "{$gruda}'{$this->nome}'"; | |
152 | + $valores .= "{$gruda}'" . addslashes($this->nome) . "'"; | |
153 | 153 | $gruda = ", "; |
154 | 154 | } |
155 | 155 | if( is_string( $this->geom ) ) |
... | ... | @@ -182,7 +182,7 @@ class clsPublicPais |
182 | 182 | |
183 | 183 | if( is_string( $this->nome ) ) |
184 | 184 | { |
185 | - $set .= "{$gruda}nome = '{$this->nome}'"; | |
185 | + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'"; | |
186 | 186 | $gruda = ", "; |
187 | 187 | } |
188 | 188 | if( is_string( $this->geom ) ) |
... | ... | @@ -203,7 +203,7 @@ class clsPublicPais |
203 | 203 | |
204 | 204 | /** |
205 | 205 | * Retorna uma lista filtrados de acordo com os parametros |
206 | - * | |
206 | + * | |
207 | 207 | * @param string str_nome |
208 | 208 | * @param string str_geom |
209 | 209 | * |
... | ... | @@ -223,7 +223,7 @@ class clsPublicPais |
223 | 223 | } |
224 | 224 | if( is_string( $str_nome ) ) |
225 | 225 | { |
226 | - $filtros .= "{$whereAnd} nome LIKE '%{$str_nome}%'"; | |
226 | + $filtros .= "{$whereAnd} nome LIKE E'%" . addslashes($str_nome) . "%'"; | |
227 | 227 | $whereAnd = " AND "; |
228 | 228 | } |
229 | 229 | if( is_string( $str_geom ) ) | ... | ... |
ieducar/intranet/include/public/clsPublicUf.inc.php
... | ... | @@ -100,7 +100,7 @@ class clsPublicUf |
100 | 100 | |
101 | 101 | /** |
102 | 102 | * Construtor (PHP 4) |
103 | - * | |
103 | + * | |
104 | 104 | * @param string sigla_uf |
105 | 105 | * @param string nome |
106 | 106 | * @param string geom |
... | ... | @@ -185,7 +185,7 @@ class clsPublicUf |
185 | 185 | if( is_string( $this->nome ) ) |
186 | 186 | { |
187 | 187 | $campos .= "{$gruda}nome"; |
188 | - $valores .= "{$gruda}'{$this->nome}'"; | |
188 | + $valores .= "{$gruda}'" . addslashes($this->nome) . "'"; | |
189 | 189 | $gruda = ", "; |
190 | 190 | } |
191 | 191 | if( is_string( $this->geom ) ) |
... | ... | @@ -223,7 +223,7 @@ class clsPublicUf |
223 | 223 | |
224 | 224 | if( is_string( $this->nome ) ) |
225 | 225 | { |
226 | - $set .= "{$gruda}nome = '{$this->nome}'"; | |
226 | + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'"; | |
227 | 227 | $gruda = ", "; |
228 | 228 | } |
229 | 229 | if( is_string( $this->geom ) ) |
... | ... | @@ -249,7 +249,7 @@ class clsPublicUf |
249 | 249 | |
250 | 250 | /** |
251 | 251 | * Retorna uma lista filtrados de acordo com os parametros |
252 | - * | |
252 | + * | |
253 | 253 | * @param string str_nome |
254 | 254 | * @param string str_geom |
255 | 255 | * @param integer int_idpais |
... | ... | @@ -270,7 +270,7 @@ class clsPublicUf |
270 | 270 | } |
271 | 271 | if( is_string( $str_nome ) ) |
272 | 272 | { |
273 | - $filtros .= "{$whereAnd} uf.nome LIKE '%{$str_nome}%'"; | |
273 | + $filtros .= "{$whereAnd} uf.nome LIKE E'%" . addslashes($str_nome) . "%'"; | |
274 | 274 | $whereAnd = " AND "; |
275 | 275 | } |
276 | 276 | if( is_string( $str_geom ) ) | ... | ... |
ieducar/intranet/public_uf_det.php
... | ... | @@ -46,18 +46,18 @@ class indice extends clsDetalhe |
46 | 46 | * @var int |
47 | 47 | */ |
48 | 48 | var $titulo; |
49 | - | |
49 | + | |
50 | 50 | var $sigla_uf; |
51 | 51 | var $nome; |
52 | 52 | var $geom; |
53 | 53 | var $idpais; |
54 | - | |
54 | + | |
55 | 55 | function Gerar() |
56 | 56 | { |
57 | 57 | @session_start(); |
58 | 58 | $this->pessoa_logada = $_SESSION['id_pessoa']; |
59 | 59 | session_write_close(); |
60 | - | |
60 | + | |
61 | 61 | $this->titulo = "Uf - Detalhe"; |
62 | 62 | $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); |
63 | 63 | |
... | ... | @@ -65,13 +65,13 @@ class indice extends clsDetalhe |
65 | 65 | |
66 | 66 | $tmp_obj = new clsPublicUf( $this->sigla_uf ); |
67 | 67 | $registro = $tmp_obj->detalhe(); |
68 | - | |
68 | + | |
69 | 69 | if( ! $registro ) |
70 | 70 | { |
71 | 71 | header( "location: public_uf_lst.php" ); |
72 | 72 | die(); |
73 | 73 | } |
74 | - | |
74 | + | |
75 | 75 | if( class_exists( "clsPais" ) ) |
76 | 76 | { |
77 | 77 | $obj_idpais = new clsPais( $registro["idpais"] ); | ... | ... |
ieducar/intranet/public_uf_lst.php
... | ... | @@ -98,9 +98,9 @@ class indice extends clsListagem |
98 | 98 | { |
99 | 99 | $objTemp = new clsPais(); |
100 | 100 | $lista = $objTemp->lista( false, false, false, false, false, "nome ASC" ); |
101 | - if ( is_array( $lista ) && count( $lista ) ) | |
101 | + if ( is_array( $lista ) && count( $lista ) ) | |
102 | 102 | { |
103 | - foreach ( $lista as $registro ) | |
103 | + foreach ( $lista as $registro ) | |
104 | 104 | { |
105 | 105 | $opcoes["{$registro['idpais']}"] = "{$registro['nome']}"; |
106 | 106 | } |
... | ... | @@ -129,7 +129,8 @@ class indice extends clsListagem |
129 | 129 | $lista = $obj_uf->lista( |
130 | 130 | $this->nome, |
131 | 131 | $this->geom, |
132 | - $this->idpais | |
132 | + $this->idpais, | |
133 | + $this->sigla_uf | |
133 | 134 | ); |
134 | 135 | |
135 | 136 | $total = $obj_uf->_total; | ... | ... |
ieducar/lib/App/Model/IedFinder.php
... | ... | @@ -335,8 +335,8 @@ class App_Model_IedFinder extends CoreExt_Entity |
335 | 335 | * Retorna array com as referências de pmieducar.escola_serie_disciplina |
336 | 336 | * a modules.componente_curricular ('ref_ref_cod_disciplina'). |
337 | 337 | * |
338 | - * @param int $anoEscolar O código do ano escolar/série. | |
339 | - * @param int $escola O código da escola. | |
338 | + * @param int $serieId O código do ano escolar/série. | |
339 | + * @param int $escola O código da escola. | |
340 | 340 | * @param ComponenteCurricular_Model_ComponenteDataMapper $mapper (Opcional) |
341 | 341 | * Instância do mapper para recuperar todas as instâncias persistidas de |
342 | 342 | * ComponenteCurricular_Model_Componente atribuídas no ano escolar/série da |
... | ... | @@ -345,20 +345,26 @@ class App_Model_IedFinder extends CoreExt_Entity |
345 | 345 | * @throws App_Model_Exception caso não existam componentes curriculares |
346 | 346 | * atribuídos ao ano escolar/série da escola. |
347 | 347 | */ |
348 | - public static function getEscolaSerieDisciplina($anoEscolar, $escola, | |
348 | + public static function getEscolaSerieDisciplina($serieId, $escolaId, | |
349 | 349 | ComponenteCurricular_Model_ComponenteDataMapper $mapper = NULL, |
350 | 350 | $disciplinaId = null) |
351 | 351 | { |
352 | + if (is_null($serieId)) | |
353 | + throw new App_Model_Exception('O parametro serieId não pode ser nulo'); | |
354 | + | |
355 | + if (is_null($escolaId)) | |
356 | + throw new App_Model_Exception('O parametro escolaId não pode ser nulo'); | |
357 | + | |
352 | 358 | // Disciplinas na série na escola |
353 | 359 | $escolaSerieDisciplina = self::addClassToStorage('clsPmieducarEscolaSerieDisciplina', |
354 | 360 | NULL, 'include/pmieducar/clsPmieducarEscolaSerieDisciplina.inc.php'); |
355 | 361 | |
356 | - $disciplinas = $escolaSerieDisciplina->lista($anoEscolar, $escola, $disciplinaId, 1); | |
362 | + $disciplinas = $escolaSerieDisciplina->lista($serieId, $escolaId, $disciplinaId, 1); | |
357 | 363 | |
358 | 364 | if (FALSE === $disciplinas) { |
359 | 365 | throw new App_Model_Exception(sprintf( |
360 | 366 | 'Nenhuma disciplina para a série (%d) e a escola (%d) informados', |
361 | - $anoEscolar, $escola | |
367 | + $serieId, $escolaId | |
362 | 368 | )); |
363 | 369 | } |
364 | 370 | |
... | ... | @@ -372,15 +378,15 @@ class App_Model_IedFinder extends CoreExt_Entity |
372 | 378 | $componentes[] = $componente; |
373 | 379 | } |
374 | 380 | |
375 | - return self::_hydrateComponentes($componentes, $anoEscolar, $mapper); | |
381 | + return self::_hydrateComponentes($componentes, $serieId, $mapper); | |
376 | 382 | } |
377 | 383 | |
378 | 384 | /** |
379 | 385 | * Retorna as instâncias de ComponenteCurricular_Model_Componente de uma turma. |
380 | 386 | * |
381 | - * @param int $anoEscolar O código do ano escolar/série da turma. | |
382 | - * @param int $escola O código da escola da turma. | |
383 | - * @param int $turma O código da turma. | |
387 | + * @param int $serieId O código do ano escolar/série da turma. | |
388 | + * @param int $escola O código da escola da turma. | |
389 | + * @param int $turma O código da turma. | |
384 | 390 | * @param ComponenteCurricular_Model_TurmaDataMapper $mapper (Opcional) Instância |
385 | 391 | * do mapper para selecionar todas as referências de |
386 | 392 | * ComponenteCurricular_Model_Componente persistidas para a turma. |
... | ... | @@ -389,7 +395,7 @@ class App_Model_IedFinder extends CoreExt_Entity |
389 | 395 | * ComponenteCurricular_Model_Componente recuperadas por $mapper. |
390 | 396 | * @return array |
391 | 397 | */ |
392 | - public static function getComponentesTurma($anoEscolar, $escola, $turma, | |
398 | + public static function getComponentesTurma($serieId, $escola, $turma, | |
393 | 399 | ComponenteCurricular_Model_TurmaDataMapper $mapper = NULL, |
394 | 400 | ComponenteCurricular_Model_ComponenteDataMapper $componenteMapper = NULL, |
395 | 401 | $componenteCurricularId = null) |
... | ... | @@ -408,7 +414,7 @@ class App_Model_IedFinder extends CoreExt_Entity |
408 | 414 | |
409 | 415 | // Não existem componentes específicos para a turma |
410 | 416 | if (0 == count($componentesTurma)) { |
411 | - return self::getEscolaSerieDisciplina($anoEscolar, $escola, $componenteMapper, $componenteCurricularId); | |
417 | + return self::getEscolaSerieDisciplina($serieId, $escola, $componenteMapper, $componenteCurricularId); | |
412 | 418 | } |
413 | 419 | |
414 | 420 | $componentes = array(); |
... | ... | @@ -421,7 +427,7 @@ class App_Model_IedFinder extends CoreExt_Entity |
421 | 427 | $componentes[] = $componente; |
422 | 428 | } |
423 | 429 | |
424 | - return self::_hydrateComponentes($componentes, $anoEscolar, $componenteMapper); | |
430 | + return self::_hydrateComponentes($componentes, $serieId, $componenteMapper); | |
425 | 431 | } |
426 | 432 | |
427 | 433 | /** | ... | ... |
ieducar/lib/Portabilis/Business/Professor.php
... | ... | @@ -84,7 +84,7 @@ class Portabilis_Business_Professor { |
84 | 84 | $sql = "select cod_turma as id, nm_turma as nome from pmieducar.turma where ref_ref_cod_escola = $1 |
85 | 85 | and (ref_ref_cod_serie = $2 or ref_ref_cod_serie_mult = $2) and ativo = 1 and |
86 | 86 | visivel != 'f' and turma_turno_id in ( select periodo from servidor_alocacao where |
87 | - ref_cod_escola = ref_ref_cod_escola and ref_cod_servidor = $3 and ativo = 1 limit 1) | |
87 | + ref_cod_escola = ref_ref_cod_escola and ref_cod_servidor = $3 and ativo = 1) | |
88 | 88 | order by nm_turma asc"; |
89 | 89 | |
90 | 90 | return self::fetchPreparedQuery($sql, array('params' => array($escolaId, $serieId, $userId))); | ... | ... |
ieducar/lib/Portabilis/Controller/Page/ListController.php
... | ... | @@ -50,13 +50,6 @@ class Portabilis_Controller_Page_ListController extends Core_Controller_Page_Lis |
50 | 50 | parent::__construct(); |
51 | 51 | } |
52 | 52 | |
53 | - protected function inputsHelper() { | |
54 | - if (! isset($this->_inputsHelper)) | |
55 | - $this->_inputsHelper = new Portabilis_View_Helper_Inputs($this); | |
56 | - | |
57 | - return $this->_inputsHelper; | |
58 | - } | |
59 | - | |
60 | 53 | protected function loadResourceAssets($dispatcher){ |
61 | 54 | $rootPath = $_SERVER['DOCUMENT_ROOT']; |
62 | 55 | $controllerName = ucwords($dispatcher->getControllerName()); | ... | ... |
ieducar/lib/Portabilis/View/Helper/Application.php
... | ... | @@ -82,7 +82,7 @@ class Portabilis_View_Helper_Application extends CoreExt_View_Helper_Abstract { |
82 | 82 | * @param array ou string $files Lista de scripts a serem carregados. |
83 | 83 | * @return null |
84 | 84 | */ |
85 | - public static function loadJavascript($viewInstance, $files, $expireCacheDateFormat = 'dmY') { | |
85 | + public static function loadJavascript($viewInstance, $files, $appendAssetsVersionParam = true) { | |
86 | 86 | if (! is_array($files)) |
87 | 87 | $files = array($files); |
88 | 88 | |
... | ... | @@ -91,9 +91,8 @@ class Portabilis_View_Helper_Application extends CoreExt_View_Helper_Abstract { |
91 | 91 | if (! in_array($file, self::$javascriptsLoaded)) { |
92 | 92 | self::$javascriptsLoaded[] = $file; |
93 | 93 | |
94 | - // cache controll | |
95 | - $file .= '?assets_version=' . Portabilis_Assets_Version::VERSION; | |
96 | - $file .= $expireCacheDateFormat ? '×tamp=' . date($expireCacheDateFormat) : ''; | |
94 | + if ($appendAssetsVersionParam) | |
95 | + $file .= '?assets_version=' . Portabilis_Assets_Version::VERSION; | |
97 | 96 | |
98 | 97 | $viewInstance->appendOutput("<script type='text/javascript' src='$file'></script>"); |
99 | 98 | } |
... | ... | @@ -112,7 +111,7 @@ class Portabilis_View_Helper_Application extends CoreExt_View_Helper_Abstract { |
112 | 111 | * @param array ou string $files Lista de estilos a serem carregados. |
113 | 112 | * @return null |
114 | 113 | */ |
115 | - public static function loadStylesheet($viewInstance, $files, $expireCacheDateFormat = 'dmY') { | |
114 | + public static function loadStylesheet($viewInstance, $files, $appendAssetsVersionParam = true) { | |
116 | 115 | if (! is_array($files)) |
117 | 116 | $files = array($files); |
118 | 117 | |
... | ... | @@ -121,9 +120,8 @@ class Portabilis_View_Helper_Application extends CoreExt_View_Helper_Abstract { |
121 | 120 | if (! in_array($file, self::$stylesheetsLoaded)) { |
122 | 121 | self::$stylesheetsLoaded[] = $file; |
123 | 122 | |
124 | - // cache controll | |
125 | - $file .= '?assets_version=' . Portabilis_Assets_Version::VERSION; | |
126 | - $file .= $expireCacheDateFormat ? '×tamp=' . date($expireCacheDateFormat) : ''; | |
123 | + if ($appendAssetsVersionParam) | |
124 | + $file .= '?assets_version=' . Portabilis_Assets_Version::VERSION; | |
127 | 125 | |
128 | 126 | $viewInstance->appendOutput("<link type='text/css' rel='stylesheet' href='$file'></script>"); |
129 | 127 | } |
... | ... | @@ -183,4 +181,17 @@ class Portabilis_View_Helper_Application extends CoreExt_View_Helper_Abstract { |
183 | 181 | // ui-autocomplete fixup |
184 | 182 | self::embedStylesheet($viewInstance, ".ui-autocomplete { font-size: 11px; }"); |
185 | 183 | } |
184 | + | |
185 | + public static function loadChosenLib($viewInstance) { | |
186 | + self::loadStylesheet($viewInstance, '/modules/Portabilis/Assets/Plugins/Chosen/chosen.css', false); | |
187 | + self::loadJavascript($viewInstance, '/modules/Portabilis/Assets/Plugins/Chosen/chosen.jquery.min.js', false); | |
188 | + } | |
189 | + | |
190 | + public static function loadAjaxChosenLib($viewInstance) { | |
191 | + // AjaxChosen requires this fixup, see https://github.com/meltingice/ajax-chosen | |
192 | + $fixupCss = ".chzn-container .chzn-results .group-result { display: list-item; }"; | |
193 | + Portabilis_View_Helper_Application::embedStylesheet($viewInstance, $fixupCss); | |
194 | + | |
195 | + self::loadJavascript($viewInstance, '/modules/Portabilis/Assets/Plugins/AjaxChosen/ajax-chosen.min.js', false); | |
196 | + } | |
186 | 197 | } | ... | ... |
ieducar/lib/Portabilis/View/Helper/DynamicInput/Turma.php
... | ... | @@ -53,7 +53,8 @@ class Portabilis_View_Helper_DynamicInput_Turma extends Portabilis_View_Helper_D |
53 | 53 | $instituicaoId = $this->getInstituicaoId($options['instituicaoId']); |
54 | 54 | $escolaId = $this->getEscolaId($options['escolaId']); |
55 | 55 | $serieId = $this->getSerieId($options['serieId']); |
56 | - //$cursoId = $this->getCursoId($options['cursoId']); | |
56 | + $ano = $this->viewInstance->ano; | |
57 | + | |
57 | 58 | $userId = $this->getCurrentUserId(); |
58 | 59 | $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId); |
59 | 60 | |
... | ... | @@ -64,9 +65,33 @@ class Portabilis_View_Helper_DynamicInput_Turma extends Portabilis_View_Helper_D |
64 | 65 | elseif ($escolaId && $serieId && empty($resources)) |
65 | 66 | $resources = App_Model_IedFinder::getTurmas($escolaId, $serieId); |
66 | 67 | |
68 | + | |
69 | + // caso no letivo esteja definido para filtrar turmas por ano, | |
70 | + // somente exibe as turmas do ano letivo. | |
71 | + | |
72 | + if ($escolaId && $ano && $this->turmasPorAno($escolaId, $ano)) { | |
73 | + foreach ($resources as $id => $nome) { | |
74 | + $turma = new clsPmieducarTurma(); | |
75 | + $turma->cod_turma = $id; | |
76 | + $turma = $turma->detalhe(); | |
77 | + | |
78 | + if ($turma['ano'] != $ano) | |
79 | + unset($resources[$id]); | |
80 | + } | |
81 | + } | |
82 | + | |
67 | 83 | return $this->insertOption(null, "Selecione uma turma", $resources); |
68 | 84 | } |
69 | 85 | |
86 | + protected function turmasPorAno($escolaId, $ano) { | |
87 | + $anoLetivo = new clsPmieducarEscolaAnoLetivo(); | |
88 | + $anoLetivo->ref_cod_escola = $escolaId; | |
89 | + $anoLetivo->ano = $ano; | |
90 | + $anoLetivo = $anoLetivo->detalhe(); | |
91 | + | |
92 | + return ($anoLetivo['turmas_por_ano'] == 1); | |
93 | + } | |
94 | + | |
70 | 95 | public function turma($options = array()) { |
71 | 96 | parent::select($options); |
72 | 97 | } | ... | ... |
ieducar/lib/Portabilis/View/Helper/Input/Date.php
... | ... | @@ -59,7 +59,10 @@ class Portabilis_View_Helper_Input_Date extends Portabilis_View_Helper_Input_Cor |
59 | 59 | 'label_hint' => '', |
60 | 60 | 'inline' => false, |
61 | 61 | 'callback' => false, |
62 | - 'disabled' => false); | |
62 | + 'disabled' => false, | |
63 | + | |
64 | + // opcoes suportadas pelo elemento, mas não pelo helper ieducar | |
65 | + 'size' => 9); | |
63 | 66 | |
64 | 67 | $inputOptions = $this->mergeOptions($options['options'], $defaultInputOptions); |
65 | 68 | |
... | ... | @@ -70,5 +73,23 @@ class Portabilis_View_Helper_Input_Date extends Portabilis_View_Helper_Input_Cor |
70 | 73 | |
71 | 74 | call_user_func_array(array($this->viewInstance, 'campoData'), $inputOptions); |
72 | 75 | $this->fixupPlaceholder($inputOptions); |
76 | + | |
77 | + // implementado fixup via js, pois algumas opções não estão sendo verificadas pelo helper ieducar. | |
78 | + $this->fixupOptions($inputOptions); | |
79 | + } | |
80 | + | |
81 | + protected function fixupOptions($inputOptions) { | |
82 | + $id = $inputOptions['id']; | |
83 | + | |
84 | + $sizeFixup = "\$input.attr('size', " . $inputOptions['size'] . ");"; | |
85 | + $disableFixup = $inputOptions['disabled'] ? "\$input.attr('disabled', 'disabled');" : ''; | |
86 | + | |
87 | + $script = " | |
88 | + var \$input = \$j('#" . $id . "'); | |
89 | + $sizeFixup | |
90 | + $disableFixup | |
91 | + "; | |
92 | + | |
93 | + Portabilis_View_Helper_Application::embedJavascript($this->viewInstance, $script, $afterReady = true); | |
73 | 94 | } |
74 | 95 | } | ... | ... |
ieducar/lib/Portabilis/View/Helper/Input/MultipleSearch.php
... | ... | @@ -81,12 +81,10 @@ class Portabilis_View_Helper_Input_MultipleSearch extends Portabilis_View_Helper |
81 | 81 | |
82 | 82 | |
83 | 83 | protected function loadAssets() { |
84 | - $cssFile = '/modules/Portabilis/Assets/Plugins/Chosen/chosen.css'; | |
85 | - Portabilis_View_Helper_Application::loadStylesheet($this->viewInstance, $cssFile); | |
84 | + Portabilis_View_Helper_Application::loadChosenLib($this->viewInstance); | |
86 | 85 | |
87 | - $jsFiles = array('/modules/Portabilis/Assets/Plugins/Chosen/chosen.jquery.min.js', | |
88 | - '/modules/Portabilis/Assets/Javascripts/Frontend/Inputs/MultipleSearch.js'); | |
89 | - Portabilis_View_Helper_Application::loadJavascript($this->viewInstance, $jsFiles); | |
86 | + $jsFile = '/modules/Portabilis/Assets/Javascripts/Frontend/Inputs/MultipleSearch.js'; | |
87 | + Portabilis_View_Helper_Application::loadJavascript($this->viewInstance, $jsFile); | |
90 | 88 | } |
91 | 89 | |
92 | 90 | ... | ... |
ieducar/lib/Portabilis/View/Helper/Input/MultipleSearchAjax.php
... | ... | @@ -81,18 +81,11 @@ class Portabilis_View_Helper_Input_MultipleSearchAjax extends Portabilis_View_He |
81 | 81 | |
82 | 82 | |
83 | 83 | protected function loadAssets() { |
84 | - $cssFile = '/modules/Portabilis/Assets/Plugins/Chosen/chosen.css'; | |
85 | - Portabilis_View_Helper_Application::loadStylesheet($this->viewInstance, $cssFile); | |
84 | + Portabilis_View_Helper_Application::loadChosenLib($this->viewInstance); | |
85 | + Portabilis_View_Helper_Application::loadAjaxChosenLib($this->viewInstance); | |
86 | 86 | |
87 | - // AjaxChosen requires this fixup, see https://github.com/meltingice/ajax-chosen | |
88 | - $fixupCss = ".chzn-container .chzn-results .group-result { display: list-item; }"; | |
89 | - Portabilis_View_Helper_Application::embedStylesheet($this->viewInstance, $fixupCss); | |
90 | - | |
91 | - | |
92 | - $jsFiles = array('/modules/Portabilis/Assets/Plugins/Chosen/chosen.jquery.min.js', | |
93 | - '/modules/Portabilis/Assets/Plugins/AjaxChosen/ajax-chosen.min.js', | |
94 | - '/modules/Portabilis/Assets/Javascripts/Frontend/Inputs/MultipleSearchAjax.js'); | |
95 | - Portabilis_View_Helper_Application::loadJavascript($this->viewInstance, $jsFiles); | |
87 | + $jsFile = '/modules/Portabilis/Assets/Javascripts/Frontend/Inputs/MultipleSearchAjax.js'; | |
88 | + Portabilis_View_Helper_Application::loadJavascript($this->viewInstance, $jsFile); | |
96 | 89 | } |
97 | 90 | |
98 | 91 | ... | ... |
ieducar/misc/database/deltas/portabilis/3_cria_modules_educacenso_cod_escola.sql
0 → 100644
... | ... | @@ -0,0 +1,32 @@ |
1 | +-- // | |
2 | + | |
3 | +-- | |
4 | +-- Cria as tabelas modules.educacenso_cod_escola | |
5 | +-- | |
6 | +-- @author Lucas D'Avila <lucasdavila@portabilis.com.br> | |
7 | +-- @license @@license@@ | |
8 | +-- @version $Id$ | |
9 | +-- | |
10 | + | |
11 | +CREATE TABLE modules.educacenso_cod_escola | |
12 | +( | |
13 | + cod_escola integer NOT NULL, | |
14 | + cod_escola_inep bigint NOT NULL, | |
15 | + nome_inep character varying(255), | |
16 | + fonte character varying(255), | |
17 | + created_at timestamp without time zone NOT NULL, | |
18 | + updated_at timestamp without time zone, | |
19 | + CONSTRAINT educacenso_cod_escola_pk PRIMARY KEY (cod_escola, cod_escola_inep), | |
20 | + CONSTRAINT educacenso_cod_escola_cod_escola_fk FOREIGN KEY (cod_escola) | |
21 | + REFERENCES pmieducar.escola (cod_escola) MATCH SIMPLE | |
22 | + ON UPDATE NO ACTION ON DELETE CASCADE | |
23 | +) | |
24 | +WITH ( | |
25 | + OIDS=FALSE | |
26 | +); | |
27 | + | |
28 | +-- //@UNDO | |
29 | + | |
30 | +DROP TABLE modules.educacenso_cod_escola; | |
31 | + | |
32 | +-- // | |
0 | 33 | \ No newline at end of file | ... | ... |
ieducar/misc/database/deltas/portabilis/50_adiciona_ano_em_turma_e_turmas_por_ano_em_escola_ano_letivo.sql
0 → 100644
... | ... | @@ -0,0 +1,17 @@ |
1 | + -- // | |
2 | + | |
3 | + -- | |
4 | + -- Adiciona ano em em pmieducar.turma e turmas_por_ano em pmieducar.escola_ano_letivo | |
5 | + -- @author Lucas D'Avila <lucasdavila@portabilis.com.br> | |
6 | + -- @license @@license@@ | |
7 | + -- @version $Id$ | |
8 | + | |
9 | + ALTER TABLE pmieducar.turma ADD COLUMN ano integer; | |
10 | + ALTER TABLE pmieducar.escola_ano_letivo ADD COLUMN turmas_por_ano smallint; | |
11 | + | |
12 | + -- //@UNDO | |
13 | + | |
14 | + ALTER TABLE pmieducar.turma DROP COLUMN ano; | |
15 | + ALTER TABLE pmieducar.escola_ano_letivo DROP COLUMN turmas_por_ano; | |
16 | + | |
17 | + -- // | ... | ... |
ieducar/modules/Api/Views/AlunoController.php
... | ... | @@ -311,8 +311,17 @@ class AlunoController extends ApiCoreController |
311 | 311 | $pessoa->idpes = $this->getRequest()->pessoa_id; |
312 | 312 | $pessoa->nome_responsavel = ''; |
313 | 313 | |
314 | + $_pessoa = $pessoa->detalhe(); | |
315 | + | |
314 | 316 | if ($this->getRequest()->tipo_responsavel == 'outra_pessoa') |
315 | 317 | $pessoa->idpes_responsavel = $this->getRequest()->responsavel_id; |
318 | + | |
319 | + elseif($this->getRequest()->tipo_responsavel == 'pai' && $_pessoa['idpes_pai']) | |
320 | + $pessoa->idpes_responsavel = $_pessoa['idpes_pai']; | |
321 | + | |
322 | + elseif($this->getRequest()->tipo_responsavel == 'mae' && $_pessoa['idpes_mae']) | |
323 | + $pessoa->idpes_responsavel = $_pessoa['idpes_mae']; | |
324 | + | |
316 | 325 | else |
317 | 326 | $pessoa->idpes_responsavel = 'NULL'; |
318 | 327 | |
... | ... | @@ -338,7 +347,7 @@ class AlunoController extends ApiCoreController |
338 | 347 | |
339 | 348 | $aluno = new clsPmieducarAluno(); |
340 | 349 | $aluno->cod_aluno = $id; |
341 | - $aluno->aluno_estado_id = $this->getRequest()->aluno_estado_id; | |
350 | + $aluno->aluno_estado_id = Portabilis_String_Utils::toLatin1($this->getRequest()->aluno_estado_id); | |
342 | 351 | |
343 | 352 | // após cadastro não muda mais id pessoa |
344 | 353 | if (is_null($id)) |
... | ... | @@ -592,6 +601,7 @@ class AlunoController extends ApiCoreController |
592 | 601 | $aluno['tipo_responsavel'] = $this->tipoResponsavel($aluno); |
593 | 602 | $aluno['aluno_inep_id'] = $this->loadAlunoInepId($id); |
594 | 603 | $aluno['ativo'] = $aluno['ativo'] == 1; |
604 | + $aluno['aluno_estado_id'] = Portabilis_String_Utils::toUtf8($aluno['aluno_estado_id']); | |
595 | 605 | |
596 | 606 | $aluno['alfabetizado'] = $aluno['analfabeto'] == 0; |
597 | 607 | unset($aluno['analfabeto']); |
... | ... | @@ -705,7 +715,6 @@ class AlunoController extends ApiCoreController |
705 | 715 | else |
706 | 716 | $this->messenger->append('Aparentemente o cadastro não pode ser alterado, por favor, verifique.', |
707 | 717 | 'error', false, 'error'); |
708 | - | |
709 | 718 | return array('id' => $id); |
710 | 719 | } |
711 | 720 | ... | ... |
ieducar/modules/Api/Views/MatriculaController.php
1 | 1 | <?php |
2 | 2 | |
3 | -#error_reporting(E_ALL); | |
4 | -#ini_set("display_errors", 1); | |
5 | - | |
6 | 3 | /** |
7 | 4 | * i-Educar - Sistema de gestão escolar |
8 | 5 | * |
... | ... | @@ -35,6 +32,7 @@ |
35 | 32 | require_once 'lib/Portabilis/Controller/ApiCoreController.php'; |
36 | 33 | require_once 'lib/Portabilis/Array/Utils.php'; |
37 | 34 | require_once 'lib/Portabilis/String/Utils.php'; |
35 | +require_once 'App/Model/MatriculaSituacao.php'; | |
38 | 36 | |
39 | 37 | class MatriculaController extends ApiCoreController |
40 | 38 | { |
... | ... | @@ -44,6 +42,11 @@ class MatriculaController extends ApiCoreController |
44 | 42 | $this->validatesId('aluno'); |
45 | 43 | } |
46 | 44 | |
45 | + protected function canDeleteAbandono() { | |
46 | + return $this->validatesPresenceOf('id') && | |
47 | + $this->validatesExistenceOf('matricula', $this->getRequest()->id); | |
48 | + } | |
49 | + | |
47 | 50 | // search options |
48 | 51 | |
49 | 52 | protected function searchOptions() { |
... | ... | @@ -189,6 +192,17 @@ class MatriculaController extends ApiCoreController |
189 | 192 | } |
190 | 193 | } |
191 | 194 | |
195 | + protected function deleteAbandono() { | |
196 | + if ($this->canDeleteAbandono()) { | |
197 | + $matriculaId = $this->getRequest()->id; | |
198 | + $situacaoAndamento = App_Model_MatriculaSituacao::EM_ANDAMENTO; | |
199 | + | |
200 | + $sql = 'update pmieducar.matricula set aprovado = $1 where cod_matricula = $2'; | |
201 | + $this->fetchPreparedQuery($sql, array($situacaoAndamento, $matriculaId)); | |
202 | + | |
203 | + $this->messenger->append('Abandono desfeito.', 'success'); | |
204 | + } | |
205 | + } | |
192 | 206 | |
193 | 207 | public function Gerar() { |
194 | 208 | if ($this->isRequestFor('get', 'matricula')) |
... | ... | @@ -200,6 +214,9 @@ class MatriculaController extends ApiCoreController |
200 | 214 | elseif ($this->isRequestFor('get', 'matricula-search')) |
201 | 215 | $this->appendResponse($this->search()); |
202 | 216 | |
217 | + elseif ($this->isRequestFor('delete', 'abandono')) | |
218 | + $this->appendResponse($this->deleteAbandono()); | |
219 | + | |
203 | 220 | else |
204 | 221 | $this->notImplementedOperationError(); |
205 | 222 | } | ... | ... |
ieducar/modules/Api/Views/PessoaController.php
... | ... | @@ -35,6 +35,7 @@ |
35 | 35 | require_once 'lib/Portabilis/Controller/ApiCoreController.php'; |
36 | 36 | require_once 'lib/Portabilis/Array/Utils.php'; |
37 | 37 | require_once 'lib/Portabilis/String/Utils.php'; |
38 | +require_once 'lib/Portabilis/Date/Utils.php'; | |
38 | 39 | |
39 | 40 | class PessoaController extends ApiCoreController |
40 | 41 | { |
... | ... | @@ -70,7 +71,8 @@ class PessoaController extends ApiCoreController |
70 | 71 | $sql = "select cod_aluno as id from pmieducar.aluno where ref_idpes = $1"; |
71 | 72 | $id = $this->fetchPreparedQuery($sql, $pessoaId, false, 'first-field'); |
72 | 73 | |
73 | - // when not exists, returns an empty array that causes error on loadDetails | |
74 | + // caso um array vazio seja retornado, seta resultado como null, | |
75 | + // evitando erro em loadDetails | |
74 | 76 | if (empty($id)) |
75 | 77 | $id = null; |
76 | 78 | |
... | ... | @@ -104,7 +106,8 @@ class PessoaController extends ApiCoreController |
104 | 106 | protected function loadDetails($pessoaId = null) { |
105 | 107 | $alunoId = $this->tryLoadAlunoId($pessoaId); |
106 | 108 | |
107 | - $sql = "select cpf, idpes_pai as pai_id, idpes_mae as mae_id, idpes_responsavel as responsavel_id, | |
109 | + $sql = "select cpf, data_nasc as data_nascimento, idpes_pai as pai_id, | |
110 | + idpes_mae as mae_id, idpes_responsavel as responsavel_id, | |
108 | 111 | coalesce((select nome from cadastro.pessoa where idpes = fisica.idpes_pai), |
109 | 112 | (select nm_pai from pmieducar.aluno where cod_aluno = $1)) as nome_pai, |
110 | 113 | coalesce((select nome from cadastro.pessoa where idpes = fisica.idpes_mae), |
... | ... | @@ -115,7 +118,7 @@ class PessoaController extends ApiCoreController |
115 | 118 | |
116 | 119 | $details = $this->fetchPreparedQuery($sql, array($alunoId, $pessoaId), false, 'first-row'); |
117 | 120 | |
118 | - $attrs = array('cpf', 'rg', 'pai_id', 'mae_id', 'responsavel_id', 'nome_pai', 'nome_mae', 'nome_responsavel'); | |
121 | + $attrs = array('cpf', 'rg', 'data_nascimento', 'pai_id', 'mae_id', 'responsavel_id', 'nome_pai', 'nome_mae', 'nome_responsavel'); | |
119 | 122 | $details = Portabilis_Array_Utils::filter($details, $attrs); |
120 | 123 | |
121 | 124 | $details['aluno_id'] = $alunoId; |
... | ... | @@ -123,6 +126,8 @@ class PessoaController extends ApiCoreController |
123 | 126 | $details['nome_pai'] = $this->toUtf8($details['nome_pai'], array('transform' => true)); |
124 | 127 | $details['nome_responsavel'] = $this->toUtf8($details['nome_responsavel'], array('transform' => true)); |
125 | 128 | |
129 | + $details['data_nascimento'] = Portabilis_Date_Utils::pgSQLToBr($details['data_nascimento']); | |
130 | + | |
126 | 131 | return $details; |
127 | 132 | } |
128 | 133 | |
... | ... | @@ -143,6 +148,28 @@ class PessoaController extends ApiCoreController |
143 | 148 | return $_deficiencias; |
144 | 149 | } |
145 | 150 | |
151 | + protected function loadRg($pessoaId) { | |
152 | + $sql = "select rg from cadastro.documento where idpes = $1"; | |
153 | + $rg = $this->fetchPreparedQuery($sql, $pessoaId, false, 'first-field'); | |
154 | + | |
155 | + // caso um array vazio seja retornado, seta resultado como null | |
156 | + if (empty($rg)) | |
157 | + $rg = null; | |
158 | + | |
159 | + return $rg; | |
160 | + } | |
161 | + | |
162 | + protected function loadDataNascimento($pessoaId) { | |
163 | + $sql = "select data_nasc from cadastro.fisica where idpes = $1"; | |
164 | + $nascimento = $this->fetchPreparedQuery($sql, $pessoaId, false, 'first-field'); | |
165 | + | |
166 | + // caso um array vazio seja retornado, seta resultado como null | |
167 | + if (empty($nascimento)) | |
168 | + $nascimento = null; | |
169 | + | |
170 | + return $nascimento; | |
171 | + } | |
172 | + | |
146 | 173 | |
147 | 174 | // search |
148 | 175 | |
... | ... | @@ -167,6 +194,27 @@ class PessoaController extends ApiCoreController |
167 | 194 | return $sqls; |
168 | 195 | } |
169 | 196 | |
197 | + // subscreve formatResourceValue para adicionar o rg da pessoa, ao final do valor, | |
198 | + // "<id_pessoa> - <nome_pessoa> (RG: <rg>)", ex: "1 - Lucas D'Avila (RG: 1234567)" | |
199 | + protected function formatResourceValue($resource) { | |
200 | + $nome = $this->toUtf8($resource['name'], array('transform' => true)); | |
201 | + $rg = $this->loadRg($resource['id']); | |
202 | + $nascimento = $this->loadDataNascimento($resource['id']); | |
203 | + | |
204 | + // Quando informado, inclui detalhes extra sobre a pessoa, como RG e Data nascimento. | |
205 | + $details = array(); | |
206 | + | |
207 | + if ($nascimento) | |
208 | + $details[] = 'Nascimento: ' . Portabilis_Date_Utils::pgSQLToBr($nascimento); | |
209 | + | |
210 | + if ($rg) | |
211 | + $details[] = "RG: $rg"; | |
212 | + | |
213 | + $details = $details ? ' (' . implode(', ', $details) . ')' : ''; | |
214 | + | |
215 | + return $resource['id'] . " - $nome$details"; | |
216 | + } | |
217 | + | |
170 | 218 | // api responders |
171 | 219 | |
172 | 220 | protected function get() { | ... | ... |
ieducar/modules/Cadastro/Assets/Javascripts/Aluno.js
... | ... | @@ -20,11 +20,15 @@ resourceOptions.handlePost = function(dataResponse) { |
20 | 20 | |
21 | 21 | if (! dataResponse.any_error_msg) |
22 | 22 | window.setTimeout(function() { document.location = '/intranet/educar_aluno_det.php?cod_aluno=' + resource.id(); }, 500); |
23 | + else | |
24 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
23 | 25 | } |
24 | 26 | |
25 | 27 | resourceOptions.handlePut = function(dataResponse) { |
26 | 28 | if (! dataResponse.any_error_msg) |
27 | 29 | window.setTimeout(function() { document.location = '/intranet/educar_aluno_det.php?cod_aluno=' + resource.id(); }, 500); |
30 | + else | |
31 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
28 | 32 | } |
29 | 33 | |
30 | 34 | resourceOptions.handleGet = function(dataResponse) { |
... | ... | @@ -104,8 +108,8 @@ var handleGetPersonDetails = function(dataResponse) { |
104 | 108 | if (dataResponse.responsavel_id) |
105 | 109 | nomeResponsavel = dataResponse.responsavel_id + ' - ' + nomeResponsavel; |
106 | 110 | |
107 | - //$j('#rg').val(dataResponse.rg); | |
108 | - //$j('#cpf').val(dataResponse.cpf); | |
111 | + $j('#data_nascimento').val(dataResponse.data_nascimento); | |
112 | + $j('#rg').val(dataResponse.rg); | |
109 | 113 | |
110 | 114 | $j('#pai').val(nomePai); |
111 | 115 | $j('#mae').val(nomeMae); | ... | ... |
ieducar/modules/Cadastro/Assets/Javascripts/MatriculaShow.js
0 → 100644
... | ... | @@ -0,0 +1,22 @@ |
1 | +var apiUrlBase = '/module/Api/matricula'; | |
2 | + | |
3 | +var handleDeleteAbandono = function(dataResponse) { | |
4 | + handleMessages(dataResponse.msgs); | |
5 | + location.reload(); | |
6 | +} | |
7 | + | |
8 | +function deleteAbandono(matriculaId) { | |
9 | + if (! confirm(stringUtils.toUtf8('Deseja desfazer o abandono?'))) | |
10 | + return false; | |
11 | + | |
12 | + var options = { | |
13 | + url : deleteResourceUrlBuilder.buildUrl(apiUrlBase, 'abandono'), | |
14 | + dataType : 'json', | |
15 | + data : { | |
16 | + id : matriculaId | |
17 | + }, | |
18 | + success : handleDeleteAbandono | |
19 | + }; | |
20 | + | |
21 | + deleteResource(options); | |
22 | +} | |
0 | 23 | \ No newline at end of file | ... | ... |
ieducar/modules/Cadastro/Assets/Javascripts/PessoaFisica.js
... | ... | @@ -183,29 +183,11 @@ $j(document).ready(function() { |
183 | 183 | |
184 | 184 | // style fixup |
185 | 185 | |
186 | - $j('#pais_origem_nome').css('width', '150px'); | |
187 | - | |
188 | 186 | // agrupado zebra por tipo documento, branco => .formlttd, colorido => .formmdtd |
189 | 187 | |
190 | 188 | $j('#tr_uf_emissao_certidao_civil td').removeClass('formmdtd'); |
191 | 189 | $j('#tr_carteira_trabalho td').removeClass('formlttd').addClass('formmdtd'); |
192 | 190 | |
193 | - | |
194 | - // remove obrigatoriedade de determinados campos, ao criar pessoa pai ou mãe | |
195 | - // para agilizar o cadastro do filho; | |
196 | - | |
197 | - if ($j.inArray($j('#parent_type').val(), ['pai', 'mae']) > -1) { | |
198 | - var $elements = $j('#sexo, #estado_civil_id, #data_nasc, #cep_, #sigla_uf, #cidade, #bairro,\ | |
199 | - #zona_localizacao, #idtlog, #logradouro').filter('[value=]'); | |
200 | - | |
201 | - $elements.addClass('skip-presence-validation'); | |
202 | - | |
203 | - // remove '*' obrigatório ao lado do label. | |
204 | - $elements.each(function(index, element) { | |
205 | - $j(element).closest('tr').find('.campo_obrigatorio').hide(); | |
206 | - }); | |
207 | - } | |
208 | - | |
209 | 191 | // bind events |
210 | 192 | |
211 | 193 | checkTipoNacionalidade(); | ... | ... |
ieducar/modules/Cadastro/Views/AlunoController.php
... | ... | @@ -50,12 +50,7 @@ class AlunoController extends Portabilis_Controller_Page_EditController |
50 | 50 | ), |
51 | 51 | |
52 | 52 | 'rg' => array( |
53 | - 'label' => 'Documento de identidade (rg)', | |
54 | - 'help' => '', | |
55 | - ), | |
56 | - | |
57 | - 'cpf' => array( | |
58 | - 'label' => 'CPF', | |
53 | + 'label' => 'Documento de identidade (RG)', | |
59 | 54 | 'help' => '', |
60 | 55 | ), |
61 | 56 | |
... | ... | @@ -143,13 +138,13 @@ class AlunoController extends Portabilis_Controller_Page_EditController |
143 | 138 | $options = array('label' => $this->_getLabel('pessoa'), 'size' => 68); |
144 | 139 | $this->inputsHelper()->simpleSearchPessoa('nome', $options); |
145 | 140 | |
146 | - // rg | |
147 | - //$options = array('label' => $this->_getLabel('rg'), 'disabled' => true, 'required' => false); | |
148 | - //$this->inputsHelper()->text('aluno', 'rg', $options); | |
141 | + // data nascimento | |
142 | + $options = array('label' => 'Data nascimento', 'disabled' => true, 'required' => false, 'size' => 25, 'placeholder' => ''); | |
143 | + $this->inputsHelper()->date('data_nascimento', $options); | |
149 | 144 | |
150 | - // cpf | |
151 | - //$options = array('label' => $this->_getLabel('cpf'), 'disabled' => true, 'required' => false); | |
152 | - //$this->inputsHelper()->text('aluno', 'cpf', $options); | |
145 | + // rg | |
146 | + $options = array('label' => $this->_getLabel('rg'), 'disabled' => true, 'required' => false, 'size' => 25); | |
147 | + $this->inputsHelper()->integer('rg', $options); | |
153 | 148 | |
154 | 149 | // pai |
155 | 150 | $options = array('label' => $this->_getLabel('pai'), 'disabled' => true, 'required' => false, 'size' => 68); | ... | ... |
ieducar/modules/DynamicInput/Assets/Javascripts/Turma.js
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | |
8 | 8 | var $serieField = getElementFor('serie'); |
9 | 9 | var $turmaField = getElementFor('turma'); |
10 | + var $ano = getElementFor('ano'); | |
10 | 11 | |
11 | 12 | var handleGetTurmas = function(response) { |
12 | 13 | var selectOptions = jsonResourcesToSelectOptions(response['options']); |
... | ... | @@ -20,9 +21,10 @@ |
20 | 21 | $turmaField.children().first().html('Aguarde carregando...'); |
21 | 22 | |
22 | 23 | var urlForGetTurmas = getResourceUrlBuilder.buildUrl('/module/DynamicInput/turma', 'turmas', { |
23 | - instituicao_id : $instituicaoField.attr('value'), | |
24 | - escola_id : $escolaField.attr('value'), | |
25 | - serie_id : $serieField.attr('value') | |
24 | + instituicao_id : $instituicaoField.val(), | |
25 | + escola_id : $escolaField.val(), | |
26 | + serie_id : $serieField.val(), | |
27 | + ano : $ano.val() | |
26 | 28 | }); |
27 | 29 | |
28 | 30 | var options = { | ... | ... |
ieducar/modules/DynamicInput/Views/TurmaController.php
... | ... | @@ -55,12 +55,22 @@ class TurmaController extends ApiCoreController |
55 | 55 | $this->validatesId('serie'); |
56 | 56 | } |
57 | 57 | |
58 | + protected function turmasPorAno($escolaId, $ano) { | |
59 | + $anoLetivo = new clsPmieducarEscolaAnoLetivo(); | |
60 | + $anoLetivo->ref_cod_escola = $escolaId; | |
61 | + $anoLetivo->ano = $ano; | |
62 | + $anoLetivo = $anoLetivo->detalhe(); | |
63 | + | |
64 | + return ($anoLetivo['turmas_por_ano'] == 1); | |
65 | + } | |
66 | + | |
58 | 67 | protected function getTurmas() { |
59 | 68 | if ($this->canGetTurmas()) { |
60 | 69 | $userId = $this->getSession()->id_pessoa; |
61 | 70 | $instituicaoId = $this->getRequest()->instituicao_id; |
62 | 71 | $escolaId = $this->getRequest()->escola_id; |
63 | 72 | $serieId = $this->getRequest()->serie_id; |
73 | + $ano = $this->getRequest()->ano; | |
64 | 74 | |
65 | 75 | $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId); |
66 | 76 | |
... | ... | @@ -68,13 +78,27 @@ class TurmaController extends ApiCoreController |
68 | 78 | $turmas = Portabilis_Business_Professor::turmasAlocado($escolaId, $serieId, $userId); |
69 | 79 | |
70 | 80 | else { |
71 | - $sql = "select cod_turma as id, nm_turma as nome from pmieducar.turma where ref_ref_cod_escola = $1 | |
81 | + $sql = "select cod_turma as id, nm_turma as nome from pmieducar.turma where ref_ref_cod_escola = $1 | |
72 | 82 | and (ref_ref_cod_serie = $2 or ref_ref_cod_serie_mult = $2) and ativo = 1 and |
73 | 83 | visivel != 'f' order by nm_turma asc"; |
74 | 84 | |
75 | 85 | $turmas = $this->fetchPreparedQuery($sql, array($escolaId, $serieId)); |
76 | 86 | } |
77 | 87 | |
88 | + // caso no ano letivo esteja definido para filtrar turmas por ano, | |
89 | + // somente retorna as turmas do ano letivo. | |
90 | + | |
91 | + if ($ano && $this->turmasPorAno($escolaId, $ano)) { | |
92 | + foreach ($turmas as $index => $t) { | |
93 | + $turma = new clsPmieducarTurma(); | |
94 | + $turma->cod_turma = $t['id']; | |
95 | + $turma = $turma->detalhe(); | |
96 | + | |
97 | + if ($turma['ano'] != $ano) | |
98 | + unset($turmas[$index]); | |
99 | + } | |
100 | + } | |
101 | + | |
78 | 102 | $options = array(); |
79 | 103 | foreach ($turmas as $turma) |
80 | 104 | $options['__' . $turma['id']] = $this->toUtf8($turma['nome']); | ... | ... |
ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Process.js
... | ... | @@ -256,7 +256,5 @@ var $resultTable = $j('#form_resultado .tablelistagem').addClass('horizontal-exp |
256 | 256 | onClickSelectAllEvent ? $selectAllButton.click(onClickSelectAllEvent) : $selectAllButton.hide(); |
257 | 257 | onClickActionEvent ? $actionButton.click(onClickActionEvent) : $actionButton.hide(); |
258 | 258 | onClickDeleteEvent ? $deleteButton.click(onClickDeleteEvent) : $deleteButton.hide(); |
259 | - | |
260 | - fixupFieldsWidth(); | |
261 | 259 | }); // ready |
262 | 260 | })(jQuery); | ... | ... |
ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Resource.js
... | ... | @@ -50,6 +50,8 @@ var resourceOptions = { |
50 | 50 | }, |
51 | 51 | |
52 | 52 | handlePost : function(dataResponse) { |
53 | + if (dataResponse && dataResponse.any_error_msg) | |
54 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
53 | 55 | }, |
54 | 56 | |
55 | 57 | _handlePost : function(dataResponse) { |
... | ... | @@ -62,6 +64,8 @@ var resourceOptions = { |
62 | 64 | }, |
63 | 65 | |
64 | 66 | handlePut : function(dataResponse) { |
67 | + if (dataResponse && dataResponse.any_error_msg) | |
68 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
65 | 69 | }, |
66 | 70 | |
67 | 71 | |
... | ... | @@ -193,6 +197,8 @@ var resourceOptions = { |
193 | 197 | safeLog('dataResponse details:'); |
194 | 198 | safeLog(dataResponse); |
195 | 199 | |
200 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
201 | + | |
196 | 202 | throw error; |
197 | 203 | } |
198 | 204 | } |
... | ... | @@ -201,6 +207,8 @@ var resourceOptions = { |
201 | 207 | function handleError(response) { |
202 | 208 | handleMessages([{type : 'error', msg : 'Erro ao realizar operação, por favor tente novamente, detalhes:' + response.responseText}], ''); |
203 | 209 | |
210 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
211 | + | |
204 | 212 | safeLog('response details:'); |
205 | 213 | safeLog(response); |
206 | 214 | } | ... | ... |
ieducar/modules/Portabilis/Assets/Javascripts/Utils.js
... | ... | @@ -277,7 +277,7 @@ var handleMessages = messageUtils.handleMessages; |
277 | 277 | $(document).ready(function() { |
278 | 278 | |
279 | 279 | // add div for feedback messages |
280 | - $j('<div />').attr('id', 'feedback-messages').appendTo($j('form').last().parent()); | |
280 | + $j('<div />').attr('id', 'feedback-messages').appendTo($j('#corpo')); | |
281 | 281 | |
282 | 282 | }); // ready |
283 | 283 | })(jQuery); | ... | ... |
ieducar/modules/Portabilis/Assets/Version.php