Current File : /home/users/barii/public_html/finansenl.com.pl/wodki/application/views/_partials/sortby.php
<script>
$(window).ready( function () {
	$('.filtr a').click( function() { 

		var opt = $(this).attr('rel');
	
		if( opt == 'sort_all' ) {
			$('#shipping').val(1);
			$('#shipping_no').val(1);
		}
		if( opt == 'sort_shipping' ) {
			$('#shipping').val(1);
			$('#shipping_no').val(0);
		}
		if( opt == 'sort_noshipping' ) {
			$('#shipping').val(0);
			$('#shipping_no').val(1);
		}

		$.ajax({
		  type: "POST",
		  url: "szukaj/ajax",
		  data: { kitchen_type_1 : $('#kitchen_type_1').val(), zone_id : $('#zone_id').val(), shipping: $('#shipping').val(), shipping_no: $('#shipping_no').val(), city_id: $('#city_id').val() }
		}).done(function(msg) {	
		
			var m  = msg.split('|||');
			$('#results_ajax').html(m[0]);
			var places = m[1];
			
		  <!-- 
			var mapa; 	// obiekt globalny
			var dymek; 	// okno z informacjami
			var geokoder = new google.maps.Geocoder();
						
			function mapaStart2()  
			{  
				var wspolrzedne = new google.maps.LatLng(53.429805, 14.537883);
				var opcjeMapy = {
					zoom: 15,
					center: wspolrzedne,
					mapTypeId: google.maps.MapTypeId.ROADMAP,
					disableDefaultUI: false
				};
				mapa = new google.maps.Map(document.getElementById("mapka"), opcjeMapy); 			
				dymek = new google.maps.InfoWindow();
				
				var places_arr  = places.split('***');
				for(i=0;i<places_arr.length-1;i++ ){
					geokoder.geocode({address: places_arr[i]}, obslugaGeokodowania2); 
				}
				//
				
				
				//geokoder.geocode({address: 'Szczecin, Krzywoustego 20'}, obslugaGeokodowania);
			}  
			-->
		
		  function obslugaGeokodowania2(wyniki, status)
			{
	
				var rozmiar 			= new google.maps.Size(32,32);
				var rozmiar_cien 		= new google.maps.Size(59,32);
				var punkt_startowy		= new google.maps.Point(0,0);
				var punkt_zaczepienia	= new google.maps.Point(16,16);
				
				var ikona	= new google.maps.MarkerImage("http://<?php echo $_SERVER['HTTP_HOST']; ?>/html/images/food.png", rozmiar, punkt_startowy, punkt_zaczepienia);
				var cien 	= new google.maps.MarkerImage("http://maps.google.com/mapfiles/kml/pal2/icon32s.png", rozmiar_cien, punkt_startowy, punkt_zaczepienia);
				
				if(status == google.maps.GeocoderStatus.OK)
				{
					mapa.setCenter(wyniki[0].geometry.location);
					var marker = new google.maps.Marker(
						{
							map: 		mapa, 
							position: 	wyniki[0].geometry.location,
							icon: 		ikona,
							shadow: 	cien,
							title: wyniki[0].formatted_address,
							clickable: true
						}
					);
					
					
					
					dymek.open(mapa, marker);
				//	dymek.setContent('<strong>Poszukiwany adres</strong><br />Szczecin, Krzywoustego 23');
				}
				else
				{
					//alert("Nie znalazłem podanego adresu!");
				}
			}
			
			mapaStart2();
		  
		  
		});
		
		
		
	
	});

	$('.customMe7').change(function() {
		$.ajax({
		  type: "POST",
		  url: "szukaj/ajax",
		  data: { kitchen_type_1 : $('#kitchen_type_1').val(), zone_id : $('#zone_id').val(), shipping: $('#shipping').val(), shipping_no: $('#shipping_no').val(), city_id: $(this).val() }
		}).done(function(msg) {	
		  
		  
		  var m  = msg.split('|||');
			$('#results_ajax').html(m[0]);
			var places = m[1];
			
		  <!-- 
			var mapa; 	// obiekt globalny
			var dymek; 	// okno z informacjami
			var geokoder = new google.maps.Geocoder();
						
			function mapaStart2()  
			{  
				var wspolrzedne = new google.maps.LatLng(53.429805, 14.537883);
				var opcjeMapy = {
					zoom: 15,
					center: wspolrzedne,
					mapTypeId: google.maps.MapTypeId.ROADMAP,
					disableDefaultUI: false
				};
				mapa = new google.maps.Map(document.getElementById("mapka"), opcjeMapy); 			
				dymek = new google.maps.InfoWindow();
				
				var places_arr  = places.split('***');
				for(i=0;i<places_arr.length-1;i++ ){
					geokoder.geocode({address: places_arr[i]}, obslugaGeokodowania2); 
				}
				//
				
				
				//geokoder.geocode({address: 'Szczecin, Krzywoustego 20'}, obslugaGeokodowania);
			}  
			
			  function obslugaGeokodowania2(wyniki, status)
			{
	
				var rozmiar 			= new google.maps.Size(32,32);
				var rozmiar_cien 		= new google.maps.Size(59,32);
				var punkt_startowy		= new google.maps.Point(0,0);
				var punkt_zaczepienia	= new google.maps.Point(16,16);
				
				var ikona	= new google.maps.MarkerImage("http://<?php echo $_SERVER['HTTP_HOST']; ?>/html/images/food.png", rozmiar, punkt_startowy, punkt_zaczepienia);
				var cien 	= new google.maps.MarkerImage("http://maps.google.com/mapfiles/kml/pal2/icon32s.png", rozmiar_cien, punkt_startowy, punkt_zaczepienia);
				
				if(status == google.maps.GeocoderStatus.OK)
				{
					mapa.setCenter(wyniki[0].geometry.location);
					var marker = new google.maps.Marker(
						{
							map: 		mapa, 
							position: 	wyniki[0].geometry.location,
							icon: 		ikona,
							shadow: 	cien,
							title: wyniki[0].formatted_address,
							clickable: true
						}
					);
					
					
					
					dymek.open(mapa, marker);
				//	dymek.setContent('<strong>Poszukiwany adres</strong><br />Szczecin, Krzywoustego 23');
				}
				else
				{
					//alert("Nie znalazłem podanego adresu!");
				}
			}
			-->
			
			mapaStart2();
			
		});	
	});

});

