forked from guaycuru/gde
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoferecimento.php
198 lines (176 loc) · 8.63 KB
/
oferecimento.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?php
namespace GDE;
if(isset($_GET['ax']))
define("NO_HTML", true);
// ToDo: Titulo mais informativo
define('TITULO', 'Oferecimento');
require_once('../common/common.inc.php');
if(empty($_GET['id']))
exit();
$Oferecimento = Oferecimento::Load($_GET['id']);
if($Oferecimento->getID() == null)
die('Oferecimento inexistente...'.$FIM);
$Horario = $Oferecimento->Monta_Horario();
$oferecimento_pagina = $Oferecimento->getPagina();
$html_oferecimento_pagina = '';
if($oferecimento_pagina == null) {
if(ColaboracaoOferecimento::Existe_Colaboracao($Oferecimento->getID(), 'pagina') == false) {
$html_oferecimento_pagina = '<input id="pagina_valor" type="text" class="valor_colaborar"><a href="#" id="pagina_colaborar" class="link_colaborar">Colaborar</a>';
} else {
$html_oferecimento_pagina = 'Colaboracao pendente já existe. Aguardando autorização.';
}
} else
$html_oferecimento_pagina = "<a href='".$oferecimento_pagina."' target='_blank'>".$oferecimento_pagina."</a>"; //.' <a href="#" id="pagina_reclamar" class="link_reclamar">Reclamar</a>';
?>
<!-- <script type="text/javascript" src="<?= CONFIG_URL; ?>web/js/gde.forum.js?<?= REVISION; ?>"></script> -->
<script type="text/javascript">
// <![CDATA[
var carregou_informacoes = false;
var tipo = 1;
var paginacao = 1;
var colaborar_padrao = 'Colabore aqui';
var id_oferecimento = '<?= $Oferecimento->getID(); ?>';
var Informacoes = function() {
$("#tab_disciplina").load('<?= CONFIG_URL; ?>disciplina/?id=<?= urlencode($Oferecimento->getSigla()); ?>&of #tabela_informacoes');
};
var Carrega = function(tp, pg) {
$("#lista_alunos").Carregando();
if(tp == 1) {
$("#lista_alunos").attr("border", "0");
} else {
$("#lista_alunos").attr("border", "1");
}
tipo = tp;
paginacao = pg;
Lista_Alunos();
};
var Lista_Alunos = function() {
$("#lista_alunos").Carregando();
var filtro = (!$("#filtro_nome").hasClass('padrao'));
var amigos = ($("#apenas_amigos").is(':checked') > 0)?'t':'f';
$("#lista_alunos").load("<?= CONFIG_URL; ?>ajax/busca.php", {t: 'alunos', nome: ((filtro) ? $("#filtro_nome").val() : ''), amigos: amigos, id_oferecimento: '<?= $Oferecimento->getID(); ?>', tpres: tipo, p: paginacao, buscar: ''});
};
$(document).ready(function() {
$("#tabs").tabs({
show: function(event, ui) {
if((ui.panel.id == 'tab_disciplina') && (!carregou_informacoes)) {
Informacoes();
carregou_informacoes = true;
}
},
select: function(event, ui) {
window.location.hash = ui.tab.hash;
}
});
Tamanho_Abas('tabs');
$("#filtro_nome").Valor_Padrao('Filtrar por nome...', 'padrao');
$("#filtro_nome").bind('keyup', function() {
paginacao = 1;
Lista_Alunos();
});
$("a.link_pagina").live('click', function() {
var pg = $(this).attr('href').split('$')[1]
Carrega(tipo, pg);
return false;
});
Carrega(1, 1);
if($("#pagina_valor").length > 0)
$("#pagina_valor").val("http://");
$("a.link_colaborar").click(function() {
var campo = $(this).attr("id").split("_")[0];
var valor = $.trim($("#" + campo + "_valor").val().replace(colaborar_padrao, ""));
if(valor == "" || valor == 0)
$.guaycuru.confirmacao("Valor inválido.");
else {
$("#" + campo + "_valor").attr('disabled', 'disabled');
$("#" + campo + "_colaborar").hide();
$.post("<?= CONFIG_URL; ?>ajax/colaboracao_oferecimento.php", {campo: campo, valor: valor, id_oferecimento: id_oferecimento}, function(data) {
if(data && data.ok) {
$.guaycuru.confirmacao("Colaboração enviada. Aguarde autorização.");
$("#" + campo + "_valor").hide();
$("#" + campo + "_valor").after("<label>Colaboração pendente já existe. Aguardando autorização.</label>");
$("#" + campo + "_colaborar").hide();
} else if(data.error) {
$.guaycuru.confirmacao(data.error, "<?= CONFIG_URL; ?>oferecimento/<?= $Oferecimento->getID(); ?>");
} else {
$("#" + campo + "_valor").removeAttr('disabled');
$("#" + campo + "_colaborar").show();
$.guaycuru.confirmacao("Houve um problema com o seu pedido. Verifique se a página colaborada referencia um site na Unicamp ou tente novamente mais tarde.");
}
});
}
return false;
});
$("#todos_alunos, #apenas_amigos").click(function() {
Carrega(1, 1);
});
});
// ]]>
</script>
<div id="coluna_esquerda_wrapper">
<div id="coluna_esquerda">
<div id="perfil_cabecalho">
<div id="perfil_mensagem_botoes">
<div id="perfil_cabecalho_nome"><?=$Oferecimento->getSigla(true); ?> <?=$Oferecimento->getTurma(true); ?> - <?=$Oferecimento->getDisciplina()->getNome(true); ?></div>
</div>
</div>
<div class="tip" id="disciplina_tip">Dica: Para acessar diretamente a página deste oferecimento use <span class="link"><a href="http://gde.ir/o/<?= $Oferecimento->getID(); ?>">http://gde.ir/o/<?= $Oferecimento->getID(); ?></a></span></div>
<div id="perfil_abas">
<div id="tabs">
<ul>
<li><a href="#tab_informacoes" class="ativo">Informações</a></li>
<li><a href="#tab_disciplina">Disciplina</a></li>
<li><a href="#tab_horario">Horário</a></li>
<!-- <li><a href="#tab_forum">Fórum</a></li> -->
</ul>
<div id="tab_informacoes" class="tab_content">
<table cellspacing="0" class="tabela_bonyta_branca">
<tr><td width="25%"><b>Período:</b></td><td><?= $Oferecimento->getPeriodo(true)->getNome(false); ?></td></tr>
<tr><td width="25%"><b>Turma:</b></td><td><?= $Oferecimento->getTurma(true); ?></td></tr>
<tr><td width="25%"><b>Professor:</b></td><td><?= ($Oferecimento->getProfessor() !== null) ? "<a href=\"".CONFIG_URL."perfil/?professor=".$Oferecimento->getProfessor(true)->getID()."\">".$Oferecimento->getProfessor(true)->getNome(true)."</a>" : "Desconhecido"; ?></td></tr>
<tr><td width="25%"><b>Vagas:</b></td><td><?= $Oferecimento->getVagas().(($Oferecimento->getFechado())?' - <b>Fechada</b>':null); ?></td></tr>
<tr><td width="25%"><b>Alunos:</b></td><td><?= $Oferecimento->Matriculados(); ?></td></tr>
<tr><td width="25%"><b>Desistências:</b></td><td><?= $Oferecimento->Desistencias(); ?></td></tr>
<tr><td width="25%"><b>Reservas:</b></td><td><?= $Oferecimento->getReservas(true); ?></td></tr>
<tr><td width="25%"><b>Página:</b></td><td><?= $html_oferecimento_pagina; ?></td></tr>
<?php if($_Usuario->getAdmin() === true) { ?><tr><td width="25%"><b>Admin:</b></td><td><a href="VisaoAdminOferecimento.php?id=<?=$Oferecimento->getID(); ?>">Editar Oferecimento</a></td></tr><?php } ?>
</table>
</div>
<div id="tab_disciplina" class="tab_content">
<img src="<?= CONFIG_URL; ?>web/images/loading.gif" alt="..." /> Carregando dados da disciplina...
</div>
<div id="tab_horario" class="tab_content">
<table cellspacing="0" class="tabela_bonyta_branca">
<tr><td align="center"><b>-</b></td><td align="center"><b>Segunda</b></td><td align="center"><b>Terça</b></td><td align="center"><b>Quarta</b></td><td align="center"><b>Quinta</b></td><td align="center"><b>Sexta</b></td><td align="center"><b>Sábado</b></td></tr>
<?php
$limpos = Util::Horarios_Livres($Horario);
for($j = 7; $j < 23; $j++) {
if(in_array($j, $limpos)) continue;
echo "<tr><td align=\"center\"><b>".$j.":00</b></td>";
for($i = 2; $i < 8; $i++) {
echo "<td align=\"center\">".Oferecimento::Formata_Horario($Horario, $i, $j)."</td>";
}
echo "</tr>";
}
?>
</table>
</div>
<!-- <div id="tab_forum" class="tab_content">
<img src="<?= CONFIG_URL; ?>web/images/loading.gif" alt="..." /> Carregando Fórum...
</div> -->
</div>
</div>
</div>
</div>
<table cellspacing="0" class="tabela_bonyta_branca">
<tr><td colspan="2">
<br /><b>Alunos: (<a href="#" onclick="Carrega(1, 1); return false;" id="link_fotos">Fotos</a> | <a href="#" onclick="Carrega(2, 1); return false;" id="link_lista">Lista</a>)</b><br />
<div style="margin-top: 10px;">
<input style="margin-left: 0;" type="radio" name="filtro_amigos" id="todos_alunos" class="tipo_atualizacoes" checked="checked"><label for="todos_alunos">Todos Alunos</label>
<input type="radio" id="apenas_amigos" name="filtro_amigos" class="tipo_atualizacoes"><label for="apenas_amigos">Apenas Amigos</label>
</div><br />
<input type="text" class="busca_simples" id="filtro_nome" />
<div id="lista_alunos"><img src="<?= CONFIG_URL; ?>web/images/loading.gif" alt="..." /></div>
</td></tr>
</table>
<?= $FIM; ?>