Skip to content

Commit

Permalink
Diversas correções
Browse files Browse the repository at this point in the history
  • Loading branch information
guaycuru committed Jun 1, 2017
1 parent 58cf769 commit 3579fca
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 51 deletions.
2 changes: 1 addition & 1 deletion ajax/acontecimentos.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
</div>
<div class="atualizacao_texto_data">
<div class="atualizacao_texto">
<?php if(($home) && ($Acontece->getOrigem() !== null)/* Nao preciso pq na home nao aparece quem nao eh meu amigo && ($Usr->Amigo($Acontece->getUsuario_Origem()))*/) echo $Acontece->getOrigem()->getChat_Status(true); ?><a href="<?= $Acontece->getLink(); ?>" title="<?= $Acontece->getNome(true); ?>"><span class="atualizacao_nome"><?= $Acontece->getNome(); ?></span></a><?= $Acontece->getTexto(true, true, $meu, $_Usuario); ?>
<?php if(($home) && ($Acontece->getOrigem() !== null)/* Nao preciso pq na home nao aparece quem nao eh meu amigo && ($Usr->Amigo($Acontece->getUsuario_Origem()))*/) echo $Acontece->getOrigem()->getChat_Status(true); ?><a href="<?= $Acontece->getLink(); ?>" title="<?= $Acontece->getNome(true); ?>"><span class="atualizacao_nome"><?= $Acontece->getNome(); ?></span></a><?= $Acontece->getTexto(true, true, $meu, $Usr); ?>
</div>
<div class="atualizacao_data_link">
<span class="atualizacao_data"><?= $Acontece->getData('d/m/Y H:i:s'); ?></span><br />
Expand Down
4 changes: 1 addition & 3 deletions ajax/planejador.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

namespace GDE;

define('NO_HTML', true);
define('JSON', true);

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

header('Content-type: application/json');

