Inserita pagina di conferma per la newsletter
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
<?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();
|
||||
|
||||
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>';
|
||||
}
|
||||
?>
|
||||
<a href="#" id="mailForm_confirm" >Conferma</a>
|
||||
<a href="#" id="mailForm_annulla">Annulla</a>
|
||||
<div><?php echo $mail->subject; ?> </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();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<form id="mailForm" method="POST" action="">
|
||||
<input type="hidden" name="action" value="" />
|
||||
<input type="hidden" name="id" value="<?php echo $id;?>" />
|
||||
</form>
|
||||
Reference in New Issue
Block a user