84 lines
2.9 KiB
PHP
84 lines
2.9 KiB
PHP
<?php
|
|
|
|
|
|
require_once(dirname(__FILE__)."/../load.php");
|
|
|
|
GUIHandler::generateHtmlHeaders(array(),true);
|
|
|
|
if (!AdminLoginManager::isLogged()){
|
|
GUIHandler::redirect("admin/login.php");
|
|
}
|
|
else if (!AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR)){
|
|
GUIHandler::redirect("admin/index.php");
|
|
}
|
|
|
|
try{
|
|
$error = "";
|
|
$notiziaId = PostHandler::get("id");
|
|
|
|
if(!is_null($notiziaId) && strcmp($notiziaId, "")!=0){
|
|
// $std = new stdClass();
|
|
|
|
// $std->user = "569ce4f71991f75342f29e5f";
|
|
// $std->notizia = $notiziaId;
|
|
// $std->titolo = "Commento nuovo";
|
|
// $std->testo = "Nuono commento dove prima non ve ne erano, orsù tutti a commentareeeeeeeeeeeeeeeeeeee!!!!!!!!!!!!!!!!!!!!!!!!1";
|
|
// $std->status = "accettato";
|
|
// $comm = new CommentoModel($std);
|
|
// GlobalVariables::get("dao")->save($comm);
|
|
|
|
|
|
$commenti = GlobalVariables::get("dao")->query("CommentoModel",
|
|
array("notizia"=>$notiziaId,"status"=>CommentoModel::STATUS_ACCEPTED),
|
|
array("sort"=>array("date"=>-1))
|
|
);
|
|
|
|
}
|
|
|
|
}catch(GUIException $ex){
|
|
$error = $ex->getMessage();
|
|
}catch (Exception $exec){
|
|
$msg = LogModel::fromException($exec);
|
|
GlobalVariables::get("dao")->save($msg);
|
|
$error = "Si è verificato un errore inatteso durante l'esecuzione della pagina. Contattare il supporto tecnico comunicando il seguente codice di erore '".$msg->getCode()."'";
|
|
|
|
// LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_ERROR, $exec->getMessage());
|
|
// $error = "Si è verificato un errore inaspettato durante l'esecuzione della pagina. Se l'errore persiste contattare il supporto tecnico.";
|
|
}
|
|
|
|
MenuGenerator::generateMenu();
|
|
HTMLHelper::generateAdminHead();
|
|
?>
|
|
|
|
<div>
|
|
<div style="position:relative;">
|
|
<div class="notiziaContainer">
|
|
<?php if(sizeof($commenti)>0){
|
|
foreach($commenti as $commento){
|
|
$user = GlobalVariables::get("dao")->getFirst("UserModel",array("id"=>$commento->user));?>
|
|
<div class="commentoContainer">
|
|
<div style="width:60%; display:inline-block;margin:5px;"><b>Utente:</b><?php echo $user->nome." ".$user->cognome;?></div>
|
|
<div style="width:30%;display:inline-block;text-align:right;margin:5px;"><b>Data:</b><?php echo date("d-m-Y H:i",$commento->date->toDateTime()->getTimestamp());?></div>
|
|
<div style="margin:5px;"><b>Titolo:</b><?php echo $commento->titolo;?></div>
|
|
<div style="margin:5px;"><b>Commento:</b><?php echo $commento->testo;?></div>
|
|
</div>
|
|
<?php }?>
|
|
|
|
<?php }else{ ?>
|
|
<?php echo "Non sono presenti commenti per questa notizia o non sono ancora stati accettati."?>
|
|
<?php } ?>
|
|
</div>
|
|
<div class="notiziaMenu" style="top:0;">
|
|
<ul>
|
|
<li><a href="#" id="commentiMenu_back">Back</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script type="text/javascript">
|
|
$("#commentiMenu_back").click(function (){
|
|
openPagePost("homeNotizie.php", [{name:"id",value:"<?php echo $notiziaId;?>"}]);
|
|
});
|
|
</script>
|