<?php	
	include('../../includes/db.php'); 
	include('_config.php');
?>
<div id="right_column">
<? adminBreadcrumbs($modulePath,$moduleTable,$moduleTitle,'list'); ?>
      
<div class="right_bg">        
<h3>Lista</h3>


<!--table-->  
<div class="table">

<table class="pagetable" width="100%" cellspacing="0" >
<thead>
  <tr>
    <th width="50">Tydzień</th>
	<th>Nazwa</th>
    <th colspan="3"><div align="center">Opcje</div></th>
  </tr>
</thead>
<tbody>
<?php
	$first= mysql_real_escape_string($_REQUEST['first']); 
	if (empty($first)) { $first = 0; }
	$ltmp = $settings['adminResults'];
	
	// zapytanie zlicza ile jest rekordow w bazie, potrzebne do porcjowania
	$sql= "SELECT * FROM `$moduleTable` ORDER by `week`";
	$sql2=$sql."LIMIT $first,$ltmp; ";
	
	$result = mysql_query($sql2) or die('Blad zapytania: '.mysql_error()); 
	
	$i=0;
	$count = mysql_num_rows(mysql_query($sql));
	$count = $count/$ltmp;
	$ile = ceil($count);
	
	if ($count==0){
	echo "
	  <tr>
		<td colspan='6'>Brak wyników.</td>
	  </tr>
	  ";
	}					
	
	while($row = mysql_fetch_array($result)) {
	
	$y++;
	$rest= $y % 2;				
	if ($rest == 0) {?>
	<tr class="row1" id="item<? echo $row[id]; ?>" onmouseover="this.className='row1hover';" onmouseout="this.className='row1';">
	<?php } else { ?>
	<tr class="row2" id="item<? echo $row[id]; ?>" onmouseover="this.className='row2hover';" onmouseout="this.className='row2';">
	<?php } ?>
        <td><?php echo $row['week'];?></td>
        <td><?php echo $row['title'];?></td>
        <td width="8"><? generateCMSitem('edit',  $moduleTable, $row['id']); ?></td>
        <td width="8"><? generateCMSitem('delete',$moduleTable, $row['id']); ?></td>        
  </tr>
<?php }?>
</tbody>
</table>
                
                  </div>
                  </div>
        
        <div class="right_bottom"></div>
        
        <div class="pagination">   
		<?
         $link=$moduleHttp."/$moduleTable.list.php?first=";
         include($basepath.'/admin/includes/pagination.php');
        
        ?>
        </div> 
        
        
           



        </div>
      </div> 
</div>
<? include($basepath.'/admin/templates/footer.php'); ?>