Aggiunte nuove mail al mail helper Correzioni grafiche alle pagine di cancellazione in amministrazione Modificata pagina di validazione commento
90 lines
2.7 KiB
PHP
90 lines
2.7 KiB
PHP
<?php
|
|
/*
|
|
Author: Riccardo Di Dato
|
|
Creation Date: 25/gen/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_NEWSLETTER)){
|
|
GUIHandler::redirect("admin/index.php");
|
|
}
|
|
|
|
MenuGenerator::generateMenu();
|
|
|
|
HTMLHelper::generateAdminHead();
|
|
|
|
$error = "";
|
|
try {
|
|
$id = PostHandler::get("id");
|
|
|
|
$config = GlobalVariables::get("config");
|
|
|
|
if (is_null($id) || strcmp("", $id)==0){
|
|
GUIHandler::redirect("admin/pendingNewsletters.php");
|
|
}
|
|
|
|
$mail = GlobalVariables::get("dao")->getFirst("MailTemplateModel",array("id"=>$id));
|
|
if (is_null($mail)){
|
|
GUIHandler::redirect("admin/pendingNewsletters.php");
|
|
}
|
|
|
|
$action = PostHandler::get("action");
|
|
if (!is_null($action) && strcmp("", $action)!=0){
|
|
if (strcmp("confirm", $action)==0){
|
|
$mail->status = MailTemplateModel::STATUS_READY;
|
|
GlobalVariables::get("dao")->save($mail);
|
|
}
|
|
GUIHandler::redirect("admin/pendingNewsletters.php");
|
|
}
|
|
}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){
|
|
echo '<div style="font-size: 16px; color:red;">'.$error.'</div>';
|
|
}
|
|
?>
|
|
<div class="formBtns" style="text-align:center;">
|
|
<a href="#" id="mailForm_confirm" >Conferma</a>
|
|
<a href="#" id="mailForm_annulla">Indietro</a>
|
|
<a href="#" id="mailForm_elimina">Elimina</a>
|
|
</div>
|
|
<div><span class="label"><b>Oggetto</b></span><?php echo $mail->subject; ?> </div>
|
|
<div><span class="label"><b>Giorno</b></span><?php echo date("d-m-Y",$mail->date->sec); ?> </div>
|
|
<div><span class="label"><b>Ora</b></span><?php echo date("H:i",$mail->date->sec); ?> </div>
|
|
<hr/>
|
|
<div><?php echo $mail->body; ?></div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(event){
|
|
$("#mailForm_confirm").click(function(event){
|
|
$("form#mailForm input[type=hidden][name=action]").val("confirm");
|
|
$("form#mailForm").submit();
|
|
});
|
|
$("#mailForm_annulla").click(function(event){
|
|
$("form#mailForm input[type=hidden][name=action]").val("cancel");
|
|
$("form#mailForm").submit();
|
|
});
|
|
|
|
$("#mailForm_elimina").click(function(event){
|
|
openPagePost("deleteNewsletter.php", [{name:"id",value:"<?php echo $id; ?>"}]);
|
|
});
|
|
});
|
|
</script>
|
|
<form id="mailForm" method="POST" action="">
|
|
<input type="hidden" name="action" value="" />
|
|
<input type="hidden" name="id" value="<?php echo $id;?>" />
|
|
</form>
|