</script>

<div class="filtr">Filtracja: &nbsp; 
	<a onclick="return false;" rel="sort_all" href="#" class="active_filtr">Wszystkie</a> 
	<a onclick="return false;" rel="sort_shipping" href="#">Dostawa</a> 
	<a onclick="return false;" rel="sort_noshipping" href="#">Bez dostawy</a>
	<form action="szukaj" method="post" name="form_filter">
		<input type="hidden" id="shipping" name="shipping" value="1"/>
		<input type="hidden" id="shipping_no" name="shipping_no" value="1"/>
		<input type="hidden" id="zone_id" name="zone_id" value="<?php if(!empty( $_REQUEST['zone_id'])) echo addslashes($_REQUEST['zone_id']); ?>"/>
		<input type="hidden" id="kitchen_type_1" name="kitchen_type_1" value="<?php if(!empty( $_POST['kitchen_type_1'])) echo addslashes($_POST['kitchen_type_1']); ?>"/>
		<select id="city_id" class="customMe7" name="city_id">
			<option value="">Wybierz miasto</option>
			<?php 
				$orm_city = ORM::Factory('city')->join('users','RIGHT')->on('users.city_id','=', 'city.id');
				if(!empty( $_REQUEST['zone_id'])) {
				$zone_id = addslashes($_REQUEST['zone_id']);
				$orm_city = $orm_city->where('city.zone_id','=', Model_Zone::get_id($zone_id));
				}
				
				$orm_city = $orm_city->group_by('title')->order_by('title','asc')->find_all();
	
			?>
			<?php foreach( $orm_city as $c ) : ?>
			<option value="<?php echo $c->title; ?>"><?php echo $c->title; ?></option>
			<?php endforeach; ?>
		</select>
	</form>
