forked from guaycuru/gde
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimprimir-horario.php
86 lines (77 loc) · 3.04 KB
/
imprimir-horario.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
namespace GDE;
// Pra aluno, professor, etc
define('NO_CACHE', true);
define('NO_HTML', true);
require_once('../common/common.inc.php');
$ra = intval($_GET['ra']);
$p = (isset($_GET['p'])) ? intval($_GET['p']) : null;
$n = (isset($_GET['n'])) ? $_GET['n'][0] : 'G';
?>
<html>
<head>
</head>
<body>
<style>
* { color: #000000; }
table.tabela_bonyta { border-top: 1px solid #000000; border-left: 1px solid #000000; width: 100%;}
table.tabela_bonyta td { border-right: 1px solid #000000; border-bottom: 1px solid #000000;}
</style>
<?php
$Periodo_Selecionado = ($p > 0) ? Periodo::Load($p) : Periodo::getAtual();
$Aluno = ($ra > 0) ? Aluno::Load($ra) : $_Usuario->getAluno(true);
$Horario = $Aluno->Monta_Horario($Periodo_Selecionado->getPeriodo(), $n);
$UsuarioAluno = ($Aluno->getUsuario(false) !== null) ? $Aluno->getUsuario(false) : new Usuario();
$pode_ver = $_Usuario->Pode_Ver($UsuarioAluno, 'horario');
if((is_array($pode_ver) && !$pode_ver[0]) || !$pode_ver)
exit;
$meu = ($_Usuario->getAluno(true)->getID() == $Aluno->getID());
$limpos = Util::Horarios_Livres($Horario);
?>
<table border="0" cellspacing="0" class="tabela_bonyta">
<tr>
<td colspan="7" align="center" style="padding: 10px;"><strong><?= $Aluno->getNome(true); ?><br />Horário para <?= $Periodo_Selecionado->getNome(false); ?></strong></td>
</tr>
<?php if(count($limpos) == 16) { ?>
<tr>
<td align="center" colspan="7"><strong>Horário indisponível para <?= $Periodo_Selecionado->getNome(false); ?>!</strong></td>
</tr>
<?php
} else {
?>
<tr>
<td align="center"><strong>-</strong></td>
<td align="center"><strong>Segunda</strong></td>
<td align="center"><strong>Terça</strong></td>
<td align="center"><strong>Quarta</strong></td>
<td align="center"><strong>Quinta</strong></td>
<td align="center"><strong>Sexta</strong></td>
<td align="center"><strong>Sábado</strong></td>
</tr>
<?php
for($j = 7; $j < 23; $j++) {
if((!isset($_GET['f'])) && (in_array($j, $limpos)))
continue;
?>
<tr>
<td align="center"><strong><?= $j; ?>:00</strong></td>
<?php
for($i = 2; $i < 8; $i++) {
$tem = isset($Horario[$i][$j]);
?>
<td align="center"><?= $_Usuario->Formata_Horario($Horario, $i, $j, $meu, $Periodo_Selecionado, false); ?></td>
<?php } ?>
</tr>
<?php
}
}
?>
<tr>
<td colspan="2" style="padding: 10px;"><strong>Matrículas (<?=$Aluno->Creditos_Atuais($Periodo_Selecionado->getPeriodo(), $n); ?>):</strong></td>
<td colspan="5" style="padding: 10px;"><?=$Aluno->getOferecimentos($Periodo_Selecionado->getPeriodo(), $n, true, false); ?></td>
</tr>
</table><br />
<a href="#" onclick="window.print(); return false;">Imprimir</a>
<?= (!isset($_GET['f'])) ? "<br /><a href=\"".CONFIG_URL."imprimir-horario/?ra=".intval($_GET['ra'])."&p=".$Periodo_Selecionado->getID(true)."&n=".$n."&f\">Horário Completo</a>" : "<br /><a href=\"".CONFIG_URL."imprimir-horario/?ra=".intval($_GET['ra'])."&p=".$Periodo_Selecionado->getID(true)."&n=".$n."\">Horário Resumido</a>"; ?>
</body>
<html>