Commit eb755d0a2b525bf6826a014ebd7ecb48e273ed72

Authored by Eriksen Costa Paixão
1 parent c08cdee3
Exists in master

Atualizado CRUD de Dispensa de Disciplina

 * Termo atualizado de "Dispensa de Disciplina" para "Dispensa de Componente Curricular"
 * Cadastro agora depende de {{{ComponenteCurricular_Model_ComponenteDataMapper}}}
 * Refactoring de lógica em {{{clsPmieducarDispensaDisciplina}}} para simplificar e remover código redundante (verificações {{{class_exists}}} e {{{method_exists}}})
ieducar/intranet/educar_dispensa_disciplina_cad.php
@@ -32,6 +32,7 @@ require_once 'include/clsBase.inc.php'; @@ -32,6 +32,7 @@ require_once 'include/clsBase.inc.php';
32 require_once 'include/clsCadastro.inc.php'; 32 require_once 'include/clsCadastro.inc.php';
33 require_once 'include/clsBanco.inc.php'; 33 require_once 'include/clsBanco.inc.php';
34 require_once 'include/pmieducar/geral.inc.php'; 34 require_once 'include/pmieducar/geral.inc.php';
  35 +require_once 'ComponenteCurricular/Model/ComponenteDataMapper.php';
35 36
36 /** 37 /**
37 * clsIndexBase class. 38 * clsIndexBase class.
@@ -47,7 +48,7 @@ class clsIndexBase extends clsBase @@ -47,7 +48,7 @@ class clsIndexBase extends clsBase
47 { 48 {
48 function Formular() 49 function Formular()
49 { 50 {
50 - $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Disciplina'); 51 + $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Componente Curricular');
51 $this->processoAp = 578; 52 $this->processoAp = 578;
52 } 53 }
53 } 54 }
@@ -154,16 +155,8 @@ class indice extends clsCadastro @@ -154,16 +155,8 @@ class indice extends clsCadastro
154 /** 155 /**
155 * Busca dados da matricula 156 * Busca dados da matricula
156 */ 157 */
157 - if (class_exists('clsPmieducarMatricula')) {  
158 - $obj_ref_cod_matricula = new clsPmieducarMatricula();  
159 - $detalhe_aluno = array_shift($obj_ref_cod_matricula->lista(  
160 - $this->ref_cod_matricula)  
161 - );  
162 - }  
163 - else {  
164 - $registro['ref_cod_matricula'] = 'Erro na geracao';  
165 - echo "<!--\nErro\nClasse nao existente: clsPmieducarMatricula\n-->";  
166 - } 158 + $obj_ref_cod_matricula = new clsPmieducarMatricula();
  159 + $detalhe_aluno = array_shift($obj_ref_cod_matricula->lista($this->ref_cod_matricula));
