Current File : /home/users/barii/public_html/finansenl.com.pl/wodki/admin/tablice/katalog.php

<?php

   /*$files = array();
                $iterator = new DirectoryIterator('img/mini/makiety/'.$_POST['kat']);
                    foreach ($iterator as $fileinfo) {
                        if ($fileinfo->isFile()) {
                            $files[] = array($fileinfo->getFilename());
                        }
                    }
                    sort($files);
                        foreach($files as $fileinfo){                                                       
                            echo '<img src="img/mini/makiety/'.$fileinfo[0].'" style="width:100px;margin:10px;" rel="'.$fileinfo[0].'"></a>';
                        }
     */
     
    $items = array();
		
		$path = 'img/mini/makiety/'.$_POST['kat'];
	
		if( is_dir( $path ) ) {
			$dir=opendir($path);
			
			
			while($file_name=readdir($dir))
			{
				if(($file_name!=".")&&($file_name!="..")) {
					$items[$file_name] = $file_name;
					$max_page++;
				}
			}
		}
                                    
		
		sort($items);
    
    $divid = 5;
		                           
    //print_r($items);
		$max_page = floor($max_page/$divid);
    
    
    	$i=1; $num_lay=1; foreach( $items as $item ) : 
			if( $i == 1 ) : 
			$hid = $num_lay > 1  ? 'style="display: none;"' : '';
			$info .= '<div class="bootles_layer bootle_lay'.$num_lay.'" '.$hid.'>';
			endif;
			
			
						$info .= '<img src="/'.$path.$item.'" rel="'.$_POST['kat'].$item.'"/>';

				if( $i == $divid ) : $i = 0; $num_lay++; 
					$info .= '</div>';
					
					endif; 
					$i++;  endforeach; 
          
          echo '<a href="#" class="prev">&nbsp;</a>
          <a href="#" class="next">&nbsp;</a>'.$info;  ?> 


<script>
          jQuery( document ).ready(function($) {  
          
                    $("#wzory img").hover(function(){
                       $("#etykieta").html('<img src="img/mini/makiety/'+$(this).attr('rel')+'">');
                    }); 
                    
                    $("#wzory img").click(function(){
                        window.location.href = "edycja.php?wzor="+$(this).attr('rel');
                    });      
                    
  		var num = 1;
		var max_page = <?php echo $max_page;?>;                  
                        
  $('.prev').click( function() {
			
			if( (num-1) > 0 ) {
				num--;
				$('.bootles_layer').hide();
        $(".bootle_lay"+num).css({
          display:'block',
          opacity: 0,
          left:"-500px"
          });        
				$('.bootle_lay'+num).animate({
    opacity: 1,
    left: "0"
  },500);
				$('.pagg a').removeClass('active');
				$('.p_'+num).addClass('active');
			} 
			return false;
		});
		$('.next').click( function() {
      
		
			if( (num+1) <= max_page ) {
				num++;          
		
				$('.bootles_layer').hide();  
        $(".bootle_lay"+num).css({
          display:'block',
          opacity: 0,
          left:"500px"
          });        
				$(".bootle_lay"+num).animate({
    opacity: 1,
    left: "0"
  },500);
			   
            
        

				
				$('.pagg a').removeClass('active');
				$('.p_'+num).addClass('active');
			} 
			return false;
		});
                     
          });
  </script>