Creato sistema accetazione commenti;
Create pagine per notizie in pending e rifiutate; Creati componenti grafici per mostrare Notizia, Commento e lista commenti; Bugfix e limature su amministrazione
This commit is contained in:
@@ -28,7 +28,7 @@ $currentSystem->apache->user = "var-www";
|
||||
$currentSystem->apache->group = "var-www";
|
||||
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
|
||||
|
||||
$currentSystem->remoteLocationPath = "/fdn2/";
|
||||
$currentSystem->remoteLocationPath = "http://localhost/fdn2/";
|
||||
|
||||
$backupSystem = new stdClass();
|
||||
$backupSystem->account = "40a911e14db8ad6faf0a0e7385e7c267";
|
||||
|
||||
@@ -30,7 +30,7 @@ $currentSystem->apache->user = "var-www";
|
||||
$currentSystem->apache->group = "var-www";
|
||||
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
|
||||
|
||||
$currentSystem->remoteLocationPath = "/";
|
||||
$currentSystem->remoteLocationPath = "http://www.ifattidinapoli.com/fdn2/";
|
||||
|
||||
$backupSystem = new stdClass();
|
||||
$backupSystem->account = "1582528f056a7ea7f391149fddc75553";
|
||||
|
||||
@@ -29,8 +29,7 @@ $currentSystem->apache->user = "var-www";
|
||||
$currentSystem->apache->group = "var-www";
|
||||
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
|
||||
|
||||
$currentSystem->remoteLocationPath = "/";
|
||||
|
||||
$currentSystem->remoteLocationPath = "http://fdn2.asdynamics.com/fdn2/";
|
||||
|
||||
$backupSystem = new stdClass();
|
||||
$backupSystem->account = "40a911e14db8ad6faf0a0e7385e7c267";
|
||||
|
||||
@@ -7,7 +7,7 @@ Creation Date: 12/gen/2016
|
||||
|
||||
require_once(dirname(__FILE__). "/../load.php");
|
||||
|
||||
$tasks = array("MailSendTask");
|
||||
$tasks = array("MailSendTask","GenerateAdminActivationMailTask");
|
||||
|
||||
if (sizeof($tasks)>0){
|
||||
foreach ($tasks as $taskName){
|
||||
|
||||
@@ -7,7 +7,8 @@ Creation Date: 27/gen/2016
|
||||
class AnalyticsHelper {
|
||||
private static $COOKIE_NAME = "FDN_STAT_NUM";
|
||||
//TODO: Switch this value to +1 year in production environment
|
||||
private static $COOKIE_TIME = "+5 minutes";
|
||||
// private static $COOKIE_TIME = "+5 minutes";
|
||||
private static $COOKIE_TIME = "+1 year";
|
||||
|
||||
public static function savePageImpression($ip, $content, $source){
|
||||
$tmp = new stdClass();
|
||||
|
||||
@@ -24,7 +24,7 @@ require_once(dirname(__FILE__)."/models/NotiziaModel.php");
|
||||
require_once(dirname(__FILE__)."/models/AdminModel.php");
|
||||
require_once(dirname(__FILE__)."/models/UserModel.php");
|
||||
|
||||
require_once(dirname(__FILE__)."/models/CommentiModel.php");
|
||||
require_once(dirname(__FILE__)."/models/CommentoModel.php");
|
||||
|
||||
require_once(dirname(__FILE__)."/models/MailModel.php");
|
||||
require_once(dirname(__FILE__)."/models/MailTemplateModel.php");
|
||||
|
||||
@@ -9,10 +9,10 @@ class MediaModel extends Model implements MediaInterface{
|
||||
|
||||
public static $MEDIA_TYPES = array(
|
||||
self::TYPE_YOUTUBE=>array("label"=>"Youtube"),
|
||||
self::TYPE_IMAGE=>array("label"=>"Image"),
|
||||
self::TYPE_IMAGE=>array("label"=>"Immagine"),
|
||||
self::TYPE_HTML5=>array("label"=>"Html5"),
|
||||
self::TYPE_PDF=>array("label"=>"Pdf"),
|
||||
self::TYPE_LOCALVIDEO=>array("label"=>"Local Video")
|
||||
self::TYPE_LOCALVIDEO=>array("label"=>"Video")
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
class CommentiModel extends Model{
|
||||
|
||||
/**
|
||||
* saveableObject deve avere alemeno il campo notizia = notiziaId;
|
||||
* @param stdClass $saveableObject
|
||||
* @throws CoreException
|
||||
*/
|
||||
public function __construct($saveableObject){
|
||||
parent::__construct($saveableObject);
|
||||
|
||||
if (!$this->hasProperty("notizia") || strcmp($this->notizia,"")==0){
|
||||
throw new CoreException("Impossible to build CommentiModel without field notizia");
|
||||
}
|
||||
|
||||
if (!$this->hasProperty("date")){
|
||||
$this->date = new MongoDate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function getCollectionName(){
|
||||
return "commenti";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
|
||||
class CommentoModel extends Model{
|
||||
const STATUS_PENDING = 1;
|
||||
const STATUS_ACCEPTED = 2;
|
||||
const STATUS_REJECTED = 3;
|
||||
|
||||
public static $COMMENTO_STATUS = array(
|
||||
self::STATUS_PENDING=>array("label"=>"Valutazione"),
|
||||
self::STATUS_ACCEPTED=>array("label"=>"Accettata"),
|
||||
self::STATUS_REJECTED=>array("label"=>"Respinta")
|
||||
);
|
||||
|
||||
/**
|
||||
* saveableObject deve avere alemeno il campo notizia = notiziaId;
|
||||
* @param stdClass $saveableObject
|
||||
* @throws CoreException
|
||||
*/
|
||||
public function __construct($saveableObject){
|
||||
parent::__construct($saveableObject);
|
||||
|
||||
if (!$this->hasProperty("notizia") || strcmp($this->notizia,"")==0){
|
||||
throw new CoreException("Impossible to build CommentoModel without field notizia");
|
||||
}
|
||||
|
||||
if (!$this->hasProperty("user") || strcmp($this->user,"")==0){
|
||||
throw new CoreException("Impossible to build CommentoModel without field user");
|
||||
}
|
||||
|
||||
if (!$this->hasProperty("status") || strcmp($this->status,"")==0){
|
||||
$this->status = self::STATUS_PENDING;
|
||||
}
|
||||
|
||||
if (!$this->hasProperty("date")){
|
||||
$this->date = new MongoDate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function getCollectionName(){
|
||||
return "commenti";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -22,7 +22,7 @@ class NotiziaModel extends HasMediaModel{
|
||||
const STATUS_REJECTED = 3;
|
||||
|
||||
public static $NOTIZIA_STATUS = array(
|
||||
self::STATUS_PENDING=>array("label"=>"In attesa"),
|
||||
self::STATUS_PENDING=>array("label"=>"Valutazione"),
|
||||
self::STATUS_ACCEPTED=>array("label"=>"Accettata"),
|
||||
self::STATUS_REJECTED=>array("label"=>"Respinta")
|
||||
);
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 29/feb/2016
|
||||
*/
|
||||
|
||||
class NotiziaBlock {
|
||||
private $notizia;
|
||||
|
||||
public function __construct(NotiziaModel $notizia){
|
||||
$this->notizia = $notizia;
|
||||
}
|
||||
|
||||
public function __toString(){
|
||||
$mainMedia = DaoMediaHandler::getMainMediaFromModel($this->notizia);
|
||||
$mediaText = "";
|
||||
if (!is_null($mainMedia)){
|
||||
$mediaText = $mainMedia->asText();
|
||||
}
|
||||
$rval = '<div class="notiziaBlock">';
|
||||
$rval.= '<div class="notiziaMainMedia">'.$mediaText.'</div>';
|
||||
$rval.= '<div class="notiziaTitle">'.$this->notizia->titolo.'</div>';
|
||||
$rval.= '<div class="notiziaSubtitle">'.$this->notizia->sottotitolo.'</div>';
|
||||
$rval.= '<div class="notiziaTesto">'.$this->notizia->testo.'</div>';
|
||||
$rval.= "</div>";
|
||||
return $rval;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class NotiziaCommentiList {
|
||||
private $notizia;
|
||||
|
||||
public function __construct(NotiziaModel $notizia){
|
||||
$this->notizia = $notizia;
|
||||
}
|
||||
|
||||
public function __toString(){
|
||||
$rval = '<div class="commentiBlock">';
|
||||
|
||||
$commenti = GlobalVariables::get("dao")->query("CommentoModel",array("notizia"=>$this->notizia->id));
|
||||
if (sizeof($commenti)>0){
|
||||
$rval.= "<ul>";
|
||||
foreach ($commenti as $commento){
|
||||
$commentoBlock = new CommentoBlock($commento);
|
||||
$rval.= "<li>".$commentoBlock."</li>";
|
||||
}
|
||||
$rval.= "</ul>";
|
||||
}
|
||||
|
||||
$rval.= "</div>";
|
||||
return $rval;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CommentoBlock {
|
||||
private $commento;
|
||||
|
||||
public function __construct(CommentoModel $commento){
|
||||
$this->commento = $commento;
|
||||
}
|
||||
|
||||
public function __toString(){
|
||||
$userModel = GlobalVariables::get("dao")->getFirst("UserModel",array("id"=>$this->commento->user));
|
||||
$userString = "Utente cancellato";
|
||||
if (!is_null($userModel)){
|
||||
$userString = $userModel->nome." ".$userModel->cognome;
|
||||
}
|
||||
|
||||
$rval = '<div class="commentoBlock">';
|
||||
|
||||
$rval.= '<div class="commentoTitolo">'.$this->commento->titolo.'</div>';
|
||||
$rval.= '<div class="commentoTesto">'.$this->commento->testo.'</div>';
|
||||
$rval.= '<div class="commentoUser">'.$userString.'</div>';
|
||||
$rval.= '<div class="commentoDate">'.date("d-m-Y H:i",$this->commento->date->sec).'</div>';
|
||||
|
||||
$rval.= "</div>";
|
||||
return $rval;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -123,7 +123,7 @@ class GUIHandler {
|
||||
|
||||
public static function getBaseUrl(){
|
||||
$conf = GlobalVariables::get("config");
|
||||
return "http://$_SERVER[HTTP_HOST]".$conf->pages->remoteLocationPath;
|
||||
return $conf->pages->remoteLocationPath;
|
||||
}
|
||||
|
||||
public static function getImagesUrl(){
|
||||
|
||||
@@ -32,4 +32,6 @@ require_once(dirname(__FILE__)."/html.inclusion.php");
|
||||
|
||||
require_once(dirname(__FILE__)."/HTMLHelper.php");
|
||||
require_once(dirname(__FILE__)."/DatatablesHelper.php");
|
||||
|
||||
require_once(dirname(__FILE__)."/FDN2Components.php");
|
||||
?>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 29/feb/2016
|
||||
*/
|
||||
|
||||
|
||||
class GenerateAdminActivationMailTask extends Task {
|
||||
public static function getName(){
|
||||
return "generateAdminActivation";
|
||||
}
|
||||
|
||||
public static function getLabel(){
|
||||
return "Genera email di attivazione admin";
|
||||
}
|
||||
|
||||
public static function execute(){
|
||||
$admins = GlobalVariables::get("dao")->query("AdminModel",array("activationSent"=>false),array("limit"=>10));
|
||||
if(sizeof($admins)>0){
|
||||
foreach ($admins as $admin){
|
||||
$mail = FDN_MailHelper::getAdminConfirmMail($admin);
|
||||
GlobalVariables::get("dao")->save($mail);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -10,4 +10,6 @@ require_once(dirname(__FILE__)."/MailSendTask.php");
|
||||
require_once(dirname(__FILE__)."/NewsletterCheckTask.php");
|
||||
|
||||
require_once(dirname(__FILE__)."/SendBackupTask.php");
|
||||
|
||||
require_once(dirname(__FILE__)."/GenerateAdminActivationMailTask.php");
|
||||
?>
|
||||
@@ -42,17 +42,17 @@ try{
|
||||
$err = true;
|
||||
$exc->addMessage("Inserire un nome utente per accedere all'applicazione");
|
||||
}
|
||||
if (GlobalVariables::get("dao")->count("AdminModel",array("username"=>$giornalista->username)) > 0 ){
|
||||
if (GlobalVariables::get("dao")->count("AdminModel",array("username"=>$giornalista->username,"id"=>array('$ne'=>new MongoId($giornalista->id) ) ) ) > 0 ){
|
||||
$err = true;
|
||||
$exc->addMessage("Il nome utente '".$giornalista->username."' è già in uso");
|
||||
}
|
||||
|
||||
// Validate Password
|
||||
$pass = trim(PostHandler::get("password"));
|
||||
if (strcmp($pass,"")==0){
|
||||
$err = true;
|
||||
$exc->addMessage("Inserire una password per accedere all'applicazione");
|
||||
}
|
||||
$pass = trim(PostHandler::get("password"));
|
||||
if (strcmp($pass,PostHandler::get("password_confirm"))!=0){
|
||||
$err = true;
|
||||
$exc->addMessage("Le password inserite non coincidono");
|
||||
|
||||
+17
-17
@@ -97,17 +97,13 @@ try{
|
||||
// }
|
||||
// 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)){
|
||||
$formFile = '<input type="hidden" name="MAX_FILE_SIZE" value="52428800" />
|
||||
<input type="file" name="data" />';
|
||||
|
||||
$formHtml = 'Inserire html: <textarea type="text" name ="data"/ rows="5" cols="30">'.$newMedia->code.'</textarea>';
|
||||
$formHtml = '<span class="label">Inserire html:</span><textarea type="text" name ="data"/ rows="5" cols="30">'.$newMedia->code.'</textarea>';
|
||||
}
|
||||
else{
|
||||
$formFile = '<input type="hidden" name="MAX_FILE_SIZE" value="52428800" />
|
||||
<input type="file" name="data" />';
|
||||
|
||||
$formHtml = 'Inserire html: <textarea type="text" name ="data"/ rows="5" cols="30"></textarea>';
|
||||
$formHtml = '<span class="label">Inserire html:</span><textarea type="text" name ="data"/ rows="5" cols="30"></textarea>';
|
||||
}
|
||||
|
||||
}catch(GUIException $ex){
|
||||
@@ -129,17 +125,18 @@ try{
|
||||
?>
|
||||
<div>
|
||||
<form enctype="multipart/form-data" id="loadFile" method="POST">
|
||||
<div style="margin:15px 5px;">Selezionare tipo multimedia:
|
||||
<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 value="<?php echo $mediaType;?>" selected="selected">
|
||||
<option name="<?php echo $data["label"];?>" value="<?php echo $mediaType;?>" selected="selected">
|
||||
<?php
|
||||
}
|
||||
else{?>
|
||||
<option value="<?php echo $mediaType;?>">
|
||||
<option name="<?php echo $data["label"];?>" value="<?php echo $mediaType;?>">
|
||||
<?php
|
||||
}
|
||||
}?>
|
||||
@@ -147,7 +144,8 @@ try{
|
||||
<?php }?>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin:15px 5px;"><?php
|
||||
<div>
|
||||
<?php
|
||||
// <input type="hidden" name="MAX_FILE_SIZE" value="52428800" />
|
||||
// <input type="file" name="userFile"/>
|
||||
|
||||
@@ -157,12 +155,14 @@ try{
|
||||
else if (strcmp($mediaTypeSaved, MediaModel::TYPE_IMAGE)==0){
|
||||
echo $formFile;
|
||||
}
|
||||
?> <input type="hidden" name="id" value="<?php echo $bannerId;?>" />
|
||||
<input type="hidden" name="action" value=""/>
|
||||
<div style="margin:10px 0px;">Cliente: <input type="text" name="customer" value="<?php echo $banner->customer;?>" /></div>
|
||||
<div style="display:inline-block;">Data inizio: <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="display:inline-block;">Data fine: <input type="text" id="datepickerEnd" name="dateEnd" value="<?php echo ($edit)? date("d-m-Y",$banner->end->sec):date("d-m-Y");?>"></div>
|
||||
?>
|
||||
</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 style="margin:15px 5px;">
|
||||
<a href="#" id="submit" >Invia</a>
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 29/feb/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_COMMENTI_SUPERVISOR)){
|
||||
GUIHandler::redirect("admin/index.php");
|
||||
}
|
||||
|
||||
MenuGenerator::generateMenu();
|
||||
HTMLHelper::generateAdminHead();
|
||||
|
||||
try{
|
||||
$error = "";
|
||||
$id = PostHandler::get("id");
|
||||
if (is_null($id) && strcmp("", $id)!=0){
|
||||
GUIHandler::redirect("admin/unacceptedCommenti.php");
|
||||
}
|
||||
|
||||
$commento = GlobalVariables::get("dao")->getFirst("CommentoModel",array("id"=>$id));
|
||||
if (is_null($commento)){
|
||||
GUIHandler::redirect("admin/unacceptedCommenti.php");
|
||||
}
|
||||
|
||||
$action = PostHandler::get("action");
|
||||
if (!is_null($action) && strcmp("", $action)!=0){
|
||||
if (strcmp("cancel", $action)==0){
|
||||
GUIHandler::redirectPost("admin/validateCommento.php",array("id"=>$id));
|
||||
}
|
||||
else if (strcmp("save", $action)==0){
|
||||
$commento->titolo = PostHandler::get("titolo");
|
||||
$commento->testo = PostHandler::get("testo");
|
||||
|
||||
GlobalVariables::get("dao")->save($commento);
|
||||
|
||||
GUIHandler::redirectPost("admin/validateCommento.php",array("id"=>$id));
|
||||
}
|
||||
}
|
||||
}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>';
|
||||
}
|
||||
?>
|
||||
<form id="commentoForm" method="POST" action="">
|
||||
<input type="hidden" name="action" value="" />
|
||||
<input type="hidden" name="id" value="<?php echo $id;?>" />
|
||||
<div>
|
||||
<span class="label">Titolo</span>
|
||||
<input type="text" name="titolo" value="<?php echo $commento->titolo; ?>" />
|
||||
</div>
|
||||
<div>
|
||||
<span class="label">Testo</span>
|
||||
<textarea name="testo" rows="3" cols="80" style="resize:none;"><?php echo $commento->testo; ?></textarea>
|
||||
</div>
|
||||
</form>
|
||||
<div class="formBtns">
|
||||
<a href="#" id="commentoForm_salva" >Salva</a>
|
||||
<a href="#" id="commentoForm_annulla">Annulla</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(event){
|
||||
$("#commentoForm_salva").click(function(event){
|
||||
$("form#commentoForm input[type=hidden][name=action]").val("save");
|
||||
$("form#commentoForm").submit();
|
||||
});
|
||||
$("#commentoForm_annulla").click(function(event){
|
||||
$("form#commentoForm input[type=hidden][name=action]").val("cancel");
|
||||
$("form#commentoForm").submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -20,7 +20,7 @@ MenuGenerator::generateMenu();
|
||||
|
||||
HTMLHelper::generateAdminHead();
|
||||
|
||||
$taskList = array("MailSendTask","NewsletterCheckTask","SendBackupTask");
|
||||
$taskList = array("MailSendTask","NewsletterCheckTask","SendBackupTask","GenerateAdminActivationMailTask");
|
||||
|
||||
$saved = false;
|
||||
$action = PostHandler::get("action");
|
||||
|
||||
@@ -56,8 +56,9 @@ try{
|
||||
$giornalista->cognome = PostHandler::get("cognome");
|
||||
GlobalVariables::get("dao")->save($giornalista);
|
||||
|
||||
$mail = FDN_MailHelper::getAdminConfirmMail($giornalista);
|
||||
GlobalVariables::get("dao")->save($mail);
|
||||
// ORA LO FA UN TASK
|
||||
// $mail = FDN_MailHelper::getAdminConfirmMail($giornalista);
|
||||
// GlobalVariables::get("dao")->save($mail);
|
||||
|
||||
GUIHandler::redirect("admin/listGiornalisti.php");
|
||||
}
|
||||
|
||||
@@ -40,6 +40,9 @@ try{
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$notizia->about->author = AdminLoginManager::getLogged()->nome." ".AdminLoginManager::getLogged()->cognome;
|
||||
}
|
||||
|
||||
MenuGenerator::generateMenu();
|
||||
HTMLHelper::generateAdminHead();
|
||||
@@ -52,12 +55,19 @@ try{
|
||||
$notizia->sottotitolo = PostHandler::get("sottotitolo");
|
||||
$notizia->testo = PostHandler::get("testo");
|
||||
$notizia->category = PostHandler::get("category");
|
||||
if(strcmp(PostHandler::get("author"), "")==0){
|
||||
$notizia->about->author = AdminLoginManager::getLogged()->nome." ".AdminLoginManager::getLogged()->cognome;
|
||||
}
|
||||
else{
|
||||
$notizia->about->author = PostHandler::get("author");
|
||||
|
||||
if (!array_key_exists($notizia->category,NotiziaModel::$NOTIZIE_CATEGORY)){
|
||||
throw new GUIException("La categoria inserita non è valida");
|
||||
}
|
||||
|
||||
$notizia->about->author = PostHandler::get("author");
|
||||
// Vedi cambiamento in riga 44
|
||||
// if(strcmp(PostHandler::get("author"), "")==0){
|
||||
// $notizia->about->author = AdminLoginManager::getLogged()->nome." ".AdminLoginManager::getLogged()->cognome;
|
||||
// }
|
||||
// else{
|
||||
// $notizia->about->author = PostHandler::get("author");
|
||||
// }
|
||||
$dateString = PostHandler::get("data")." ".PostHandler::get("time");
|
||||
if(!preg_match("/^[0-9]{2}[-][0-9]{2}[-][0-9]{4} [0-9]{2}[:][0-9]{2}$/", $dateString)){
|
||||
throw new GUIException("Il formato della data inserita non è corretto. Per favore segui il seguente formato Date: dd-mm-yyyy hh:ii");
|
||||
@@ -76,7 +86,7 @@ try{
|
||||
|
||||
|
||||
GlobalVariables::get("dao")->save($notizia);
|
||||
GUIHandler::redirect("admin/listNotizie.php");
|
||||
GUIHandler::redirect("admin/myNotizie.php");
|
||||
}
|
||||
}
|
||||
else{
|
||||
@@ -101,37 +111,43 @@ try{
|
||||
?>
|
||||
<form method="POST" id="notiziaForm">
|
||||
<input type="hidden" value="<?php echo $notiziaId;?>" name="id"/>
|
||||
<div style="padding:10px;">
|
||||
<div style="padding:5px; display:inline-block;">Titolo:
|
||||
<textarea name="titolo" rows="2" cols="30" style="resize:none;"><?php echo $notizia->titolo;?></textarea>
|
||||
</div>
|
||||
<div style="padding:5px;display:inline-block;">Sottotitolo:
|
||||
<textarea name="sottotitolo" rows="2" cols="30" style="resize:none;"><?php echo $notizia->sottotitolo;?></textarea>
|
||||
</div>
|
||||
<div style="padding:5px;display:inline-block;">
|
||||
<select name="category">
|
||||
<option disabled="disabled" selected="selected" style="display:none;">Selezionare Categoria</option>
|
||||
<?php foreach (NotiziaModel::$NOTIZIE_CATEGORY as $category=>$data){
|
||||
if(strcmp($notizia->category,$category)==0){?>
|
||||
<option value="<?php echo $category;?>" selected="selected">
|
||||
<?php }
|
||||
else{ ?>
|
||||
<option value="<?php echo $category;?>">
|
||||
<?php } ?>
|
||||
<?php echo $data["label"];?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div style="padding:5px;display:inline-block;">
|
||||
<span class="label">Categoria:</span>
|
||||
<select name="category">
|
||||
<option disabled="disabled" selected="selected" style="display:none;">Seleziona una categoria</option>
|
||||
<?php foreach (NotiziaModel::$NOTIZIE_CATEGORY as $category=>$data){
|
||||
if(strcmp($notizia->category,$category)==0){?>
|
||||
<option value="<?php echo $category;?>" selected="selected">
|
||||
<?php }
|
||||
else{ ?>
|
||||
<option value="<?php echo $category;?>">
|
||||
<?php } ?>
|
||||
<?php echo $data["label"];?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div >
|
||||
<span class="label">Autore:</span>
|
||||
<input type="text" value="<?php echo $notizia->about->author;?>" name="author"/>
|
||||
</div>
|
||||
<div style="">
|
||||
<span class="label">Titolo:</span>
|
||||
<textarea name="titolo" rows="3" cols="80" style="resize:none;"><?php echo $notizia->titolo;?></textarea>
|
||||
</div>
|
||||
<div style="">
|
||||
<span class="label">Sottotitolo:</span>
|
||||
<textarea name="sottotitolo" rows="3" cols="80" style="resize:none;"><?php echo $notizia->sottotitolo;?></textarea>
|
||||
</div>
|
||||
<textarea name="testo" id="editore_testo" rows="10" cols="80"><?php echo $notizia->testo;?></textarea>
|
||||
<div style="display:inline-block;">Data: <input type="text" id="datepicker" name="data" value="<?php echo ($edit)? date("d-m-Y",$notizia->about->data->sec):date("d-m-Y");?>"></div>
|
||||
<div style="display:inline-block;">Time: <input type="text" id="timepicker" name="time" value="<?php echo ($edit)? date("H:i",$notizia->about->data->sec):date("H:i");?>"></div>
|
||||
<div style="display:inline-block;">Author: <input value="<?php echo $notizia->about->author;?>" name="author"/></div>
|
||||
<div style="display:inline-block;"><span class="label">Data:</span><input type="text" id="datepicker" name="data" value="<?php echo ($edit)? date("d-m-Y",$notizia->about->data->sec):date("d-m-Y");?>"></div>
|
||||
<div style="display:inline-block;"><span class="label">Ora:</span><input type="text" id="timepicker" name="time" value="<?php echo ($edit)? date("H:i",$notizia->about->data->sec):date("H:i");?>"></div>
|
||||
|
||||
<input type="hidden" name="action" value=""/>
|
||||
</form>
|
||||
|
||||
<div style="display:inline-block;margin:25px 5px;"><a href="#" id="submit" >Submit</a></div>
|
||||
<div class="formBtns">
|
||||
<a href="#" id="submit" >Salva</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
CKEDITOR.replace( 'editore_testo');
|
||||
|
||||
+121
-48
@@ -17,39 +17,58 @@ try{
|
||||
$notiziaId = PostHandler::get("id");
|
||||
|
||||
$notizia = new NotiziaModel();
|
||||
// $ansa = false;
|
||||
// var_dump($notizia);
|
||||
$notizia = null;
|
||||
|
||||
if(!is_null($notiziaId) && strcmp($notiziaId, "")!=0){
|
||||
$notizia = GlobalVariables::get("dao")->getFirst("NotiziaModel",array("id"=>$notiziaId));
|
||||
|
||||
// echo "pene";
|
||||
if(is_null($notizia)){
|
||||
GUIHandler::redirect("admin/myNotizie.php");
|
||||
}
|
||||
|
||||
if (!AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR) &&
|
||||
AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_EDITORE)){
|
||||
if(strcmp($notizia->about->owner, AdminLoginManager::getLogged()->id) != 0){
|
||||
GUIHandler::redirect("admin/myNotizie.php");
|
||||
if (!is_null($notizia)){
|
||||
if (!AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR)){// LA CONDIZIONE ERA SBAGLIATA... NON ERO NE SUPERVISOR NE EDITOR VEDEVO LE NOTIZIE.....
|
||||
if(strcmp($notizia->about->owner, AdminLoginManager::getLogged()->id) != 0){
|
||||
GUIHandler::redirect("admin/myNotizie.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!$notizia->hasProperty("isAnsa")){
|
||||
$ansa = false;
|
||||
}
|
||||
|
||||
if(array_key_exists("ansa", $_POST)){
|
||||
if(strcmp(PostHandler::get("ansa"), "true")==0){
|
||||
$notizia->isAnsa = true;
|
||||
}
|
||||
else{
|
||||
|
||||
if(!$notizia->hasProperty("isAnsa")){
|
||||
$notizia->isAnsa = false;
|
||||
// $ansa = false;// SBAGLIATO, DOPO LO CAMBI E IGNORI IL VALORE CHE METTI QUI
|
||||
}
|
||||
GlobalVariables::get("dao")->save($notizia);
|
||||
|
||||
$postAnsa = PostHandler::get("ansa");
|
||||
if(!is_null($postAnsa)){
|
||||
if(strcmp($postAnsa, "true")==0){
|
||||
$notizia->isAnsa = true;
|
||||
}
|
||||
else{
|
||||
$notizia->isAnsa = false;
|
||||
}
|
||||
GlobalVariables::get("dao")->save($notizia);
|
||||
}
|
||||
$ansa = $notizia->isAnsa;
|
||||
}
|
||||
$ansa = $notizia->isAnsa;
|
||||
|
||||
}
|
||||
|
||||
// SENZA QUESTO ENTRI NELLA PAGINA ANCHE SENZA ID......
|
||||
if(is_null($notizia)){
|
||||
GUIHandler::redirect("admin/myNotizie.php");
|
||||
}
|
||||
|
||||
$changeStatus = PostHandler::get("status");
|
||||
if(!is_null($changeStatus)){
|
||||
if(strcmp($changeStatus, "accept")==0){
|
||||
$notizia->status = NotiziaModel::STATUS_ACCEPTED;
|
||||
GlobalVariables::get("dao")->save($notizia);
|
||||
}
|
||||
else if(strcmp($changeStatus, "reject")==0){
|
||||
$notizia->status = NotiziaModel::STATUS_REJECTED;
|
||||
GlobalVariables::get("dao")->save($notizia);
|
||||
}
|
||||
}
|
||||
|
||||
MenuGenerator::generateMenu();
|
||||
HTMLHelper::generateAdminHead();
|
||||
@@ -57,46 +76,100 @@ try{
|
||||
}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){echo $error;}?>
|
||||
<?php
|
||||
if(strcmp($error, "")!=0){
|
||||
echo '<div style="font-size: 16px; color:red;">'.$error.'</div>';
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if (!$notizia->hasProperty("status") || $notizia->status==NotiziaModel::STATUS_PENDING){
|
||||
if (AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR)){
|
||||
?>
|
||||
<div class="notiziaAcceptance">
|
||||
Questa notizia è ancora in stato di valutazione. Si desidera cambiare lo stato della notizia?
|
||||
<div>
|
||||
<a class="green" href="javascript:void();">Accettata</a>
|
||||
<a class="red" href="javascript:void();">Respinta</a>
|
||||
<script type="text/javascript">
|
||||
$(".notiziaAcceptance a.green").click(function () {
|
||||
openPagePost("homeNotizie.php", [{name:"id",value:"<?php echo $notiziaId;?>"},{name:"status",value:"accept"}])
|
||||
});
|
||||
$(".notiziaAcceptance a.red").click(function () {
|
||||
openPagePost("homeNotizie.php", [{name:"id",value:"<?php echo $notiziaId;?>"},{name:"status",value:"reject"}])
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
?>
|
||||
<div class="notiziaAcceptance">
|
||||
Questa notizia è ancora in stato di valutazione.
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
else if ($notizia->status==NotiziaModel::STATUS_REJECTED){
|
||||
?>
|
||||
<div class="notiziaAcceptance" style="background:#FF8DA6;" >
|
||||
Questa notizia è stata respinta!
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div style="position:relative;">
|
||||
<div class="notiziaContainer">
|
||||
<h1> <?php echo $notizia->titolo;?></h1>
|
||||
<h2> <?php echo $notizia->sottotitolo;?></h2>
|
||||
<h3> <?php echo $notizia->testo;?></h3>
|
||||
<?php echo new NotiziaBlock($notizia);?>
|
||||
</div>
|
||||
<div class="notiziaMenu">
|
||||
<ul>
|
||||
<li><a href="#" id="notiziaMenu_multimedia">Gestisci Multimedia</a></li>
|
||||
<li><a href="#" id="notiziaMenu_ansa"><?php echo ($ansa)?"Rimuovi dall'Ansa":"Aggiungi all'Ansa";?></a></li>
|
||||
<li><a href="#" id="notiziaMenu_commenti">Visualizza Commenti</a></li>
|
||||
<?php if(sizeof($notizia->sondaggio->votanti)==0){
|
||||
if($notizia->hasProperty("sondaggio") && !is_null($notizia->sondaggio)){?>
|
||||
<li><a href="#" id="notiziaMenu_addSondaggi">Modifica Sondaggio</a></li>
|
||||
<?php }else{?>
|
||||
<li><a href="#" id="notiziaMenu_addSondaggi">Crea Sondaggio</a></li>
|
||||
<?php }
|
||||
} ?>
|
||||
<li><a href="listNotizie.php" id="notiziaMenu_back">Back</a></li>
|
||||
</ul>
|
||||
<!-- <div class="notiziaContainer">
|
||||
<h1> <?php echo $notizia->titolo;?></h1>
|
||||
<h2> <?php echo $notizia->sottotitolo;?></h2>
|
||||
<h3> <?php echo $notizia->testo;?></h3>
|
||||
</div> -->
|
||||
<div class="notiziaMenu">
|
||||
<ul>
|
||||
<li><a href="#" id="notiziaMenu_edit">Modifica Notizia</a></li>
|
||||
<li><a href="#" id="notiziaMenu_multimedia">Gestisci Multimedia</a></li>
|
||||
<li><a href="#" id="notiziaMenu_ansa"><?php echo ($ansa)?"Rimuovi dall'Ansa":"Aggiungi all'Ansa";?></a></li>
|
||||
<li><a href="#" id="notiziaMenu_commenti">Visualizza Commenti</a></li>
|
||||
<?php if(sizeof($notizia->sondaggio->votanti)==0){
|
||||
if($notizia->hasProperty("sondaggio") && !is_null($notizia->sondaggio)){?>
|
||||
<li><a href="#" id="notiziaMenu_addSondaggi">Modifica Sondaggio</a></li>
|
||||
<?php }else{?>
|
||||
<li><a href="#" id="notiziaMenu_addSondaggi">Crea Sondaggio</a></li>
|
||||
<?php }
|
||||
} ?>
|
||||
<li><a href="listNotizie.php" id="notiziaMenu_back">Back</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<form id="notiziaForm" method="POST" action="">
|
||||
<input type="hidden" name="ansa" value="" />
|
||||
<input type="hidden" name="id" value="<?php echo $notiziaId;?>" />
|
||||
</form>
|
||||
<?php if($notizia->hasProperty("sondaggio") && !is_null($notizia->sondaggio)){?>
|
||||
<div id="sondaggioGraph" style="height:300px;margin-right:280px;margin-top:10px;"></div>
|
||||
<div class="votanti">Votanti: <?php $i=0; foreach ($notizia->sondaggio->votanti as $votante){ echo ($i++==0?"":", ").$votante;}?></div>
|
||||
<?php }?>
|
||||
</div>
|
||||
<form id="notiziaForm" method="POST" action="">
|
||||
<input type="hidden" name="ansa" value="" />
|
||||
<input type="hidden" name="id" value="<?php echo $notiziaId;?>" />
|
||||
</form>
|
||||
<?php if($notizia->hasProperty("sondaggio") && !is_null($notizia->sondaggio)){?>
|
||||
<div id="sondaggioGraph" style="height:300px;margin-right:280px;margin-top:10px;"></div>
|
||||
<div class="votanti">Votanti: <?php $i=0; foreach ($notizia->sondaggio->votanti as $votante){ echo ($i++==0?"":", ").$votante;}?></div>
|
||||
<?php }?>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(event){
|
||||
$("#notiziaMenu_edit").click(function(event){
|
||||
$("form#notiziaForm").attr("action","editNotizie.php");
|
||||
$("form#notiziaForm").submit();
|
||||
});
|
||||
|
||||
$("#notiziaMenu_multimedia").click(function(event){
|
||||
$("form#notiziaForm").attr("action","homeMultimedia.php");
|
||||
$("form#notiziaForm").submit();
|
||||
|
||||
@@ -19,6 +19,7 @@ MenuGenerator::generateMenu();
|
||||
|
||||
HTMLHelper::generateAdminHead();
|
||||
$columns = array(
|
||||
array("label"=>"Categoria","data"=>"category"),
|
||||
array("label"=>"Titolo","data"=>"titolo"),
|
||||
array("label"=>"Sottotitolo","data"=>"sottotitolo"),
|
||||
array("label"=>"Autore","data"=>"about.author"),
|
||||
@@ -27,7 +28,7 @@ $columns = array(
|
||||
|
||||
$buttons = array(
|
||||
array("icon"=>"icon-medium-blue icon-home","page"=>"homeNotizie.php"),
|
||||
array("icon"=>"icon-medium-blue icon-editmed","page"=>"editNotizie.php"),
|
||||
// array("icon"=>"icon-medium-blue icon-editmed","page"=>"editNotizie.php"),
|
||||
array("icon"=>"icon-medium-blue icon-remove","page"=>"deleteNotizie.php")
|
||||
);
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ HTMLHelper::generateAdminHead();
|
||||
$columns = array(
|
||||
array("label"=>"Titolo","data"=>"titolo"),
|
||||
array("label"=>"Sottotitolo","data"=>"sottotitolo"),
|
||||
array("label"=>"Autore","data"=>"about.author"),
|
||||
array("label"=>"Data","data"=>"about.data")
|
||||
array("label"=>"Stato","data"=>"status"),
|
||||
array("label"=>"Data","data"=>"about.data","sort"=>"desc")
|
||||
);
|
||||
|
||||
$buttons = array(
|
||||
|
||||
@@ -24,12 +24,12 @@ try{
|
||||
// $std->titolo = "Commento nuovo";
|
||||
// $std->testo = "Nuono commento dove prima non ve ne erano, orsù tutti a commentareeeeeeeeeeeeeeeeeeee!!!!!!!!!!!!!!!!!!!!!!!!1";
|
||||
// $std->status = "accettato";
|
||||
// $comm = new CommentiModel($std);
|
||||
// $comm = new CommentoModel($std);
|
||||
// GlobalVariables::get("dao")->save($comm);
|
||||
|
||||
|
||||
$commenti = GlobalVariables::get("dao")->query("CommentiModel",
|
||||
array('$and'=>array(array("notizia"=>$notiziaId),array("status"=>"accettato"))),
|
||||
$commenti = GlobalVariables::get("dao")->query("CommentoModel",
|
||||
array("notizia"=>$notiziaId,"status"=>CommentoModel::STATUS_ACCEPTED),
|
||||
array("sort"=>array("date"=>-1))
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 29/feb/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_EDITORE_SUPERVISOR)){
|
||||
GUIHandler::redirect("admin/index.php");
|
||||
}
|
||||
|
||||
MenuGenerator::generateMenu();
|
||||
|
||||
HTMLHelper::generateAdminHead();
|
||||
$columns = array(
|
||||
array("label"=>"Categoria","data"=>"category"),
|
||||
array("label"=>"Titolo","data"=>"titolo"),
|
||||
array("label"=>"Autore","data"=>"about.author"),
|
||||
array("label"=>"Proprietario","data"=>"about.owner"),
|
||||
array("label"=>"Data","data"=>"about.data","sort"=>"asc")
|
||||
);
|
||||
|
||||
$buttons = array(
|
||||
array("icon"=>"icon-medium-blue icon-home","page"=>"homeNotizie.php")
|
||||
// array("icon"=>"icon-medium-blue icon-editmed","page"=>"editNotizie.php"),
|
||||
// array("icon"=>"icon-medium-blue icon-remove","page"=>"deleteNotizie.php")
|
||||
);
|
||||
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
$details = DatatablesHelper::generateTable("rejectedNotizieTableBackend.php",$columns,array("buttons"=>$buttons));
|
||||
?>
|
||||
</div>
|
||||
@@ -12,7 +12,7 @@ GUIHandler::generateHtmlHeaders(array(),true);
|
||||
if (!AdminLoginManager::isLogged()){
|
||||
GUIHandler::redirect("admin/login.php");
|
||||
}
|
||||
else if (!AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_SUPERADMIN)){
|
||||
else if (!AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_STATISTICHE_SUPERVISOR)){
|
||||
GUIHandler::redirect("admin/index.php");
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,35 @@ Creation Date: 25/gen/2016
|
||||
require_once(dirname(__FILE__)."/../../load.php");
|
||||
|
||||
$useModel = "NotiziaModel";
|
||||
$permissionFlagRequired = AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR;
|
||||
$permissionFlagRequired = AdminModel::ADMIN_TYPE_EDITORE;
|
||||
$exposedFields = array(
|
||||
"titolo"=>null,
|
||||
"sottotitolo"=>null,
|
||||
"about"=>array("data"=>null,"author"=>null),
|
||||
"titolo"=>function($data){
|
||||
$rval = $data;
|
||||
if (strlen($rval)>80){
|
||||
$rval = substr($rval, 0, 80)."...";
|
||||
}
|
||||
return $rval;
|
||||
},
|
||||
"sottotitolo"=>function($data){
|
||||
$rval = $data;
|
||||
if (strlen($rval)>80){
|
||||
$rval = substr($rval, 0, 80)."...";
|
||||
}
|
||||
return $rval;
|
||||
},
|
||||
"status"=>function ($data) {
|
||||
switch ($data){
|
||||
case NotiziaModel::STATUS_ACCEPTED:
|
||||
return "<span style=\"color:green;\">".NotiziaModel::$NOTIZIA_STATUS[$data]["label"]."</span>";
|
||||
case NotiziaModel::STATUS_PENDING:
|
||||
return "<span style=\"color:#FF9440;\">".NotiziaModel::$NOTIZIA_STATUS[$data]["label"]."</span>";
|
||||
case NotiziaModel::STATUS_REJECTED:
|
||||
return "<span style=\"color:red;\">".NotiziaModel::$NOTIZIA_STATUS[$data]["label"]."</span>";
|
||||
default:
|
||||
return "Sconosciuto";
|
||||
}
|
||||
},
|
||||
"about"=>array("data"=>null),
|
||||
"id"=>null
|
||||
);
|
||||
|
||||
|
||||
@@ -9,13 +9,33 @@ require_once(dirname(__FILE__)."/../../load.php");
|
||||
$useModel = "NotiziaModel";
|
||||
$permissionFlagRequired = AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR;
|
||||
$exposedFields = array(
|
||||
"titolo"=>null,
|
||||
"sottotitolo"=>null,
|
||||
"category"=>function ($data){
|
||||
if (array_key_exists($data, NotiziaModel::$NOTIZIE_CATEGORY) ){
|
||||
return NotiziaModel::$NOTIZIE_CATEGORY[$data]["label"];
|
||||
}
|
||||
else {
|
||||
return "Sconosciuta";
|
||||
}
|
||||
},
|
||||
"titolo"=>function($data){
|
||||
$rval = $data;
|
||||
if (strlen($rval)>80){
|
||||
$rval = substr($rval, 0, 80)."...";
|
||||
}
|
||||
return $rval;
|
||||
},
|
||||
"sottotitolo"=>function($data){
|
||||
$rval = $data;
|
||||
if (strlen($rval)>80){
|
||||
$rval = substr($rval, 0, 80)."...";
|
||||
}
|
||||
return $rval;
|
||||
},
|
||||
"about"=>array("data"=>null,"author"=>null),
|
||||
"id"=>null
|
||||
);
|
||||
|
||||
$ret = DatatablesHelper::getResult($useModel, $permissionFlagRequired, $exposedFields);
|
||||
$ret = DatatablesHelper::getResult($useModel, $permissionFlagRequired, $exposedFields, array("status"=>NotiziaModel::STATUS_ACCEPTED));
|
||||
echo json_encode($ret);
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 29/feb/2016
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__)."/../../load.php");
|
||||
|
||||
$useModel = "NotiziaModel";
|
||||
$permissionFlagRequired = AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR;
|
||||
$exposedFields = array(
|
||||
"category"=>function ($data){
|
||||
if (array_key_exists($data, NotiziaModel::$NOTIZIE_CATEGORY) ){
|
||||
return NotiziaModel::$NOTIZIE_CATEGORY[$data]["label"];
|
||||
}
|
||||
else {
|
||||
return "Sconosciuta";
|
||||
}
|
||||
},
|
||||
"titolo"=>function($data){
|
||||
$rval = $data;
|
||||
if (strlen($rval)>80){
|
||||
$rval = substr($rval, 0, 80)."...";
|
||||
}
|
||||
return $rval;
|
||||
},
|
||||
"about"=>array("data"=>null,"author"=>null,"owner"=>function ($id){
|
||||
$model = GlobalVariables::get("dao")->getFirst("AdminModel",array("id"=>$id));
|
||||
return $model->nome." ".$model->cognome;
|
||||
}),
|
||||
"id"=>null
|
||||
);
|
||||
|
||||
$ret = DatatablesHelper::getResult($useModel, $permissionFlagRequired, $exposedFields,array("status"=>NotiziaModel::STATUS_REJECTED));
|
||||
echo json_encode($ret);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 29/feb/2016
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__)."/../../load.php");
|
||||
|
||||
$useModel = "CommentoModel";
|
||||
$permissionFlagRequired = AdminModel::ADMIN_TYPE_COMMENTI_SUPERVISOR;
|
||||
$exposedFields = array(
|
||||
"notizia"=>function($id){
|
||||
$model = GlobalVariables::get("dao")->getFirst("NotiziaModel",array("id"=>$id));
|
||||
return '<a href="javascript:void(0);" onClick="openPagePost(\''.GUIHandler::getBaseUrl().'admin/homeNotizie.php\',[{name:\'id\',value:\''.$id.'\'}],true);">'.$model->titolo.'</a>';
|
||||
// return $model->nome." ".$model->cognome;
|
||||
},
|
||||
"titolo"=>function($data){
|
||||
$rval = $data;
|
||||
if (strlen($rval)>80){
|
||||
$rval = substr($rval, 0, 80)."...";
|
||||
}
|
||||
return $rval;
|
||||
},
|
||||
"user"=>function ($id){
|
||||
$model = GlobalVariables::get("dao")->getFirst("UserModel",array("id"=>$id));
|
||||
return $model->nome." ".$model->cognome;
|
||||
},
|
||||
"date"=>null,
|
||||
"id"=>null
|
||||
);
|
||||
|
||||
$ret = DatatablesHelper::getResult($useModel, $permissionFlagRequired, $exposedFields,array("status"=>NotiziaModel::STATUS_PENDING));
|
||||
echo json_encode($ret);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 29/feb/2016
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__)."/../../load.php");
|
||||
|
||||
$useModel = "NotiziaModel";
|
||||
$permissionFlagRequired = AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR;
|
||||
$exposedFields = array(
|
||||
"category"=>function ($data){
|
||||
if (array_key_exists($data, NotiziaModel::$NOTIZIE_CATEGORY) ){
|
||||
return NotiziaModel::$NOTIZIE_CATEGORY[$data]["label"];
|
||||
}
|
||||
else {
|
||||
return "Sconosciuta";
|
||||
}
|
||||
},
|
||||
"titolo"=>function($data){
|
||||
$rval = $data;
|
||||
if (strlen($rval)>80){
|
||||
$rval = substr($rval, 0, 80)."...";
|
||||
}
|
||||
return $rval;
|
||||
},
|
||||
"about"=>array("data"=>null,"author"=>null,"owner"=>function ($id){
|
||||
$model = GlobalVariables::get("dao")->getFirst("AdminModel",array("id"=>$id));
|
||||
return $model->nome." ".$model->cognome;
|
||||
}),
|
||||
"id"=>null
|
||||
);
|
||||
|
||||
$ret = DatatablesHelper::getResult($useModel, $permissionFlagRequired, $exposedFields,array("status"=>NotiziaModel::STATUS_PENDING));
|
||||
echo json_encode($ret);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 29/feb/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_COMMENTI_SUPERVISOR)){
|
||||
GUIHandler::redirect("admin/index.php");
|
||||
}
|
||||
|
||||
MenuGenerator::generateMenu();
|
||||
|
||||
HTMLHelper::generateAdminHead();
|
||||
$columns = array(
|
||||
array("label"=>"Notizia","data"=>"notizia"),
|
||||
array("label"=>"Titolo","data"=>"titolo"),
|
||||
array("label"=>"Autore","data"=>"user"),
|
||||
array("label"=>"Data","data"=>"date","sort"=>"asc")
|
||||
);
|
||||
|
||||
$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")
|
||||
);
|
||||
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
$details = DatatablesHelper::generateTable("unacceptedCommentiTableBackend.php",$columns,array("buttons"=>$buttons));
|
||||
?>
|
||||
</div>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 29/feb/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_EDITORE_SUPERVISOR)){
|
||||
GUIHandler::redirect("admin/index.php");
|
||||
}
|
||||
|
||||
MenuGenerator::generateMenu();
|
||||
|
||||
HTMLHelper::generateAdminHead();
|
||||
$columns = array(
|
||||
array("label"=>"Categoria","data"=>"category"),
|
||||
array("label"=>"Titolo","data"=>"titolo"),
|
||||
array("label"=>"Autore","data"=>"about.author"),
|
||||
array("label"=>"Proprietario","data"=>"about.owner"),
|
||||
array("label"=>"Data","data"=>"about.data","sort"=>"asc")
|
||||
);
|
||||
|
||||
$buttons = array(
|
||||
array("icon"=>"icon-medium-blue icon-home","page"=>"homeNotizie.php")
|
||||
// array("icon"=>"icon-medium-blue icon-editmed","page"=>"editNotizie.php"),
|
||||
// array("icon"=>"icon-medium-blue icon-remove","page"=>"deleteNotizie.php")
|
||||
);
|
||||
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
$details = DatatablesHelper::generateTable("unacceptedNotizieTableBackend.php",$columns,array("buttons"=>$buttons));
|
||||
?>
|
||||
</div>
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 29/feb/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_COMMENTI_SUPERVISOR) ){
|
||||
GUIHandler::redirect("admin/index.php");
|
||||
}
|
||||
|
||||
MenuGenerator::generateMenu();
|
||||
HTMLHelper::generateAdminHead();
|
||||
|
||||
try{
|
||||
$commentoId = PostHandler::get("id");
|
||||
if (is_null($commentoId)){
|
||||
GUIHandler::redirect("admin/unacceptedCommenti.php");
|
||||
}
|
||||
|
||||
$commento = GlobalVariables::get("dao")->getFirst("CommentoModel",array("id"=>$commentoId));
|
||||
|
||||
if (is_null($commento)){
|
||||
GUIHandler::redirect("admin/unacceptedCommenti.php");
|
||||
}
|
||||
|
||||
$notiziaId = $commento->notizia;
|
||||
$notizia = GlobalVariables::get("dao")->getFirst("NotiziaModel",array("id"=>$notiziaId));
|
||||
|
||||
if (is_null($notizia)){
|
||||
throw new Exception("Impossibile aprire il commento in quanto associato ad una notizia non valida. (Commento: '".$commentoId."', Notizia: '".$notiziaId."')");
|
||||
}
|
||||
|
||||
$userId = $commento->user;
|
||||
$userModel = GlobalVariables::get("dao")->getFirst("UserModel",array("id"=>$userId));
|
||||
$userString = "Utente cancellato";
|
||||
if (!is_null($userModel)){
|
||||
$userString = $userModel->nome." ".$userModel->cognome;
|
||||
}
|
||||
|
||||
$validation = PostHandler::get("status");
|
||||
if (!is_null($validation)){
|
||||
if (strcmp($validation, "accept")==0){
|
||||
$commento->status = CommentoModel::STATUS_ACCEPTED;
|
||||
GlobalVariables::get("dao")->save($commento);
|
||||
}
|
||||
else if (strcmp($validation, "reject")==0){
|
||||
$commento->status = CommentoModel::STATUS_REJECTED;
|
||||
GlobalVariables::get("dao")->save($commento);
|
||||
}
|
||||
}
|
||||
|
||||
}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 class="commentoAcceptance">
|
||||
<div class="commentoTitolo"><?php echo $commento->titolo; ?></div>
|
||||
<div class="commentoTesto"><?php echo $commento->testo; ?></div>
|
||||
<div class="commentoUser"><?php echo $userString; ?></div>
|
||||
<div class="commentoDate"><?php echo date("d-m-Y H:i",$commento->date->sec); ?></div>
|
||||
<div class="buttons">
|
||||
<a class="green" href="javascript:void();">Accetta</a>
|
||||
<a class="yellow" href="javascript:void();">Modifica</a>
|
||||
<a class="red" href="javascript:void();">Cancella</a>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(".commentoAcceptance a.green").click(function () {
|
||||
openPagePost("validateCommento.php", [{name:"id",value:"<?php echo $commentoId;?>"},{name:"status",value:"accept"}]);
|
||||
});
|
||||
$(".commentoAcceptance a.yellow").click(function () {
|
||||
openPagePost("editCommento.php", [{name:"id",value:"<?php echo $commentoId;?>"}]);
|
||||
});
|
||||
$(".commentoAcceptance a.red").click(function () {
|
||||
openPagePost("validateCommento.php", [{name:"id",value:"<?php echo $commentoId;?>"},{name:"status",value:"reject"}]);
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<?php
|
||||
echo new NotiziaBlock($notizia);
|
||||
echo new NotiziaCommentiList($notizia);
|
||||
|
||||
?>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
function openPagePost(page, request){
|
||||
function openPagePost(page, request, blank = false){
|
||||
var inputs = '';
|
||||
request.forEach(function(element, index, array){
|
||||
inputs += '<input type="hidden" name="'+element.name+'" value="'+element.value+'" />';
|
||||
});
|
||||
$('<form method="POST" action="'+page+'">'+inputs+'</form>').appendTo("body").submit();
|
||||
$('<form '+(blank?'target="_blank" ':"")+'method="POST" action="'+page+'">'+inputs+'</form>').appendTo("body").submit();
|
||||
}
|
||||
+25
-5
@@ -47,7 +47,8 @@ span.label{display:inline-block; width:210px; text-align:right; padding:5px;}
|
||||
div.formBtns{padding:15px 165px;}
|
||||
div.formBtns a{text-decoration:none; color:rgb(51, 102, 255); font-weight:bold; margin-right:5px; padding:5px;}
|
||||
div.formBtns a:hover{background-color:rgb(204, 217, 255);}
|
||||
|
||||
form input[type="text"], form textarea{padding:6px 5px;}
|
||||
form > div{margin:5px 0;}
|
||||
|
||||
|
||||
/*
|
||||
@@ -61,10 +62,16 @@ div.formBtns a:hover{background-color:rgb(204, 217, 255);}
|
||||
|
||||
.notiziaContainer{margin-right:280px;background-color:#f2f2f2;overflow:auto;}
|
||||
.notiziaContainer h1,.notiziaContainer h2,.notiziaContainer h3{padding:10px;}
|
||||
.notiziaMenu{display:inline-block;background-color:#33ccff;position:absolute; width:250px;right:20px;top:20px;}
|
||||
.notiziaMenu a{text-decoration:none;color:black;cursor:pointer;}
|
||||
.notiziaMenu a:hover{text-decoration:underline;}
|
||||
.notiziaMenu{background-color:#CCC;position:absolute; width:250px;right:20px;top:20px; padding: 10px 0 15px; border-radius:10px;border: 1px solid #A5A5A5;}
|
||||
.notiziaMenu a{text-decoration:none;color:#5656C3;cursor:pointer;}
|
||||
.notiziaMenu a:hover{color:#8484F1;}
|
||||
.notiziaMenu ul {list-style:none; display:inline-block; padding:0 20px;}
|
||||
.notiziaMenu ul li{margin: 10px 0px;display: block; clear:both;}
|
||||
|
||||
div.notiziaAcceptance{text-align: center; background-color: #ffd677; padding: 20px; border: 1px solid grey; border-radius: 10px;}
|
||||
div.notiziaAcceptance > a{text-decoration:none; color:rgb(51, 102, 255); font-weight:bold; margin-right:5px; padding:5px; display:inline-block;}
|
||||
div.notiziaAcceptance > a.green:hover{background-color:#7EFF83;}
|
||||
div.notiziaAcceptance > a.red:hover{background-color:#FF8DA6;}
|
||||
/*
|
||||
__ __ _ _
|
||||
| \/ | ___ __| (_) __ _
|
||||
@@ -73,7 +80,7 @@ div.formBtns a:hover{background-color:rgb(204, 217, 255);}
|
||||
|_| |_|\___|\__,_|_|\__,_|
|
||||
|
||||
*/
|
||||
.mediaElement.selected > img{opacity:0.4;}
|
||||
.mediaElement.selected > img{opacity:0.4;background-color:orange;}
|
||||
|
||||
/*
|
||||
____ _ _
|
||||
@@ -86,4 +93,17 @@ div.formBtns a:hover{background-color:rgb(204, 217, 255);}
|
||||
|
||||
.commentoContainer{border:2px solid black; border-left:0px; border-right:0px; border-top:0px; padding: 5px; margin: 15px 5px}
|
||||
|
||||
div.commentoAcceptance{text-align: left; background-color: #ffd677; padding: 20px 50px; border: 1px solid grey; border-radius: 10px; margin-bottom:20px;}
|
||||
|
||||
div.commentoAcceptance .commentoTitolo{font-size:18px;font-weight:bold;}
|
||||
div.commentoAcceptance .commentoTesto{margin-left:15px;}
|
||||
div.commentoAcceptance .commentoUser{display:inline-block; font-style:italic; font-size:12px; margin-top:15px;margin-left:15px;}
|
||||
div.commentoAcceptance .commentoDate{display:inline-block; font-style:italic; font-size:12px;}
|
||||
|
||||
div.commentoAcceptance > .buttons {text-align:center;}
|
||||
div.commentoAcceptance > .buttons a{text-decoration:none; color:rgb(51, 102, 255); font-weight:bold; margin-right:5px; padding:5px; display:inline-block;}
|
||||
div.commentoAcceptance > .buttons a.green:hover{background-color:#7EFF83;}
|
||||
div.commentoAcceptance > .buttons a.red:hover{background-color:#FF8DA6;}
|
||||
div.commentoAcceptance > .buttons a.yellow:hover{background-color:#FF8DA6;}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user