Commit intermedio per fix notizia home
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 01/mar/2016
|
||||
*/
|
||||
|
||||
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_BANNER_SUPERVISOR)){
|
||||
GUIHandler::redirect("admin/listBanner.php");
|
||||
}
|
||||
|
||||
MenuGenerator::generateMenu();
|
||||
HTMLHelper::generateAdminHead();
|
||||
|
||||
try{
|
||||
$error = "";
|
||||
$bannerId = PostHandler::get("id");
|
||||
if (is_null($bannerId) || strcmp("",$bannerId)==0){
|
||||
GUIHandler::redirect("admin/listBanner.php");
|
||||
}
|
||||
|
||||
$banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$bannerId));
|
||||
|
||||
if (is_null($banner)){
|
||||
GUIHandler::redirect("admin/listBanner.php");
|
||||
}
|
||||
|
||||
$media = DaoMediaHandler::getMainMediaFromModel($banner);
|
||||
|
||||
if (is_null($media)){
|
||||
throw new Exception("Impossibile mostrare il banner in quanto associato ad un media non valido. (Banner: '".$bannerId."')");
|
||||
}
|
||||
|
||||
$bannerTypeString = "Sconosciuto";
|
||||
if(array_key_exists($banner->type, MediaModel::$MEDIA_TYPES)){
|
||||
$bannerTypeString = MediaModel::$MEDIA_TYPES[$banner->type]["label"];
|
||||
}
|
||||
else {
|
||||
throw new Exception("Impossibile mostrare il tipo banner in quanto non presente nella lista dei tipi MediaModel::\$MEDIA_TYPES. (Banner: '".$bannerId."', BannerType: {$banner->type})");
|
||||
}
|
||||
|
||||
}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()."'";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
if(strcmp($error, "")!=0){
|
||||
echo '<div style="font-size: 16px; color:red;">'.$error.'</div>';
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<div><span class="label">Cliente</span><?php echo $banner->customer;?></div>
|
||||
<div><span class="label">Data Inizio</span><?php echo date("d-m-Y H:i",$banner->start->sec);?></div>
|
||||
<div><span class="label">Data Fine</span><?php echo date("d-m-Y H:i",$banner->end->sec);?></div>
|
||||
<div><span class="label">Tipo</span><?php echo $bannerTypeString;?></div>
|
||||
</div>
|
||||
<div>
|
||||
<?php $media->renderMedia(); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user