Finto archivio con style

This commit is contained in:
Lorenzo Giacomelli
2016-03-10 13:59:42 +01:00
parent 87aa5d387e
commit ec33f9220c
4 changed files with 172 additions and 14 deletions
+3 -3
View File
@@ -177,13 +177,13 @@ class GUIHandler {
?><div class="menuContainer">
<div class="menuBar">
<div class="menuTab">
<a href="#">HOME</a>
<a href="index.php">HOME</a>
</div>
<?php
foreach (NotiziaModel::$NOTIZIE_CATEGORY as $category=>$data){
if(($data["mainMenu"]) && !$data["hidden"]){
?>
<div class="menuTab"><a href="javascript:void(0)"><?php echo strtoupper($data["label"]);?></a></div>
<div class="menuTab"><a href="categorySummary.php?category=<?php echo $category;?>"><?php echo strtoupper($data["label"]);?></a></div>
<?php
}
}
@@ -198,7 +198,7 @@ class GUIHandler {
foreach(NotiziaModel::$NOTIZIE_CATEGORY as $category=>$data){
if(!$data["mainMenu"] && !$data["hidden"]){
?>
<li class="categoryVoice"><a href="javascript:void(0)"><?php echo strtoupper($data["label"]);?></a></li>
<li class="categoryVoice"><a href="categorySummary.php?category=<?php echo $category;?>"><?php echo strtoupper($data["label"]);?></a></li>
<?php
}
}
+156
View File
@@ -0,0 +1,156 @@
<?php
require_once(dirname(__FILE__)."/load.php");
try {
AnalyticsHelper::logNotiziaImpression($articolo->id);
AnalyticsHelper::logPageImpression();
GUIHandler::generateHtmlHeaders();
$mesi = array(1=>'Gennaio', 'Febbraio', 'Marzo', 'Aprile',
'Maggio', 'Giugno', 'Luglio', 'Agosto',
'Settembre', 'Ottobre', 'Novembre','Dicembre');
$currentYear=date("Y");
$post=false;
$found = false;
$day = "";
$month= "";
$year = "";
if(array_key_exists("submit", $_POST) && strcmp($_POST["submit"], "Invia")==0){
$post = true;
$day = $_POST["day"];
$month= $_POST["month"];
$year = $_POST["year"];
$dateString = $_POST["year"]."-".$_POST["month"]."-".$_POST["day"];
$notizieDate = GlobalVariables::get("dao")->query("NotiziaModel",
array("status"=>NotiziaModel::STATUS_ACCEPTED,"about.data"=>array('$gt'=>new MongoDate(strtotime($dateString)),
'$lt'=>new MongoDate(strtotime($dateString." +1 day"))))
);
if(sizeof($notizieDate)>0){
$found=true;
}
// var_dump($notizieDate);
}
}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>
<form method="POST">
<select name="day">
<?php
for($i=1;$i<=31;$i++){
if($post && ($i == intval($day))){
?>
<option value="<?php echo $i;?>" selected><?php echo $i;?></option>
<?php }
else{
?>
<option value="<?php echo $i;?>"><?php echo $i;?></option>
<?php
}
}
?>
</select>
<select name="month">
<?php
foreach ($mesi as $key=>$value){
if($post && ($key == intval($month))){
?>
<option value="<?php echo $key;?>" selected><?php echo $value;?></option>
<?php }
else{
?>
<option value="<?php echo $key;?>"><?php echo $value;?></option>
<?php
}
}
?>
</select>
<select name="year">
<?php
for($i=2006;$i<=$currentYear;$i++){
if($post && ($i == intval($year))){
?>
<option value="<?php echo $i;?>" selected><?php echo $i;?></option>
<?php }
else{
?>
<option value="<?php echo $i;?>"><?php echo $i;?></option>
<?php
}
}
?>
</select>
<input type="submit" name="submit" value="Invia"/>
</form>
</div>
<div class="archivioResults">
<?php if(!$post){
?>
<div>Selezionate una data per la ricerca, e premere il tasto Invia.</div>
<?php
}
else{
if ($found){
$i=0;
foreach ($notizieDate 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
}
}
else{
?>
<div style="color:red;">Nessun articolo trovato nella data selezionata.</div>
<?php
}
}
?>
</div>
<div class="summaryRightBar">
<?php GUIHandler::generateRightBannerBlock();?>
</div>
<?php
GUIHandler::generateFooter();
?>
</div>
+9 -7
View File
@@ -4,15 +4,17 @@ require_once(dirname(__FILE__)."/load.php");
try{
// AnalyticsHelper::logPageImpression();
AnalyticsHelper::logPageImpression();
GUIHandler::generateHtmlHeaders();
$category = PostHandler::get("category");
$category = NotiziaModel::CATEGORY_CRONACA;
if(!is_null($category) || ($category!=0)){
$category = "";
if(array_key_exists("category", $_GET) && strcmp($_GET["category"], "")!=0){
$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)
+4 -4
View File
@@ -320,10 +320,10 @@ body{font-family:lato, arial;}
.articoloRightBar{vertical-align:top;}
.categorySummaryContainer{width:600px;padding:5px 10px 5px 0px;vertical-align:top;display:inline-block;}
.categorySummaryContainer > .notiziaContainer{border:solid #d6d6d6 1px;margin-bottom:5px;padding:5px;}
.notiziaContainer > .notiziaImage{display:inline-block;vertical-align:middle;text-align:center;}
.notiziaContainer > .notiziaInfo{display:inline-block;width:430px;padding:10px;vertical-align:middle;cursor:pointer;}
.archivioResults, .categorySummaryContainer{width:600px;padding:5px 10px 5px 0px;vertical-align:top;display:inline-block;}
.archivioResults > .notiziaContainer, .categorySummaryContainer > .notiziaContainer{border:solid #d6d6d6 1px;margin-bottom:5px;padding:5px;}
.notiziaContainer > .notiziaImage{display:inline-block;vertical-align:middle;text-align:center;width:160px;}
.notiziaContainer > .notiziaInfo{display:inline-block;width:400px;padding:10px;vertical-align:middle;cursor:pointer;}
.notiziaInfo > .notiziaTitolo{font-weight:bold;padding:5px;}
.notiziaInfo > .notiziaSottotitolo{padding:5px;}
.notiziaInfo > .notiziaTesto{padding:5px;color:#1a9ee9;font-weight:bold;}