Current File : /home/users/barii/public_html/finansenl.com.pl/wodki/application/views/artist/index.php
	
	<script>
		$(window).ready( function() {
			$('.item').hover( function() {
				var l_show = $(this).attr('rel');
				$('#'+l_show).show();
			},
			function() {
				var l_show = $(this).attr('rel');
				$('#'+l_show).hide();
			});
			
			$('.profile_description_show').click( function() {
				$('.profile_description').show();
				$('.profile_description_hide').show();
				$('.profile_description_show').hide();
			});
			
			$('.profile_description_hide').click( function() {
				$('.profile_description').hide();
				$('.profile_description_show').show();
			});
		});
	</script>
		<div id="profile_info">
			<div class="container">
				<div class="breadcrumb">
					<a href="#">STRONA GŁÓWNA</a> \ 
					<a href="#">ARTYŚCI</a> 
				</div><br style="clear:  both;"/>	
				<span class="title nomargin">Artyści</span>
				<div class="sort">
					SORTOWANIE<br/>
					<a href="Artist" <?php if( !empty( $sort ) AND $sort == 'username' AND empty($filtr) ) echo 'class="blue"'; ?>>WSZYSCY</a>&nbsp;&nbsp;|&nbsp;&nbsp;
					<a href="Artist?sort=id&direct=desc" <?php if( !empty( $sort ) AND $sort == 'id' ) echo 'class="blue"'; ?>>OSTATNIO DODANI</a>&nbsp;&nbsp;|&nbsp;&nbsp;
					<a href="Artist?sort=viewed&direct=desc" <?php if( !empty( $sort ) AND $sort == 'viewed' ) echo 'class="blue"'; ?>>POPULARNI</a>&nbsp;&nbsp;|&nbsp;&nbsp;
					<a href="Artist?sort=sold&direct=desc" <?php if( !empty( $sort ) AND $sort == 'sold' ) echo 'class="blue"'; ?>>NAJLEPIEJ SPRZEDAJĄCY</a>&nbsp;&nbsp;|&nbsp;&nbsp;
					<a href="Artist?filtr=print&filtr_value=1" <?php if( !empty( $filtr ) AND $filtr == 'print' ) echo 'class="blue"'; ?>>PRACE DO DRUKU</a>&nbsp;&nbsp;|&nbsp;&nbsp;
					<a href="Artist?filtr=manual&filtr_value=1" <?php if( !empty( $filtr ) AND $filtr == 'manual' ) echo 'class="blue"'; ?>>PRACE RĘCZNIE WYKONANE</a>
				</div>
			</div>
		</div>
		<div class="shadow">
			<div class="container">

				<form action="" method="get">
					<fieldset class="search">
						<label>WYSZUKAJ ARTYSTĘ</label>
						<input type="text" placeholder="NAZWA / SŁOWO KLUCZOWE" name="keyword" value="<?php echo $keyword; ?>"/>
						<input type="image" src="html/images/artpiece_08.png"/>
						<select id="categories_id" name="categories_id" class="small_i" onchange="form.submit();">
							<option value="">DZIEDZINA SZTUKI</option>
							<?php foreach( $categories as $row ) : ?>
							<option value="<?php echo $row->id; ?>" <?php if( !empty( $categories_id ) AND $row->id == $categories_id) echo 'SELECTED="SELECTED"'; ?>><?php echo $row->title; ?></option>
							<?php endforeach; ?>
						</select>
						<select id="techniques_id" name="techniques_id" class="small_i" onchange="form.submit();">
							<option value="">TECHNIKA WYKONANIA</option>
							<?php foreach( $techniques as $row ) : ?>
							<option value="<?php echo $row->id; ?>" <?php if( !empty( $techniques_id ) AND $row->id == $techniques_id) echo 'SELECTED="SELECTED"'; ?>><?php echo $row->title; ?></option>
							<?php endforeach; ?>
						</select>
						<select id="topics_id" name="topics_id" class="small_i" onchange="form.submit();">
							<option value="">TEMATYKA</option>
							<?php foreach( $topics as $row ) : ?>
							<option value="<?php echo $row->id; ?>" <?php if( !empty( $topics_id ) AND $row->id == $topics_id) echo 'SELECTED="SELECTED"'; ?>><?php echo $row->title; ?></option>
							<?php endforeach; ?>
						</select>
						
					</fieldset>
				</form>
			</div>
		</div>
		
		<div class="container">
		<?php if( $artists->count() == 0 ) : ?>
			<p>Wyszukiwana fraza nie została przypisana do żadnego z artystów w naszej bazie. Spróbuj ponownie znaleźć interesującego Cię artystę, wpisując inną frazę.</p>
		<?php endif; ?>
			<?php echo $pagination->render(); ?>
			<?php foreach( $artists as $artist ) : ?>
			<div class="artist_item">
				<a href="Artist/show/<?php echo $artist->id; ?>"><img src="/image.php/image-name.jpg?width=96&amp;height=96&amp;cropratio=1:1&amp;image=/uploads/user/images/<?php echo $artist->logo; ?>" alt="" class="thumb_a"/></a>
				<span class="artist_title">
					<?php echo ucfirst($artist->username); ?><br/>
					<a href="Artist/show/<?php echo $artist->id; ?>">ZOBACZ PROFIL</a>
				</span>	
				<br style="clear: both;"/>
				<?php
				$i=0;
				$artist_items = ORM::Factory('item');
							if( !empty( $filtr ) AND $filtr == "manual" ) 
								$artist_items = $artist_items->where('manual','=', 1);
							if( !empty( $filtr ) AND $filtr == "print" ) 
								$artist_items = $artist_items->where('print','=', 1);
							if( !empty( $categories_id ) ) 
								$artist_items = $artist_items->where('categories_id','=', $categories_id);
							if( !empty( $techniques_id ) ) 
								$artist_items = $artist_items->where('techniques_id','=', $techniques_id);
							if( !empty( $topics_id ) ) {
								$artist_items = $artist_items->join('item_topic_links','LEFT')
								->on('item_topic_links.id', '=', 'item.topics_id')
								->join('item_topics','LEFT')
								->on('item_topics.id', '=', 'item_topic_links.topics_id')
								->where('item_topic_links.topics_id','=', $topics_id);
								//$artist_items = $artist_items->where('topics_id','=', $topics_id);
							}	
							
							
							if( !empty( $keyword ) ) {
									$artist_items = $artist_items
									->join('item_type_links','LEFT')
									->on('item_type_links.id', '=', 'item.types_id')
									->join('item_types','LEFT')
									->on('item_types.id', '=', 'item_type_links.types_id')
									->join('item_topic_links','LEFT')
									->on('item_topic_links.id', '=', 'item.topics_id')
									->join('item_topics','LEFT')
									->on('item_topics.id', '=', 'item_topic_links.topics_id')
									->join('item_categories','LEFT')
									->on('item_categories.id', '=', 'item.categories_id')
									->join('item_techniques','LEFT')
									->on('item_techniques.id', '=', 'item.techniques_id')
					
										->where('item.can_own_photo','=', 0)
										->and_where_open()
										->where('item_categories.title','LIKE', '%'.$keyword.'%')
										->or_where('item_techniques.title','LIKE', '%'.$keyword.'%')
										->or_where('item_topics.title','LIKE', $keyword.'%')
										->or_where('item_types.title','LIKE', $keyword.'%')
										->or_where('item.tags','LIKE', '%'.$keyword.'%')
										->or_where('item.title','LIKE', '%'.$keyword.'%')
										->and_where_close();
													
								}
			
								$artist_items = $artist_items
								->where('item.status', '=', 1)
								->and_where_open()
									->where('user_id','=', $artist->parent)
									->or_where('user_id','=', $artist->id)
									->or_where('owner_id','=', $artist->id)
								->and_where_close()
								->limit(12)
								->find_all();
								
				foreach( $artist_items as $row ) : $i++;
				?>
				<a href="Artist/show/<?php echo $artist->id; ?>"><img src="/image.php/image-name.jpg?width=95&amp;height=95&amp;cropratio=1:1&amp;image=/<?php echo $row->thumb; ?>" alt=""/></a>
				<?php endforeach; ?>
				<?php for( $j=$i; $j<12; $j++ ) : ?>
				<a href="Artist/show/<?php echo $artist->id; ?>"><img src="html/images/no_pic.jpg" alt=""/></a>
				<?php endfor; ?>
			</div>
		<?php endforeach; ?>	
		<br style="clear: both;"/>
			<?php echo $pagination->render(); ?>
			
		</div>