<?
$_GET['cachewalker'] = NULL;
include ("funkcje/cache_start.php");
include ("funkcje/funkcje.php");
foreach ($_GET as $klucz => $wartosc)
{
if (!checkField
($_GET[$klucz])) {header ("Location: index.php"); exit;} }
#przygotowanie zmiennych
foreach ($_GET as $klucz => $wartosc)
{
$link[$klucz] = przygotoj($_GET[$klucz]);
}
if ($link['kraj'])
{
if (is_numeric($link['kraj'])) $dodaj = $dodaj.' and offers."countryId"='.$link['kraj'].' '; }
if ($link['miejscowosc'])
{
if (is_numeric($link['miejscowosc'])) $dodaj = $dodaj.' and offers."cityId"='.$link['miejscowosc'].' '; }
if ($link['obiekt'])
{
if (is_numeric($link['obiekt'])) $dodaj = $dodaj.' and offers."cantonmentTypeId"='.$link['obiekt'].' '; }
if ($link['dojazd'])
{
if (is_numeric($link['dojazd'])) $dodaj = $dodaj.' and offers."journeyTypeId"='.$link['dojazd'].' '; }
if ($link['typ'])
{
{
$tabela = ', "offerHasOfferType" ';
$dodaj = $dodaj.' and "offerHasOfferType"."offerId"=offers."offerId" and "offerHasOfferType"."offerTypeId"='.$link['typ'].' ';
}
}
$naglowek = "Tekst przykładowy tytułu";
include ("layout.php");
?>
<center>
<div class="wysz">
<form action="szukaj.php" method="get" style="margin:0px;padding:0px;">
<div><b>Wyszukiwarka</b></div>
<div style="margin:8px;">
<?
$warunek_dod = ' "serviceHasOffers"."serviceId"=40 and "serviceHasOffers"."offerId"=offers."offerId" ';
?>
<select name="kraj" onchange="getMiasto(this)">
<option value="">- kraj -</option>
<?
$sql = 'select distinct(countries.name) as kraj, countries."countryId"
from
offers, countries, "serviceHasOffers"
where
offers."isActive"=true and
countries."countryId"=offers."countryId" and '.$warunek_dod.' order by countries.name asc ';
for ($i=0;$i<$ilosc;$i++)
{
echo "<option value='".$re['countryId']."'>".$re['kraj']."</option>"; }
?>
</select>
<select name="miejscowosc" id="miejscowosc" style="width:200px;"><option value="">wybierz kraj</option></select>
<select name="obiekt">
<option value="">- rodzaj obiektu -</option>
<?
$sql = 'select distinct("cantonmentTypes"."cantonmentTypeId"), "cantonmentTypes".name as nocleg
from
offers, "cantonmentTypes", "serviceHasOffers"
where
offers."isActive"=true and
"cantonmentTypes"."cantonmentTypeId"=offers."cantonmentTypeId" and '.$warunek_dod.' order by "cantonmentTypes".name asc';
for ($i=0;$i<$ilosc;$i++)
{
echo "<option value='".$re['cantonmentTypeId']."'>".$re['nocleg']."</option>"; }
?>
</select><br /><br />
<select name="dojazd">
<option value="">- dojazd -</option>
<option value='2'>Bus</option>
<option value='3'>Dojazd własny</option>
<option value='4'>Pociąg</option>
<option value='1'>Lot</option>
</select>
<select name="typ">
<option value="">- typ oferty -</option>
<?
$sql = 'select distinct("offerTypes"."offerTypeId"), "offerTypes".name as typ
from
offers, "offerTypes", "serviceHasOffers"
where
offers."isActive"=true and '.$warunek_dod.' order by "offerTypes".name asc';
for ($i=0;$i<$ilosc;$i++)
{
echo "<option value='".$re['offerTypeId']."'>".$re['typ']."</option>"; }
?>
</select>
</div>
<div style="margin-top:12px;text-align:right;">
<input type="submit" name="go" value="szukaj">
</div>
</form>
</div>
<?
if ($page) $granica = $page * 30;
if (!$page) {$granica=0;$page=0;}
$sql = 'select count(offers."offerId")
from
offers, cities, countries, "cantonmentTypes"
where
offers."isActive"=true and
cities."cityId"=offers."cityId" and
countries ."countryId"=offers."countryId" and
"cantonmentTypes"."cantonmentTypeId"=offers."cantonmentTypeId" '.$dodaj.' and '.$warunek_dod.' ';
$strony = $ilosc_calk[0]/30;
$sql = 'select offers."offerId",offers.name,offers."galleryId",offers.description,offers."pictureId", cities.name as miasto, countries.name as kraj, "cantonmentTypes".name as nocleg, (select price from termins where termins."offerId"=offers."offerId" and termins."currencyId"=1 order by termins.price asc limit 1) as cena, (select "dateFrom" from termins where termins."offerId"=offers."offerId" and termins."dateFrom">\''.$dzis.'\' order by termins."dateFrom" asc limit 1) as terminod
from
offers, cities, countries, "cantonmentTypes", "serviceHasOffers"
where
offers."isActive"=true and
cities."cityId"=offers."cityId" and
countries ."countryId"=offers."countryId" and
"cantonmentTypes"."cantonmentTypeId"=offers."cantonmentTypeId" '.$dodaj.' and '.$warunek_dod.'
order by terminod,cena asc, offers."offerId" desc limit 15 offset '.$granica.' ';
if ($ilosc==0
) echo "Nie znaleziono ofert spełniających Twoje kryteria.";
for ($i=0;$i<$ilosc;$i++)
{
$temp = $i/2;
if (is_int($temp)) $back = "#ffffff"; else $back = "#f3f9fe";
$url = tworz_url($re['name'], $re['offerId']);
if (!$re['terminod'])
{
$sql = 'select "dateFrom" from termins where "offerId"='.$re['offerId'].' and "isActive"=true order by "dateFrom" desc limit 1';
if (!$datt['dateFrom']) $re['terminod'] = "-";
else $re['terminod'] = $datt['dateFrom'];
}
echo "<div class='oferta1'> <div class='oferta2'>";
echo "<table style='width:100%;' cellspacing='2' cellpadding='2'>"; <td width='110' valign='top'><a href='".$url.".html' class='none'>";
if (is_file("../img/gallery/".$re['galleryId']."/small".$re['pictureId'].".jpg")) echo "<img src='/gallery/".$re['galleryId']."/small".$re['pictureId'].".jpg' alt='".$re['miasto']."' border='0' width='120' height='90'>"; else echo "<img src='gfx/brak.png' alt=' ' border='0' />"; <td valign='top'>
<div style='line-height:19px;'>
<a href='".$url.".html' class='none'><b style='color:#b0d224;font-size:13px;'>".$re['name']."</b></a><br>
<div class='oferta3'>
Lokalizacja: <b>".$re['kraj']."</b> -> <b>".$re['miasto']."</b><br>
Obiekt: <b>".$re['nocleg']."</b>,<br>";
if ($re['cena']>=1
) echo "Cena od: <b>".$re['cena']."</b> PLN, <br>"; else
{
$sql = 'select price from termins where "offerId"='.$re['offerId'].' and "currencyId"=3 order by price asc limit 1';
if ($cena_eur['price']) echo "Cena od: <b>".$cena_eur['price']."</b> EUR, <br>"; else echo "Cena od: <b>-</b> <br>"; }
echo "Termin od: <b>".$re['terminod']."</b>"; <div style='text-align:right;'><a href='".$url.".html' style='color:#fe6e00;text-decoration:none;'>[zobacz]</a></div>
</td>
</tr>
</table>";
$opis = str_replace("<br />", " ", $re['description']); $opis = substr($opis, 0
, 370
); echo "<div class='ofertaopis'> ".$opis."...
</div><br style='clear:both;' /></div>";
}
if ($strony>1)
{
$pp = 0;
$start = 0;
$pp = $page/23;
$start = $page - 11;
if ($start<0) $start = 0;
if ($page<=9) $plus = 11 - $page;
else $plus = 0;
$temp = $page + 11 + $plus;
if ($temp>$strony) $end = $strony;
else $end = $temp;
for ($i=$start;$i<$end;$i++)
{
$j = $i+1;
if ($page==$i) echo " <b>[".$j."]</b> |"; else echo " <a href='szukaj.php?kraj=".$link['kraj']."&miejscowosc=".$link['miejscowosc']."&obiekt=".$link['obiekt']."&dojazd=".$link['dojazd']."&typ=".$link['typ']."&go=szukaj&page=".$i."' class='pages'>".$j."</a> |"; }
}
?>
</center>
<?
include ("layout_dol.php");
include ("funkcje/cache_end.php");
?>