implementato search notizia e stilata la pagina dei riusltati
This commit is contained in:
@@ -210,7 +210,12 @@ class GUIHandler {
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="searchBar"><input class="inputBar" name="search" placeholder="cerca nel sito" /><img alt="" src="images/magnifyingGlass.png"/></div>
|
||||
<div class="searchBar">
|
||||
<form id="searchForm" method="POST" action="searchResults.php">
|
||||
<input class="inputBar" name="search" placeholder="cerca nel sito" />
|
||||
</form>
|
||||
<img id="sendFormGlass" alt="" src="images/magnifyingGlass.png"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
@@ -231,6 +236,16 @@ class GUIHandler {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$("#sendFormGlass").click(function (){
|
||||
$("#searchForm").submit();
|
||||
});
|
||||
|
||||
$(".inputBar").keypress(function(e){
|
||||
if(e.which == 13){
|
||||
$("#sendFormGlass").click();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ try {
|
||||
?>
|
||||
<div style="color:red;">Nessun articolo trovato nella data selezionata.</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__)."/load.php");
|
||||
|
||||
try {
|
||||
|
||||
AnalyticsHelper::logNotiziaImpression($articolo->id);
|
||||
AnalyticsHelper::logPageImpression();
|
||||
|
||||
GUIHandler::generateHtmlHeaders();
|
||||
|
||||
$found = false;
|
||||
if(array_key_exists("search", $_POST) && strcmp($_POST["search"], "")!=0){
|
||||
$searchParameters = strip_tags(PostHandler::get("search"));
|
||||
|
||||
$notizie = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
array("status"=>NotiziaModel::STATUS_ACCEPTED),
|
||||
array("sort"=>array("about.data"=>-1),"limit"=>10)
|
||||
);
|
||||
|
||||
if (sizeof($notizie)>0){
|
||||
$found=true;
|
||||
$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="searchResultsContainer">
|
||||
<?php
|
||||
if ($found){
|
||||
$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
|
||||
}
|
||||
}
|
||||
else{
|
||||
?>
|
||||
<div style="color:red;">Nessun articolo trovato con questi parametri di ricerca.</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="summaryRightBar">
|
||||
<?php GUIHandler::generateRightBannerBlock();?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
GUIHandler::generateFooter();
|
||||
?>
|
||||
</div>
|
||||
@@ -33,18 +33,20 @@ body{font-family:lato, arial;}
|
||||
margin:10px 10px 0px;
|
||||
}
|
||||
|
||||
.searchBar > input{
|
||||
.searchBar input{
|
||||
border-radius: 6px;
|
||||
border: none;
|
||||
padding: 5px 25px 5px 5px;
|
||||
}
|
||||
.searchBar > img{
|
||||
.searchBar img{
|
||||
width: 17px;
|
||||
right: 5px;
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
}
|
||||
#sendFormGlass{cursor:pointer;}
|
||||
|
||||
|
||||
.hiddenMenu{
|
||||
background-color: #139be5;
|
||||
@@ -322,8 +324,8 @@ body{font-family:lato, arial;}
|
||||
.articoloRightBar{vertical-align:top;}
|
||||
|
||||
|
||||
.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;}
|
||||
.searchResultsContainer, .archivioResults, .categorySummaryContainer{width:600px;padding:5px 10px 5px 0px;vertical-align:top;display:inline-block;}
|
||||
.searchResultsContainer > .notiziaContainer, .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;}
|
||||
|
||||
Reference in New Issue
Block a user