167 160
168 $obj_aluno = new clsPmieducarAluno(); 161 $obj_aluno = new clsPmieducarAluno();
169 $det_aluno = array_shift($det_aluno = $obj_aluno->lista($detalhe_aluno['ref_cod_aluno'], 162 $det_aluno = array_shift($det_aluno = $obj_aluno->lista($detalhe_aluno['ref_cod_aluno'],
@@ -173,9 +166,9 @@ class indice extends clsCadastro @@ -173,9 +166,9 @@ class indice extends clsCadastro
173 NULL, NULL, NULL, NULL, NULL, NULL, 1); 166 NULL, NULL, NULL, NULL, NULL, NULL, 1);
174 167
175 $det_escola = $obj_escola->detalhe(); 168 $det_escola = $obj_escola->detalhe();
176 - $this->ref_cod_instituicao = $det_escola["ref_cod_instituicao"]; 169 + $this->ref_cod_instituicao = $det_escola['ref_cod_instituicao'];
177 170
178 - $this->campoRotulo("nm_aluno", "Nome do Aluno", $det_aluno['nome_aluno']); 171 + $this->campoRotulo('nm_aluno', 'Nome do Aluno', $det_aluno['nome_aluno']);
179 172
180 $obj_matricula_turma = new clsPmieducarMatriculaTurma(); 173 $obj_matricula_turma = new clsPmieducarMatriculaTurma();
181 $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula, 174 $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula,
@@ -194,29 +187,21 @@ class indice extends clsCadastro @@ -194,29 +187,21 @@ class indice extends clsCadastro
194 $this->campoOculto('ref_cod_escola', $this->ref_cod_escola); 187 $this->campoOculto('ref_cod_escola', $this->ref_cod_escola);
195 188
196 $opcoes = array('' => 'Selecione'); 189 $opcoes = array('' => 'Selecione');
197 - if (class_exists('clsPmieducarEscolaSerieDisciplina')) {  
198 - $objTemp = new clsPmieducarEscolaSerieDisciplina();  
199 - $lista = $objTemp->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1);  
200 -  
201 - if (is_array($lista) && count($lista)) {  
202 - foreach ($lista as $registro) {  
203 - $obj_disciplina = new clsPmieducarDisciplina(  
204 - $registro['ref_cod_disciplina'], NULL, NULL, NULL, NULL, NULL, NULL,  
205 - NULL, NULL, NULL, 1);  
206 -  
207 - $det_disciplina = $obj_disciplina->detalhe();  
208 - $opcoes[$registro['ref_cod_disciplina']] = $det_disciplina['nm_disciplina'];  
209 - } 190 +
  191 + $objTemp = new clsPmieducarEscolaSerieDisciplina();
  192 + $lista = $objTemp->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1);
  193 +
  194 + $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper();
  195 + if (is_array($lista) && count($lista)) {
  196 + foreach ($lista as $registro) {
  197 + $componente = $componenteMapper->find($registro['ref_cod_disciplina']);
  198 + $opcoes[$componente->id] = $componente->nome;
210 } 199 }
211 } 200 }
212 - else {  
213 - echo "<!--\nErro\nClasse clsPmieducarTurmaDisciplina nao encontrada\n-->";  
214 - $opcoes = array('' => 'Erro na geracao');  
215 - }  
216 201
217 if ($this->ref_cod_disciplina) { 202 if ($this->ref_cod_disciplina) {
218 $this->campoRotulo('nm_disciplina', 'Disciplina', $opcoes[$this->ref_cod_disciplina]); 203 $this->campoRotulo('nm_disciplina', 'Disciplina', $opcoes[$this->ref_cod_disciplina]);
219 - $this->campoOculto('ref_cod_disciplina', $this->ref_cod_disciplina ); 204 + $this->campoOculto('ref_cod_disciplina', $this->ref_cod_disciplina);
220 } 205 }
221 else { 206 else {
222 $this->campoLista('ref_cod_disciplina', 'Disciplina', $opcoes, 207 $this->campoLista('ref_cod_disciplina', 'Disciplina', $opcoes,
@@ -225,26 +210,20 @@ class indice extends clsCadastro @@ -225,26 +210,20 @@ class indice extends clsCadastro
225 210
226 $opcoes = array('' => 'Selecione'); 211 $opcoes = array('' => 'Selecione');
227 212
228 - if (class_exists('clsPmieducarTipoDispensa')) {  
229 - $objTemp = new clsPmieducarTipoDispensa(); 213 + $objTemp = new clsPmieducarTipoDispensa();
230 214
231 - if ($this->ref_cod_instituicao) {  
232 - $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,  
233 - NULL, 1, $this->ref_cod_instituicao);  
234 - }  
235 - else {  
236 - $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);  
237 - }  
238 -  
239 - if (is_array($lista) && count($lista)) {  
240 - foreach ($lista as $registro) {  
241 - $opcoes[$registro['cod_tipo_dispensa']] = $registro['nm_tipo'];  
242 - }  
243 - } 215 + if ($this->ref_cod_instituicao) {
  216 + $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
  217 + NULL, 1, $this->ref_cod_instituicao);
244 } 218 }
245 else { 219 else {
246 - echo "<!--\nErro\nClasse clsPmieducarTipoDispensa nao encontrada\n-->";  
247 - $opcoes = array('' => 'Erro na geracao'); 220 + $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
  221 + }
  222 +
  223 + if (is_array($lista) && count($lista)) {
  224 + foreach ($lista as $registro) {
  225 + $opcoes[$registro['cod_tipo_dispensa']] = $registro['nm_tipo'];
  226 + }
248 } 227 }
249 228
250 $this->campoLista('ref_cod_tipo_dispensa', 'Tipo Dispensa', $opcoes, 229 $this->campoLista('ref_cod_tipo_dispensa', 'Tipo Dispensa', $opcoes,
ieducar/intranet/educar_dispensa_disciplina_det.php
@@ -32,6 +32,7 @@ require_once &quot;include/clsBase.inc.php&quot;; @@ -32,6 +32,7 @@ require_once &quot;include/clsBase.inc.php&quot;;
32 require_once "include/clsDetalhe.inc.php"; 32 require_once "include/clsDetalhe.inc.php";
33 require_once "include/clsBanco.inc.php"; 33 require_once "include/clsBanco.inc.php";
34 require_once "include/pmieducar/geral.inc.php"; 34 require_once "include/pmieducar/geral.inc.php";
  35 +require_once 'ComponenteCurricular/Model/ComponenteDataMapper.php';
35 36
36 /** 37 /**
37 * clsIndexBase class. 38 * clsIndexBase class.
@@ -47,7 +48,7 @@ class clsIndexBase extends clsBase @@ -47,7 +48,7 @@ class clsIndexBase extends clsBase
47 { 48 {
48 function Formular() 49 function Formular()
49 { 50 {
50 - $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Disciplina'); 51 + $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Componente Curricular');
51 $this->processoAp = 578; 52 $this->processoAp = 578;
52 } 53 }
53 } 54 }
@@ -86,7 +87,7 @@ class indice extends clsDetalhe @@ -86,7 +87,7 @@ class indice extends clsDetalhe
86 $this->pessoa_logada = $_SESSION['id_pessoa']; 87 $this->pessoa_logada = $_SESSION['id_pessoa'];
87 session_write_close(); 88 session_write_close();
88 89
89 - $this->titulo = 'Dispensa Disciplina - Detalhe'; 90 + $this->titulo = 'Dispensa Componente Curricular - Detalhe';
90 $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 91 $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg',
91 'Intranet'); 92 'Intranet');
92 93
@@ -116,17 +117,9 @@ class indice extends clsDetalhe @@ -116,17 +117,9 @@ class indice extends clsDetalhe
116 echo "<!--\nErro\nClasse nao existente: clsPmieducarSerie\n-->"; 117 echo "<!--\nErro\nClasse nao existente: clsPmieducarSerie\n-->";
117 } 118 }
118 119
119 - /**  
120 - * Busca dados da matrícula  
121 - */  
122 - if (class_exists('clsPmieducarMatricula')) {  
123 - $obj_ref_cod_matricula = new clsPmieducarMatricula();  
124 - $detalhe_aluno = array_shift($obj_ref_cod_matricula->lista($this->ref_cod_matricula));  
125 - }  
126 - else {  
127 - $registro['ref_cod_matricula'] = 'Erro na geracao';  
128 - echo "<!--\nErro\nClasse nao existente: clsPmieducarMatricula\n-->";  
129 - } 120 + // Dados da matrícula
  121 + $obj_ref_cod_matricula = new clsPmieducarMatricula();
  122 + $detalhe_aluno = array_shift($obj_ref_cod_matricula->lista($this->ref_cod_matricula));
130 123
131 $obj_aluno = new clsPmieducarAluno(); 124 $obj_aluno = new clsPmieducarAluno();
132 $det_aluno = array_shift($obj_aluno->lista($detalhe_aluno['ref_cod_aluno'], 125 $det_aluno = array_shift($obj_aluno->lista($detalhe_aluno['ref_cod_aluno'],
@@ -138,25 +131,15 @@ class indice extends clsDetalhe @@ -138,25 +131,15 @@ class indice extends clsDetalhe
138 131
139 $nm_aluno = $det_aluno['nome_aluno']; 132 $nm_aluno = $det_aluno['nome_aluno'];
140 133
141 - if (class_exists('clsPmieducarCurso')) {  
142 - $obj_ref_cod_curso = new clsPmieducarCurso( $detalhe_aluno['ref_cod_curso'] );  
143 - $det_ref_cod_curso = $obj_ref_cod_curso->detalhe();  
144 - $registro['ref_cod_curso'] = $det_ref_cod_curso['nm_curso'];  
145 - }  
146 - else {  
147 - $registro['ref_cod_curso'] = 'Erro na geracao';  
148 - echo "<!--\nErro\nClasse nao existente: clsPmieducarCurso\n-->";  
149 - } 134 + // Dados do curso
  135 + $obj_ref_cod_curso = new clsPmieducarCurso($detalhe_aluno['ref_cod_curso']);
  136 + $det_ref_cod_curso = $obj_ref_cod_curso->detalhe();
  137 + $registro['ref_cod_curso'] = $det_ref_cod_curso['nm_curso'];
150 138
151 - if (class_exists('clsPmieducarTipoDispensa')) {  
152 - $obj_ref_cod_tipo_dispensa = new clsPmieducarTipoDispensa($registro['ref_cod_tipo_dispensa']);  
153 - $det_ref_cod_tipo_dispensa = $obj_ref_cod_tipo_dispensa->detalhe();  
154 - $registro['ref_cod_tipo_dispensa'] = $det_ref_cod_tipo_dispensa['nm_tipo'];  
155 - }  
156 - else {  
157 - $registro['ref_cod_tipo_dispensa'] = 'Erro na geracao';  
158 - echo "<!--\nErro\nClasse nao existente: clsPmieducarTipoDispensa\n-->";  
159 - } 139 + // Tipo de dispensa
  140 + $obj_ref_cod_tipo_dispensa = new clsPmieducarTipoDispensa($registro['ref_cod_tipo_dispensa']);
  141 + $det_ref_cod_tipo_dispensa = $obj_ref_cod_tipo_dispensa->detalhe();
  142 + $registro['ref_cod_tipo_dispensa'] = $det_ref_cod_tipo_dispensa['nm_tipo'];
160 143
161 if ($registro['ref_cod_matricula']) { 144 if ($registro['ref_cod_matricula']) {
162 $this->addDetalhe(array('Matricula', $registro['ref_cod_matricula'])); 145 $this->addDetalhe(array('Matricula', $registro['ref_cod_matricula']));
@@ -175,11 +158,9 @@ class indice extends clsDetalhe @@ -175,11 +158,9 @@ class indice extends clsDetalhe
175 } 158 }
176 159
177 if ($registro['ref_cod_disciplina']) { 160 if ($registro['ref_cod_disciplina']) {
178 - $obj_disciplina = new clsPmieducarDisciplina($registro['ref_cod_disciplina'],  
179 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);  
180 -  
181 - $det_disciplina = $obj_disciplina->detalhe();  
182 - $this->addDetalhe(array('Disciplina', $det_disciplina['nm_disciplina'])); 161 + $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper();
  162 + $componente = $componenteMapper->find($registro['ref_cod_disciplina']);
  163 + $this->addDetalhe(array('Componente Curricular', $componente->nome));
183 } 164 }
184 165
185 if ($registro['ref_cod_tipo_dispensa']) { 166 if ($registro['ref_cod_tipo_dispensa']) {
ieducar/intranet/educar_dispensa_disciplina_lst.php
@@ -32,6 +32,8 @@ require_once &#39;include/clsBase.inc.php&#39;; @@ -32,6 +32,8 @@ require_once &#39;include/clsBase.inc.php&#39;;
32 require_once 'include/clsListagem.inc.php'; 32 require_once 'include/clsListagem.inc.php';
33 require_once 'include/clsBanco.inc.php'; 33 require_once 'include/clsBanco.inc.php';
34 require_once 'include/pmieducar/geral.inc.php'; 34 require_once 'include/pmieducar/geral.inc.php';
  35 +require_once 'CoreExt/View/Helper/UrlHelper.php';
  36 +require_once 'ComponenteCurricular/Model/ComponenteDataMapper.php';
35 37
36 /** 38 /**
37 * clsIndexBase class. 39 * clsIndexBase class.
@@ -47,7 +49,7 @@ class clsIndexBase extends clsBase @@ -47,7 +49,7 @@ class clsIndexBase extends clsBase
47 { 49 {
48 function Formular() 50 function Formular()
49 { 51 {
50 - $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Disciplina'); 52 + $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Componente Curricular');
51 $this->processoAp = 578; 53 $this->processoAp = 578;
52 } 54 }
53 } 55 }
@@ -91,7 +93,10 @@ class indice extends clsListagem @@ -91,7 +93,10 @@ class indice extends clsListagem
91 $this->pessoa_logada = $_SESSION['id_pessoa']; 93 $this->pessoa_logada = $_SESSION['id_pessoa'];
92 session_write_close(); 94 session_write_close();
93 95
94 - $this->titulo = 'Dispensa Disciplina - Listagem'; 96 + // Helper para url
  97 + $urlHelper = CoreExt_View_Helper_UrlHelper::getInstance();
  98 +
  99 + $this->titulo = 'Dispensa Componente Curricular - Listagem';
95 100
96 // passa todos os valores obtidos no GET para atributos do objeto 101 // passa todos os valores obtidos no GET para atributos do objeto
97 foreach ($_GET as $var => $val) { 102 foreach ($_GET as $var => $val) {
@@ -139,26 +144,20 @@ class indice extends clsListagem @@ -139,26 +144,20 @@ class indice extends clsListagem
139 144
140 // Filtros de Foreign Keys 145 // Filtros de Foreign Keys
141 $opcoes = array('' => 'Selecione'); 146 $opcoes = array('' => 'Selecione');
142 - if (class_exists('clsPmieducarTipoDispensa')) {  
143 $objTemp = new clsPmieducarTipoDispensa(); 147 $objTemp = new clsPmieducarTipoDispensa();
144 148
145 - if ($this->ref_cod_instituicao) {  
146 - $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,  
147 - NULL, 1, $this->ref_cod_instituicao);  
148 - }  
149 - else {  
150 - $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);  
151 - }  
152 -  
153 - if (is_array($lista) && count($lista)) {  
154 - foreach ($lista as $registro) {  
155 - $opcoes[$registro['cod_tipo_dispensa']] = $registro['nm_tipo'];  
156 - }  
157 - } 149 + if ($this->ref_cod_instituicao) {
  150 + $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
  151 + NULL, 1, $this->ref_cod_instituicao);
158 } 152 }
159 else { 153 else {
160 - echo "<!--\nErro\nClasse clsPmieducarTipoDispensa nao encontrada\n-->";  
161 - $opcoes = array('' => 'Erro na geração'); 154 + $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
  155 + }
  156 +
  157 + if (is_array($lista) && count($lista)) {
  158 + foreach ($lista as $registro) {
  159 + $opcoes[$registro['cod_tipo_dispensa']] = $registro['nm_tipo'];
  160 + }
162 } 161 }
163 162
164 $this->campoLista('ref_cod_tipo_dispensa', 'Motivo', $opcoes, 163 $this->campoLista('ref_cod_tipo_dispensa', 'Motivo', $opcoes,
@@ -168,25 +167,21 @@ class indice extends clsListagem @@ -168,25 +167,21 @@ class indice extends clsListagem
168 167
169 // outros Filtros 168 // outros Filtros
170 $opcoes = array('' => 'Selecione'); 169 $opcoes = array('' => 'Selecione');
171 - if (class_exists('clsPmieducarEscolaSerieDisciplina')) {  
172 - $objTemp = new clsPmieducarEscolaSerieDisciplina();  
173 - $lista = $objTemp->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1);  
174 -  
175 - if (is_array($lista) && count($lista)) {  
176 - foreach ($lista as $registro) {  
177 - $obj_disciplina = new clsPmieducarDisciplina(  
178 - $registro['ref_cod_disciplina'], NULL, NULL, NULL, NULL, NULL, NULL,  
179 - NULL, NULL, NULL, 1);  
180 -  
181 - $det_disciplina = $obj_disciplina->detalhe();  
182 - $opcoes[$registro['ref_cod_disciplina']] = $det_disciplina['nm_disciplina'];  
183 - } 170 +
  171 + // Escola série disciplina
  172 + $objTemp = new clsPmieducarEscolaSerieDisciplina();
  173 + $lista = $objTemp->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1);
  174 +
  175 + if (is_array($lista) && count($lista)) {
  176 + foreach ($lista as $registro) {
  177 + $obj_disciplina = new clsPmieducarDisciplina(
  178 + $registro['ref_cod_disciplina'], NULL, NULL, NULL, NULL, NULL, NULL,
  179 + NULL, NULL, NULL, 1);
  180 +
  181 + $det_disciplina = $obj_disciplina->detalhe();
  182 + $opcoes[$registro['ref_cod_disciplina']] = $det_disciplina['nm_disciplina'];
184 } 183 }
185 } 184 }
186 - else {  
187 - echo "<!--\nErro\nClasse clsPmieducarEscolaSerieDisciplina nao encontrada\n-->";  
188 - $opcoes = array('' => 'Erro na geração');  
189 - }  
190 185
191 $this->campoLista('ref_cod_disciplina', 'Disciplina', $opcoes, 186 $this->campoLista('ref_cod_disciplina', 'Disciplina', $opcoes,
192 $this->ref_cod_disciplina, '', FALSE, '', '', FALSE, FALSE); 187 $this->ref_cod_disciplina, '', FALSE, '', '', FALSE, FALSE);
@@ -217,6 +212,9 @@ class indice extends clsListagem @@ -217,6 +212,9 @@ class indice extends clsListagem
217 212
218 $total = $obj_dispensa_disciplina->_total; 213 $total = $obj_dispensa_disciplina->_total;
219 214
  215 + // Mapper de componente curricular
  216 + $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper();
  217 +
220 // monta a lista 218 // monta a lista
221 if (is_array($lista) && count($lista)) { 219 if (is_array($lista) && count($lista)) {
222 foreach ($lista as $registro) { 220 foreach ($lista as $registro) {
@@ -224,25 +222,27 @@ class indice extends clsListagem @@ -224,25 +222,27 @@ class indice extends clsListagem
224 $registro['data_cadastro_time'] = strtotime(substr($registro['data_cadastro'], 0, 16)); 222 $registro['data_cadastro_time'] = strtotime(substr($registro['data_cadastro'], 0, 16));
225 $registro['data_cadastro_br'] = date('d/m/Y', $registro['data_cadastro_time']); 223 $registro['data_cadastro_br'] = date('d/m/Y', $registro['data_cadastro_time']);
226 224
227 - if (class_exists('clsPmieducarTipoDispensa')) {  
228 - $obj_ref_cod_tipo_dispensa = new clsPmieducarTipoDispensa($registro['ref_cod_tipo_dispensa']);  
229 - $det_ref_cod_tipo_dispensa = $obj_ref_cod_tipo_dispensa->detalhe();  
230 - $registro['ref_cod_tipo_dispensa'] = $det_ref_cod_tipo_dispensa['nm_tipo'];  
231 - }  
232 - else {  
233 - $registro['ref_cod_tipo_dispensa'] = 'Erro na geracao';  
234 - echo "<!--\nErro\nClasse nao existente: clsPmieducarTipoDispensa\n-->";  
235 - }  
236 -  
237 - $obj_disciplina = new clsPmieducarDisciplina($registro['ref_cod_disciplina'],  
238 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);  
239 -  
240 - $det_disciplina = $obj_disciplina->detalhe(); 225 + // Tipo da dispensa
  226 + $obj_ref_cod_tipo_dispensa = new clsPmieducarTipoDispensa($registro['ref_cod_tipo_dispensa']);
  227 + $det_ref_cod_tipo_dispensa = $obj_ref_cod_tipo_dispensa->detalhe();
  228 + $registro['ref_cod_tipo_dispensa'] = $det_ref_cod_tipo_dispensa['nm_tipo'];
  229 +
  230 + // Componente curricular
  231 + $componente = $componenteMapper->find($registro['ref_cod_disciplina']);
  232 +
  233 + // Dados para a url
  234 + $url = 'educar_dispensa_disciplina_det.php';
  235 + $options = array('query' => array(
  236 + 'ref_cod_matricula' => $registro['ref_cod_matricula'],
  237 + 'ref_cod_serie' => $registro['ref_cod_serie'],
  238 + 'ref_cod_escola' => $registro['ref_cod_escola'],
  239 + 'ref_cod_disciplina' => $registro['ref_cod_disciplina']
  240 + ));
241 241
242 $this->addLinhas(array( 242 $this->addLinhas(array(
243 - "<a href=\"educar_dispensa_disciplina_det.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_serie={$registro["ref_cod_serie"]}&ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_disciplina={$registro["ref_cod_disciplina"]}\">{$det_disciplina["nm_disciplina"]}</a>",  
244 - "<a href=\"educar_dispensa_disciplina_det.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_serie={$registro["ref_cod_serie"]}&ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_disciplina={$registro["ref_cod_disciplina"]}\">{$registro["ref_cod_tipo_dispensa"]}</a>",  
245 - "<a href=\"educar_dispensa_disciplina_det.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_serie={$registro["ref_cod_serie"]}&ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_disciplina={$registro["ref_cod_disciplina"]}\">{$registro["data_cadastro_br"]}</a>" 243 + $urlHelper->l($componente->nome, $url, $options),
  244 + $urlHelper->l($registro['ref_cod_tipo_dispensa'], $url, $options),
  245 + $urlHelper->l($registro['data_cadastro_br'], $url, $options)
246 )); 246 ));
247 } 247 }
248 } 248 }
ieducar/intranet/educar_matricula_det.php
@@ -231,7 +231,7 @@ class indice extends clsDetalhe @@ -231,7 +231,7 @@ class indice extends clsDetalhe
231 $this->array_botao_url_script[] = "go(\"educar_matricula_ocorrencia_disciplinar_lst.php?ref_cod_matricula={$registro['cod_matricula']}\")"; 231 $this->array_botao_url_script[] = "go(\"educar_matricula_ocorrencia_disciplinar_lst.php?ref_cod_matricula={$registro['cod_matricula']}\")";
232 232
233 if ($registro['ref_ref_cod_serie']) { 233 if ($registro['ref_ref_cod_serie']) {
234 - $this->array_botao[] = 'Dispensa de Disciplinas'; 234 + $this->array_botao[] = 'Dispensa de Componentes Curriculares';
235 $this->array_botao_url_script[] = "go(\"educar_dispensa_disciplina_lst.php?ref_cod_matricula={$registro['cod_matricula']}\")"; 235 $this->array_botao_url_script[] = "go(\"educar_dispensa_disciplina_lst.php?ref_cod_matricula={$registro['cod_matricula']}\")";
236 } 236 }
237 237
ieducar/intranet/include/pmieducar/clsPmieducarDispensaDisciplina.inc.php
@@ -115,119 +115,49 @@ class clsPmieducarDispensaDisciplina @@ -115,119 +115,49 @@ class clsPmieducarDispensaDisciplina
115 $cod_dispensa = NULL) 115 $cod_dispensa = NULL)
116 { 116 {
117 $db = new clsBanco(); 117 $db = new clsBanco();
118 - $this->_schema = "pmieducar.";  
119 - $this->_tabela = "{$this->_schema}dispensa_disciplina"; 118 + $this->_schema = 'pmieducar.';
  119 + $this->_tabela = $this->_schema . 'dispensa_disciplina';
120 120
121 - $this->_campos_lista = $this->_todos_campos = "ref_cod_matricula, ref_cod_serie, ref_cod_escola, ref_cod_disciplina, ref_usuario_exc, ref_usuario_cad, ref_cod_tipo_dispensa, data_cadastro, data_exclusao, ativo, observacao"; 121 + $this->_campos_lista = $this->_todos_campos = 'ref_cod_matricula, ref_cod_serie, ref_cod_escola, ref_cod_disciplina, ref_usuario_exc, ref_usuario_cad, ref_cod_tipo_dispensa, data_cadastro, data_exclusao, ativo, observacao';
122 122
123 if (is_numeric($ref_usuario_exc)) { 123 if (is_numeric($ref_usuario_exc)) {
124 - if (class_exists("clsPmieducarUsuario")) {  
125 - $tmp_obj = new clsPmieducarUsuario($ref_usuario_exc);  
126 - if (method_exists($tmp_obj, "existe")) {  
127 - if ($tmp_obj->existe()) {  
128 - $this->ref_usuario_exc = $ref_usuario_exc;  
129 - }  
130 - }  
131 - elseif (method_exists($tmp_obj, "detalhe")) {  
132 - if ($tmp_obj->detalhe()) {  
133 - $this->ref_usuario_exc = $ref_usuario_exc;  
134 - }  
135 - }  
136 - }  
137 - else {  
138 - if ($db->CampoUnico("SELECT 1 FROM pmieducar.usuario WHERE cod_usuario = '{$ref_usuario_exc}'")) {  
139 - $this->ref_usuario_exc = $ref_usuario_exc;  
140 - } 124 + $usuario = new clsPmieducarUsuario($ref_usuario_exc);
  125 + if ($usuario->existe()) {
  126 + $this->ref_usuario_exc = $ref_usuario_exc;
141 } 127 }
142 } 128 }
143 129
144 if (is_numeric($ref_usuario_cad)) { 130 if (is_numeric($ref_usuario_cad)) {
145 - if (class_exists("clsPmieducarUsuario")) {  
146 - $tmp_obj = new clsPmieducarUsuario($ref_usuario_cad);  
147 - if (method_exists($tmp_obj, "existe")) {  
148 - if ($tmp_obj->existe()) {  
149 - $this->ref_usuario_cad = $ref_usuario_cad;  
150 - }  
151 - }  
152 - elseif (method_exists($tmp_obj, "detalhe")) {  
153 - if ($tmp_obj->detalhe()) {  
154 - $this->ref_usuario_cad = $ref_usuario_cad;  
155 - }  
156 - }  
157 - }  
158 - else {  
159 - if ($db->CampoUnico("SELECT 1 FROM pmieducar.usuario WHERE cod_usuario = '{$ref_usuario_cad}'")) {  
160 - $this->ref_usuario_cad = $ref_usuario_cad;  
161 - } 131 + $usuario = new clsPmieducarUsuario($ref_usuario_cad);
  132 + if ($usuario->existe()) {
  133 + $this->ref_usuario_cad = $ref_usuario_cad;
162 } 134 }
163 } 135 }
164 136
165 if (is_numeric($ref_cod_matricula)) { 137 if (is_numeric($ref_cod_matricula)) {
166 - if (class_exists("clsPmieducarMatricula")) {  
167 - $tmp_obj = new clsPmieducarMatricula($ref_cod_matricula);  
168 - if (method_exists($tmp_obj, "existe")) {  
169 - if ($tmp_obj->existe()) {  
170 - $this->ref_cod_matricula = $ref_cod_matricula;  
171 - }  
172 - }  
173 - elseif (method_exists($tmp_obj, "detalhe")) {  
174 - if ($tmp_obj->detalhe()) {  
175 - $this->ref_cod_matricula = $ref_cod_matricula;  
176 - }  
177 - }  
178 - }  
179 - else {  
180 - if ($db->CampoUnico("SELECT 1 FROM pmieducar.matricula WHERE ref_cod_matricula = '{$ref_cod_matricula}'")) {  
181 - $this->ref_cod_matricula = $ref_cod_matricula;  
182 - } 138 + $matricula = new clsPmieducarMatricula($ref_cod_matricula);
  139 + if ($matricula->existe()) {
  140 + $this->ref_cod_matricula = $ref_cod_matricula;
183 } 141 }
184 } 142 }
185 143
186 if (is_numeric($ref_cod_tipo_dispensa)) { 144 if (is_numeric($ref_cod_tipo_dispensa)) {
187 - if (class_exists("clsPmieducarTipoDispensa")) {  
188 - $tmp_obj = new clsPmieducarTipoDispensa($ref_cod_tipo_dispensa);  
189 - if (method_exists($tmp_obj, "existe")) {  
190 - if ($tmp_obj->existe()) {  
191 - $this->ref_cod_tipo_dispensa = $ref_cod_tipo_dispensa;  
192 - }  
193 - }  
194 - elseif (method_exists($tmp_obj, "detalhe")) {  
195 - if ($tmp_obj->detalhe()) {  
196 - $this->ref_cod_tipo_dispensa = $ref_cod_tipo_dispensa;  
197 - }  
198 - }  
199 - }  
200 - else {  
201 - if ($db->CampoUnico("SELECT 1 FROM pmieducar.tipo_dispensa WHERE cod_tipo_dispensa = '{$ref_cod_tipo_dispensa}'")) {  
202 - $this->ref_cod_tipo_dispensa = $ref_cod_tipo_dispensa;  
203 - } 145 + $tipoDispensa = new clsPmieducarTipoDispensa($ref_cod_tipo_dispensa);
  146 + if ($tipoDispensa->existe()) {
  147 + $this->ref_cod_tipo_dispensa = $ref_cod_tipo_dispensa;
204 } 148 }
205 } 149 }
206 150
207 - if (is_numeric($ref_cod_disciplina) && is_numeric($ref_cod_escola) && is_numeric($ref_cod_serie)) {  
208 - if (class_exists("clsPmieducarEscolaSerieDisciplina")) {  
209 - $tmp_obj = new clsPmieducarEscolaSerieDisciplina($ref_cod_serie, $ref_cod_escola, $ref_cod_disciplina);  
210 - if (method_exists($tmp_obj, "existe")) {  
211 - if ($tmp_obj->existe()) {  
212 - $this->ref_cod_disciplina = $ref_cod_disciplina;  
213 - $this->ref_cod_escola = $ref_cod_escola;  
214 - $this->ref_cod_serie = $ref_cod_serie;  
215 - }  
216 - }  
217 - elseif (method_exists($tmp_obj, "detalhe")) {  
218 - if ($tmp_obj->detalhe()) {  
219 - $this->ref_cod_disciplina = $ref_cod_disciplina;  
220 - $this->ref_cod_escola = $ref_cod_escola;  
221 - $this->ref_cod_serie = $ref_cod_serie;  
222 - }  
223 - }  
224 - }  
225 - else {  
226 - if ($db->CampoUnico("SELECT 1 FROM pmieducar.escola_serie_disciplina WHERE ref_cod_disciplina = '{$ref_cod_disciplina}' AND ref_cod_escola = '{$ref_cod_escola}' AND ref_cod_serie = '{$ref_cod_serie}'")) {  
227 - $this->ref_cod_disciplina = $ref_cod_disciplina;  
228 - $this->ref_cod_escola = $ref_cod_escola;  
229 - $this->ref_cod_serie = $ref_cod_serie;  
230 - } 151 + if (is_numeric($ref_cod_disciplina) && is_numeric($ref_cod_escola) &&
  152 + is_numeric($ref_cod_serie)
  153 + ) {
  154 + $escolaSerieDisciplina = new clsPmieducarEscolaSerieDisciplina($ref_cod_serie,
  155 + $ref_cod_escola, $ref_cod_disciplina);
  156 +
  157 + if ($escolaSerieDisciplina->existe()) {
  158 + $this->ref_cod_disciplina = $ref_cod_disciplina;
  159 + $this->ref_cod_escola = $ref_cod_escola;
  160 + $this->ref_cod_serie = $ref_cod_serie;
231 } 161 }
232 } 162 }
233 163