From 1694fe3d1448261ffbbceee3097b8547f5cd63bd Mon Sep 17 00:00:00 2001 From: Felipe Guaycuru Date: Thu, 18 May 2017 20:15:22 -0300 Subject: [PATCH] Mais algumas coisas pequenas funcionando --- ajax/chat_status.php | 11 +++++++++++ ajax/professores.php | 31 +++++++++++++++++++++++++++++++ ajax/status.php | 16 ++++++++++++++++ views/index.php | 21 ++++++++++----------- web/js/gde.chat.js | 2 +- 5 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 ajax/chat_status.php create mode 100644 ajax/professores.php create mode 100644 ajax/status.php diff --git a/ajax/chat_status.php b/ajax/chat_status.php new file mode 100644 index 0000000..d62d01f --- /dev/null +++ b/ajax/chat_status.php @@ -0,0 +1,11 @@ +setChat_Status($_POST['set_chat_status'][0]); + $_Usuario->Save_Json(true); +} diff --git a/ajax/professores.php b/ajax/professores.php new file mode 100644 index 0000000..77be75b --- /dev/null +++ b/ajax/professores.php @@ -0,0 +1,31 @@ + $Professor->getNome(true).' ('.(($Professor->getInstituto(false) === null) ? 'Desconhecido' : $Professor->getInstituto()->getSigla(true).' - '.$Professor->getInstituto()->getNome(true)).')', 'id' => $Professor->getID()); + else + $ret[] = array('nome' => $Professor->getNome(true)); +} + +echo Base::To_JSON(array( + 'ok' => true, + 'total' => $total, + 'resultados' => $ret +)); diff --git a/ajax/status.php b/ajax/status.php new file mode 100644 index 0000000..5df7608 --- /dev/null +++ b/ajax/status.php @@ -0,0 +1,16 @@ +setStatus(null); + $_Usuario->Save_JSON(true); +} elseif($_POST['q'] == 'carregar') { + $Usr = (!empty($_POST['i'])) ? Usuario>>Load($_POST['i']) : $_Usuario; + echo Base::To_JSON(array( + 'status' => $Usr->getStatus(true, true) + )); +} diff --git a/views/index.php b/views/index.php index 078f4df..507212c 100644 --- a/views/index.php +++ b/views/index.php @@ -45,11 +45,11 @@ } }); return false; -} +}; var Toggle_Cardapio = function() { $("#cardapio_conteudo").toggle("slow"); -} +}; var Atualizar_Horario = function(periodo, nivel) { if(!periodo) @@ -61,7 +61,7 @@ if(data) $("#tab_horario").html(data); }); -} +}; var Atualizar_Status = function() { var status = $("#meu_status").val(); @@ -71,8 +71,8 @@ $("#atualizar_status").text('Salvando...'); $("#meu_status").addClass('enviando'); $.post('ajax/ax_acontecimento.php', {tp: 'us', txt: status}, function(data) { - if(data != 0) { - $("#meu_status_atual").load('ajax/ax_status.php', {q: 'carregar'}); + if(data && data.ok) { + $("#meu_status_atual").load('ajax/status.php', {q: 'carregar'}); $("#limpar_status").show(); $("#meu_status").Padrao(); Adicionar_Atualizacao('', data); @@ -82,19 +82,19 @@ $("#atualizar_status").click(Atualizar_Status); }); return false; -} +}; var Limpar_Status = function() { $("#limpar_status").text('Removendo...'); - $.post('ajax/ax_status.php', {q: 'limpar_status'}, function(data) { - if(data != 0) { + $.post('ajax/status.php', {q: 'limpar_status'}, function(data) { + if(data && data.ok) { $("#meu_status_atual").html(''); $("#limpar_status").hide(); } $("#limpar_status").text('Remover'); }); return false; -} +}; var Adicionar_Amigo_Sugestao = function(id) { $.post('ajax/amigo.php', {i: id, tipo: 'a'}, function(data) { @@ -102,7 +102,7 @@ $("#amigo_"+id).hide(); }); return false; -} +}; $(document).ready(function() { $("#atualizacoes_mensagens").attr('checked', getConfig(true)->getAcontecimentos_Mensagens()) ? 'true' : 'false'; ?>); @@ -298,7 +298,6 @@
Cardapio
- diff --git a/web/js/gde.chat.js b/web/js/gde.chat.js index 867b274..42decc4 100644 --- a/web/js/gde.chat.js +++ b/web/js/gde.chat.js @@ -493,7 +493,7 @@ $(document).ready(function(){ $("div.chatStatusSelect > a").click(function() { var status = ($(this).attr("id").split("_"))[2]; $("#chatOpcoesLink > img").attr("src", CONFIG_URL + "web/images/loading.gif"); - $.post(CONFIG_URL + "ajax/ax_chat_status.php", {set_chat_status: status}); + $.post(CONFIG_URL + "ajax/chat_status.php", {set_chat_status: status}); $("#chatStatus").animate({left: 'toggle'}, 1000); Change_Chat_Image(status); return false;