Commit 509b5f80348b0af8b04e677f56896d02cd35cda8
Exists in
master
Merge branch 'remocao-enturmacao'
Showing
1 changed file
with
26 additions
and
30 deletions
Show diff stats
ieducar/intranet/educar_matricula_turma_det.php
@@ -204,6 +204,15 @@ class indice extends clsDetalhe | @@ -204,6 +204,15 @@ class indice extends clsDetalhe | ||
204 | $this->possuiEnturmacaoTurmaDestino = false; | 204 | $this->possuiEnturmacaoTurmaDestino = false; |
205 | $this->turmaOrigemMesmaDestino = false; | 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 | if ($this->possuiEnturmacao) { | 216 | if ($this->possuiEnturmacao) { |
208 | //se possui uma enturmacao mostra o nome, se mais de uma mostra select para selecionar | 217 | //se possui uma enturmacao mostra o nome, se mais de uma mostra select para selecionar |
209 | if (count($enturmacoes) > 1) { | 218 | if (count($enturmacoes) > 1) { |
@@ -227,23 +236,7 @@ class indice extends clsDetalhe | @@ -227,23 +236,7 @@ class indice extends clsDetalhe | ||
227 | $selectEnturmacoes = "<input id='ref_cod_turma_origem' type='hidden' value = '{$enturmacoes[0]['ref_cod_turma']}'/>{$enturmacoes[0]['nm_turma']}"; | 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 | $this->addDetalhe(array( | 242 | $this->addDetalhe(array( |
@@ -287,7 +280,7 @@ class indice extends clsDetalhe | @@ -287,7 +280,7 @@ class indice extends clsDetalhe | ||
287 | if (turmaOrigemId && turmaOrigemId.value) | 280 | if (turmaOrigemId && turmaOrigemId.value) |
288 | document.formcadastro.ref_cod_turma_origem.value = turmaOrigemId.value; | 281 | document.formcadastro.ref_cod_turma_origem.value = turmaOrigemId.value; |
289 | else { | 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 | return false; | 284 | return false; |
292 | } | 285 | } |
293 | } | 286 | } |
@@ -301,7 +294,7 @@ class indice extends clsDetalhe | @@ -301,7 +294,7 @@ class indice extends clsDetalhe | ||
301 | 294 | ||
302 | function removerEnturmacao(ref_cod_matricula, ref_cod_turma_destino) { | 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 | return false; | 298 | return false; |
306 | 299 | ||
307 | document.formcadastro.ref_cod_turma_origem.value = "remover-enturmacao-destino"; | 300 | document.formcadastro.ref_cod_turma_origem.value = "remover-enturmacao-destino"; |
@@ -314,22 +307,25 @@ class indice extends clsDetalhe | @@ -314,22 +307,25 @@ class indice extends clsDetalhe | ||
314 | 307 | ||
315 | print $script; | 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 | if ($this->possuiEnturmacao) { | 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 | //nova enturmação | 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 |