forked from guaycuru/gde
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathamigos.php
285 lines (270 loc) · 9.99 KB
/
amigos.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
<?php
namespace GDE;
define('TITULO', 'Amigos');
require_once('../common/common.inc.php');
$Quase_Amigos = $_Usuario->getQuase_Amigos();
$Autorizacoes = $_Usuario->getAmigos_Pendentes();
$Amigos = $_Usuario->Amigos(true);
?>
<script type="text/javascript">
// <![CDATA[
var remover_amigo = function(id) {
$.guaycuru.simnao("Tem certeza que deseja remover este Usuário da sua lista de Amigos?", function() {
$.post(CONFIG_URL + 'ajax/amigo.php', {i: id, tipo: 'r'}, function(data) {
if(data == '1') {
$.guaycuru.confirmacao("Usuário não está mais na sua lista de amigos!", null);
history.go(0);
}
else if(data == '2')
$.guaycuru.confirmacao("Não foi possível remover o usuário da sua lista de amigos.");
});
}, {});
};
var autorizar_amigo = function(id) {
$.post(CONFIG_URL + 'ajax/amigo.php', {i: id, tipo: 'h'}, function(data) {
if(data == '1') {
$.guaycuru.confirmacao("O Pedido de Amizade foi aceito com sucesso!");
history.go(0);
}
else if(data == '2')
$.guaycuru.confirmacao("Não foi possível aceitar o Pedido de Amizade.");
});
};
Carrega = function(tp) {
if(tp == 0) {
$("#tabela_amigos_foto").show();
$("#tabela_amigos_lista").hide();
} else if(tp == 1){
$("#tabela_amigos_foto").hide();
$("#tabela_amigos_lista").show();
} else if(tp == 2){
$("#tabela_quaseAmigos_lista").hide();
$("#tabela_quaseAmigos_foto").show();
} else if(tp == 3){
$("#tabela_quaseAmigos_foto").hide();
$("#tabela_quaseAmigos_lista").show();
} else if(tp == 4){
$("#tabela_pendentes_foto").show();
$("#tabela_pendentes_lista").hide();
} else {
$("#tabela_pendentes_foto").hide();
$("#tabela_pendentes_lista").show();
}
};
$(document).ready(function() {
Carrega(0);
Carrega(2);
Carrega(4);
});
// ]]>
</script>
<?php
if(count($Autorizacoes) > 0) { ?>
<h2>Autorizações Pendentes</h2>(<a href="#" id="link_amigos_foto" onclick="Carrega(4); return false;">Fotos</a> | <a href="#" id="link_amigos_lista" onclick="Carrega(5); return false;">Lista</a>)
<table border="0" id="tabela_pendentes_foto" >
<tr>
<?php
$i = 0;
foreach($Autorizacoes as $Auth) {
$Aluno = $Auth->getUsuario(true)->getAluno(true);
?>
<td width="50%"><table border="1" width="100%">
<tr>
<td width="128" height="150" align="center" rowspan="6"><a href="<?= CONFIG_URL; ?>perfil/?usuario=<?= $Auth->getUsuario(true)->getLogin(true); ?>"><img src="<?= $Auth->getUsuario(true)->getFoto(true); ?>" border="0" alt="<?= $Auth->getUsuario(true)->getNome(true); ?>" /></a></td>
<td width="20%"><strong>Nome:</strong></td>
<td><a href="<?= CONFIG_URL; ?>perfil/?usuario=<?= $Auth->getUsuario(true)->getLogin(true); ?>"><?= $Auth->getUsuario(true)->getNome_Completo(true); ?></a></td>
</tr>
<tr>
<td width="20%"><strong>RA:</strong></td>
<td><?= $Aluno->getRA(true); ?></td>
</tr>
<tr>
<td width="20%"><strong>Nível:</strong></td>
<td><?= $Aluno->getNivel(true); ?></td>
</tr>
<tr>
<td width="20%"><strong>Curso:</strong></td>
<td><?= $Aluno->getCurso(true)->getNome(true)." (".$Aluno->getCurso(true)->getNumero(true).")"; ?></td>
</tr>
<tr>
<td width="20%"><strong>Modalidade:</strong></td>
<td><?= $Aluno->getModalidade(true); ?></td>
</tr>
<tr>
<td width="20%"><strong>Ação:</strong></td>
<td><a href="#" onclick="autorizar_amigo('<?= $Auth->getUsuario()->getID(); ?>'); return false;">Aceitar</a> | <a href="#" onclick="remover_amigo('<?= $Auth->getUsuario()->getID(); ?>'); return false;">Recusar</a></td></tr>
</table></td>
<?php
if($i++ % 2 == 1)
echo "</tr><tr>";
}
$i = 0;
?>
</tr>
</table>
<table border="1" width="100%" class="tabela_busca" id="tabela_pendentes_lista" >
<tr>
<th>Nome</th>
<th>RA</th>
<th>Nível</th>
<th>Curso</th>
<th>Modalidade</th>
<th>Ação</th>
</tr>
<?php
foreach($Autorizacoes as $Auth) {
$Aluno = $Auth->getUsuario()->getAluno();
?>
<tr>
<td><a href="Perfil.php?l=<?= $Auth->getUsuario()->getLogin(); ?>"><?= $Auth->getUsuario(true)->getNome_Completo(true); ?></a></td>
<td><?= $Aluno->getRA(true); ?></td>
<td><?= $Aluno->getNivel(true); ?></td>
<td><?= $Aluno->getCurso(true)->getNome(true)." (".$Aluno->getCurso(true)->getNumero(true).")"; ?></td>
<td><?= $Aluno->getModalidade(true); ?></td>
<td><a href="#" onclick="autorizar_amigo('<?= $Auth->getUsuario(true)->getID(); ?>'); return false;">Autorizar</a> | <a href="#" onclick="remover_amigo('<?= $Auth->getUsuario(true)->getID(); ?>'); return false;">Recusar</a></td>
</tr>
<?php
}
?>
</tr>
</table>
<?php }
if(count($Amigos) > 0) { ?>
<h2>Amigos</h2>(<a href="#" id="link_amigos_foto" onclick="Carrega(0); return false;">Fotos</a> | <a href="#" id="link_amigos_lista" onclick="Carrega(1); return false;">Lista</a>)
<table border="0" id="tabela_amigos_foto" ><tr>
<?php
$i = 0;
foreach($Amigos as $Amigo) {
$Aluno = $Amigo->getAmigo(true)->getAluno(true);
?>
<td width="50%"><table border="1" width="100%">
<tr>
<td width="128" height="150" align="center" rowspan="6"><a href="<?= CONFIG_URL; ?>perfil/?usuario=<?= $Amigo->getAmigo(true)->getLogin(true); ?>"><img src="<?= $Amigo->getAmigo(true)->getFoto(true); ?>" border="0" alt="<?= $Amigo->getAmigo(true)->getNome(true); ?>" /></a></td>
<td width="20%"><strong>Nome:</strong></td>
<td><a href="<?= CONFIG_URL; ?>perfil/?usuario=<?= $Amigo->getAmigo(true)->getLogin(true); ?>"><?= $Amigo->getAmigo()->getNome_Completo(true); ?></a></td>
</tr>
<tr>
<td width="20%"><strong>RA:</strong></td>
<td><?= $Aluno->getRA(true); ?></td>
</tr>
<tr>
<td width="20%"><strong>Nível:</strong></td>
<td><?= $Aluno->getNivel(true); ?></td>
</tr>
<tr>
<td width="20%"><strong>Curso:</strong></td>
<td><?= $Aluno->getCurso(true)->getNome(true)." (".$Aluno->getCurso(true)->getNumero(true).")"; ?></td>
</tr>
<tr>
<td width="20%"><strong>Modalidade:</strong></td>
<td><?= $Aluno->getModalidade(true); ?></td>
</tr>
<tr>
<td width="20%"><strong>Remover:</strong></td>
<td><a href="#" onclick="remover_amigo('<?= $Amigo->getAmigo(true)->getID(); ?>'); return false;">Remover</a></td>
</tr>
</table></td>
<?php
if($i++ % 2 == 1)
echo "</tr><tr>";
} ?>
<td> </td>
</tr>
</table>
<table border="1" width="100%" class="tabela_busca" id="tabela_amigos_lista" >
<tr>
<th>RA</th>
<th>Nome</th>
<th>Nível</th>
<th>Curso</th>
<th>Modalidade</th>
<th>Remover</th>
</tr>
<?php
foreach($Amigos as $Amigo) {
$Aluno = $Amigo->getAmigo()->getAluno();
?>
<tr>
<td><a href="<?= CONFIG_URL; ?>perfil/?aluno=<?= $Aluno->getRA(true); ?>"><?= $Aluno->getRA(true); ?></a></td>
<td><a href="<?= CONFIG_URL; ?>perfil/?usuario=<?= $Amigo->getAmigo(true)->getLogin(true); ?>"><?= $Amigo->getAmigo(true)->getNome_Completo(true); ?></a></td>
<td><?= $Aluno->getNivel(true); ?></td>
<td><?= $Aluno->getCurso(true)->getNome(true)." (".$Aluno->getCurso(true)->getNumero(true).")"; ?></td>
<td><?= $Aluno->getModalidade(true); ?></td>
<td><a href="#" onclick="remover_amigo('<?= $Amigo->getAmigo(true)->getID(); ?>'); return false;">Remover</a></td>
</tr>
<?php
}
?>
</table>
<?php
}
if(count($Quase_Amigos) > 0) { ?>
<h2>Amigos - Aguardando Autorização</h2>(<a href="#" onclick="Carrega(2); return false;" target="false" id="link_fotos">Fotos</a> | <a href="#" onclick="Carrega(3); return false;" target="false" id="link_lista">Lista</a>)
<table border="0" class="tabela_bonyta_branca" id="tabela_quaseAmigos_foto" ><tr>
<?php
$i = 0;
foreach($Quase_Amigos as $Amigo) {
$Aluno = $Amigo->getAmigo()->getAluno(true);
?>
<td width="50%"><table border="1" width="100%">
<tr>
<td width="128" height="150" align="center" rowspan="6"><a href="<?= CONFIG_URL; ?>perfil/?usuario=<?= $Amigo->getAmigo(true)->getLogin(true); ?>"><img src="<?= $Amigo->getAmigo(true)->getFoto(true); ?>" border="0" alt="<?= $Amigo->getAmigo(true)->getNome(true); ?>" /></a></td>
<td width="20%"><strong>Nome:</strong></td>
<td><a href="<?= CONFIG_URL; ?>perfil/?usuario=<?= $Amigo->getAmigo(true)->getLogin(true); ?>"><?= $Amigo->getAmigo(true)->getNome_Completo(true); ?></a></td>
</tr>
<tr>
<td width="20%"><strong>RA:</strong></td>
<td><?= $Aluno->getRA(true); ?></td>
</tr>
<tr>
<td width="20%"><strong>Nível:</strong></td>
<td><?= $Aluno->getNivel(true); ?></td>
</tr>
<tr>
<td width="20%"><strong>Curso:</strong></td>
<td><?= $Aluno->getCurso(true)->getNome(true)." (".$Aluno->getCurso(true)->getNumero(true).")"; ?></td>
</tr>
<tr>
<td width="20%"><strong>Modalidade:</strong></td>
<td><?= $Aluno->getModalidade(true); ?></td>
</tr>
<tr>
<td width="20%"><strong>Remover:</strong></td>
<td><a href="#" onclick="remover_amigo('<?= $Amigo->getAmigo(true)->getID(); ?>'); return false;">Remover</a> <i>(Aguardando Autorização)</i></td>
</tr>
</table></td>
<?php
if($i++ % 2 == 1)
echo "</tr><tr>";
} ?>
<td> </td>
</tr>
</table>
<table border="1" width="100%" class="tabela_busca" id="tabela_quaseAmigos_lista" >
<tr>
<th>RA</th>
<th>Nome</th>
<th>Nível</th>
<th>Curso</th>
<th>Modalidade</th>
<th>Remover</th>
</tr>
<?php
foreach($Quase_Amigos as $Amigo) {
$Aluno = $Amigo->getAmigo()->getAluno();
?>
<tr>
<td><a href="<?= CONFIG_URL; ?>perfil/?aluno=<?= $Aluno->getRA(true); ?>"><?= $Aluno->getRA(true); ?></a></td>
<td><a href="<?= CONFIG_URL; ?>perfil/?usuario=<?= $Amigo->getAmigo(true)->getLogin(true); ?>"><?= $Amigo->getAmigo(true)->getNome(true).' '.$Amigo->getAmigo(true)->getSobrenome(true); ?></a></td>
<td><?= $Aluno->getNivel(true); ?></td>
<td><?= $Aluno->getCurso(true)->getNome(true)." (".$Aluno->getCurso(true)->getNumero(true).")"; ?></td>
<td><?= $Aluno->getModalidade(true); ?></td>
<td><a href="#" onclick="remover_amigo('<?= $Amigo->getAmigo(true)->getID(); ?>'); return false;">Remover</a></td>
</tr>
<?php
}
?>
</table>
<?php
}
echo $FIM;