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); GUIHandler::redirect("admin/unacceptedCommenti.php"); } else if (strcmp($validation, "reject")==0){ $commento->status = CommentoModel::STATUS_REJECTED; GlobalVariables::get("dao")->save($commento); GUIHandler::redirect("admin/unacceptedCommenti.php"); } } }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()."'"; } ?>
'.$error.'
'; } ?>
titolo; ?>
testo; ?>
date->sec); ?>
Accetta Modifica Cancella