function Sort_Nomes($A, $B) {
return strcasecmp($A->getApelido(), $B->getApelido());
}
Expand Down
30 changes: 15 additions & 15 deletions classes/GDE/Acontecimento.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,26 +78,26 @@ class Acontecimento extends Base {
const TIPO_RA = 'ra';
const TIPO_RM = 'rm';
const TIPO_RS = 'rs';
const TIPO_UA = 'ua';
const TIPO_UM = 'um';
const TIPO_US = 'us';
const TIPO_USUARIO_AMIZADE = 'ua';
const TIPO_USUARIO_MENSAGEM = 'um';
const TIPO_USUARIO_STATUS = 'us';

public function getTexto($html = false, $processa = false, $meu = false, Usuario $Usuario = null) {
global $_Usuario;
if(!$html)
return $this->texto;
// Amizade
if($this->getTipo(false) == 'ua')
if($this->getTipo(false) == self::TIPO_USUARIO_AMIZADE)
return (!$meu)
? " agora &eacute; amig".$this->getOrigem()->getSexo(true, true)." de ".$_Usuario->Apelido_Ou_Nome($this->getDestino(), false, true)."."
: " agora &eacute; ".(($this->getOrigem()->getSexo() == 'f')?'sua amiga':'seu amigo').".";
// Mensagem, Status de Usuario
elseif(($this->getTipo(false) == 'um') || ($this->getTipo(false) == 'us') || ($this->getTipo(false) == 'rs')) {
if($this->getTipo(false) == 'us')
elseif(($this->getTipo(false) == self::TIPO_USUARIO_MENSAGEM) || ($this->getTipo(false) == self::TIPO_USUARIO_STATUS) || ($this->getTipo(false) == 'rs')) {
if($this->getTipo(false) == self::TIPO_USUARIO_STATUS)
$texto_pre = "<span class=\"atualizacao_tipo\"> (status)</span>";
elseif($this->getTipo(false) == 'rs')
$texto_pre = "<span class=\"atualizacao_tipo\"> (an&uacute;ncio)</span>";
elseif(($this->getOriginal() !== null) && ($this->getDestino() !== null) && ($this->getDestino()->getID() != $Usuario->getID())) // Tinha um ($meu) && ali, mas acho q nao faz sentido
elseif(($this->getOriginal() === null) && ($this->getDestino() !== null) && ($this->getDestino()->getID() != $Usuario->getID())) // Tinha um ($meu) && ali, mas acho q nao faz sentido
$texto_pre = " -> ".$_Usuario->Apelido_Ou_Nome($this->getDestino(), false, true);
else
$texto_pre = "";
Expand Down Expand Up @@ -149,10 +149,10 @@ public function Pode_Responder(Usuario $Usuario) {
if($this->getTipo(false) == self::TIPO_GDE)
return true;
// Status de Usuario
if($this->getTipo(false) == 'us')
if($this->getTipo(false) == self::TIPO_USUARIO_STATUS)
return true;
// Mensagens pra mim ou minhas
if(($this->getTipo(false) == 'um') && (($this->getOrigem()->getID() == $Usuario->getID()) || ($this->getDestino()->getID() == $Usuario->getID())))
if(($this->getTipo(false) == self::TIPO_USUARIO_MENSAGEM) && (($this->getOrigem()->getID() == $Usuario->getID()) || ($this->getDestino()->getID() == $Usuario->getID())))
return true;
return false;
}
Expand Down Expand Up @@ -244,26 +244,26 @@ public static function Listar(Usuario $Usuario = null, $limit = '-1', $start = '
return array();
// Mensagens para mim
if($mensagens)
$qrs[] = "(O.tipo = 'um')";
$qrs[] = "(O.tipo = '".self::TIPO_USUARIO_MENSAGEM."')";
// Minhas Atualizacoes
if($minhas)
$qrs[] = "(O.tipo = 'us' AND O.id_origem = :id_usuario)";
$qrs[] = "(O.tipo = '".self::TIPO_USUARIO_STATUS."' AND O.id_origem = :id_usuario)";
// Atualizacoes dos meus amigos
if($amigos) {
/*ESTE EH (BEM) MAIS LENTO $jns[] = "LEFT JOIN ".Usuario::$tabela_r_amigos." AS UA ON (UA.amigo = A.id_origem)";
$qrs[] = "(A.tipo = 'us' AND UA.".Usuario::$chave." = '".$Usuario->getID()."' AND UA.ativo = 't')";*/
$qrs[] = "(A.tipo = '".self::TIPO_USUARIO_STATUS."' AND UA.".Usuario::$chave." = '".$Usuario->getID()."' AND UA.ativo = 't')";*/
$UsuarioAmigoMetaData = self::_EM()->getClassMetadata('GDE\\UsuarioAmigo');
$qrs[] = "(O.tipo = 'us' AND O.id_origem IN (SELECT id_amigo FROM " . $UsuarioAmigoMetaData->getTableName() . " WHERE id_usuario = :id_usuario AND ativo = TRUE))";
$qrs[] = "(O.tipo = ".self::TIPO_USUARIO_STATUS."' AND O.id_origem IN (SELECT id_amigo FROM " . $UsuarioAmigoMetaData->getTableName() . " WHERE id_usuario = :id_usuario AND ativo = TRUE))";
}
if($amizades)
$qrs[] = "(O.tipo = 'ua')";
$qrs[] = "(O.tipo = '".self::TIPO_USUARIO_AMIZADE."')";
// Atualizacoes do GDE
if($gde)
$qrs[] = "(O.tipo = '".self::TIPO_GDE."')";
$qrs = implode(" OR ", $qrs);
//if(!$todas_respostas)
// Pego todas as respostas que sejam para o usuario ou que nao tenham sido enviadas pelo proprio usuario (qd eh US e id_destino eh NULL, eh broadcast...)
$qrsr[] = "(R.id_destino = :id_usuario OR (O.tipo = 'us' AND R.id_origem != :id_usuario AND R.id_destino IS NULL))";
$qrsr[] = "(R.id_destino = :id_usuario OR (O.tipo = '".self::TIPO_USUARIO_STATUS."' AND R.id_origem != :id_usuario AND R.id_destino IS NULL))";
$AcontecimentoMetaData = self::_EM()->getClassMetadata('GDE\Acontecimento');
if($maior_que)
$qrsr[] = "(R.id_acontecimento > :maior_que)";
Expand Down
9 changes: 4 additions & 5 deletions classes/GDE/Arvore.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function __construct(Usuario $Usuario, $completa = true, $periodo = null,
$Old_Eliminadas = $this->Eliminadas;
foreach($this->Atuais as $Mtr) {
if($this->Usuario->Eliminada($Mtr->getDisciplina(), false) === false) { // Se ja nao foi eliminada completamente
$El = new Usuario_Eliminada();
$El = new UsuarioEliminada();
$El->setUsuario($Usuario);
$El->setDisciplina($Mtr->getDisciplina());
$El->setPeriodo($this->Periodo);
Expand Down Expand Up @@ -161,7 +161,7 @@ public function __construct(Usuario $Usuario, $completa = true, $periodo = null,
} else { // Disciplina Obrigatoria
$this->Disciplinas[$For_Curriculo->getSemestre()][] = $For_Curriculo->getDisciplina();
$this->siglas_obrigatorias[] = $For_Curriculo->getSigla();
$this->creditos_totais += $For_Curriculo->getDisciplina()->getCreditos();
$this->creditos_totais += intval($For_Curriculo->getDisciplina()->getCreditos());
}
}
$this->numero_semestres = $maior_semestre;
Expand Down Expand Up @@ -416,7 +416,6 @@ public static function LinhaEntreDois($image, $consts, $dados, $x1, $y1, $x2, $y
$altura_l2 = $pr_y - $altura_l1;
self::imagelinethick($image, $at_x, $at_y, $at_x, $altura_l2, $cor, 2); // Desce

$at_x = $at_x;
$at_y = $altura_l2;
}
self::imagelinethick($image, $at_x, $at_y, $largura_s1, $at_y, $cor, 2); // Vai ate a seta
Expand Down Expand Up @@ -792,10 +791,10 @@ public function Historico() {
$eliminadas = array();
//$ret = " HISTORICO ATUAL:\r\n";
$ret = " <strong>Disciplinas j&aacute; cursadas:</strong>\r\n";
foreach($this->Eliminadas as $sigla => $Eliminada) {
foreach($this->Eliminadas as $Eliminada) {
$sigla = $Eliminada->getDisciplina(true)->getSigla(true);
if(($sigla == 'AA200') || ($Eliminada->getParcial() === true)) // Pula as eliminadas parcialmente
continue;
$sigla = $Eliminada->getDisciplina(true)->getSigla(true);
$eliminadas[] = $sigla;
if(substr($sigla, 0, 2) == 'AA')
continue;
Expand Down
4 changes: 3 additions & 1 deletion views/amigos.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php

namespace GDE;

define('TITULO', 'Amigos');

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

$Quase_Amigos = $_Usuario->getQuase_Amigos();
$Autorizacoes = $_Usuario->getAmigos_Pendentes();
$Amigos = $_Usuario->Amigos();
$Amigos = UsuarioAmigo::Ordenar_Por_Nome($_Usuario->Amigos());

?>
<script type="text/javascript">
Expand Down
8 changes: 5 additions & 3 deletions views/arvore.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ function TrazDoCache($params) {
$completa = ((isset($_GET['cp'])) && ($_GET['cp'] == 1));
$meu = true;
} else {
$Usr = Usuario::Load($_GET['us']);
$Usr = Usuario::Por_Login($_GET['us']);
if($Usr->getID() == null)
die("<h2>Usu&aacute;rio n&atilde;o encontrado.</h2>");
if($_Usuario->Posso_Ver($Usr, $Usr->getCompartilha_Arvore()) === false)
die("<h2>Parab&eacute;ns, voc&ecirc; descobriu o segredo para ver a &Aacute;rvore de quem n&atilde;o quer compartilh&aacute;-la...</h2><h1>NOT!!!!!</h1>");
die("<h2>Vo&ccedil;&ecirc; n&atilde;o tem permiss&atilde;o para ver esta &aacute;rvore!</h2>");
$curso = $Usr->getCurso(true)->getNumero(true);
$modalidade = $Usr->getModalidade(true)->getSigla(true);
$catalogo = $Usr->getCatalogo(true);
Expand All @@ -91,7 +93,7 @@ function TrazDoCache($params) {
$construct = microtime(true) - $start;
echo "Construct: ".$construct."<br />";
}
$_SESSION['Arvore_Curriculo']['Imagem_Tmp'] = '../cache/arvores/arvore_'.Util::Code(8).'.png';
$_SESSION['Arvore_Curriculo']['Imagem_Tmp'] = '../cache/arvores/arvore_'.Util::Code(16).'.png';
$Arvore->Desenha($_SESSION['Arvore_Curriculo']['Imagem_Tmp']);
if((isset($_SESSION['admin']['debug'])) && ($_SESSION['admin']['debug'] >= 1))
echo "Desenha: ".(microtime(true) - $start - $construct)."<br />";
Expand Down
2 changes: 1 addition & 1 deletion views/avaliar.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
if(count($Oferecimentos) == 0)
continue;
?>
<h3 style="padding: 5px"><?= $Periodo->getNome(true); ?></h3>
<h3 style="padding: 5px"><?= $Periodo->getNome(false); ?></h3>
<div><table class="ui-corner-bottom" style="width: 100%; border: 1px solid #A6C9E2" >
<?php
foreach($Oferecimentos as $Oferecimento) {
Expand Down
2 changes: 1 addition & 1 deletion views/eliminador.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
if(count($Oferecimentos) == 0)
continue;
?>
<h3 style="padding: 5px"><?= $Periodo->getNome(true) ?></h3>
<h3 style="padding: 5px"><?= $Periodo->getNome(false) ?></h3>
<div><table class="tabela_bonyta_branca tabela_busca" width="100%" >
<?php
foreach($Oferecimentos as $Oferecimento) {
Expand Down
36 changes: 18 additions & 18 deletions web/js/gde.planejador.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var InicializarPlanejador = function(id) {
PlanejadorProcessarExtras(data.Extras);
esconder_aguarde();
});
}
};
var PlanejadorProcessarPlanejado = function(Planejado) {
periodo = Planejado.periodo;
periodo_nome = Planejado.periodo_nome;
Expand All @@ -82,7 +82,7 @@ var PlanejadorProcessarPlanejado = function(Planejado) {
}
});
});
}
};
var PlanejadorAdicionarDisciplina = function(Disciplina) {
if($("#psd_d"+Disciplina.semestre).length == 0) { // Ainda nao tem este semestre
$("#planejador_disciplinas").append(' <div class="planejador_semestre">'+
Expand All @@ -109,10 +109,10 @@ var PlanejadorAdicionarDisciplina = function(Disciplina) {
query: "#menu_"+Disciplina.siglan
});
}
}
};
var PlanejadorPodeQuinzenais = function(OA, OB) {
return ((OA.Disciplina.quinzenal === true) && (OB.Disciplina.quinzenal === true));
}
};
var PlanejadorLiBinds = {
mouseenter: function() {
if($(this).data('emcima')) // Previne que aconteca multiplas vezes
Expand Down Expand Up @@ -153,15 +153,15 @@ var PlanejadorLiBinds = {
PlanejadorAdicionarOferecimento(Oferecimento, false, true);
$(document).click(); // Fecho o menu
}
}
};
var PlanejadorProcessarConflitos = function(O, P) {
// Este ja foi adicionado ou marcado ou eh da mesma disciplina ou eh quinzenal
if((P.adicionado) || (!P.possivel) || (P.siglan == O.siglan) || (PlanejadorPodeQuinzenais(O, P)))
return true;
P.possivel = false;
P.eventSources.textColor = '#FFFFFF'; // E mudo a cor para preto
P.eventSources.backgroundColor = '#000000'; // E mudo a cor do texto para branco
}
};
var PlanejadorProcessarOferecimentos = function(Oferecimentos, atualizar_conflitos) {
var a = 0;
var Adicionar = [];
Expand Down Expand Up @@ -224,7 +224,7 @@ var PlanejadorProcessarOferecimentos = function(Oferecimentos, atualizar_conflit
$.each(Adicionar, function(i, O) {
PlanejadorAdicionarOferecimento(O, true, false);
});
}
};
var PlanejadorAdicionarOferecimento = function(Oferecimento, sources, salvar) {
if(salvar) {
var tmp = $("#planejador_matriculas").CarregandoL();
Expand Down Expand Up @@ -264,7 +264,7 @@ var PlanejadorAdicionarOferecimento = function(Oferecimento, sources, salvar) {
} else
$("#li_oferecimento_"+Oferecimento.id).triggerHandler(e);
});
}
};
var PlanejadorRemoverOferecimento = function(Oferecimento, sources, salvar, automatico) {
if(salvar) {
var tmp = $("#planejador_matriculas").CarregandoL();
Expand Down Expand Up @@ -303,7 +303,7 @@ var PlanejadorRemoverOferecimento = function(Oferecimento, sources, salvar, auto
Oferecimento.possivel = true;
Oferecimento.eventSources.textColor = '#000000';
Oferecimento.eventSources.backgroundColor = Oferecimento.Disciplina.cor;
}
};
var PlanejadorProcessarArvore = function(Arvore) {
$("#planejador_cp").html(Arvore.cp);
$("#planejador_cpf").html(Arvore.cpf);
Expand All @@ -313,7 +313,7 @@ var PlanejadorProcessarArvore = function(Arvore) {
});
if((Arvore.cp == '1,0000') && ($("#span_cp1").length == 0))
$("#planejador_disciplinas").prepend('<span id="span_cp1"><strong>N&atilde;o falta nenhuma Disciplina para voc&ecirc; cursar...</strong><br />Infelizmente o GDE (ainda) n&atilde;o tem suporte<br />a planejamento do <i>futuro fora da Unicamp</i>...<br />Boa sorte! :)<br /><br /><span>');
}
};
var PlanejadorProcessarExtras = function(Lista) {
$.each(Lista, function(i, E) {
var x = -1;
Expand All @@ -327,14 +327,14 @@ var PlanejadorProcessarExtras = function(Lista) {
x = PlanejadorCriarNovoExtra(E.title);
PlanejadorAdicionarExtra(E, x);
});
}
};
var PlanejadorAdicionarExtraPopUp = function(dia, hr1, hr2) {
$("#extra_dia_da_semana").val(dia);
$("#extra_horario1").val(hr1+':00');
$("#extra_horario2").val(hr2+':00');
$("#link_novo_extra").click();
return false;
}
};
var PlanejadorAdicionarExtraPopUpFechar = function(botao) {
if(botao == 'salvar') {
if(($("#extra_lista_nomes").val() == '-1') && ($("#extra_novo_nome").val().length < 2)) {
Expand Down Expand Up @@ -362,7 +362,7 @@ var PlanejadorAdicionarExtraPopUpFechar = function(botao) {
$("#extra_horario1").val('');
$("#extra_horario2").val('');
$.fancybox.close();
}
};
var PlanejadorCriarNovoExtra = function(nome) {
var e = Extras.length;
if(ce >= nce)
Expand All @@ -376,13 +376,13 @@ var PlanejadorCriarNovoExtra = function(nome) {
$("#extra_lista_nomes").val(e);
$("#extra_novo_nome").hide();
return e;
}
};
var PlanejadorAdicionarExtra = function(event, e) {
calendario.fullCalendar('renderEvent', event);
}
};
var PlanejadorRemoverExtra = function(event) {
calendario.fullCalendar('removeEvents', event.id);
}
};
var PlanejadorAdicionarEletiva = function(sigla, after) {
if(sigla == undefined)
return;
Expand Down Expand Up @@ -443,7 +443,7 @@ var PlanejadorBindMostrarInfo = function(elemento, Oferecimento) {
DivTip.data('id_timeout', id_timeout);
}
});
}
};
$(document).ready(function() {
calendario = $('#planejador_calendario').fullCalendar({
header: {
Expand Down Expand Up @@ -598,7 +598,7 @@ $(document).ready(function() {
});
$.post(CONFIG_URL + 'ajax/planejador.php', {a: 'f', id: id_planejado, 'conf[]': config, 'parciais[]': parciais}, function(data) {
window.location.reload();
})
});
return false;
});
$("#compartilhado_t, #compartilhado_f").click(function() {
Expand Down
4 changes: 2 additions & 2 deletions web/js/jquery.blockui.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ $.blockUI.version = 2.28; // 2nd generation blocking at no extra cost!
// override these in your code to change the default behavior and style
$.blockUI.defaults = {
// message displayed when blocking (use null for no message)
message: '<h1 style="text-align: center;"><img src="../web/images/loading.gif" /> Aguarde...</h1>',
message: '<h1 style="text-align: center;"><img src="' + CONFIG_URL + 'web/images/loading.gif" /> Aguarde...</h1>',

title: null, // title string; only used when theme == true
draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
Expand Down Expand Up @@ -460,4 +460,4 @@ function sz(el, p) {
return parseInt($.css(el,p))||0;
};

})(jQuery);
})(jQuery);
2 changes: 1 addition & 1 deletion web/js/jquery.guaycuru.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jQuery.guaycuru = {

aguarde: function() {

return jQuery.popup.show("", '<h1 style="text-align: center;"><img src=' + CONFIG_URL + 'web/images/loading.gif" /> Aguarde...</h1>', {returnHide: true});
return jQuery.popup.show("", '<h1 style="text-align: center;"><img src="' + CONFIG_URL + 'web/images/loading.gif" /> Aguarde...</h1>', {returnHide: true});

},

Expand Down

0 comments on commit 3579fca

Please sign in to comment.