Skip to content

Commit

Permalink
Mais algumas coisas pequenas funcionando
Browse files Browse the repository at this point in the history
  • Loading branch information
guaycuru committed May 18, 2017
1 parent ced92cd commit 1694fe3
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 12 deletions.
11 changes: 11 additions & 0 deletions ajax/chat_status.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace GDE;

define('JSON', true);
require_once('../common/common.inc.php');

if(isset($_POST['set_chat_status'])) {
$_Usuario->setChat_Status($_POST['set_chat_status'][0]);
$_Usuario->Save_Json(true);
}
31 changes: 31 additions & 0 deletions ajax/professores.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace GDE;

define('JSON', true);

if(isset($_POST['token'])) {
if(DAC::Validar_Token($_POST['token']) === false)
die('ERRO');
define('NO_LOGIN_CHECK', true);
}

require_once('../common/common.inc.php');

$total = 0;
$ret = array();

$Professores = Professor::Consultar_Simples($_POST['q'], null, $total);

foreach($Professores as $Professor) {
if(isset($_POST['i']))
$ret[] = array('nome' => $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
));
16 changes: 16 additions & 0 deletions ajax/status.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace GDE;

define('JSON', true);
require_once('../common/common.inc.php');

if($_POST['q'] == 'limpar_status') {
$_Usuario->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)
));
}
21 changes: 10 additions & 11 deletions views/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
}
});
return false;
}
};

var Toggle_Cardapio = function() {
$("#cardapio_conteudo").toggle("slow");
}
};

var Atualizar_Horario = function(periodo, nivel) {
if(!periodo)
Expand All @@ -61,7 +61,7 @@
if(data)
$("#tab_horario").html(data);
});
}
};

var Atualizar_Status = function() {
var status = $("#meu_status").val();
Expand All @@ -71,8 +71,8 @@
$("#atualizar_status").text('Salvando...');
$("#meu_status").addClass('enviando');
$.post('<?= CONFIG_URL; ?>ajax/ax_acontecimento.php', {tp: 'us', txt: status}, function(data) {
if(data != 0) {
$("#meu_status_atual").load('<?= CONFIG_URL; ?>ajax/ax_status.php', {q: 'carregar'});
if(data && data.ok) {
$("#meu_status_atual").load('<?= CONFIG_URL; ?>ajax/status.php', {q: 'carregar'});
$("#limpar_status").show();
$("#meu_status").Padrao();
Adicionar_Atualizacao('', data);
Expand All @@ -82,27 +82,27 @@
$("#atualizar_status").click(Atualizar_Status);
});
return false;
}
};

var Limpar_Status = function() {
$("#limpar_status").text('Removendo...');
$.post('<?= CONFIG_URL; ?>ajax/ax_status.php', {q: 'limpar_status'}, function(data) {
if(data != 0) {
$.post('<?= CONFIG_URL; ?>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('<?= CONFIG_URL; ?>ajax/amigo.php', {i: id, tipo: 'a'}, function(data) {
$.guaycuru.confirmacao("Foi enviado um pedido de autoriza&ccedil;&atilde;o!", null);
$("#amigo_"+id).hide();
});
return false;
}
};

$(document).ready(function() {
$("#atualizacoes_mensagens").attr('checked', <?= ($_Usuario->getConfig(true)->getAcontecimentos_Mensagens()) ? 'true' : 'false'; ?>);
Expand Down Expand Up @@ -298,7 +298,6 @@
<div id="cardapio_botao"><img src="<?= CONFIG_URL; ?>web/images/cardapio_icone.gif" alt="Cardapio" /></div>
</div>
<div id="cardapio_conteudo" style="width: 260px; float: left; margin-left: 10px"></div>
<!--<div id="previsao_tempo" style="float: left; margin-left: 20px"></div> -->
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion web/js/gde.chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1694fe3

Please sign in to comment.