</div>
<?php /*
		<form action="" name="f_sort" method="post">
				
				<fieldset class="sort-by">
					<input type="hidden" name="view-mode" value="<?php echo !empty( $_POST['view-mode'] ) ? addslashes($_POST['view-mode']) : 'simple'; ?>"/>
					<input type="hidden" name="type" value="<?php echo !empty( $_POST['type'] ) ? addslashes($_POST['type']) : 7; ?>"/>
					<input type="hidden" name="keyword-f" value="<?php echo !empty( $_POST['keyword-f'] ) ? addslashes($_POST['keyword-f']) : ''; ?>"/>
					<input type="hidden" name="disciplines_id_2" value="<?php echo !empty( $_POST['disciplines_id_2'] ) ? addslashes($_POST['disciplines_id_2']) : ''; ?>"/>
					<input type="hidden" name="price_from_2" value="<?php echo !empty( $_POST['price_from_2'] ) ? addslashes($_POST['price_from_2']) : ''; ?>"/>
					<input type="hidden" name="price_to_2" value="<?php echo !empty( $_POST['price_to_2'] ) ? addslashes($_POST['price_to_2']) : ''; ?>"/>
					<input type="hidden" name="zone_id_2" value="<?php echo !empty( $_POST['zone_id_2'] ) ? addslashes($_POST['zone_id_2']) : ''; ?>"/>
					<input type="hidden" name="city_id_2" value="<?php echo !empty( $_POST['city_id_2'] ) ? addslashes($_POST['city_id_2']) : ''; ?>"/>
					<input type="hidden" name="keyword_1" value="<?php echo !empty( $_POST['keyword_1'] ) ? addslashes($_POST['keyword_1']) : ''; ?>"/>
					<input type="hidden" name="keyword" value="<?php echo !empty( $_POST['keyword'] ) ? addslashes($_POST['keyword']) : ''; ?>"/>
					<input type="hidden" name="keyword_1" value="<?php echo !empty( $_POST['keyword_1'] ) ? addslashes($_POST['keyword_1']) : ''; ?>"/>
					<input type="hidden" name="keyword_2" value="<?php echo !empty( $_POST['keyword_2'] ) ? addslashes($_POST['keyword_2']) : ''; ?>"/>
					<input type="hidden" name="keyword_3" value="<?php echo !empty( $_POST['keyword_3'] ) ? addslashes($_POST['keyword_3']) : ''; ?>"/>
					<input type="hidden" name="keyword_4" value="<?php echo !empty( $_POST['keyword_4'] ) ? addslashes($_POST['keyword_4']) : ''; ?>"/>
					<input type="hidden" name="keyword_5" value="<?php echo !empty( $_POST['keyword_5'] ) ? addslashes($_POST['keyword_5']) : ''; ?>"/>
					<input type="hidden" name="keyword_6" value="<?php echo !empty( $_POST['keyword_6'] ) ? addslashes($_POST['keyword_6']) : ''; ?>"/>
					<input type="hidden" name="keyword_7" value="<?php echo !empty( $_POST['keyword_7'] ) ? addslashes($_POST['keyword_7']) : ''; ?>"/>
					<input type="hidden" name="price_from_4" value="<?php echo !empty( $_POST['price_from_4'] ) ? addslashes($_POST['price_from_4']) : ''; ?>"/>
					<input type="hidden" name="price_to_4" value="<?php echo !empty( $_POST['price_to_4'] ) ? addslashes($_POST['price_to_4']) : ''; ?>"/>
					
					<input type="hidden" name="zone_id_4" value="<?php echo !empty( $_POST['zone_id_4'] ) ? addslashes($_POST['zone_id_4']) : ''; ?>"/>
					<input type="hidden" name="city_id_4" value="<?php echo !empty( $_POST['city_id_4'] ) ? addslashes($_POST['city_id_4']) : ''; ?>"/>
					<input type="hidden" name="disciplines_id_6" value="<?php echo !empty( $_POST['disciplines_id_6'] ) ? addslashes($_POST['disciplines_id_6']) : ''; ?>"/>
					<input type="hidden" name="price_from_6" value="<?php echo !empty( $_POST['price_from_6'] ) ? addslashes($_POST['price_from_6']) : ''; ?>"/>
					
					<input type="hidden" name="price_to_6" value="<?php echo !empty( $_POST['price_to_6'] ) ? addslashes($_POST['price_to_6']) : ''; ?>"/>
					<input type="hidden" name="zone_id_6" value="<?php echo !empty( $_POST['zone_id_6'] ) ? addslashes($_POST['zone_id_6']) : ''; ?>"/>
					<input type="hidden" name="city_id_6" value="<?php echo !empty( $_POST['city_id_6'] ) ? addslashes($_POST['city_id_6']) : ''; ?>"/>
					<input type="hidden" name="day_from_6" value="<?php echo !empty( $_POST['day_from_6'] ) ? addslashes($_POST['day_from_6']) : ''; ?>"/>
					<input type="hidden" name="month_from_6" value="<?php echo !empty( $_POST['month_from_6'] ) ? addslashes($_POST['month_from_6']) : ''; ?>"/>
					<input type="hidden" name="year_from_6" value="<?php echo !empty( $_POST['year_from_6'] ) ? addslashes($_POST['year_from_6']) : ''; ?>"/>
					<input type="hidden" name="day_to_6" value="<?php echo !empty( $_POST['day_to_6'] ) ? addslashes($_POST['day_to_6']) : ''; ?>"/>
					<input type="hidden" name="month_to_6" value="<?php echo !empty( $_POST['month_to_6'] ) ? addslashes($_POST['month_to_6']) : ''; ?>"/>
					<input type="hidden" name="year_to_6" value="<?php echo !empty( $_POST['year_to_6'] ) ? addslashes($_POST['year_to_6']) : ''; ?>"/>
					
					<label for="f1">sortuj wg:</label>
				
					<select name="sortby" class="mark" onchange="document.forms['f_sort'].submit()">
						<option value="id" <?php if( !empty( $_POST['sortby'] ) AND  $_POST['sortby'] == "id") echo "SELECTED='SELECTED'"; ?>>daty dodania</option>
						<option value="mark" <?php if( !empty( $_POST['sortby'] ) AND  $_POST['sortby'] == "mark") echo "SELECTED='SELECTED'"; ?>>ocena</option>
						<option value="firstname" <?php if( !empty( $_POST['sortby'] ) AND  $_POST['sortby'] == "firstname") echo "SELECTED='SELECTED'"; ?>>nazwa</option>
						<option value="price" <?php if( !empty( $_POST['sortby'] ) AND  $_POST['sortby'] == "price") echo "SELECTED='SELECTED'"; ?>>cena</option>
						<option value="city_id" <?php if( !empty( $_POST['sortby'] ) AND  $_POST['sortby'] == "city_id") echo "SELECTED='SELECTED'"; ?>>miejscowość</option>
					</select>
					<select name="direct" class="desc" onchange="document.forms['f_sort'].submit()">
						<option value="desc" <?php if( !empty( $_POST['direct'] ) AND  $_POST['direct'] == "desc") echo "SELECTED='SELECTED'"; ?>>majeląco</option>
						<option value="asc" <?php if( !empty( $_POST['direct'] ) AND  $_POST['direct'] == "asc") echo "SELECTED='SELECTED'"; ?>>rosnąco</option>
					</select>
					<input type="submit" value="" style="display: none;"/>
				</fieldset>
		</form>
		*/ ?>