Aggiornato testo CommentoModel;

Guihandeler::generateHeadPublic link registrami crea una piccola
finestra;
articolo da finire backend per inviare commento
This commit is contained in:
Lorenzo Giacomelli
2016-03-07 16:08:40 +01:00
parent 51664e4e79
commit 17f21e8b0d
8 changed files with 162 additions and 9 deletions
+41
View File
@@ -0,0 +1,41 @@
<?php
require_once(dirname(__FILE__)."/load.php");
try {
// if(UserLoginManager::isLogged()){
var_dump($_POST);
$id = PostHandler::get("id");
$titolo = PostHandler::get("titolo");
$commento = PostHandler::get("commento");
if(!is_null($id)){
$articolo = GlobalVariables::get("dao")->getFirst("NotiziaModel",array("id"=>$id,"status"=>NotiziaModel::STATUS_ACCEPTED));
if(!is_null($articolo)){
$news = new stdClass();
$news->notizia = $articolo->id;
$news->user = UserLoginManager::getLogged();
$commento = new CommentoModel($news);
$commento->titolo = $titolo;
$commento->testo = $testo;
$commento->status = CommentoModel::STATUS_PENDING;
GlobalVariables::get("dao")->save($commento);
echo '<div class="commentoSent">Il tuo commento è stato inviato ed è in attesa di apporvazione.</div>';
}
}
// }
else{
echo '<div class="commentoSent redError">Un errore ha impedito l\'invio del commento.</div>';
}
}catch (Exception $exec){
var_dump($exec);
// echo '<div class="commentoSent redError">Un errore ha impedito l\'invio del commento.(Ex)</div>';
$msg = LogModel::fromException($exec);
GlobalVariables::get("dao")->save($msg);
}
?>