Commit intermedio per fix notizia home
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
Nel Menu:
|
||||
Home
|
||||
Politica
|
||||
Cronaca
|
||||
Sport
|
||||
Cultura e Spettacolo
|
||||
|
||||
Tutte le categorie:
|
||||
Ristoranti
|
||||
Viaggi
|
||||
Mondo animale
|
||||
Gossip
|
||||
|
||||
Categorie Nascoste:
|
||||
Antichi mestieri
|
||||
Casa
|
||||
Salute
|
||||
Annunci
|
||||
@@ -10,6 +10,13 @@ class BannerModel extends HasMediaModel{
|
||||
self::TYPE_HTML=>array("label"=>"Html")
|
||||
);
|
||||
|
||||
public function __set($attr,$value){
|
||||
if (strcmp("type", $attr)==0){
|
||||
$value = intval($value);
|
||||
}
|
||||
return parent::__set($attr, $value);
|
||||
}
|
||||
|
||||
public static function getCollectionName(){
|
||||
return "banner";
|
||||
}
|
||||
|
||||
+17
-173
@@ -1,4 +1,9 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 02/mar/2016
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__)."/../load.php");
|
||||
|
||||
GUIHandler::generateHtmlHeaders(array(),true);
|
||||
@@ -7,193 +12,32 @@ if (!AdminLoginManager::isLogged()){
|
||||
GUIHandler::redirect("admin/login.php");
|
||||
}
|
||||
else if (!AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_BANNER_SUPERVISOR)){
|
||||
GUIHandler::redirect("admin/index.php");
|
||||
GUIHandler::redirect("admin/listBanner.php");
|
||||
}
|
||||
|
||||
MenuGenerator::generateMenu();
|
||||
|
||||
HTMLHelper::generateAdminHead();
|
||||
|
||||
$bannerId = PostHandler::get("id");
|
||||
|
||||
try{
|
||||
$error="";
|
||||
$edit=false;
|
||||
$error = "";
|
||||
$bannerId = PostHandler::get("id");
|
||||
|
||||
$banner = new BannerModel();
|
||||
$newMedia = null;
|
||||
$mediaTypeSaved = PostHandler::get("mediaType");
|
||||
|
||||
if(!is_null($bannerId) && strcmp($bannerId, "")!=0){
|
||||
$edit = true;
|
||||
if (!is_null($bannerId) && strcmp("",$bannerId)!=0){
|
||||
$banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$bannerId));
|
||||
$newMedias = DaoMediaHandler::getMedias($banner);
|
||||
if(sizeof($newMedias)>0){
|
||||
$newMedia = reset($newMedias);
|
||||
}
|
||||
if($banner->hasProperty("type") && !is_null($banner->type)){
|
||||
$mediaTypeSaved = $banner->type;
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("action", $_POST) && strcmp(PostHandler::get("action"), "save")==0){
|
||||
if(is_null($bannerId) || strcmp($bannerId, "")==0){
|
||||
$banner->customer = PostHandler::get("customer");
|
||||
$banner->type = PostHandler::get("mediaType");
|
||||
$banner->start = new Mongodate(strtotime(PostHandler::get("dateStart")));
|
||||
$banner->end = new Mongodate(strtotime(PostHandler::get("dateEnd")));
|
||||
GlobalVariables::get("dao")->save($banner);
|
||||
$bannerId = $banner->id;
|
||||
}
|
||||
|
||||
if(!is_null($bannerId) && strcmp($bannerId, "")!=0){
|
||||
$edit=true;
|
||||
// $banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$bannerId));
|
||||
$file = "";
|
||||
|
||||
$mediaType = PostHandler::get("mediaType");
|
||||
$banner->type=$mediaType;
|
||||
if(strcmp($mediaType, "")!=0){
|
||||
$tmp = array();
|
||||
$saveable = new stdClass();
|
||||
$saveable->mediaType = $mediaType;
|
||||
if(strcmp($mediaType,MediaModel::TYPE_HTML5)==0){
|
||||
$saveable->code = PostHandler::get("data");
|
||||
$media = DaoMediaHandler::createNewTextBasedMedia($saveable);
|
||||
}
|
||||
else if(strcmp($mediaType,MediaModel::TYPE_IMAGE)==0){
|
||||
$file = $_FILES['data']['tmp_name'];
|
||||
$info = pathinfo($_FILES['data']['name']);
|
||||
// $file = PostHandler::get("data");
|
||||
$media = DaoMediaHandler::createNewFileBasedMedia($saveable, $file,$info["extension"]);
|
||||
}
|
||||
|
||||
if(!is_null($media)){
|
||||
GlobalVariables::get("dao")->save($media);
|
||||
DaoMediaHandler::addMedia($banner, $media);
|
||||
GlobalVariables::get("dao")->save($banner);
|
||||
}
|
||||
else{
|
||||
throw new Exception("Cannot save a null media in the news with id '".$bannerId."'");
|
||||
}
|
||||
}
|
||||
else{
|
||||
throw new Exception("Invalid mediaType '".$mediaType."' while trying to add the media in editBanner");
|
||||
}
|
||||
|
||||
if (is_null($banner)){
|
||||
GUIHandler::redirect("admin/listBanner.php");
|
||||
}
|
||||
}
|
||||
// else if(array_key_exists("action", $_POST) && strcmp(PostHandler::get("action"), "delete")==0){
|
||||
// if(!is_null($bannerId) && strcmp($bannerId, "")!=0){
|
||||
// $banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$bannerId));
|
||||
// $medias = DaoMediaHandler::getMedias($banner);
|
||||
// // $media = reset($medias);
|
||||
// // $media = GlobalVariables::get("dao")->getFirst("MediaModel",array("id"=>$mediaId));
|
||||
// foreach ($medias as $media){
|
||||
// DaoMediaHandler::deleteMedia($banner, $media);
|
||||
// $banner->type = null;
|
||||
// GlobalVariables::get("dao")->save($banner);
|
||||
// }
|
||||
// }
|
||||
// GUIHandler::redirect("admin/listBanner.php");
|
||||
// }
|
||||
$formFile = '<input type="hidden" name="MAX_FILE_SIZE" value="52428800" />
|
||||
<span class="label">Seleziona file</span><input type="file" name="data" />';
|
||||
if($edit && !is_null($newMedia)){
|
||||
$formHtml = '<span class="label">Inserire html:</span><textarea type="text" name ="data"/ rows="5" cols="30">'.$newMedia->code.'</textarea>';
|
||||
}
|
||||
else{
|
||||
$formHtml = '<span class="label">Inserire html:</span><textarea type="text" name ="data"/ rows="5" cols="30"></textarea>';
|
||||
}
|
||||
|
||||
|
||||
}catch(GUIException $ex){
|
||||
$error = $ex->getMessage();
|
||||
}catch (Exception $exec){
|
||||
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.";
|
||||
$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){
|
||||
?>
|
||||
<div style="font-size: 16px; color:red;">
|
||||
<?php echo $error;?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<form enctype="multipart/form-data" id="loadFile" method="POST">
|
||||
<div>
|
||||
<span class="label">Tipo:</span>
|
||||
<select id="mediaType" name="mediaType">
|
||||
<option disabled selected style="display:none;">Seleziona Tipo</option>
|
||||
<?php foreach (MediaModel::$MEDIA_TYPES as $mediaType=>$data){
|
||||
if(strcmp($mediaType, MediaModel::TYPE_HTML5)==0 || strcmp($mediaType, MediaModel::TYPE_IMAGE)==0){
|
||||
if(strcmp($mediaTypeSaved,$mediaType)==0){?>
|
||||
<option name="<?php echo $data["label"];?>" value="<?php echo $mediaType;?>" selected="selected">
|
||||
<?php
|
||||
}
|
||||
else{?>
|
||||
<option name="<?php echo $data["label"];?>" value="<?php echo $mediaType;?>">
|
||||
<?php
|
||||
}
|
||||
}?>
|
||||
<?php echo $data["label"];?></option>
|
||||
<?php }?>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<?php
|
||||
// <input type="hidden" name="MAX_FILE_SIZE" value="52428800" />
|
||||
// <input type="file" name="userFile"/>
|
||||
|
||||
if(strcmp($mediaTypeSaved, MediaModel::TYPE_HTML5)==0){
|
||||
echo $formHtml;
|
||||
}
|
||||
else if (strcmp($mediaTypeSaved, MediaModel::TYPE_IMAGE)==0){
|
||||
echo $formFile;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<input type="hidden" name="id" value="<?php echo $bannerId;?>" />
|
||||
<input type="hidden" name="action" value=""/>
|
||||
<div style="margin:10px 0px;"><span class="label">Cliente:</span><input type="text" name="customer" value="<?php echo $banner->customer;?>" /></div>
|
||||
<div style=""><span class="label">Data inizio:</span><input type="text" id="datepickerStart" name="dateStart" value="<?php echo ($edit)? date("d-m-Y",$banner->start->sec):date("d-m-Y");?>"></div>
|
||||
<div style=""><span class="label">Data fine:</span><input type="text" id="datepickerEnd" name="dateEnd" value="<?php echo ($edit)? date("d-m-Y",$banner->end->sec):date("d-m-Y");?>"></div>
|
||||
|
||||
</form>
|
||||
<div class="formBtns">
|
||||
<a href="#" id="submit" >Invia</a>
|
||||
<a href="#" id="back" >Back</a>
|
||||
<!-- <a href="#" id="delete">Delete</a> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(event){
|
||||
$("#submit").click(function(event){
|
||||
$("form#loadFile input[type=hidden][name=action]").val("save");
|
||||
$("form#loadFile").submit();
|
||||
});
|
||||
|
||||
$("#mediaType").change(function (event){
|
||||
$("form#loadFile input[type=hidden][name=action]").val("change");
|
||||
$("form#loadFile").submit();
|
||||
});
|
||||
|
||||
$("#back").click(function(event){
|
||||
$("form#loadFile").attr("action","listBanner.php");
|
||||
$("form#loadFile").submit();
|
||||
});
|
||||
|
||||
// $("#delete").click(function(event){
|
||||
// $("form#loadFile input[type=hidden][name=action]").val("delete");
|
||||
// $("form#loadFile").submit();
|
||||
// });
|
||||
|
||||
$("#datepickerStart").datepicker({dateFormat:"dd-mm-yy"});
|
||||
$("#datepickerEnd").datepicker({dateFormat:"dd-mm-yy"});
|
||||
});
|
||||
</script>
|
||||
?>
|
||||
@@ -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>
|
||||
@@ -199,7 +199,7 @@ try{
|
||||
<?php if($notizia->hasProperty("sondaggio") && !is_null($notizia->sondaggio)){?>
|
||||
$("#sondaggioGraph").highcharts({
|
||||
chart:{type:'bar'},
|
||||
title:{text:'<?php echo trim($notizia->sondaggio->titolo); ?>'},
|
||||
title:{text:'<?php echo trim(html_entity_decode($notizia->sondaggio->titolo)); ?>'},
|
||||
xAxis:{
|
||||
categories:[<?php $i =0; foreach($notizia->sondaggio->voci as $voce){
|
||||
echo ($i++==0?"":", ")."\"".trim($voce->nome)."\"";
|
||||
|
||||
@@ -21,10 +21,15 @@ $columns = array(
|
||||
array("label"=>"Fine","data"=>"end")
|
||||
);
|
||||
|
||||
$buttons = array(
|
||||
array("icon"=>"icon-medium-blue icon-editmed","page"=>"editBanner.php"),
|
||||
array("icon"=>"icon-medium-blue icon-remove","page"=>"deleteBanner.php")
|
||||
);
|
||||
$buttons = array();
|
||||
if (AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_BANNER_SUPERVISOR)){
|
||||
$buttons[] = array("icon"=>"icon-medium-blue icon-home","page"=>"homeBanner.php");
|
||||
}
|
||||
if (AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_BANNER)){
|
||||
$buttons[] = array("icon"=>"icon-medium-blue icon-editmed","page"=>"editBanner.php");
|
||||
}
|
||||
$buttons[] = array("icon"=>"icon-medium-blue icon-remove","page"=>"deleteBanner.php");
|
||||
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
<?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_BANNER_SUPERVISOR)){
|
||||
GUIHandler::redirect("admin/index.php");
|
||||
}
|
||||
|
||||
MenuGenerator::generateMenu();
|
||||
|
||||
HTMLHelper::generateAdminHead();
|
||||
|
||||
// $bannerId = PostHandler::get("id");
|
||||
|
||||
try{
|
||||
$error="";
|
||||
// $edit=false;
|
||||
$banner = new BannerModel();
|
||||
$newMedia = null;
|
||||
$mediaTypeSaved = PostHandler::get("mediaType");
|
||||
|
||||
// if(!is_null($bannerId) && strcmp($bannerId, "")!=0){
|
||||
// $edit = true;
|
||||
// $banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$bannerId));
|
||||
// $newMedias = DaoMediaHandler::getMedias($banner);
|
||||
// if(sizeof($newMedias)>0){
|
||||
// $newMedia = reset($newMedias);
|
||||
// }
|
||||
// if($banner->hasProperty("type") && !is_null($banner->type)){
|
||||
// $mediaTypeSaved = $banner->type;
|
||||
// }
|
||||
// }
|
||||
|
||||
if(array_key_exists("action", $_POST) && strcmp(PostHandler::get("action"), "save")==0){
|
||||
$mediaType = PostHandler::get("mediaType");
|
||||
if (!is_null($mediaType) && strcmp($mediaType, "")!=0){
|
||||
$banner->type=$mediaType;
|
||||
|
||||
$banner->customer = PostHandler::get("customer");
|
||||
$banner->start = new Mongodate(strtotime(PostHandler::get("dateStart")));
|
||||
$banner->end = new Mongodate(strtotime(PostHandler::get("dateEnd")));
|
||||
|
||||
$media = null;
|
||||
if ($banner->type == MediaModel::TYPE_HTML5){
|
||||
$saveableMedia = new stdClass();
|
||||
$saveableMedia->mediaType = MediaModel::TYPE_HTML5;
|
||||
$saveableMedia->code = PostHandler::get("data");
|
||||
$media = DaoMediaHandler::createNewTextBasedMedia($saveableMedia);
|
||||
}
|
||||
else if ($banner->type == MediaModel::TYPE_IMAGE){
|
||||
$saveableMedia = new stdClass();
|
||||
$saveableMedia->mediaType = MediaModel::TYPE_IMAGE;
|
||||
|
||||
$file = $_FILES['data']['tmp_name'];
|
||||
$extension = pathinfo($_FILES['data']['name'], PATHINFO_EXTENSION);
|
||||
|
||||
$media = DaoMediaHandler::createNewFileBasedMedia($saveable, $file, $extension);
|
||||
}
|
||||
|
||||
if (!is_null($media)){
|
||||
GlobalVariables::get("dao")->save($banner);
|
||||
GlobalVariables::get("dao")->save($media);
|
||||
DaoMediaHandler::addMedia($banner, $media);
|
||||
GlobalVariables::get("dao")->save($banner);
|
||||
GUIHandler::redirect("admin/listBanner.php");
|
||||
}
|
||||
else {
|
||||
throw new GUIException("I dati inseriti per il file multimediale non sono validi");
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new GUIException("Selezionare il tipo di file multimediale da utilizzare");
|
||||
}
|
||||
|
||||
|
||||
// if(is_null($bannerId) || strcmp($bannerId, "")==0){
|
||||
// $banner->customer = PostHandler::get("customer");
|
||||
// $banner->type = PostHandler::get("mediaType");
|
||||
// $banner->start = new Mongodate(strtotime(PostHandler::get("dateStart")));
|
||||
// $banner->end = new Mongodate(strtotime(PostHandler::get("dateEnd")));
|
||||
// GlobalVariables::get("dao")->save($banner);
|
||||
// $bannerId = $banner->id;
|
||||
// }
|
||||
|
||||
// if(!is_null($bannerId) && strcmp($bannerId, "")!=0){
|
||||
// $edit=true;
|
||||
// // $banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$bannerId));
|
||||
// $file = "";
|
||||
|
||||
// $mediaType = PostHandler::get("mediaType");
|
||||
// $banner->type=$mediaType;
|
||||
// if(strcmp($mediaType, "")!=0){
|
||||
// $tmp = array();
|
||||
// $saveable = new stdClass();
|
||||
// $saveable->mediaType = $mediaType;
|
||||
// if(strcmp($mediaType,MediaModel::TYPE_HTML5)==0){
|
||||
// $saveable->code = PostHandler::get("data");
|
||||
// $media = DaoMediaHandler::createNewTextBasedMedia($saveable);
|
||||
// }
|
||||
// else if(strcmp($mediaType,MediaModel::TYPE_IMAGE)==0){
|
||||
// $file = $_FILES['data']['tmp_name'];
|
||||
// $info = pathinfo($_FILES['data']['name']);
|
||||
// // $file = PostHandler::get("data");
|
||||
// $media = DaoMediaHandler::createNewFileBasedMedia($saveable, $file,$info["extension"]);
|
||||
// }
|
||||
|
||||
// if(!is_null($media)){
|
||||
// GlobalVariables::get("dao")->save($media);
|
||||
// DaoMediaHandler::addMedia($banner, $media);
|
||||
// GlobalVariables::get("dao")->save($banner);
|
||||
// }
|
||||
// else{
|
||||
// throw new Exception("Cannot save a null media in the news with id '".$bannerId."'");
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// throw new Exception("Invalid mediaType '".$mediaType."' while trying to add the media in editBanner");
|
||||
// }
|
||||
|
||||
// GUIHandler::redirect("admin/listBanner.php");
|
||||
// }
|
||||
}
|
||||
// else if(array_key_exists("action", $_POST) && strcmp(PostHandler::get("action"), "delete")==0){
|
||||
// if(!is_null($bannerId) && strcmp($bannerId, "")!=0){
|
||||
// $banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$bannerId));
|
||||
// $medias = DaoMediaHandler::getMedias($banner);
|
||||
// // $media = reset($medias);
|
||||
// // $media = GlobalVariables::get("dao")->getFirst("MediaModel",array("id"=>$mediaId));
|
||||
// foreach ($medias as $media){
|
||||
// DaoMediaHandler::deleteMedia($banner, $media);
|
||||
// $banner->type = null;
|
||||
// GlobalVariables::get("dao")->save($banner);
|
||||
// }
|
||||
// }
|
||||
// GUIHandler::redirect("admin/listBanner.php");
|
||||
// }
|
||||
$formFile = '<input type="hidden" name="MAX_FILE_SIZE" value="52428800" />
|
||||
<span class="label">Seleziona file</span><input type="file" name="data" />';
|
||||
if($edit && !is_null($newMedia)){
|
||||
$formHtml = '<span class="label">Inserire html:</span><textarea type="text" name ="data"/ rows="5" cols="30">'.$newMedia->code.'</textarea>';
|
||||
}
|
||||
else{
|
||||
$formHtml = '<span class="label">Inserire html:</span><textarea type="text" name ="data"/ rows="5" cols="30"></textarea>';
|
||||
}
|
||||
|
||||
}catch(GUIException $ex){
|
||||
$error = $ex->getMessage();
|
||||
}catch (Exception $exec){
|
||||
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.";
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
if(strcmp($error, "")!=0){
|
||||
?>
|
||||
<div style="font-size: 16px; color:red;">
|
||||
<?php echo $error;?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<form enctype="multipart/form-data" id="loadFile" method="POST">
|
||||
<div>
|
||||
<span class="label">Tipo:</span>
|
||||
<select id="mediaType" name="mediaType">
|
||||
<option disabled selected style="display:none;">Seleziona Tipo</option>
|
||||
<?php foreach (MediaModel::$MEDIA_TYPES as $mediaType=>$data){
|
||||
if(strcmp($mediaType, MediaModel::TYPE_HTML5)==0 || strcmp($mediaType, MediaModel::TYPE_IMAGE)==0){
|
||||
if(strcmp($mediaTypeSaved,$mediaType)==0){?>
|
||||
<option name="<?php echo $data["label"];?>" value="<?php echo $mediaType;?>" selected="selected">
|
||||
<?php
|
||||
}
|
||||
else{?>
|
||||
<option name="<?php echo $data["label"];?>" value="<?php echo $mediaType;?>">
|
||||
<?php
|
||||
}
|
||||
}?>
|
||||
<?php echo $data["label"];?></option>
|
||||
<?php }?>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<?php
|
||||
// <input type="hidden" name="MAX_FILE_SIZE" value="52428800" />
|
||||
// <input type="file" name="userFile"/>
|
||||
|
||||
if(strcmp($mediaTypeSaved, MediaModel::TYPE_HTML5)==0){
|
||||
echo $formHtml;
|
||||
}
|
||||
else if (strcmp($mediaTypeSaved, MediaModel::TYPE_IMAGE)==0){
|
||||
echo $formFile;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<input type="hidden" name="id" value="<?php echo $bannerId;?>" />
|
||||
<input type="hidden" name="action" value=""/>
|
||||
<div style="margin:10px 0px;"><span class="label">Cliente:</span><input type="text" name="customer" value="<?php echo $banner->customer;?>" /></div>
|
||||
<div style=""><span class="label">Data inizio:</span><input type="text" id="datepickerStart" name="dateStart" value="<?php echo ($edit)? date("d-m-Y",$banner->start->sec):date("d-m-Y");?>"></div>
|
||||
<div style=""><span class="label">Data fine:</span><input type="text" id="datepickerEnd" name="dateEnd" value="<?php echo ($edit)? date("d-m-Y",$banner->end->sec):date("d-m-Y");?>"></div>
|
||||
|
||||
</form>
|
||||
<div class="formBtns">
|
||||
<a href="#" id="submit" >Invia</a>
|
||||
<a href="#" id="back" >Back</a>
|
||||
<!-- <a href="#" id="delete">Delete</a> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(event){
|
||||
$("#submit").click(function(event){
|
||||
$("form#loadFile input[type=hidden][name=action]").val("save");
|
||||
$("form#loadFile").submit();
|
||||
});
|
||||
|
||||
$("#mediaType").change(function (event){
|
||||
$("form#loadFile input[type=hidden][name=action]").val("change");
|
||||
$("form#loadFile").submit();
|
||||
});
|
||||
|
||||
$("#back").click(function(event){
|
||||
$("form#loadFile").attr("action","listBanner.php");
|
||||
$("form#loadFile").submit();
|
||||
});
|
||||
|
||||
// $("#delete").click(function(event){
|
||||
// $("form#loadFile input[type=hidden][name=action]").val("delete");
|
||||
// $("form#loadFile").submit();
|
||||
// });
|
||||
|
||||
$("#datepickerStart").datepicker({dateFormat:"dd-mm-yy"});
|
||||
$("#datepickerEnd").datepicker({dateFormat:"dd-mm-yy"});
|
||||
});
|
||||
</script>
|
||||
@@ -27,8 +27,6 @@ $columns = array(
|
||||
|
||||
$buttons = array(
|
||||
array("icon"=>"icon-medium-blue icon-home","page"=>"validateCommento.php")
|
||||
// array("icon"=>"icon-medium-blue icon-editmed","page"=>"editNotizie.php"),
|
||||
// array("icon"=>"icon-medium-blue icon-remove","page"=>"deleteNotizie.php")
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user