Skip to content

Commit 1ad840f

Browse files
committed
Configuracoes da conta
1 parent 857fef3 commit 1ad840f

File tree

9 files changed

+147
-19
lines changed

9 files changed

+147
-19
lines changed

ajax/configuracao.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace GDE;
4+
5+
define('NO_CACHE', true);
6+
define('NO_HTML', true);
7+
define('NO_REDIRECT', true);
8+
9+
require_once('../common/common.inc.php');
10+
11+
$Usuario_Config = $_Usuario->getConfig(true);
12+
$Usuario_Config->setAvisos_Aniversario($_POST['tipoA']);
13+
echo ($Usuario_Config->Save(true) !== false) ? '1' : '0';

ajax/excluir_conta.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace GDE;
4+
5+
define('NO_CACHE', true);
6+
define('NO_HTML', true);
7+
define('NO_REDIRECT', true);
8+
9+
require_once('../common/common.inc.php');
10+
11+
if($_POST['tipo'] == 'excluir') {
12+
$_Usuario->Delete(true);
13+
Logout();
14+
} else if($_POST['tipo'] == 'desativar') {
15+
$_Usuario->setAtivo(false);
16+
$_Usuario->Save(true);
17+
Logout();
18+
}

ajax/favorito.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
if($_POST['tipo'] == 'a') {
1212
$Aluno = Aluno::Load($_POST['ra']);
1313
$_Usuario->addFavoritos($Aluno);
14-
echo ($_Usuario->Save(true)) ? '1' : '0';
14+
echo ($_Usuario->Save(true) !== false) ? '1' : '0';
1515
} elseif($_POST['tipo'] == 'r') {
1616
$Aluno = Aluno::Load($_POST['ra']);
1717
$_Usuario->removeFavoritos($Aluno);
18-
echo ($_Usuario->Save(true)) ? '1' : '0';
18+
echo ($_Usuario->Save(true) !== false) ? '1' : '0';
1919
}

classes/GDE/UsuarioConfig.inc.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ class UsuarioConfig extends Base {
2929
protected $usuario;
3030

3131
/**
32-
* @var boolean
32+
* @var string
3333
*
34-
* @ORM\Column(type="boolean", options={"default"=1}, nullable=false)
34+
* @ORM\Column(type="string", options={"default"="n"}, nullable=false)
3535
*/
36-
protected $avisos_aniversario = true;
36+
protected $avisos_aniversario = 'n';
3737

3838
/**
3939
* @var boolean
@@ -70,5 +70,10 @@ class UsuarioConfig extends Base {
7070
*/
7171
protected $acontecimentos_gde = true;
7272

73+
static $tipos = array('e' => 'Email', 'a' => 'Aba Aviso', 't' => 'Ambos', 'n' => 'Nenhum Aviso');
74+
75+
public static function getTipos() {
76+
return self::$tipos;
77+
}
7378

7479
}

common/common.inc.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@
104104
<script type="text/javascript" src="<?= CONFIG_URL; ?>web/js/jquery.watcherkeys.js?<?= REVISION; ?>"></script>
105105
<script type="text/javascript" src="<?= CONFIG_URL; ?>web/js/gde.common.js?<?= REVISION; ?>"></script>
106106
<script type="text/javascript" src="<?= CONFIG_URL; ?>web/js/gde.42.js?<?= REVISION; ?>"></script>
107-
<?php if(($_Usuario !== null) && ((!isset($_SESSION['admin_su'])) || ($_SESSION['admin_su'] === false))) { ?><script type="text/javascript" src="<?= CONFIG_URL; ?>web/js/gde.chat.js?<?= REVISION; ?>"></script><?php } ?>
107+
<?php if(($_Usuario !== null) && ($_Usuario->getID() != null) && ((!isset($_SESSION['admin_su'])) || ($_SESSION['admin_su'] === false))) { ?>
108+
<script type="text/javascript" src="<?= CONFIG_URL; ?>web/js/gde.chat.js?<?= REVISION; ?>"></script>
109+
<?php } ?>
108110
<script type="text/javascript">var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-3315545-3']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();</script>
109111
<link rel="stylesheet" href="<?= CONFIG_URL; ?>web/css/dropdown_menu.css?<?= REVISION; ?>" type="text/css" />
110112
<link rel="stylesheet" href="<?= CONFIG_URL; ?>web/css/gde.css?<?= REVISION; ?>" type="text/css" />
@@ -215,8 +217,8 @@
215217
</li>
216218
<li><a href="#" onclick="return false;">Social</a>
217219
<ul>
218-
<li><a href="<?= CONFIG_URL; ?>visoes/EditarPerfil.php">Editar Perfil</a></li>
219-
<li><a href="<?= CONFIG_URL; ?>visoes/Configuracoes.php">Configura&ccedil;&otilde;es da Conta</a></li>
220+
<li><a href="<?= CONFIG_URL; ?>editar/">Editar Perfil</a></li>
221+
<li><a href="<?= CONFIG_URL; ?>configuracoes/">Configura&ccedil;&otilde;es da Conta</a></li>
220222
<li><a href="<?= CONFIG_URL; ?>amigos/">Meus Amigos</a></li>
221223
<li><a class="ui-corner-bottom" href="<?= CONFIG_URL; ?>recomendar/">Convidar um Amigo</a></li>
222224
</ul>

