0)
$strRicerca = ' a ' . $strRicerca;
if ($_REQUEST['type'] != '') {
if ($strBaseQuery != "")
$strBaseQuery .= " AND";
$strBaseQuery .= " type_" . $_REQUEST['type'] . " = 1";
}
switch ($_REQUEST['type']) {
case 'consigliato':
$strRicerca = 'Ristoranti consigliati' . $strRicerca;
break;
case 'pesce':
$strRicerca = 'Ristoranti di pesce' . $strRicerca;
break;
case 'carne':
$strRicerca = 'Ristoranti di carne' . $strRicerca;
break;
case 'nouvelle':
$strRicerca = 'Cucina creativa' . $strRicerca;
break;
case 'trattoria':
$strRicerca = 'Trattorie' . $strRicerca;
break;
case 'osteria':
$strRicerca = 'Osterie' . $strRicerca;
break;
case 'pizzeria':
$strRicerca = 'Pizzerie' . $strRicerca;
break;
case 'agriturismo':
$strRicerca = 'Agriturismi' . $strRicerca;
break;
case 'enoteca':
$strRicerca = 'Enoteche' . $strRicerca;
break;
case 'etnico':
$strRicerca = 'Ristoranti etnici' . $strRicerca;
break;
default:
$strRicerca = 'Ristoranti' . $strRicerca;
}
if ($_REQUEST['nome'] != '') {
if ($strBaseQuery != "")
$strBaseQuery .= " AND";
$strBaseQuery .= " nome LIKE '%" . mysql_real_escape_string($_REQUEST['nome']) . "%'";
$strRicerca .= ' con "' . htmlentities(stripslashes($_REQUEST['nome'])) . '" nel nome';
}
// Manage paging
$blnNewSearch = true;
$intCount = 0; // Numero totale di ristoranti rispondenti alla ricerca
$intNorm = 0; // Numero ristoranti sottili rispondenti alla ricerca
$intLarge = 0; // Numero ristoranti grossi, ma senza scheda (priorita' 1), rispondenti alla ricerca
$intBigSpace = 3; // I ristoranti grossi o con scheda occupano 3 posti
$intPosition = 0;
$intPaging = 15; // Massimo numero di ristoranti per pagina
if (isset($_REQUEST['count'])) {
$intCount = (int) $_REQUEST['count'];
$intNorm = (int) $_REQUEST['norm'];
$blnNewSearch = false;
}
if (isset($_REQUEST['position'])) {
$intPosition = (int) $_REQUEST['position'];
if ($intPosition < 0) $intPosition = 0;
$blnNewSearch = false;
}
if ($blnNewSearch) {
// Determine the number of total documents
$strQuery = "SELECT count(*) AS total FROM ristoranti";
if (strlen($strBaseQuery) > 0)
$strQuery .= " WHERE" . $strBaseQuery;
$rstTotal = mysql_query($strQuery)
or die('Query ' . $strQuery . ' fallita: ' . mysql_error());
$recTotal = mysql_fetch_array($rstTotal, MYSQL_ASSOC);
mysql_free_result($rstTotal);
$intCount = (int) $recTotal['total'];
// Determine the number of large documents
$strQuery = "SELECT count(*) AS total FROM ristoranti WHERE priority = 1";
if (strlen($strBaseQuery) > 0)
$strQuery .= " AND" . $strBaseQuery;
$rstTotal = mysql_query($strQuery)
or die('Query ' . $strQuery . ' fallita: ' . mysql_error());
$recTotal = mysql_fetch_array($rstTotal, MYSQL_ASSOC);
mysql_free_result($rstTotal);
$intLarge = (int) $recTotal['total'];
// Determine the number of normal documents
$strQuery = "SELECT count(*) AS total FROM ristoranti WHERE priority = 0";
if (strlen($strBaseQuery) > 0)
$strQuery .= " AND" . $strBaseQuery;
$rstTotal = mysql_query($strQuery)
or die('Query ' . $strQuery . ' fallita: ' . mysql_error());
$recTotal = mysql_fetch_array($rstTotal, MYSQL_ASSOC);
mysql_free_result($rstTotal);
$intNorm = (int) $recTotal['total'];
}
$intMaxSponsor = 2; // Massimo numero di sponsor per pagina
$strQuery = "SELECT DISTINCT sponsor.* FROM sponsor ";
if (strlen($strLocalitaXAree) > 0)
$strQuery .= ", sponsorxaree, localitaxaree WHERE" . $strLocalitaXAree . " AND localitaxaree.area = sponsorxaree.area AND sponsorxaree.sponsor = sponsor.id";
else
$strQuery .= "WHERE NOT EXISTS (SELECT area FROM sponsorxaree WHERE sponsor = sponsor.id)";
$strQuery .= " ORDER BY sponsor.ordine LIMIT 0, " . $intMaxSponsor;
$rstSponsor = mysql_query($strQuery)
or die('Query ' . $strQuery . ' fallita: ' . mysql_error());
$i = 0;
while ($recSponsor = mysql_fetch_array($rstSponsor, MYSQL_ASSOC)) {
if ($i == 0) {
?>
0)
echo 'vspace="3"';
echo '> '; if (strlen($recSponsor['link']) > 0) echo ''; echo ' '; } // Free the ResultSet mysql_free_result($rstSponsor); if ($i > 0) { ?> |
![]() |
![]() | ';
echo '';
if (strlen($rec['thumb1']))
echo '![]() '; echo '' . xmlentities($rec['descr']) . ' '; echo 'Piatto tipico: ' . xmlentities($rec['piatto']) . ' '; echo 'Tipo di cucina: ' . xmlentities($rec['cucina']) . ' '; echo 'Tel. ' . xmlentities($rec['telefono']) . ' '; echo xmlentities($rec['indirizzo']) . ' - ' . xmlentities($rec['localita']) . ' ' . xmlentities($rec['comune']) . ' '; echo 'Chiuso: ' . xmlentities($rec['chiusura']) . ' | ';
echo '![]() | ';
echo '';
$i += $intBigSpace;
}
else {
// Ristorante normale
if ($norm == 0) { // E' il primo
if ($i > 0) // Prima c'erano dei ristoranti grossi o con scheda
echo '
![]() | ![]() | |
' . xmlentities($rec['nome']) . ' ' . xmlentities($rec['descr']) . ' ' . xmlentities($rec['localita']) . ' ' . xmlentities($rec['comune']) . ' - ' . xmlentities($rec['indirizzo']) . ' Tel. ' . xmlentities($rec['telefono']); if (strlen($rec['chiusura']) > 0) echo ' Chiuso: ' . xmlentities($rec['chiusura']); echo ' '; $norm++; } if ($i+1 > $intPaging) break; } if (($norm == 0) && ($i > 0)) // Chiudo i ristoranti grossi o con scheda echo ' |
![]() |
Nessun ristorante trovato con queste caratteristiche | ![]() |