lock in categorySummary per le categorie hidden; aggiunta del sondaggio in articolo; inizio funzione di commento
84 lines
2.7 KiB
PHP
84 lines
2.7 KiB
PHP
<?php
|
|
|
|
require_once(dirname(__FILE__)."/load.php");
|
|
|
|
try{
|
|
|
|
AnalyticsHelper::logPageImpression();
|
|
GUIHandler::generateHtmlHeaders();
|
|
|
|
|
|
$category = "";
|
|
if(array_key_exists("category", $_GET) && strcmp($_GET["category"], "")!=0){
|
|
|
|
var_dump(NotiziaModel::$NOTIZIE_CATEGORY[intval($_GET["category"])]["hidden"]);
|
|
if(NotiziaModel::$NOTIZIE_CATEGORY[$_GET["category"]]["hidden"]){
|
|
GUIHandler::redirect("index.php");
|
|
}
|
|
$category = $_GET["category"];
|
|
|
|
// $category = NotiziaModel::CATEGORY_CRONACA;
|
|
|
|
$category = intval($category);
|
|
$notizie = GlobalVariables::get("dao")->query("NotiziaModel",
|
|
array('$and'=>array(array("status"=>NotiziaModel::STATUS_ACCEPTED),array("category"=>$category))),
|
|
array("sort"=>array("about.data"=>-1),"limit"=>10)
|
|
);
|
|
|
|
if (sizeof($notizie)>0){
|
|
$notizie = array_map(function($ele){$ele->testo = strip_tags($ele->testo);$ele->sottotitolo = strip_tags($ele->sottotitolo); return $ele; }, $notizie);
|
|
}
|
|
}
|
|
else{
|
|
GUIHandler::redirect("index.php");
|
|
}
|
|
|
|
|
|
}catch(GUIException $ex){
|
|
$error = $ex->getMessage();
|
|
}catch (Exception $exec){
|
|
$msg = LogModel::fromException($exec);
|
|
GlobalVariables::get("dao")->save($msg);
|
|
|
|
GUIHandler::redirect("index.php");
|
|
}
|
|
?>
|
|
<div style="width:1000px;margin-left:auto;margin-right:auto;">
|
|
<?php
|
|
GUIHandler::generateHeadPublic();
|
|
GUIHandler::generateMenu();?>
|
|
<div class="categorySummaryContainer">
|
|
<?php $i=0;
|
|
foreach ($notizie as $notizia){
|
|
$i++;
|
|
$stringTitolo = (strlen($notizia->titolo) > 103) ? substr($notizia->titolo,0,100).'...' : $notizia->titolo;
|
|
$stringSottotitolo = (strlen($notizia->sottotitolo) > 73) ? substr($notizia->sottotitolo,0,70).'...' : $notizia->sottotitolo;
|
|
$stringTesto = (strlen($notizia->testo) > 33) ? substr($notizia->testo,0,30).'...' : $notizia->testo;
|
|
$media = DaoMediaHandler::getMainMediaFromModel($notizia);
|
|
?>
|
|
<div class="notiziaContainer">
|
|
<div class="notiziaImage mediaContent"><?php (!is_null($media))?$media->renderMedia(array("size"=>MediaRenderer::SIZE_SMALL)):"" ;?></div>
|
|
<div id="notizia_<?php echo $i;?>" class="notiziaInfo">
|
|
<div class="notiziaTitolo"><?php echo $stringTitolo;?></div>
|
|
<div class="notiziaSottotitolo"><?php echo$stringSottotitolo;?></div>
|
|
<div class="notiziaTesto"><?php echo $stringTesto;?></div>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(event){
|
|
$("#notizia_<?php echo $i;?>").click(function(event){
|
|
window.location.href="articolo.php?id=<?php echo $notizia->id;?>";
|
|
});
|
|
});
|
|
</script>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
<div class="summaryRightBar">
|
|
<?php GUIHandler::generateRightBannerBlock();?>
|
|
</div>
|
|
|
|
<?php
|
|
GUIHandler::generateFooter();?>
|
|
</div>
|