views/configuracoes.php

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?php
2+
3+
namespace GDE;
4+
5+
define('TITULO', 'Configura&ccedil;&otilde;es da Conta');
6+
7+
require_once('../common/common.inc.php');
8+
9+
?>
10+
11+
<script type="text/javascript">
12+
// <![CDATA[
13+
$(document).ready(function() {
14+
$.guaycuru.tooltip("TT_desativar", "Desativar Conta:", "Ser&aacute; como se voc&ecirc; n&atilde;o existisse no GDE, mas seus dados ser&atilde;o preservados para quando voc&ecirc; quiser voltar.", {});
15+
$.guaycuru.tooltip("TT_excluir", "Excluir Conta:", "Tem certeza? Absoluta? Caso exclua a conta, n&atilde;o haver&aacute; volta!", {});
16+
17+
$("#tabs").tabs({});
18+
Tamanho_Abas('tabs');
19+
20+
$('#salvar_conta').click(function() {
21+
if($("input[name='confConta']:checked").val() == 'excluir') {
22+
$.guaycuru.simnao2('Tem certeza que deseja excluir seu cadastro do GDE?<br />Todos os seus dados ser&atilde;o perdidos <strong>PARA TODA A ETERNIDADE</strong>!', function() {
23+
$.post('<?= CONFIG_URL; ?>ajax/excluir_conta.php', {tipo: 'excluir'}, function(data){
24+
$.guaycuru.confirmacao("Seu cadstro foi exclu&iacute;do do GDE!<br />So long, so long, and thanks for all the fish!", "<?= CONFIG_URL; ?>");
25+
});
26+
});
27+
} else if($("input[name='confConta']:checked").val() == 'desativar') {
28+
$.post('<?= CONFIG_URL; ?>ajax/excluir_conta.php', {tipo: 'desativar'}, function(data){
29+
$.guaycuru.confirmacao("Sua conta foi desativada!", "<?= CONFIG_URL; ?>");
30+
});
31+
} else
32+
$.guaycuru.confirmacao("Marque a op&ccedil;&atilde;o para desativar / excluir a conta");
33+
});
34+
35+
$('#salvar').click(function() {
36+
if($("input[name='tipoAviso']").is(':checked'))
37+
$.post('<?= CONFIG_URL; ?>ajax/configuracao.php', {tipoA: $("input[name='tipoAviso']:checked").val()}, function(data){
38+
if(data == '1')
39+
$.guaycuru.confirmacao("Configura&ccedil;&otilde;es salvas com sucesso!");
40+
});
41+
});
42+
43+
$('#cancelar').click(function() {
44+
window.location="<?= CONFIG_URL; ?>";
45+
});
46+
47+
});
48+
// ]]>
49+
</script>
50+
<div id="coluna_esquerda_wrapper">
51+
<div id="perfil_abas">
52+
<div id="tabs">
53+
<ul>
54+
<li><a href="#tab_aviso" class="ativo">Configura&ccedil;&atilde;o dos Avisos</a></li>
55+
<li><a href="#tab_conta">Configura&ccedil;&atilde;o da Conta</a></li>
56+
</ul>
57+
<div id="tab_aviso" class="tab_content">
58+
<table cellspacing="0" class="tabela_bonyta_branca">
59+
<tr>
60+
<td><strong>Avisos de Anivers&aacute;rio</strong></td>
61+
<td>
62+
<?php foreach(UsuarioConfig::getTipos() as $i => $tipo) { ?>
63+
<input type="radio" name="tipoAviso" value="<?= $i ?>" <?= ($_Usuario->getConfig(true)->getAvisos_Aniversario(false) == $i) ? 'checked="checked"' : '' ?> /><label><?= $tipo ?></label>
64+
<?php } ?>
65+
</td>
66+
</tr>
67+
</table>
68+
<br />
69+
<input type="button" id="salvar" name="salvar" class="botao_salvar" value=" " alt="Salvar" />
70+
</div>
71+
<div id="tab_conta" class="tab_content">
72+
<table cellspacing="0" class="tabela_bonyta_branca">
73+
<tr>
74+
<td>
75+
<input type="radio" name="confConta" value="excluir" /><label>Deseja excluir sua conta?</label> <span class="formInfo"><a href="#" id="TT_excluir">?</a></span>
76+
</td>
77+
</tr>
78+
<tr>
79+
<td>
80+
<input type="radio" name="confConta" value="desativar"/><label>Deseja desativar sua conta?</label> <span class="formInfo"><a href="#" id="TT_desativar">?</a></span>
81+
</td>
82+
</tr>
83+
</table>
84+
<br />
85+
<input type="button" id="salvar_conta" name="salvar_conta" class="botao_salvar" value=" " alt="Excluir ou Desativar Perfil" />
86+
</div>
87+
</div>
88+
</div>
89+
</div>
90+
<?= $FIM; ?>

