forked from guaycuru/gde
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apelidos e colaborações funcionando.
- Loading branch information
Showing
10 changed files
with
139 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace GDE; | ||
|
||
define('JSON', true); | ||
require_once('../common/common.inc.php'); | ||
|
||
$Amigo = UsuarioAmigo::Load($_POST['id']); | ||
if(($Amigo->getID() == null) || ($Amigo->getUsuario()->getID() != $_Usuario->getID())) | ||
Base::Error_JSON('Erro'); | ||
$Amigo->setApelido(trim($_POST['nome'])); | ||
$Amigo->Save_JSON(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace GDE; | ||
|
||
define('JSON', true); | ||
require_once('../common/common.inc.php'); | ||
|
||
if(!isset($_POST['campo']) || !isset($_POST['valor']) || !isset($_POST['id_oferecimento'])) | ||
Base::Error_JSON('Faltando dados.'); | ||
|
||
$campo = trim($_POST['campo']); | ||
if(ColaboracaoOferecimento::Campo_Valido($campo) === false) | ||
Base::Error_JSON('Campo inválido.'); | ||
|
||
$valor = trim($_POST['valor']); | ||
if($campo == 'pagina') { | ||
if(substr($valor, 0, 7) != 'http://' || strpos($valor, 'unicamp.br') == false) | ||
Base::Error_JSON("A página deve começar com 'http://' e deve conter 'unicamp.br'."); | ||
} | ||
|
||
$id_oferecimento = intval($_POST['id_oferecimento']); | ||
if(ColaboracaoOferecimento::Existe_Colaboracao($id_oferecimento, $campo) == true) | ||
Base::Error_JSON('Já existe uma colaboração para este item.'); | ||
|
||
$Oferecimento = Oferecimento::Load($id_oferecimento); | ||
if($Oferecimento->getID() == null) | ||
Base::Error_JSON('Oferecimento não encontrado.'); | ||
|
||
$Colaboracao = new ColaboracaoOferecimento(); | ||
$Colaboracao->setOferecimento($Oferecimento); | ||
$Colaboracao->setUsuario($_Usuario); | ||
$Colaboracao->setCampo($campo); | ||
$Colaboracao->setValor($valor); | ||
$Colaboracao->setStatus(ColaboracaoOferecimento::STATUS_PENDENTE); | ||
$Colaboracao->setData(); | ||
$Colaboracao->Save_JSON(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace GDE; | ||
|
||
define('JSON', true); | ||
require_once('../common/common.inc.php'); | ||
|
||
if(!isset($_POST['campo']) || !isset($_POST['valor']) || !isset($_POST['id_professor'])) | ||
Base::Error_JSON('Faltando dados.'); | ||
|
||
$campo = trim($_POST['campo']); | ||
if(ColaboracaoProfessor::Campo_Valido($campo) === false) | ||
Base::Error_JSON('Campo inválido.'); | ||
|
||
if($campo == 'instituto') | ||
$valor = intval($_POST['valor']); | ||
else { | ||
$valor = trim($_POST['valor']); | ||
if($campo == 'pagina') { | ||
if(substr($valor, 0, 7) != 'http://' || strpos($valor, 'unicamp.br') == false) | ||
Base::Error_JSON("A página deve começar com 'http://' e deve conter 'unicamp.br'."); | ||
} | ||
else if($campo == 'email') { | ||
if(strpos($valor, 'unicamp.br') == false || preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i', $valor) == 0) | ||
Base::Error_JSON("O e-mail deve conter 'unicamp.br'."); | ||
} | ||
else if($campo == 'lattes') { | ||
if(substr($valor, 0, 55) != 'http://buscatextual.cnpq.br/buscatextual/visualizacv.do' && substr($valor, 0, 22) != 'http://lattes.cnpq.br/') | ||
Base::Error_JSON("O link para o curriculo Lattes deve começar com 'http://buscatextual.cnpq.br/buscatextual/visualizacv.do' ou 'http://lattes.cnpq.br/'."); | ||
} | ||
} | ||
|
||
$id_professor = intval($_POST['id_professor']); | ||
if(ColaboracaoProfessor::Existe_Colaboracao($id_professor, $campo) == true) | ||
Base::Error_JSON('Já existe uma colaboração para este item.'); | ||
|
||
$Professor = Professor::Load($id_professor); | ||
if($Professor->getID() == null) | ||
Base::Error_JSON('Professor não encontrado.'); | ||
|
||
$Colaboracao = new ColaboracaoProfessor(); | ||
$Colaboracao->setProfessor($Professor); | ||
$Colaboracao->setUsuario($_Usuario); | ||
$Colaboracao->setCampo($campo); | ||
$Colaboracao->setValor($valor); | ||
$Colaboracao->setStatus(ColaboracaoProfessor::STATUS_PENDENTE); | ||
$Colaboracao->setData(); | ||
$Colaboracao->Save_JSON(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters