<?php
//<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
//sigurnost:
if (!defined('SIGURICA')) die('Nedozvoljen pristup!');
if ($prava_pristup_vijesti!=1) die('Nedozvoljen pristup!');
if ($prava_prava_vijesti_kat!=1) die('Nedozvoljen pristup!');
?>
<script type="text/javascript">
$(document).ready(function(){
//JQuery ready is quicker than onload
$(".stripeMe tr").mouseover(function() {$(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");});
$(".stripeMe tr:even").addClass("alt");
});
</script>
<div id="main_content">
<h1>Uređivanje kategorija vijesti</h1>
<a href="glavna.php?modul=vijesti&amp;akcija=form_insert_new_kategorija">Unos nove kategorije za vijesti</a><br />
<?php
//izlistaj sve kategorije


$sql99="select * from b7_news_kategorija order by id_kategorija asc";
$rez99=mysql_query($sql99,$conn);
$num99=mysql_num_rows($rez99);
if ($num99>0) {
	?>   
    <table class="stripeMe" cellpadding="5" cellspacing="1" border="0">
    <tr>
    <th>ID</th>
    <th>Naslov</th>
    <th>Link</th>
    <th>Opis</th>
    <th>Kratka</th>
    <th>Znakovi</th>
    <th>Textarea</th>
    <th>Napredno</th>
    <th>Autor</th>
    <th>Slike</th>
    <th>Thumb_x</th>
    <th>Thumb_y</th>
    <th>Big_x</th>
    <th>Big_y</th>       
    <th colspan="2">Akcija</th>
    <?php if ($log_username_id=='1') {	?>
    <th>Zadnja promjena</th>
    <?php	}	?>
    </tr>
    <?php
	$cur99=1;
	while ($num99>=$cur99) {
		$row99=mysql_fetch_array($rez99);	
		$id_kategorija=$row99['id_kategorija'];
		$naslov=$row99['naslov'];
		$link=$row99['link'];
		$opis=$row99['opis'];
		$kratka=$row99['kratka'];
		$kratka_znakovi=$row99['kratka_znakovi'];
		$tekstarea=$row99['tekstarea'];
		$linkovi=$row99['linkovi'];
		$autor=$row99['autor'];
		$slika=$row99['slika'];
		$thumb_sirina=$row99['thumb_sirina'];
		$thumb_visina=$row99['thumb_visina'];
		$big_sirina=$row99['big_sirina'];
		$big_visina=$row99['big_visina'];
		$user=$row99['user'];
		$datum=$row99['datum'];
		
		$kr_q[0]='ne';
		$kr_q[1]='da';
		$te_q[0]='ne';
		$te_q[1]='da';
		
		$li_q[0]='ne';
		$li_q[1]='da';
		
		$au_q[0]='ne';
		$au_q[1]='da';
		
		$sl_q[0]='ne';
		$sl_q[1]='da';
		?>
		<tr>
        <td><?php echo $id_kategorija; ?></td>
    	<td><?php echo $naslov; ?></td>
        <td><?php echo $link; ?></td>        
        <td><?php echo substr($opis, 0, 20); ?>...</td>
        <td><?php echo $kr_q[$kratka]; ?></td>
        <td><?php echo $kratka_znakovi; ?></td>
        <td><?php echo $te_q[$tekstarea]; ?></td>
        <td><?php echo $li_q[$linkovi]; ?></td>
        <td><?php echo $au_q[$autor]; ?></td>
        <td><?php echo $sl_q[$slika]; ?></td>
        <td><?php echo $thumb_sirina; ?></td>
        <td><?php echo $thumb_visina; ?></td>
        <td><?php echo $big_sirina; ?></td>
        <td><?php echo $big_visina; ?></td>        
        <td><a href="glavna.php?modul=vijesti&amp;akcija=form_edit_kategorija&amp;id_kategorija=<?php echo $id_kategorija;?>">Promjeni</a></td>        
		<td><a href="glavna.php?modul=sadrzaj&amp;akcija=delete_kategorija&amp;id_kategorija=<?php echo $id_kategorija;?>" onclick="return verify()">Obriši</a></td>
		<?php if ($log_username_id=='1') {	?>
        <td><?php echo $user.' - '.date_format(date_create($datum), 'd.m.Y'); ?></td>
    	<?php	}	?>
        </tr>
		<?php
		$cur99++;
	}
	?>
    </table>    
    <?php
} else {
	?>
    <p>Trenutno nema niti jedne kategorije vijesti u bazi????</p>
	<?php
}
?>
</div>