views/editar.php

Whitespace-only changes.

views/perfil.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@
421421
else
422422
$link_arvore = '&Aacute;rvore n&atilde;o compartilhada...';
423423
if($Usr->getLogin() == $_Usuario->getLogin())
424-
$link_pessoal = '<a href="'.CONFIG_URL.'configuracoes/">Editar Perfil</a>';
424+
$link_pessoal = '<a href="'.CONFIG_URL.'editar/">Editar Perfil</a>';
425425
elseif($Meu_Amigo !== false) {
426426
$link_pessoal = '<a href="#" id="link_amigo" style="font-size: 10px;">Excluir Amigo</a>';
427427
if($Meu_Amigo->getApelido(false) != null)

web/js/gde.chat.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ var Iniciar_Chat = function() {
1717
Atualizar_Chat();
1818
$("#chatMiguxo").show();
1919
Atualizar_Coisas(true);
20-
}
20+
};
2121

2222
var Atualizar_Coisas = function(atualiza_chat) {
2323
$.post(CONFIG_URL + 'ajax/ax_xml.php', {n: n_requisicao, id_chat: id_chat, ac: (atualiza_chat) ? 1 : 0}, function(data){
2424
if($(data).find('deslogado').length > 0) {
25-
document.location = 'VisaoLogin.php';
25+
document.location = CONFIG_URL + 'login/';
2626
return;
2727
}
2828
n_requisicao++;
@@ -206,7 +206,7 @@ var Atualizar_Coisas = function(atualiza_chat) {
206206
else if(!atualiza_chat)
207207
setTimeout(function() { Atualizar_Coisas(false); }, 10000);
208208
});
209-
}
209+
};
210210

211211
var Atualizar_Chat = function() {
212212
$("#chatAmigos").height(300);
@@ -259,7 +259,7 @@ var Atualizar_Chat = function() {
259259
});
260260
}
261261
});
262-
}
262+
};
263263

264264
var Cria_Chat = function(id) {
265265
var chat_html = "<div id=\"chat_" + id + "\" class=\"chat\">";
@@ -340,7 +340,7 @@ var Cria_Chat = function(id) {
340340
});
341341

342342
Atualizar_Chat();
343-
}
343+
};
344344

345345
var Minimizar_Restaurar_Chat = function(id) {
346346
$("#chat_body_" + id).toggle();
@@ -358,7 +358,7 @@ var Minimizar_Restaurar_Chat = function(id) {
358358
$.post(CONFIG_URL + "ajax/ax_chat.php", {tipo: 'ws', id: id, status: status});
359359
Atualizar_Chat();
360360
return false;
361-
}
361+
};
362362

363363
var Mensagem_Enviar = function(id, id_usuario_destino, mensagem) {
364364
$.post(CONFIG_URL + "ajax/ax_chat.php", {tipo: 'i', id: id, id_usuario_destino: id_usuario_destino, mensagem: mensagem}, function (data) {
@@ -379,7 +379,7 @@ var Mensagem_Enviar = function(id, id_usuario_destino, mensagem) {
379379
}
380380
$("#chat_body_"+id_usuario_destino).scrollTop($("#chat_body_"+id_usuario_destino).outerHeight());
381381
});
382-
}
382+
};
383383

384384
var Mensagem_Chat = function(id, id_destino, nome_usuario, mensagem, hora, direcao, foto, enviar) {
385385
if($("#chat_"+id_destino).length > 0) { // Janela ja esta aberta
@@ -454,7 +454,7 @@ var Mensagem_Chat = function(id, id_destino, nome_usuario, mensagem, hora, direc
454454
Cria_Chat(id_destino);
455455
Mensagem_Chat(id, id_destino, nome_usuario, mensagem, hora, direcao, foto, enviar);
456456
}
457-
}
457+
};
458458

459459
var Toggle_Lista_Amigos = function() {
460460
if ($("#chatAmigos").is(":hidden"))
@@ -465,7 +465,7 @@ var Toggle_Lista_Amigos = function() {
465465
Atualizar_Chat();
466466
});
467467
Atualizar_Chat();
468-
}
468+
};
469469

470470
var Change_Chat_Image = function(status) {
471471
if(status == "i")
@@ -482,7 +482,7 @@ var Change_Chat_Image = function(status) {
482482
$("img.status_icone_"+meu_id).each(function() {
483483
$(this).attr("src", CONFIG_URL + "web/images/status_" + status + ".png");
484484
});
485-
}
485+
};
486486

487487
$(document).ready(function(){
488488
$("#chatOpcoesLink > img").click(function() {

0 commit comments

Comments
 (0)