<?php
$druh = "kategorie";
include "head.php";
include_head($lang['categories_title'], $druh);

$dnesnidatum = StrFTime("%Y-%m-%d %H:%M:%S", Time());

if (!isset($_GET['action'])) {$_GET['action'] = "default";};
switch ($_GET['action']) {

case "add" : 

  $nazev = $_POST['nazev'];
  $datum_pub = $_POST['datum_pub'];    
  $menu_zob = $_POST['menu_zob'];
  $menu_por = $_POST['menu_por'];
    
  if (!empty($nazev) && !empty($menu_zob) && $menu_por != "" && is_numeric($menu_por)) { 
  
    if ($menu_zob == 2) {$menu_por = 0;};    

    if ($datum_pub == "hned") {
      $datum = "NOW()";
    } else {
      $datum = "'".$_POST['year']."-".$_POST['month']."-".$_POST['day']." ".$_POST['hour'].":".$_POST['minute'].":00'"; 
    };
      
    $nazev = mysql_real_escape_string($nazev);
    $pridal = mysql_real_escape_string($pridal);
    $menu_zob = mysql_real_escape_string($menu_zob);
    $menu_por = mysql_real_escape_string($menu_por);
 
    mysql_query("INSERT INTO jtcms_kategorie (nazev,pridal,datum,menu_zob,menu_por) VALUES ('".$nazev."','".$_SESSION['userid']."',".$datum.",'".$menu_zob."','".$menu_por."')");
    Header("Location: categories.php?work=added&nazev=".rawurlencode($nazev));
    echo '<script type="text/javascript">location.replace("categories.php?work=added&nazev='.rawurlencode($nazev).'")</script>';
    
  } else {
    echo '<h1>'.$lang['categories_add_category'].'</h1>';
    echo '<br />';
    
    echo '<div class="oznameni_div">';
    echo '<div class="chyba">'.$lang['categories_error'].'</div>';
    if (empty($nazev)) {echo '<li>'.$lang['categories_er_1'].'</li>';};
    if (empty($menu_zob)) {echo '<li>'.$lang['categories_er_9'].'</li>';};
    if ($menu_por == "") {echo '<li>'.$lang['categories_er_10'].'</li>';};
    if (!is_numeric($menu_por)) {echo '<li>'.$lang['categories_er_11'].'</li>';};
    echo '</div>';   
  };

break;

case "edit" :
$id = $_GET['id']; 
$query = mysql_query("SELECT * FROM jtcms_kategorie WHERE id='".$id."' LIMIT 1");
$radku = mysql_num_rows($query);
$result = mysql_fetch_array($query);

echo '<h1>'.$lang['categories_edit_category'].'</h1><br />';

 if (empty($id) or $radku == 0 or ($prava == 2 && $result['pridal'] != $_SESSION['userid'])) {
    echo '<div class="oznameni_div">';
    echo '<div class="chyba">'.$lang['categories_error'].'</div>';
    if (empty($id)) {echo '<p>'.$lang['categories_er_4'].'</p>';};
    if ($radku == 0) {echo '<p>'.$lang['categories_er_5'].'</p>';};
    if ($prava == 2 && $result['pridal'] != $_SESSION['userid']) {echo '<p>'.$lang['categories_er_12'].'</p>';};
    echo '</div>';
    
    include_end();
    exit();
  }; 

if (!empty($_POST)) {

  $id = $_GET['id'];
  $nazev = $_POST['nazev'];
  $pridal = $_POST['pridal'];
  $datum_pub = $_POST['datum_pub'];    
  $menu_zob = $_POST['menu_zob'];
  $menu_por = $_POST['menu_por'];
    
  if (!empty($nazev) && !empty($pridal) && !empty($menu_zob) && $menu_por != "" && is_numeric($menu_por)) {
  
    if ($datum_pub == "jindy") {
      $datum = "'".$_POST['year']."-".$_POST['month']."-".$_POST['day']." ".$_POST['hour'].":".$_POST['minute'].":00'";
      mysql_query("UPDATE jtcms_kategorie SET datum=".$datum." WHERE id='".$id."' LIMIT 1");
    }; 
  
    if ($menu_zob == 2) {$menu_por = 0;};    
  
    $nazev = mysql_real_escape_string($nazev);
    $pridal = mysql_real_escape_string($pridal);
    $menu_zob = mysql_real_escape_string($menu_zob);
    $menu_por = mysql_real_escape_string($menu_por);
    
    mysql_query("UPDATE jtcms_kategorie SET nazev='".$nazev."', pridal='".$pridal."', menu_zob='".$menu_zob."', menu_por='".$menu_por."' WHERE id='".$id."' LIMIT 1");
    Header("Location: categories.php?work=edited&nazev=".rawurlencode($nazev));
    echo '<script type="text/javascript">location.replace("categories.php?work=edited&nazev='.rawurlencode($nazev).'")</script>';
    
  } else {
    echo '<div class="oznameni_div">';
    echo '<div class="chyba">'.$lang['categories_error'].'</div>';
    if (empty($nazev)) {echo '<li>'.$lang['categories_er_1'].'</li>';};
    if (empty($pridal)) {echo '<li>'.$lang['categories_er_8'].'</li>';};
    if (empty($menu_zob)) {echo '<li>'.$lang['categories_er_9'].'</li>';};
    if ($menu_por == "") {echo '<li>'.$lang['categories_er_10'].'</li>';};
    if (!is_numeric($menu_por)) {echo '<li>'.$lang['categories_er_11'].'</li>';};
    echo '</div>';   
  };
};
    
?>

<form method="post" action="categories.php?action=edit&amp;id=<?php echo $id; ?>" id="kategorie_form">
<label for="cat_nazev"><?php echo $lang['categories_name']; ?>:</label> <input type="text" name="nazev" id="cat_nazev" class="input"<?php if (empty($_POST['nazev'])) {echo ' value="'.$result['nazev'].'"';} else {echo ' value="'.$_POST['nazev'].'"';}; ?> /><br />
<br />

<div class="nastaveni" style="display: block;">

<div class="nadpis"><img src="stuff/img/icons/list.png" alt="" /> <?php echo $lang['categories_view_in_menu']; ?>:</div>
<div class="moznosti">
<input type="radio" name="menu_zob" id="menu_zob1" value="1"<?php if (empty($_POST)) {if ($result['menu_zob'] == 1) {echo ' checked';};} else {if ($_POST['menu_zob'] == 1) {echo ' checked';};}; ?> /> <label for="menu_zob1"><?php echo $lang['categories_number_in_menu_1']; ?></label><br />
<input type="radio" name="menu_zob" id="menu_zob2" value="2"<?php if (empty($_POST)) {if ($result['menu_zob'] == 2) {echo ' checked';};} else {if ($_POST['menu_zob'] == 2) {echo ' checked';};}; ?> /> <label for="menu_zob2"><?php echo $lang['categories_number_in_menu_2']; ?></label><br />
</div>

<div class="nf"></div>
<br />

<div class="nadpis"><img src="stuff/img/icons/numbered list.png" alt="" /> <?php echo $lang['categories_num_in_menu']; ?>:</div>
<div class="moznosti">
<select name="menu_por" size="1" class="pocet input">
<option value="0" /> 0
<?php $pocet_cat = mysql_query("SELECT COUNT(*) AS pocet FROM jtcms_kategorie");
$pocet_cat = mysql_fetch_array($pocet_cat);
 
for($i=1;$i<($pocet_cat['pocet']+3);$i++) {
echo '<option value="'.$i.'"';
if (empty($_POST)) {if ($result['menu_por'] == $i) {echo ' selected';};} else {if ($_POST['menu_por'] == $i) {echo ' selected';};};
echo ' /> '.$i;
}; ?>
</select>
</div>

<div class="nf"></div>
<br />

<div class="nadpis"><img src="stuff/img/icons/date.png" alt="" /> <?php echo $lang['categories_date']; ?>:</div>
<div class="moznosti">
<input type="radio" name="datum_pub" id="datum_pub_hned" value="hned"<?php if (!empty($_POST)) {if ($_POST['datum_pub'] == "hned") {echo ' checked';};} else {if ($dnesnidatum >= $result['datum']) {echo ' checked';};}; ?> /> <label for="datum_pub_hned"><?php echo $lang['categories_publish_immediately']; ?></label><br />
<input type="radio" name="datum_pub" value="jindy"<?php if (!empty($_POST)) {if ($_POST['datum_pub'] == "jindy") {echo ' checked';};} else {if (!($dnesnidatum >= $result['datum'])) {echo ' checked';};}; ?> />
<select name="day" size="1"> 
<?php for($i=1;$i<32;$i++) {
echo '<option value="'.$i.'"';
articles_categories_over_post_result_datepub('day', $i, 'd');
echo ' />'.$i;
}; ?>
</select>
.
<select name="month" size="1"> 
<?php for($i=1;$i<13;$i++) {
echo '<option value="'.$i.'"';
articles_categories_over_post_result_datepub('month', $i, 'm');
echo ' />'.$i;
}; ?>
</select>
.
<select name="year" size="1"> 
<?php for($i=2012;$i<2021;$i++) {
echo '<option value="'.$i.'"';
articles_categories_over_post_result_datepub('year', $i, 'Y');
echo ' />'.$i;
}; ?>
</select>
-
<select name="hour" size="1"> 
<?php for($i=1;$i<24;$i++) {
echo '<option value="'.$i.'"';
articles_categories_over_post_result_datepub('hour', $i, 'H');
echo ' />'.$i;
}; ?>
</select>
:
<select name="minute" size="1"> 
<?php for($i=1;$i<60;$i++) {
echo '<option value="'.$i.'"';
articles_categories_over_post_result_datepub('minute', $i, 'M');
echo ' />'.$i;
}; ?>
</select><br />
<span class="popis">DD.MM.YYYY - HH:MM</span>
</div>

<div class="nf"></div>
<?php if ($prava == 1) { ?>
<br />

<div class="nadpis"><img src="stuff/img/icons/user.png" alt="" /> <?php echo $lang['categories_author']; ?>:</div>
<div class="moznosti">
<select name="pridal" size="1" class="pridal input"> 
<?php $query_user = mysql_query("SELECT * FROM jtcms_uzivatele");

while ($result_user = mysql_fetch_array($query_user)) {
echo '<option value="'.$result_user['id'].'"';
if (empty($_POST)) {if ($result['pridal'] == $result_user['id']) {echo ' selected';};} elseif ($_POST['pridal'] == $result_user['id']) {echo ' selected';};
echo ' />'.$result_user['jmeno'];
};
?>
</select>
</div>

<div class="nf"></div>
<br />
<?php }; ?>

</div>

<input type="submit" name="submit" value="<?php echo $lang['categoires_save_changes']; ?>" class="submit" />
</form>

<?php  
break;

case "delete" :
$id = $_GET['id']; 
$query = mysql_query("SELECT * FROM jtcms_kategorie WHERE id='".$id."' LIMIT 1");
$radku = mysql_num_rows($query);
$result = mysql_fetch_array($query);
$nazev = $result['nazev'];

 if (empty($id) or $radku == 0 or ($prava == 2 && $result['pridal'] != $_SESSION['userid'])) {
    echo '<h1>'.$lang['categories_delete_category'].'</h1><br />';
    echo '<div class="oznameni_div">';
    echo '<div class="chyba">'.$lang['categories_error'].'</div>';
    if (empty($id)) {echo '<p>'.$lang['categories_er_4'].'</p>';};
    if ($radku == 0) {echo '<p>'.$lang['categories_er_5'].'</p>';};
    if ($prava == 2 && $result['pridal'] != $_SESSION['userid']) {echo '<p>'.$lang['categories_er_12'].'</p>';};
    echo '</div>';
    
    include_end();
    exit();
  }; 
  
    mysql_query("UPDATE jtcms_clanky SET kategorie='0' WHERE kategorie='".$id."'");
    mysql_query("DELETE FROM jtcms_kategorie WHERE id='".$id."' LIMIT 1");    
    Header("Location: categories.php?work=deleted&nazev=".rawurlencode($nazev));
    echo '<script type="text/javascript">location.replace("categories.php?work=deleted&nazev='.rawurlencode($nazev).'")</script>'; 

break;

case "detail" :

$kategorie = $_GET['kategorie'];

echo '<h1>'.$lang['categories_detail_category'].'</h1><br />';

 if (!is_numeric($kategorie) && $kategorie != "all") {
    echo '<div class="oznameni_div">';
    echo '<div class="chyba">'.$lang['categories_error'].'</div>';
    echo '<p>'.$lang['categories_er_6'].'</p>';
    echo '</div>';
    
    include_end();
    exit();
  };
  
  if (is_numeric($kategorie)) {
    $query = mysql_query("SELECT * FROM jtcms_kategorie WHERE id='".$kategorie."' ORDER BY id DESC LIMIT 1");
    $result = mysql_fetch_array($query);
    $radku = mysql_num_rows($query);
    
   echo '<a href="categories.php?action=detail&amp;kategorie=all" class="tlacitko1" title="'.$lang['categories_view_all_categories'].'">'.$lang['categories_all_categories'].'</a><br />';
   
   if ($radku == 0 && $kategorie != 0) {
     echo '<div class="oznameni_div">';
     echo '<div class="chyba">'.$lang['categories_error'].'</div>';
     echo '<p>'.$lang['categories_er_7'].'</p>';
     echo '</div>';
    
     include_end();
     exit();
   };
    
   echo '<h2>';
   if ($kategorie == 0) {echo '<i>'.$lang['categories_uncategorized'].'</i>';} else {echo $result['nazev'];};
   echo '</h2>'; 
   echo '<div class="detail_kategorie">';  
       echo '<div class="clanky">';
         $query2 = mysql_query("SELECT id, nazev, datum FROM jtcms_clanky WHERE kategorie='".$result['id']."'");
         $radku = mysql_num_rows($query2);
           if ($radku == 0) {echo $lang['categories_category_is_empty'];} else {
         while ($result2 = mysql_fetch_array($query2)) {
         echo '<li title="'.$lang['categories_detail_1'].': '.$result2['datum'].'. '.$lang['categories_detail_2'].'"><a href="articles.php?action=edit&amp;id='.$result2['id'].'">'.$result2['nazev'].'</a></li>';
         };
           };
       echo '</div>';
   echo '</div>';
   
  } else {
    $query = mysql_query("SELECT * FROM jtcms_kategorie ORDER BY id DESC");
   echo '<h2>'.$lang['categories_all_categories'].'</h2><br />';
   echo '<div class="detail_kategorie">';  
     while ($result = mysql_fetch_array($query)) {
       echo '<h3><a href="categories.php?action=detail&amp;kategorie='.$result['id'].'">'.$result['nazev'].'</a></h3>';
       echo '<div class="clanky">';
         $query2 = mysql_query("SELECT id, nazev, datum FROM jtcms_clanky WHERE kategorie='".$result['id']."'");
         $radku = mysql_num_rows($query2);
           if ($radku == 0) {echo $lang['categories_category_is_empty'];} else {
         while ($result2 = mysql_fetch_array($query2)) {
         echo '<li title="'.$lang['categories_detail_1'].': '.$result2['datum'].'. '.$lang['categories_detail_2'].'"><a href="articles.php?action=edit&amp;id='.$result2['id'].'">'.$result2['nazev'].'</a></li>';
         };
           };
       echo '</div>';
     };
     echo '<h3><a href="categories.php?action=detail&amp;kategorie=0"><i>'.$lang['categories_uncategorized'].'</i></a></h3>';
     echo '<div class="clanky">';
        $query2 = mysql_query("SELECT id, nazev, datum FROM jtcms_clanky WHERE kategorie='0'");
        $radku = mysql_num_rows($query2);
          if ($radku == 0) {echo $lang['categories_category_is_empty'];} else {
        while ($result2 = mysql_fetch_array($query2)) {
          echo '<li title="'.$lang['categories_detail_1'].': '.$result2['datum'].'. '.$lang['categories_detail_2'].'"><a href="articles.php?action=edit&amp;id='.$result2['id'].'">'.$result2['nazev'].'</a></li>';
        };
          };
     echo '</div>';
   echo '</div>';
   
   };
   
break;

default : ?>

<div class="filtr_but" onclick="$('.kategorie_add_form').slideToggle();"><img src="stuff/img/icons/add.png" alt="" /> <?php echo $lang['categories_add_category']; ?></div>

<?php
echo '<h1>'.$lang['categories_title'].'</h1>';
echo '<br />';

if (!isset($_GET['work'])) {$_GET['work'] = "default";};
switch ($_GET['work']) {
case "added" : 
echo '<div class="oznameni_div">';
echo '<p>'.$lang['categories_title'].' <span class="blue">'.stripslashes($_GET['nazev']).'</span> '.$lang['categories_work_1'].'</p>';
echo '</div>';
break;

case "edited" :
echo '<div class="oznameni_div">';
echo '<p>'.$lang['categories_title'].' <span class="blue">'.stripslashes($_GET['nazev']).'</span> '.$lang['categories_work_2'].'</p>';
echo '</div>';
break;

case "deleted" :
echo '<div class="oznameni_div">';
echo '<p>'.$lang['categories_title'].' <span class="blue">'.stripslashes($_GET['nazev']).'</span> '.$lang['categories_work_3'].'</p>';
echo '</div>';
break;
};

$query = mysql_query("SELECT * FROM jtcms_kategorie ORDER BY menu_por");
$radku = mysql_num_rows($query);
?>

<form method="post" action="categories.php?action=add" id="kategorie_form" class="kategorie_add_form">
<label for="cat_nazev"><?php echo $lang['categories_name']; ?>:</label> <input type="text" name="nazev" id="cat_nazev" class="input" /><br />
<br />

<div class="nastaveni_nadpis" onclick="$('.nastaveni').slideToggle();"><?php echo $lang['categories_extended_setting']; ?></div>

<div class="nastaveni">

<div class="nadpis"><img src="stuff/img/icons/list.png" alt="" /> <?php echo $lang['categories_view_in_menu']; ?>:</div>
<div class="moznosti">
<input type="radio" name="menu_zob" id="menu_zob1" value="1"<?php if (!empty($_POST)) {if ($_POST['menu_zob'] == 1) {echo ' checked';};} else {echo ' checked';}; ?> /> <label for="menu_zob1"><?php echo $lang['categories_number_in_menu_1']; ?></label><br />
<input type="radio" name="menu_zob" id="menu_zob2" value="2"<?php if (!empty($_POST) && $_POST['menu_zob'] == 2) {echo ' checked';}; ?> /> <label for="menu_zob2"><?php echo $lang['categories_number_in_menu_2']; ?></label><br />
</div>

<div class="nf"></div>
<br />

<div class="nadpis"><img src="stuff/img/icons/numbered list.png" alt="" /> <?php echo $lang['categories_num_in_menu']; ?>:</div>
<div class="moznosti">
<select name="menu_por" size="1" class="pocet input">
<option value="0" /> 0
<?php $pocet_cat = mysql_query("SELECT MAX(menu_por) AS max_menu_por, COUNT(*) AS pocet FROM jtcms_kategorie");
$pocet_cat = mysql_fetch_array($pocet_cat);
$max = $pocet_cat['max_menu_por']+1;

for($i=1;$i<($pocet_cat['pocet']+3);$i++) {
echo '<option value="'.$i.'"';
if (!empty($_POST) && $_POST['menu_por'] == $i) {echo ' selected';} elseif ($max == $i) {echo ' selected';};
echo ' /> '.$i;
}; ?>
</select>
</div>

<div class="nf"></div>
<br />

<div class="nadpis"><img src="stuff/img/icons/date.png" alt="" /> <?php echo $lang['categories_date']; ?>:</div>
<div class="moznosti">
<input type="radio" name="datum_pub" id="datum_pub_hned" value="hned"<?php if (!empty($_POST)) {if ($_POST['datum_pub'] == "hned") {echo ' checked';};} else {echo ' checked';}; ?> /> <label for="datum_pub_hned"><?php echo $lang['categories_publish_immediately']; ?></label><br />
<input type="radio" name="datum_pub" value="jindy"<?php if (!empty($_POST) && $_POST['datum_pub'] == "jindy") {echo ' checked';}; ?> />
<select name="day" size="1"> 
<?php for($i=1;$i<32;$i++) {
echo '<option value="'.$i.'"';
articles_categories_over_post_datepub('day', $i, 'd');
echo ' />'.$i;
}; ?>
</select>
.
<select name="month" size="1"> 
<?php for($i=1;$i<13;$i++) {
echo '<option value="'.$i.'"';
articles_categories_over_post_datepub('month', $i, 'm');
echo ' />'.$i;
}; ?>
</select>
.
<select name="year" size="1"> 
<?php for($i=2012;$i<2021;$i++) {
echo '<option value="'.$i.'"';
articles_categories_over_post_datepub('year', $i, 'Y');
echo ' />'.$i;
}; ?>
</select>
-
<select name="hour" size="1"> 
<?php for($i=1;$i<24;$i++) {
echo '<option value="'.$i.'"';
articles_categories_over_post_datepub('hour', $i, 'H');
echo ' />'.$i;
}; ?>
</select>
:
<select name="minute" size="1"> 
<?php for($i=1;$i<60;$i++) {
echo '<option value="'.$i.'"';
articles_categories_over_post_datepub('minute', $i, 'M');
echo ' />'.$i;
}; ?>
</select><br />
<span class="popis">DD.MM.YYYY - HH:MM</span>
</div>

<div class="nf"></div>

</div>

<div class="nf"></div>

<input type="submit" name="submit" value="<?php echo $lang['categories_add_category']; ?>" class="submit" />
</form>

<table class="tabulka_kategorie">
<tr class="prvni_tr">
  <td class="td1 first">&nbsp;<?php echo $lang['categories_name']; ?></td>
  <td class="td2"><img src="stuff/img/icons/list.png" alt="<?php echo $lang['categories_view_in_menu_table']; ?>" title="<?php echo $lang['categories_view_in_menu_table']; ?>" /></td>
  <td class="td3"><img src="stuff/img/icons/numbered list.png" alt="<?php echo $lang['categories_num_in_menu']; ?>" title="<?php echo $lang['categories_num_in_menu']; ?>" /></td>
  <td class="td4"><img src="stuff/img/icons/document.png" alt="<?php echo $lang['categories_number_articles']; ?>" title="<?php echo $lang['categories_number_articles']; ?>" /></td>
  <td class="td5 last"><?php echo $lang['categories_date']; ?></td>
</tr>
<?php
if ($radku == 0) {
  echo '<tr><td colspan="5" style="text-align: center; padding: 5px;">'.$lang['categories_categories_is_empty'].'</td></tr>';
} else {
  while ($result = mysql_fetch_array($query)) {
    $query2 = mysql_query("SELECT COUNT(*) AS pocet FROM jtcms_clanky WHERE kategorie='".$result['id']."'");
    $result2 = mysql_fetch_array($query2);

    echo '<tr>';
    echo '<td>&nbsp;<a href="categories.php?action=detail&amp;kategorie='.$result['id'].'" title="'.$lang['categories_view_articles'].'">'.$result['nazev'].'</a></td>';
    echo '<td class="menu_zob_td">';
      switch ($result['menu_zob']) {
        case "1" : echo '<img src="stuff/img/icons/tick.png" alt="'.$lang['categories_number_in_menu_1'].'" title="'.$lang['categories_number_in_menu_1'].'" />'; break;
        case "2" : echo '<img src="stuff/img/icons/delete.png" alt="'.$lang['categories_number_in_menu_2'].'" title="'.$lang['categories_number_in_menu_2'].'" />'; break;
      };
    echo '</td>';
    echo '<td>';
      if ($result['menu_zob'] == 1) {
        echo $result['menu_por'];
      } else {
        echo '<span class="prazdno">-</span>';
      };
    echo '</td>';    
    echo '<td>';
      if ($result2['pocet'] == 0) {
        echo '<span class="prazdno">'.$result2['pocet'].'</span>';
      } else {
        echo $result2['pocet'];
      };
    echo '</td>';
    echo '<td class="datum">';    
      if (($prava == 2 && $result['pridal'] == $_SESSION['userid']) or $prava == 1) {
        echo '<div class="links">';
          echo '<a href="categories.php?action=edit&amp;id='.$result['id'].'" title="'.$lang['categories_edit_category'].'"><img src="stuff/img/icons/edit.png" alt="'.$lang['categories_edit_category'].'" /></a>';
          echo '<br />';
          echo '<img src="stuff/img/icons/trash.png" class="smaz" alt="'.$lang['categories_delete_category'].'" title="'.$lang['categories_delete_category'].'" onclick="smaz_cat(\''.$result['id'].'\',\''.$result['nazev'].'\',\''.$result2['pocet'].'\')" />';
        echo '</div>';
      };     
      echo '<div class="datum" title="'.StrFTime("%H:%M %d.%m.%Y", strtotime($result["datum"])).'">'.StrFTime("%d.%m.%Y", strtotime($result["datum"])).'</div>';
    echo '</td>';
    echo '</tr>';
    echo "\n";
  };
};  
    $query2 = mysql_query("SELECT COUNT(*) AS pocet FROM jtcms_clanky WHERE kategorie='0'");
    $result2 = mysql_fetch_array($query2);
  echo '<tr>';
  echo '<td>&nbsp;<a href="categories.php?action=detail&amp;kategorie=0" title="'.$lang['categories_view_articles'].'"><i>'.$lang['categories_uncategorized'].'</i></a></td>';
  echo '<td colspan="2" class="tac">';
    echo '<img src="stuff/img/icons/info.png" alt="'.$lang['categories_uncategorized_des'].'" title="'.$lang['categories_uncategorized_des'].'" />';
  echo '</td>';
  echo '<td>'.$result2['pocet'].'</td>';
  echo '<td></td>';
  echo '</tr>';

?>
</table>
<script type="text/javascript">
function smaz_cat(id, nazev, pocet){
jConfirm("<?php echo $lang['categories_really_del_1']; ?> "+nazev+"? <?php echo $lang['categories_really_del_2']; ?> "+pocet+". <?php echo $lang['categories_really_del_3']; ?>", "<?php echo $lang['categories_really_del_headline']; ?>", function(r) {
    if (r == true) {location.replace("categories.php?action=delete&id="+id);};
});
};
</script>
<?php
};

include_end();
?>