<?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!');


?>
<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 vijesti u kategoriji <em><?php echo $kategorija_naslov; ?></em></h1>
<br />
<a class="gray_normal toggleopacity" href="glavna.php?modul=vijesti&amp;akcija=form_insert_new_news&amp;id_kat=<?php echo $id_kat; ?>">Unos nove vijesti u bazu</a><br />
<?php
//izlistaj vijesti iz aktivne kategorije
$sql99="select id,naslov,datum_prikaz,dan,datum,user from b7_news where id_kategorija='$id_kat' order by datum_prikaz desc, id desc";
$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>Datum</th>    
    <th <?php if ($kategorija_linkovi==1) echo 'colspan="4"'; else echo 'colspan="2"' ?>>Akcija</th>
    <th>Zadnja promjena</th>
    </tr>
    <?php
	$cur99=1;
	while ($num99>=$cur99) {
		$row99=mysql_fetch_array($rez99);	
		$id=$row99[0];
		$naslov=$row99[1];
		$datum_prikaz=$row99[2];
		$dan=$row99[3];
		$datum=$row99[4];
		$user=$row99[5];
		?>
        <td><?php echo $id; ?></td>
        <td><?php echo substr($naslov, 0, 20); ?>...</td>
        <td><?php echo date_format(date_create($datum_prikaz), 'd.m.Y'); ?></td>
        <td><a href="glavna.php?modul=vijesti&amp;akcija=form_edit_news&amp;id_kat=<?php echo $id_kat;?>&amp;id_news=<?php echo $id;?>">Promjeni vijest</a></td>
        <?php
		if ($kategorija_linkovi==1) {
			?>
            <td><a href="glavna.php?modul=vijesti&amp;akcija=display_slike&amp;id_kat=<?php echo $id_kat;?>&amp;id_news=<?php echo $id;?>">Uredi dodatne slike</a></td>
            <td><a href="glavna.php?modul=vijesti&amp;akcija=display_news_file_download&amp;id_kat=<?php echo $id_kat;?>&amp;id_news=<?php echo $id;?>">Uredi dodatne fajlove</a></td>
            <?php
		}
		?>
        <td><a href="glavna.php?modul=vijesti&amp;akcija=delete_news&amp;id_kat=<?php echo $id_kat;?>&amp;id_news=<?php echo $id;?>" onclick="return verify()">Obriši</a></td>
        <td><?php echo $user.' - '.date_format(date_create($datum), 'd.m.Y'); ?></td>
        </tr>
		<?php
		$cur99++;
	}
	?>
</tbody>    
</table>    
    <?php
} else {
	?>
    <p>Trenutno nema niti jedne vijesti u bazi!</p>
	<?php
}
?>
</div>