<?php
$druh = "skupiny";
include "head.php";
$menu2 = include_menu("skupiny");
include_head($lang['set_user_groups_title'], $druh);

$promenne = array('nazev','clanky','stranky','kategorie','stitky','galerie','soubory','komentare','nastaveni','sablony','banlist','zacleneni','uzivatele','skupiny');

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

case "add" :

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

if (!empty($_POST)) {

  over_posts();

  $nazev = $_POST['nazev'];
  $clanky = $_POST['clanky'];
  $stranky = $_POST['stranky'];
  $kategorie = $_POST['kategorie'];
  $stitky = $_POST['stitky'];
  $galerie = $_POST['galerie'];
  $soubory = $_POST['soubory'];
  $komentare = $_POST['komentare'];
  $nastaveni = $_POST['nastaveni'];
  $sablony = $_POST['sablony'];
  $banlist = $_POST['banlist'];
  $zacleneni = $_POST['zacleneni'];
  $uzivatele = $_POST['uzivatele'];
  $skupiny = $_POST['skupiny'];
  
  if (!empty($nazev) && !empty($clanky) && !empty($stranky) && !empty($kategorie) && !empty($stitky) && !empty($galerie) && !empty($soubory) && !empty($komentare) && !empty($nastaveni) && !empty($sablony) && !empty($banlist) && !empty($zacleneni) && !empty($uzivatele) && !empty($skupiny)) {
    
    $nazev = mysql_real_escape_string($nazev);
    $clanky = intval($clanky);
    $stranky = intval($stranky);
    $kategorie = intval($kategorie);
    $stitky = intval($stitky);
    $galerie = intval($galerie);
    $soubory = intval($soubory);
    $komentare = intval($komentare);
    $nastaveni = intval($nastaveni);
    $sablony = intval($sablony);
    $banlist = intval($banlist);
    $zacleneni = intval($zacleneni);
    $uzivatele = intval($uzivatele);
    $skupiny = intval($skupiny);
    
    mysql_query("INSERT INTO jtcms_skupiny (nazev, clanky, stranky, kategorie, stitky, galerie, soubory, komentare, nastaveni, sablony, banlist, zacleneni, uzivatele, skupiny) VALUES ('".$nazev."', '".$clanky."', '".$stranky."', '".$kategorie."', '".$stitky."', '".$galerie."', '".$soubory."', '".$komentare."', '".$nastaveni."', '".$sablony."', '".$banlist."', '".$zacleneni."', '".$uzivatele."', '".$skupiny."')");
    Header("Location: set_user_groups.php?work=added&nazev=".rawurlencode($nazev));
    echo '<script type="text/javascript">location.replace("set_user_groups.php?work=added&nazev='.rawurlencode($nazev).'")</script>'; 
     
  } else {
  
    echo '<div class="oznameni_div">';
    echo '<div class="chyba">'.$lang['set_user_groups_error'].'</div>';
    if (empty($nazev)) {echo '<li>'.$lang['set_user_groups_er_1'].'</li>';};
    if (empty($clanky)) {echo '<li>'.$lang['set_user_groups_er_2'].'</li>';};
    if (empty($stranky)) {echo '<li>'.$lang['set_user_groups_er_3'].'</li>';};
    if (empty($kategorie)) {echo '<li>'.$lang['set_user_groups_er_4'].'</li>';};
    if (empty($stitky)) {echo '<li>'.$lang['set_user_groups_er_16'].'</li>';};
    if (empty($galerie)) {echo '<li>'.$lang['set_user_groups_er_17'].'</li>';};
    if (empty($soubory)) {echo '<li>'.$lang['set_user_groups_er_19'].'</li>';};
    if (empty($komentare)) {echo '<li>'.$lang['set_user_groups_er_5'].'</li>';};
    if (empty($nastaveni)) {echo '<li>'.$lang['set_user_groups_er_6'].'</li>';};
    if (empty($sablony)) {echo '<li>'.$lang['set_user_groups_er_7'].'</li>';};
    if (empty($banlist)) {echo '<li>'.$lang['set_user_groups_er_8'].'</li>';};
    if (empty($zacleneni)) {echo '<li>'.$lang['set_user_groups_er_9'].'</li>';};
    if (empty($uzivatele)) {echo '<li>'.$lang['set_user_groups_er_10'].'</li>';};
    if (empty($skupiny)) {echo '<li>'.$lang['set_user_groups_er_11'].'</li>';};
    echo '</div>';
  
  };
};
?>

<form method="post" action="set_user_groups.php?action=add" id="groups_form">

<div class="tac">
  <label for="set_nazev" class="nazev_label"><?php echo $lang['set_user_groups_name_of_group']; ?></label><input type="text" name="nazev" class="input"<?php if (isset($_POST['nazev']) && !empty($_POST['nazev'])) {echo ' value="'.$_POST['nazev'].'"';}; ?> /><br />
</div>
<br /><br />

<table class="uzivatele_skupiny_tabulka">
<tr class="prvni_tr">
  <td class="td1 first">&nbsp;<?php echo $lang['set_user_groups_group']; ?></td>
  <td><img src="stuff/img/icons/lists.png" alt="<?php echo $lang['set_user_groups_articles']; ?>" title="<?php echo $lang['set_user_groups_articles']; ?>" /></td>
  <td><img src="stuff/img/icons/text.png" alt="<?php echo $lang['set_user_groups_pages']; ?>" title="<?php echo $lang['set_user_groups_pages']; ?>" /></td>
  <td><img src="stuff/img/icons/open folder.png" alt="<?php echo $lang['set_user_groups_categories']; ?>" title="<?php echo $lang['set_user_groups_categories']; ?>" /></td>
  <td><img src="stuff/img/icons/label.png" alt="<?php echo $lang['set_user_groups_tags']; ?>" title="<?php echo $lang['set_user_groups_tags']; ?>" /></td>
  <td><img src="stuff/img/icons/camera.png" alt="<?php echo $lang['set_user_groups_galleries']; ?>" title="<?php echo $lang['set_user_groups_galleries']; ?>" /></td>
  <td><img src="stuff/img/icons/software.png" alt="<?php echo $lang['set_user_groups_files']; ?>" title="<?php echo $lang['set_user_groups_files']; ?>"></td>
  <td><img src="stuff/img/icons/comments.png" alt="<?php echo $lang['set_user_groups_comments']; ?>" title="<?php echo $lang['set_user_groups_comments']; ?>" /></td>
  <td><img src="stuff/img/icons/gear.png" alt="<?php echo $lang['set_user_groups_setting']; ?>" title="<?php echo $lang['set_user_groups_setting']; ?>" /></td>
  <td><img src="stuff/img/icons/bricks.png" alt="<?php echo $lang['set_user_groups_templates']; ?>" title="<?php echo $lang['set_user_groups_templates']; ?>" /></td>
  <td><img src="stuff/img/icons/no.png" alt="<?php echo $lang['set_user_groups_banlist']; ?>" title="<?php echo $lang['set_user_groups_banlist']; ?>" /></td>
  <td><img src="stuff/img/icons/wizard.png" alt="<?php echo $lang['set_user_groups_integration']; ?>" title="<?php echo $lang['set_user_groups_integration']; ?>" /></td>
  <td><img src="stuff/img/icons/users.png" alt="<?php echo $lang['set_user_groups_users']; ?>" title="<?php echo $lang['set_user_groups_users']; ?>" /></td>
  <td><img src="stuff/img/icons/user group.png" alt="<?php echo $lang['set_user_groups_user_groups']; ?>" title="<?php echo $lang['set_user_groups_user_groups']; ?>" /></td>
  <td class="last"></td>
</tr>

<tr>
  <td class="tal">&nbsp;<?php echo $lang['set_user_groups_per_1']; ?></td>
  <td><input type="radio" name="clanky" id="set_clanky_1" value="1"<?php set_user_groups_over_post('clanky', '1'); ?> /></td>
  <td><input type="radio" name="stranky" id="set_gr_stranky_1" value="1"<?php set_user_groups_over_post('stranky', '1'); ?> /></td>
  <td><input type="radio" name="kategorie" id="set_gr_kategorie_1" value="1"<?php set_user_groups_over_post('kategorie', '1'); ?> /></td>
  <td><input type="radio" name="stitky" id="set_gr_stitky_1" value="1"<?php set_user_groups_over_post('stitky', '1'); ?> /></td>
  <td><input type="radio" name="galerie" id="set_gr_galerie_1" value="1"<?php set_user_groups_over_post('galerie', '1'); ?> /></td>
  <td><input type="radio" name="soubory" id="set_gr_soubory_1" value="1"<?php set_user_groups_over_post('soubory', '1'); ?> /></td>
  <td><input type="radio" name="komentare" id="set_gr_komentare_1" value="1"<?php set_user_groups_over_post('komentare', '1'); ?> /></td>
  <td><input type="radio" name="nastaveni" id="set_gr_nastaveni_1" value="1"<?php set_user_groups_over_post('nastaveni', '1'); ?> /></td>
  <td><input type="radio" name="sablony" id="set_gr_sablony_1" value="1"<?php set_user_groups_over_post('sablony', '1'); ?> /></td>
  <td><input type="radio" name="banlist" id="set_gr_banlist_1" value="1"<?php set_user_groups_over_post('banlist', '1'); ?> /></td>
  <td><input type="radio" name="zacleneni" id="set_gr_zacleneni_1" value="1"<?php set_user_groups_over_post('zacleneni', '1'); ?> /></td>
  <td><input type="radio" name="uzivatele" id="set_gr_uzivatele_1" value="1"<?php set_user_groups_over_post('uzivatele', '1'); ?> /></td>
  <td><input type="radio" name="skupiny" id="set_gr_skupiny_1" value="1"<?php set_user_groups_over_post('skupiny', '1'); ?> /></td>
  <td></td>  
</tr>
<tr>
  <td class="tal">&nbsp;<?php echo $lang['set_user_groups_per_2']; ?></td>
  <td><input type="radio" name="clanky" id="set_clanky_2" value="2"<?php set_user_groups_over_post('clanky', '2'); ?> /><label for="set_clanky_2"></td>
  <td><input type="radio" name="stranky" id="set_gr_stranky_2" value="2"<?php set_user_groups_over_post('stranky', '2'); ?> /></td>
  <td><input type="radio" name="kategorie" id="set_gr_kategorie_2" value="2"<?php set_user_groups_over_post('kategorie', '2'); ?> /></td>
  <td><input type="radio" name="stitky" id="set_gr_stitky_2" value="2"<?php set_user_groups_over_post('stitky', '2'); ?> /></td>
  <td><input type="radio" name="galerie" id="set_gr_galerie_2" value="2"<?php set_user_groups_over_post('galerie', '2'); ?> /></td>
  <td><input type="radio" name="soubory" id="set_gr_soubory_2" value="1"<?php set_user_groups_over_post('soubory', '2'); ?> /></td>
  <td><input type="radio" name="komentare" id="set_gr_komentare_2" value="2"<?php set_user_groups_over_post('komentare', '2'); ?> /></td>
  <td><input type="radio" name="disabled" disabled /></td>
  <td><input type="radio" name="disabled" disabled /></td>
  <td><input type="radio" name="disabled" disabled /></td>
  <td><input type="radio" name="disabled" disabled /></td>
  <td><input type="radio" name="disabled" disabled /></td>
  <td><input type="radio" name="disabled" disabled /></td>
  <td></td>
</tr>
<tr>
  <td class="tal">&nbsp;<?php echo $lang['set_user_groups_per_3']; ?></td>
  <td><input type="radio" name="clanky" id="set_clanky_3" value="3"<?php set_user_groups_over_post('clanky', '3'); ?> />   </td>
  <td><input type="radio" name="stranky" id="set_gr_stranky_3" value="3"<?php set_user_groups_over_post('stranky', '3'); ?> /></td>
  <td><input type="radio" name="kategorie" id="set_gr_kategorie_3" value="3"<?php set_user_groups_over_post('kategorie', '3'); ?> /></td>
  <td><input type="radio" name="stitky" id="set_gr_stitky_3" value="3"<?php set_user_groups_over_post('stitky', '3'); ?> /></td>
  <td><input type="radio" name="galerie" id="set_gr_galerie_3" value="3"<?php set_user_groups_over_post('galerie', '3'); ?> /></td>
  <td><input type="radio" name="soubory" id="set_gr_soubory_3" value="3"<?php set_user_groups_over_post('soubory', '3'); ?> /></td>
  <td><input type="radio" name="komentare" id="set_gr_komentare_3" value="3"<?php set_user_groups_over_post('komentare', '3'); ?> /></td>
  <td><input type="radio" name="nastaveni" id="set_gr_nastaveni_3" value="3"<?php set_user_groups_over_post('nastaveni', '3'); ?> /></td>
  <td><input type="radio" name="sablony" id="set_gr_sablony_3" value="3"<?php set_user_groups_over_post('sablony', '3'); ?> /></td>
  <td><input type="radio" name="banlist" id="set_gr_banlist_3" value="3"<?php set_user_groups_over_post('banlist', '3'); ?> /></td>
  <td><input type="radio" name="zacleneni" id="set_gr_zacleneni_3" value="3"<?php set_user_groups_over_post('zacleneni', '3'); ?> /></td>
  <td><input type="radio" name="uzivatele" id="set_gr_uzivatele_3" value="3"<?php set_user_groups_over_post('uzivatele', '3'); ?> /></td>
  <td><input type="radio" name="skupiny" id="set_gr_skupiny_3" value="3"<?php set_user_groups_over_post('skupiny', '3'); ?> /></td>
  <td></td>
</tr>
<tr class="last_tr">
  <td class="td1 first"></td>
  <td><img src="stuff/img/icons/lists.png" alt="<?php echo $lang['set_user_groups_articles']; ?>" title="<?php echo $lang['set_user_groups_articles']; ?>" /></td>
  <td><img src="stuff/img/icons/text.png" alt="<?php echo $lang['set_user_groups_pages']; ?>" title="<?php echo $lang['set_user_groups_pages']; ?>" /></td>
  <td><img src="stuff/img/icons/open folder.png" alt="<?php echo $lang['set_user_groups_categories']; ?>" title="<?php echo $lang['set_user_groups_categories']; ?>" /></td>
  <td><img src="stuff/img/icons/label.png" alt="<?php echo $lang['set_user_groups_tags']; ?>" title="<?php echo $lang['set_user_groups_tags']; ?>" /></td>
  <td><img src="stuff/img/icons/camera.png" alt="<?php echo $lang['set_user_groups_galleries']; ?>" title="<?php echo $lang['set_user_groups_galleries']; ?>" /></td>
  <td><img src="stuff/img/icons/software.png" alt="<?php echo $lang['set_user_groups_files']; ?>" title="<?php echo $lang['set_user_groups_files']; ?>"></td>
  <td><img src="stuff/img/icons/comments.png" alt="<?php echo $lang['set_user_groups_comments']; ?>" title="<?php echo $lang['set_user_groups_comments']; ?>" /></td>
  <td><img src="stuff/img/icons/gear.png" alt="<?php echo $lang['set_user_groups_setting']; ?>" title="<?php echo $lang['set_user_groups_setting']; ?>" /></td>
  <td><img src="stuff/img/icons/bricks.png" alt="<?php echo $lang['set_user_groups_templates']; ?>" title="<?php echo $lang['set_user_groups_templates']; ?>" /></td>
  <td><img src="stuff/img/icons/no.png" alt="<?php echo $lang['set_user_groups_banlist']; ?>" title="<?php echo $lang['set_user_groups_banlist']; ?>" /></td>
  <td><img src="stuff/img/icons/wizard.png" alt="<?php echo $lang['set_user_groups_integration']; ?>" title="<?php echo $lang['set_user_groups_integration']; ?>" /></td>
  <td><img src="stuff/img/icons/users.png" alt="<?php echo $lang['set_user_groups_users']; ?>" title="<?php echo $lang['set_user_groups_users']; ?>" /></td>
  <td><img src="stuff/img/icons/user group.png" alt="<?php echo $lang['set_user_groups_user_groups']; ?>" title="<?php echo $lang['set_user_groups_user_groups']; ?>" /></td>
  <td class="last"></td>
</tr>
</table>

<br /><br />

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

<br />
</form>

<?php
break;

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

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

 if (empty($id) or $id == 1 or $radku == 0) {
    echo '<div class="oznameni_div">';
    echo '<div class="chyba">'.$lang['set_user_groups_error'].'</div>';
    if (empty($id)) {echo '<p>'.$lang['set_user_groups_er_12'].'</p>';};
    if ($radku == 0) {echo '<p>'.$lang['set_user_groups_er_13'].'</p>';};
    if ($id == 1) {echo '<p>'.$lang['set_user_groups_er_14'].'</p>';};
    echo '</div>';
    
    include_end();
    exit();
  };
  

if (!empty($_POST)) {

  over_posts();

  $nazev = $_POST['nazev'];
  $clanky = $_POST['clanky'];
  $stranky = $_POST['stranky'];
  $kategorie = $_POST['kategorie'];
  $stitky = $_POST['stitky'];
  $galerie = $_POST['galerie'];
  $soubory = $_POST['soubory'];
  $komentare = $_POST['komentare'];
  $nastaveni = $_POST['nastaveni'];
  $sablony = $_POST['sablony'];
  $banlist = $_POST['banlist'];
  $zacleneni = $_POST['zacleneni'];
  $uzivatele = $_POST['uzivatele'];
  $skupiny = $_POST['skupiny'];
  
  if (!empty($nazev) && !empty($clanky) && !empty($stranky) && !empty($kategorie) && !empty($stitky) && !empty($galerie) && !empty($soubory) && !empty($komentare) && !empty($nastaveni) && !empty($sablony) && !empty($banlist) && !empty($zacleneni) && !empty($uzivatele) && !empty($skupiny)) {
    
    $nazev = mysql_real_escape_string($nazev);
    $clanky = intval($clanky);
    $stranky = intval($stranky);
    $kategorie = intval($kategorie);
    $stitky = intval($stitky);
    $galerie = intval($galerie);
    $soubory = intval($soubory);
    $komentare = intval($komentare);
    $nastaveni = intval($nastaveni);
    $sablony = intval($sablony);
    $banlist = intval($banlist);
    $zacleneni = intval($zacleneni);
    $uzivatele = intval($uzivatele);
    $skupiny = intval($skupiny);

    mysql_query("UPDATE jtcms_skupiny SET nazev='".$nazev."', clanky='".$clanky."', stranky='".$stranky."', kategorie='".$kategorie."', stitky='".$stitky."', galerie='".$galerie."', soubory='".$soubory."', komentare='".$komentare."', nastaveni='".$nastaveni."', sablony='".$sablony."', banlist='".$banlist."', zacleneni='".$zacleneni."', uzivatele='".$uzivatele."', skupiny='".$skupiny."' WHERE id='".$id."' LIMIT 1");
    Header("Location: set_user_groups.php?work=edited&nazev=".rawurlencode($nazev));
    echo '<script type="text/javascript">location.replace("set_user_groups.php?work=edited&nazev='.rawurlencode($nazev).'")</script>'; 
     
  } else {
  
    echo '<div class="oznameni_div">';
    echo '<div class="chyba">'.$lang['set_user_groups_error'].'</div>';
    if (empty($nazev)) {echo '<li>'.$lang['set_user_groups_er_1'].'</li>';};
    if (empty($clanky)) {echo '<li>'.$lang['set_user_groups_er_2'].'</li>';};
    if (empty($stranky)) {echo '<li>'.$lang['set_user_groups_er_3'].'</li>';};
    if (empty($kategorie)) {echo '<li>'.$lang['set_user_groups_er_4'].'</li>';};
    if (empty($stitky)) {echo '<li>'.$lang['set_user_groups_er_16'].'</li>';};
    if (empty($galerie)) {echo '<li>'.$lang['set_user_groups_er_17'].'</li>';};
    if (empty($soubory)) {echo '<li>'.$lang['set_user_groups_er_19'].'</li>';};
    if (empty($komentare)) {echo '<li>'.$lang['set_user_groups_er_5'].'</li>';};
    if (empty($nastaveni)) {echo '<li>'.$lang['set_user_groups_er_6'].'</li>';};
    if (empty($sablony)) {echo '<li>'.$lang['set_user_groups_er_7'].'</li>';};
    if (empty($banlist)) {echo '<li>'.$lang['set_user_groups_er_8'].'</li>';};
    if (empty($zacleneni)) {echo '<li>'.$lang['set_user_groups_er_9'].'</li>';};
    if (empty($uzivatele)) {echo '<li>'.$lang['set_user_groups_er_10'].'</li>';};
    if (empty($skupiny)) {echo '<li>'.$lang['set_user_groups_er_11'].'</li>';};
    echo '</div>';
  
  };
};
?>  
  
<form method="post" action="set_user_groups.php?action=edit&amp;id=<?php echo $id; ?>" id="groups_form">

<div class="tac">
  <label for="set_nazev" class="nazev_label"><?php echo $lang['set_user_groups_name_of_group']; ?></label><input type="text" name="nazev" class="input" value="<?php if (empty($_POST['nazev'])) {echo $result['nazev'];} else {echo $_POST['nazev'];}; ?>" /><br />
</div>
<br /><br />

<table class="uzivatele_skupiny_tabulka">
<tr class="prvni_tr">
  <td class="td1 first">&nbsp;<?php echo $lang['set_user_groups_group']; ?></td>
  <td><img src="stuff/img/icons/lists.png" alt="<?php echo $lang['set_user_groups_articles']; ?>" title="<?php echo $lang['set_user_groups_articles']; ?>" /></td>
  <td><img src="stuff/img/icons/text.png" alt="<?php echo $lang['set_user_groups_pages']; ?>" title="<?php echo $lang['set_user_groups_pages']; ?>" /></td>
  <td><img src="stuff/img/icons/open folder.png" alt="<?php echo $lang['set_user_groups_categories']; ?>" title="<?php echo $lang['set_user_groups_categories']; ?>" /></td>
  <td><img src="stuff/img/icons/label.png" alt="<?php echo $lang['set_user_groups_tags']; ?>" title="<?php echo $lang['set_user_groups_tags']; ?>" /></td>
  <td><img src="stuff/img/icons/camera.png" alt="<?php echo $lang['set_user_groups_galleries']; ?>" title="<?php echo $lang['set_user_groups_galleries']; ?>" /></td>
  <td><img src="stuff/img/icons/software.png" alt="<?php echo $lang['set_user_groups_files']; ?>" title="<?php echo $lang['set_user_groups_files']; ?>"></td>
  <td><img src="stuff/img/icons/comments.png" alt="<?php echo $lang['set_user_groups_comments']; ?>" title="<?php echo $lang['set_user_groups_comments']; ?>" /></td>
  <td><img src="stuff/img/icons/gear.png" alt="<?php echo $lang['set_user_groups_setting']; ?>" title="<?php echo $lang['set_user_groups_setting']; ?>" /></td>
  <td><img src="stuff/img/icons/bricks.png" alt="<?php echo $lang['set_user_groups_templates']; ?>" title="<?php echo $lang['set_user_groups_templates']; ?>" /></td>
  <td><img src="stuff/img/icons/no.png" alt="<?php echo $lang['set_user_groups_banlist']; ?>" title="<?php echo $lang['set_user_groups_banlist']; ?>" /></td>
  <td><img src="stuff/img/icons/wizard.png" alt="<?php echo $lang['set_user_groups_integration']; ?>" title="<?php echo $lang['set_user_groups_integration']; ?>" /></td>
  <td><img src="stuff/img/icons/users.png" alt="<?php echo $lang['set_user_groups_users']; ?>" title="<?php echo $lang['set_user_groups_users']; ?>" /></td>
  <td><img src="stuff/img/icons/user group.png" alt="<?php echo $lang['set_user_groups_user_groups']; ?>" title="<?php echo $lang['set_user_groups_user_groups']; ?>" /></td>
  <td class="last"></td>
</tr>

<tr>
  <td class="tal">&nbsp;<?php echo $lang['set_user_groups_per_1']; ?></td>
  <td><input type="radio" name="clanky" id="set_clanky_1" value="1"<?php set_user_groups_over_post_result('clanky', '1'); ?> /></td>
  <td><input type="radio" name="stranky" id="set_gr_stranky_1" value="1"<?php set_user_groups_over_post_result('stranky', '1'); ?> /></td>
  <td><input type="radio" name="kategorie" id="set_gr_kategorie_1" value="1"<?php set_user_groups_over_post_result('kategorie', '1'); ?> /></td>
  <td><input type="radio" name="stitky" id="set_gr_stitky_1" value="1"<?php set_user_groups_over_post_result('stitky', '1'); ?> /></td>
  <td><input type="radio" name="galerie" id="set_gr_galerie_1" value="1"<?php set_user_groups_over_post_result('galerie', '1'); ?> /></td>
  <td><input type="radio" name="soubory" id="set_qr_soubory_1" value="1"<?php set_user_groups_over_post_result('soubory', '1'); ?> /></td>
  <td><input type="radio" name="komentare" id="set_gr_komentare_1" value="1"<?php set_user_groups_over_post_result('komentare', '1'); ?> /></td>
  <td><input type="radio" name="nastaveni" id="set_gr_nastaveni_1" value="1"<?php set_user_groups_over_post_result('nastaveni', '1'); ?> /></td>
  <td><input type="radio" name="sablony" id="set_gr_sablony_1" value="1"<?php set_user_groups_over_post_result('sablony', '1'); ?> /></td>
  <td><input type="radio" name="banlist" id="set_gr_banlist_1" value="1"<?php set_user_groups_over_post_result('banlist', '1'); ?> /></td>
  <td><input type="radio" name="zacleneni" id="set_gr_zacleneni_1" value="1"<?php set_user_groups_over_post_result('zacleneni', '1'); ?> /></td>
  <td><input type="radio" name="uzivatele" id="set_gr_uzivatele_1" value="1"<?php set_user_groups_over_post_result('uzivatele', '1'); ?> /></td>
  <td><input type="radio" name="skupiny" id="set_gr_skupiny_1" value="1"<?php set_user_groups_over_post_result('skupiny', '1'); ?> /></td>
  <td></td>  
</tr>
<tr>
  <td class="tal">&nbsp;<?php echo $lang['set_user_groups_per_2']; ?></td>
  <td><input type="radio" name="clanky" id="set_clanky_2" value="2"<?php set_user_groups_over_post_result('clanky', '2'); ?> /><label for="set_clanky_2"></td>
  <td><input type="radio" name="stranky" id="set_gr_stranky_2" value="2"<?php set_user_groups_over_post_result('stranky', '2'); ?> /></td>
  <td><input type="radio" name="kategorie" id="set_gr_kategorie_2" value="2"<?php set_user_groups_over_post_result('kategorie', '2'); ?> /></td>
  <td><input type="radio" name="stitky" id="set_gr_stitky_2" value="2"<?php set_user_groups_over_post_result('stitky', '2'); ?> /></td>
  <td><input type="radio" name="galerie" id="set_gr_galerie_2" value="2"<?php set_user_groups_over_post_result('galerie', '2'); ?> /></td>
  <td><input type="radio" name="soubory" id="set_qr_soubory_2" value="2"<?php set_user_groups_over_post_result('soubory', '2'); ?> /></td>
  <td><input type="radio" name="komentare" id="set_gr_komentare_2" value="2"<?php set_user_groups_over_post_result('komentare', '2'); ?> /></td>
  <td><input type="radio" name="disabled" disabled /></td>
  <td><input type="radio" name="disabled" disabled /></td>
  <td><input type="radio" name="disabled" disabled /></td>
  <td><input type="radio" name="disabled" disabled /></td>
  <td><input type="radio" name="disabled" disabled /></td>
  <td><input type="radio" name="disabled" disabled /></td>
  <td></td>
</tr>
<tr>
  <td class="tal">&nbsp;<?php echo $lang['set_user_groups_per_3']; ?></td>
  <td><input type="radio" name="clanky" id="set_clanky_3" value="3"<?php set_user_groups_over_post_result('clanky', '3'); ?> />   </td>
  <td><input type="radio" name="stranky" id="set_gr_stranky_3" value="3"<?php set_user_groups_over_post_result('stranky', '3'); ?> /></td>
  <td><input type="radio" name="kategorie" id="set_gr_kategorie_3" value="3"<?php set_user_groups_over_post_result('kategorie', '3'); ?> /></td>
  <td><input type="radio" name="stitky" id="set_gr_stitky_3" value="3"<?php set_user_groups_over_post_result('stitky', '3'); ?> /></td>
  <td><input type="radio" name="galerie" id="set_gr_galerie_3" value="3"<?php set_user_groups_over_post_result('galerie', '3'); ?> /></td>
  <td><input type="radio" name="soubory" id="set_qr_soubory_3" value="3"<?php set_user_groups_over_post_result('soubory', '3'); ?> /></td>
  <td><input type="radio" name="komentare" id="set_gr_komentare_3" value="3"<?php set_user_groups_over_post_result('komentare', '3'); ?> /></td>
  <td><input type="radio" name="nastaveni" id="set_gr_nastaveni_3" value="3"<?php set_user_groups_over_post_result('nastaveni', '3'); ?> /></td>
  <td><input type="radio" name="sablony" id="set_gr_sablony_3" value="3"<?php set_user_groups_over_post_result('sablony', '3'); ?> /></td>
  <td><input type="radio" name="banlist" id="set_gr_banlist_3" value="3"<?php set_user_groups_over_post_result('banlist', '3'); ?> /></td>
  <td><input type="radio" name="zacleneni" id="set_gr_zacleneni_3" value="3"<?php set_user_groups_over_post_result('zacleneni', '3'); ?> /></td>
  <td><input type="radio" name="uzivatele" id="set_gr_uzivatele_3" value="3"<?php set_user_groups_over_post_result('uzivatele', '3'); ?> /></td>
  <td><input type="radio" name="skupiny" id="set_gr_skupiny_3" value="3"<?php set_user_groups_over_post_result('skupiny', '3'); ?> /></td>
  <td></td>
</tr>
<tr class="last_tr">
  <td class="td1 first"></td>
  <td><img src="stuff/img/icons/lists.png" alt="<?php echo $lang['set_user_groups_articles']; ?>" title="<?php echo $lang['set_user_groups_articles']; ?>" /></td>
  <td><img src="stuff/img/icons/text.png" alt="<?php echo $lang['set_user_groups_pages']; ?>" title="<?php echo $lang['set_user_groups_pages']; ?>" /></td>
  <td><img src="stuff/img/icons/open folder.png" alt="<?php echo $lang['set_user_groups_categories']; ?>" title="<?php echo $lang['set_user_groups_categories']; ?>" /></td>
  <td><img src="stuff/img/icons/label.png" alt="<?php echo $lang['set_user_groups_tags']; ?>" title="<?php echo $lang['set_user_groups_tags']; ?>" /></td>
  <td><img src="stuff/img/icons/camera.png" alt="<?php echo $lang['set_user_groups_galleries']; ?>" title="<?php echo $lang['set_user_groups_galleries']; ?>" /></td>
  <td><img src="stuff/img/icons/software.png" alt="<?php echo $lang['set_user_groups_files']; ?>" title="<?php echo $lang['set_user_groups_files']; ?>"></td>
  <td><img src="stuff/img/icons/comments.png" alt="<?php echo $lang['set_user_groups_comments']; ?>" title="<?php echo $lang['set_user_groups_comments']; ?>" /></td>
  <td><img src="stuff/img/icons/gear.png" alt="<?php echo $lang['set_user_groups_setting']; ?>" title="<?php echo $lang['set_user_groups_setting']; ?>" /></td>
  <td><img src="stuff/img/icons/bricks.png" alt="<?php echo $lang['set_user_groups_templates']; ?>" title="<?php echo $lang['set_user_groups_templates']; ?>" /></td>
  <td><img src="stuff/img/icons/no.png" alt="<?php echo $lang['set_user_groups_banlist']; ?>" title="<?php echo $lang['set_user_groups_banlist']; ?>" /></td>
  <td><img src="stuff/img/icons/wizard.png" alt="<?php echo $lang['set_user_groups_integration']; ?>" title="<?php echo $lang['set_user_groups_integration']; ?>" /></td>
  <td><img src="stuff/img/icons/users.png" alt="<?php echo $lang['set_user_groups_users']; ?>" title="<?php echo $lang['set_user_groups_users']; ?>" /></td>
  <td><img src="stuff/img/icons/user group.png" alt="<?php echo $lang['set_user_groups_user_groups']; ?>" title="<?php echo $lang['set_user_groups_user_groups']; ?>" /></td>
  <td class="last"></td>
</tr>
</table>

<br /><br />

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

<br />
</form>  
  
<?php
break;

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

 if (empty($id) or $id == 1 or $radku == 0) {
    echo '<h1>'.$lang['set_user_groups_delete_group'].'</h1>';
    echo '<br />';
    
    echo '<div class="oznameni_div">';
    echo '<div class="chyba">'.$lang['set_user_groups_error'].'</div>';
    if (empty($id)) {echo '<p>'.$lang['set_user_groups_er_12'].'</p>';};
    if ($radku == 0) {echo '<p>'.$lang['set_user_groups_er_13'].'</p>';};
    if ($id == 1) {echo '<p>'.$lang['set_user_groups_er_14'].'</p>';};
    echo '</div>';
    
    include_end();
    exit();
  };

?>

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

<form method="post" action="set_user_groups.php?action=delete&amp;id=<?php echo $id; ?>" id="users_del_form">
  <label for="set_user_groups"><?php echo $lang['set_user_groups_del_ins_1']; ?></label>
  <select name="skupina" size="1" id="set_user_groups" class="input">
    <?php $query2 = mysql_query("SELECT id, nazev FROM jtcms_skupiny ORDER BY id");
    while ($result2 = mysql_fetch_array($query2)) {
      if ($result2['id'] != $id) {
        echo '<option value="'.$result2['id'].'" />'.$result2['nazev']."\n";
      };
    }; ?>  
  </select>
    <br /><br />
  <input type="submit" name="submit" value="<?php echo $lang['set_user_groups_delete_group']; ?>" class="submit" />
</form>
<br />

<?php
if (!empty($_POST)) {
  $skupina = $_POST['skupina'];
  
  if (!empty($skupina)) {
  
    $skupina = intval($skupina);
  
    mysql_query("UPDATE jtcms_uzivatele SET skupina='".$skupina."' WHERE skupina='".intval($id)."'");
    mysql_query("DELETE FROM jtcms_skupiny WHERE id='".intval($id)."' LIMIT 1");
    Header("Location: set_user_groups.php?work=deleted&nazev=".rawurlencode($nazev));
    echo '<script type="text/javascript">location.replace("set_user_groups.php?work=deleted&nazev='.rawurlencode($nazev).'")</script>';   
  } else {
    echo '<div class="oznameni_div">';
    echo '<div class="chyba">'.$lang['set_user_groups_error'].'</div>';
    if (empty($skupina)) {echo '<li>'.$lang['set_user_groups_er_18'].'</li>';};
    echo '</div>';   
  };
};

break;

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

 if (empty($id) or $id == 1 or $radku == 0) {
    echo '<h1>'.$lang['set_user_groups_delete_group'].'</h1>';
    echo '<br />';
    
    echo '<div class="oznameni_div">';
    echo '<div class="chyba">'.$lang['set_user_groups_error'].'</div>';
    if (empty($id)) {echo '<p>'.$lang['set_user_groups_er_12'].'</p>';};
    if ($radku == 0) {echo '<p>'.$lang['set_user_groups_er_13'].'</p>';};
    if ($id == 1) {echo '<p>'.$lang['set_user_groups_er_14'].'</p>';};
    echo '</div>';
    
    include_end();
    exit();
  };
  
    mysql_query("DELETE FROM jtcms_skupiny WHERE id='".intval($id)."' LIMIT 1");
    Header("Location: set_user_groups.php?work=deleted&nazev=".rawurlencode($nazev));
    echo '<script type="text/javascript">location.replace("set_user_groups.php?work=deleted&nazev='.rawurlencode($nazev).'")</script>';   

break;

case "detail" :

  $skupina = $_GET['skupina'];
  
  echo '<h1>'.$lang['set_user_groups_detail_group'].'</h1>';
  echo '<br />';
  
  if (!is_numeric($skupina) && $skupina != "all") {
    echo '<div class="oznameni_div">';
    echo '<div class="chyba">'.$lang['set_user_groups_error'].'</div>';
    echo '<p>'.$lang['set_user_groups_er_15'].'</p>';
    echo '</div>';
    
    include_end();
    exit();  
  };
  
  
  if (is_numeric($skupina)) {
    $query = mysql_query("SELECT id, nazev FROM jtcms_skupiny WHERE id='".intval($skupina)."' ORDER BY id");
  } else {
    $query = mysql_query("SELECT id, nazev FROM jtcms_skupiny ORDER BY id");
  };
  
  $radku = mysql_num_rows($query);

  if ($radku == 0) {
    echo '<div class="oznameni_div">';
    echo '<div class="chyba">'.$lang['set_user_groups_error'].'</div>';
    echo '<p>'.$lang['set_user_groups_no_groups'].'</p>';
    echo '</div>';
    
    include_end();
    exit();  
  };
  
  if ($skupina != "all") {
    echo '<a href="set_user_groups.php?action=detail&amp;skupina=all" class="tlacitko1" title="'.$lang['set_user_groups_all_groups'].'">'.$lang['set_user_groups_all_groups'].'</a>';
    echo '<br />';
  } else {
    echo '<h2>'.$lang['set_user_groups_all_groups'].'</h2><br />';    
  };
  
  while ($result = mysql_fetch_array($query)) {
    $query2 = mysql_query("SELECT id, jmeno FROM jtcms_uzivatele WHERE skupina='".$result['id']."'");
    $radku2 = mysql_num_rows($query2);
    
    if (is_numeric($skupina)) {
      echo '<h2>'.$result['nazev'].'</h2>';
      echo '<div class="detail_skupiny">';
    } else {
      echo '<div class="detail_skupiny">';
      echo '<h3><a href="set_user_groups.php?action=detail&amp;skupina='.$result['id'].'" title="'.$lang['set_user_groups_view_detail'].'">'.$result['nazev'].'</a></h3>';
    };
    
    echo '<div class="skupiny">';
    if ($radku2 == 0) {
      echo '<p>'.$lang['set_user_groups_group_is_empty'].'</p>';
    } else {    
      while ($result2 = mysql_fetch_array($query2)) {
        echo '<li><a href="set_users.php?action=edit&amp;id='.$result2['id'].'" title="'.$lang['set_user_groups_go_edit'].'">'.$result2['jmeno'].'</a></li>';
      };
    };
    echo '</div>';
    echo '</div>';
  };
  
break;

default:

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

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

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

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

<a href="set_user_groups.php?action=add" class="pridat_tlacitko fl"><img src="stuff/img/icons/create.png" alt="+" /> <?php echo $lang['set_user_groups_add_group']; ?></a>

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

<?php
  $query = mysql_query("SELECT * FROM jtcms_skupiny ORDER BY id");
?>
<table class="uzivatele_skupiny_tabulka">
<tr class="prvni_tr">
<td class="td1 first">&nbsp;<?php echo $lang['set_user_groups_group']; ?></td>
<td><img src="stuff/img/icons/users.png" alt="<?php echo $lang['set_user_groups_number_of_users']; ?>" alt="<?php echo $lang['set_user_groups_number_of_users']; ?>" /></td>
<td><img src="stuff/img/icons/lists.png" alt="<?php echo $lang['set_user_groups_articles']; ?>" title="<?php echo $lang['set_user_groups_articles']; ?>" /></td>
<td><img src="stuff/img/icons/text.png" alt="<?php echo $lang['set_user_groups_pages']; ?>" title="<?php echo $lang['set_user_groups_pages']; ?>" /></td>
<td><img src="stuff/img/icons/open folder.png" alt="<?php echo $lang['set_user_groups_categories']; ?>" title="<?php echo $lang['set_user_groups_categories']; ?>" /></td>
<td><img src="stuff/img/icons/label.png" alt="<?php echo $lang['set_user_groups_tags']; ?>" title="<?php echo $lang['set_user_groups_tags']; ?>" /></td>
<td><img src="stuff/img/icons/camera.png" alt="<?php echo $lang['set_user_groups_galleries']; ?>" title="<?php echo $lang['set_user_groups_galleries']; ?>" /></td>
<td><img src="stuff/img/icons/software.png" alt="<?php echo $lang['set_user_groups_files']; ?>" title="<?php echo $lang['set_user_groups_files']; ?>"></td>
<td><img src="stuff/img/icons/comments.png" alt="<?php echo $lang['set_user_groups_comments']; ?>" title="<?php echo $lang['set_user_groups_comments']; ?>" /></td>
<td><img src="stuff/img/icons/gear.png" alt="<?php echo $lang['set_user_groups_setting']; ?>" title="<?php echo $lang['set_user_groups_setting']; ?>" /></td>
<td><img src="stuff/img/icons/bricks.png" alt="<?php echo $lang['set_user_groups_templates']; ?>" title="<?php echo $lang['set_user_groups_templates']; ?>" /></td>
<td><img src="stuff/img/icons/no.png" alt="<?php echo $lang['set_user_groups_banlist']; ?>" title="<?php echo $lang['set_user_groups_banlist']; ?>" /></td>
<td><img src="stuff/img/icons/wizard.png" alt="<?php echo $lang['set_user_groups_integration']; ?>" title="<?php echo $lang['set_user_groups_integration']; ?>" /></td>
<td><img src="stuff/img/icons/users.png" alt="<?php echo $lang['set_user_groups_users']; ?>" title="<?php echo $lang['set_user_groups_users']; ?>" /></td>
<td><img src="stuff/img/icons/user group.png" alt="<?php echo $lang['set_user_groups_user_groups']; ?>" title="<?php echo $lang['set_user_groups_user_groups']; ?>" /></td>
<td class="last"></td>
</tr>
<?php 
  while ($result = mysql_fetch_array($query)) {
    $query2 = mysql_query("SELECT COUNT(*) AS pocet FROM jtcms_uzivatele WHERE skupina='".$result['id']."'");
    $result2 = mysql_fetch_array($query2);
    
    echo '<tr>';
    echo '<td class="tal">&nbsp;';
      echo $result['nazev'];
    echo '</td>';
    echo '<td><a href="set_user_groups.php?action=detail&amp;skupina='.$result['id'].'" title="'.$lang['set_user_groups_view_all_members'].'">'.$result2['pocet'].'</a></td>';
    echo '<td>';
      switch ($result['clanky']) {
        case "1" : echo '<img src="stuff/img/icons/dot_per_1.png" alt="'.$lang['set_user_groups_per_1_1'].'" title="'.$lang['set_user_groups_per_1_1'].'" />'; break;
        case "2" : echo '<img src="stuff/img/icons/dot_per_2.png" alt="'.$lang['set_user_groups_per_1_2'].'" title="'.$lang['set_user_groups_per_1_2'].'" />'; break;
        case "3" : echo '<img src="stuff/img/icons/dot_per_3.png" alt="'.$lang['set_user_groups_per_1_3'].'" title="'.$lang['set_user_groups_per_1_3'].'" />'; break;
      };
    echo '</td>';
    echo '<td>';
      switch ($result['stranky']) {
        case "1" : echo '<img src="stuff/img/icons/dot_per_1.png" alt="'.$lang['set_user_groups_per_2_1'].'" title="'.$lang['set_user_groups_per_2_1'].'" />'; break;
        case "2" : echo '<img src="stuff/img/icons/dot_per_2.png" alt="'.$lang['set_user_groups_per_2_2'].'" title="'.$lang['set_user_groups_per_2_2'].'" />'; break;
        case "3" : echo '<img src="stuff/img/icons/dot_per_3.png" alt="'.$lang['set_user_groups_per_2_3'].'" title="'.$lang['set_user_groups_per_2_3'].'" />'; break;
      };
    echo '</td>';
    echo '<td>';
      switch ($result['kategorie']) {
        case "1" : echo '<img src="stuff/img/icons/dot_per_1.png" alt="'.$lang['set_user_groups_per_3_1'].'" title="'.$lang['set_user_groups_per_3_1'].'" />'; break;
        case "2" : echo '<img src="stuff/img/icons/dot_per_2.png" alt="'.$lang['set_user_groups_per_3_2'].'" title="'.$lang['set_user_groups_per_3_2'].'" />'; break;
        case "3" : echo '<img src="stuff/img/icons/dot_per_3.png" alt="'.$lang['set_user_groups_per_3_3'].'" title="'.$lang['set_user_groups_per_3_3'].'" />'; break;
      };
    echo '</td>';
    echo '<td>';
      switch ($result['stitky']) {
        case "1" : echo '<img src="stuff/img/icons/dot_per_1.png" alt="'.$lang['set_user_groups_per_11_1'].'" title="'.$lang['set_user_groups_per_11_1'].'" />'; break;
        case "2" : echo '<img src="stuff/img/icons/dot_per_2.png" alt="'.$lang['set_user_groups_per_11_2'].'" title="'.$lang['set_user_groups_per_11_2'].'" />'; break;
        case "3" : echo '<img src="stuff/img/icons/dot_per_3.png" alt="'.$lang['set_user_groups_per_11_3'].'" title="'.$lang['set_user_groups_per_11_3'].'" />'; break;
      };
    echo '</td>';
    echo '<td>';
      switch ($result['galerie']) {
        case "1" : echo '<img src="stuff/img/icons/dot_per_1.png" alt="'.$lang['set_user_groups_per_12_1'].'" title="'.$lang['set_user_groups_per_12_1'].'" />'; break;
        case "2" : echo '<img src="stuff/img/icons/dot_per_2.png" alt="'.$lang['set_user_groups_per_12_2'].'" title="'.$lang['set_user_groups_per_12_2'].'" />'; break;
        case "3" : echo '<img src="stuff/img/icons/dot_per_3.png" alt="'.$lang['set_user_groups_per_12_3'].'" title="'.$lang['set_user_groups_per_12_3'].'" />'; break;
      };
    echo '</td>'; 
    echo '<td>';
      switch ($result['soubory']) {
        case "1" : echo '<img src="stuff/img/icons/dot_per_1.png" alt="'.$lang['set_user_groups_per_13_1'].'" title="'.$lang['set_user_groups_per_13_1'].'" />'; break;
        case "2" : echo '<img src="stuff/img/icons/dot_per_2.png" alt="'.$lang['set_user_groups_per_13_2'].'" title="'.$lang['set_user_groups_per_13_2'].'" />'; break;
        case "3" : echo '<img src="stuff/img/icons/dot_per_3.png" alt="'.$lang['set_user_groups_per_13_3'].'" title="'.$lang['set_user_groups_per_13_3'].'" />'; break;
      };
    echo '</td>';   
    echo '<td>';
      switch ($result['komentare']) {
        case "1" : echo '<img src="stuff/img/icons/dot_per_1.png" alt="'.$lang['set_user_groups_per_4_1'].'" title="'.$lang['set_user_groups_per_4_1'].'" />'; break;
        case "2" : echo '<img src="stuff/img/icons/dot_per_2.png" alt="'.$lang['set_user_groups_per_4_2'].'" title="'.$lang['set_user_groups_per_4_2'].'" />'; break;
        case "3" : echo '<img src="stuff/img/icons/dot_per_3.png" alt="'.$lang['set_user_groups_per_4_3'].'" title="'.$lang['set_user_groups_per_4_3'].'" />'; break;
      };
    echo '</td>';
    echo '<td>';
      switch ($result['nastaveni']) {
        case "1" : echo '<img src="stuff/img/icons/dot_per_1.png" alt="'.$lang['set_user_groups_per_5_1'].'" title="'.$lang['set_user_groups_per_5_1'].'" />'; break;
        case "3" : echo '<img src="stuff/img/icons/dot_per_3.png" alt="'.$lang['set_user_groups_per_5_3'].'" title="'.$lang['set_user_groups_per_5_3'].'" />'; break;
      };
    echo '</td>';
    echo '<td>';
      switch ($result['sablony']) {
        case "1" : echo '<img src="stuff/img/icons/dot_per_1.png" alt="'.$lang['set_user_groups_per_6_1'].'" title="'.$lang['set_user_groups_per_6_1'].'" />'; break;
        case "3" : echo '<img src="stuff/img/icons/dot_per_3.png" alt="'.$lang['set_user_groups_per_6_3'].'" title="'.$lang['set_user_groups_per_6_3'].'" />'; break;
      };
    echo '</td>';
    echo '<td>';
      switch ($result['banlist']) {
        case "1" : echo '<img src="stuff/img/icons/dot_per_1.png" alt="'.$lang['set_user_groups_per_7_1'].'" title="'.$lang['set_user_groups_per_7_1'].'" />'; break;
        case "3" : echo '<img src="stuff/img/icons/dot_per_3.png" alt="'.$lang['set_user_groups_per_7_3'].'" title="'.$lang['set_user_groups_per_7_3'].'" />'; break;
      };
    echo '</td>';
    echo '<td>';
      switch ($result['zacleneni']) {
        case "1" : echo '<img src="stuff/img/icons/dot_per_1.png" alt="'.$lang['set_user_groups_per_8_1'].'" title="'.$lang['set_user_groups_per_8_1'].'" />'; break;
        case "3" : echo '<img src="stuff/img/icons/dot_per_3.png" alt="'.$lang['set_user_groups_per_8_3'].'" title="'.$lang['set_user_groups_per_8_3'].'" />'; break;
      };
    echo '</td>';
    echo '<td>';
      switch ($result['uzivatele']) {
        case "1" : echo '<img src="stuff/img/icons/dot_per_1.png" alt="'.$lang['set_user_groups_per_9_1'].'" title="'.$lang['set_user_groups_per_9_1'].'" />'; break;
        case "3" : echo '<img src="stuff/img/icons/dot_per_3.png" alt="'.$lang['set_user_groups_per_9_3'].'" title="'.$lang['set_user_groups_per_9_3'].'" />'; break;
      };
    echo '</td>';
    echo '<td>';
      switch ($result['skupiny']) {
        case "1" : echo '<img src="stuff/img/icons/dot_per_1.png" alt="'.$lang['set_user_groups_per_10_1'].'" title="'.$lang['set_user_groups_per_10_1'].'" />'; break;
        case "3" : echo '<img src="stuff/img/icons/dot_per_3.png" alt="'.$lang['set_user_groups_per_10_3'].'" title="'.$lang['set_user_groups_per_10_3'].'" />'; break;
      };
    echo '</td>';
    echo '<td>';
      echo '<div class="links">';
       echo '<div>';
        if ($result['id'] == 1) {
          echo '<img src="stuff/img/icons/info.png" alt="'.$lang['set_user_groups_admin_no_edit'].'" title="'.$lang['set_user_groups_admin_no_edit'].'" />';
        } else {
          echo '<a href="set_user_groups.php?action=edit&amp;id='.$result['id'].'" title="'.$lang['set_user_groups_edit_group'].'"><img src="stuff/img/icons/edit.png" alt="'.$lang['set_user_groups_edit_group'].'" /></a>';
          if ($result2['pocet'] == 0) {
            echo '<img src="stuff/img/icons/trash.png" class="smaz" alt="'.$lang['set_user_groups_delete_group'].'" title="'.$lang['set_user_groups_delete_group'].'" onclick="smaz_skup_null(\''.$result['id'].'\',\''.$result['nazev'].'\')" />';
          } else {
            echo '<img src="stuff/img/icons/trash.png" class="smaz" alt="'.$lang['set_user_groups_delete_group'].'" title="'.$lang['set_user_groups_delete_group'].'" onclick="smaz_skup(\''.$result['id'].'\',\''.$result['nazev'].'\',\''.$result2['pocet'].'\')" />';
          };
        };
       echo '</div>';
      echo '</div>';
    echo '</td>';        
    echo '</tr>';
    echo "\n";
  }; 
?>
<tr class="last_tr">
<td class="first"></td>
<td></td>
<td><img src="stuff/img/icons/lists.png" alt="<?php echo $lang['set_user_groups_articles']; ?>" title="<?php echo $lang['set_user_groups_articles']; ?>" /></td>
<td><img src="stuff/img/icons/text.png" alt="<?php echo $lang['set_user_groups_pages']; ?>" title="<?php echo $lang['set_user_groups_pages']; ?>" /></td>
<td><img src="stuff/img/icons/open folder.png" alt="<?php echo $lang['set_user_groups_categories']; ?>" title="<?php echo $lang['set_user_groups_categories']; ?>" /></td>
<td><img src="stuff/img/icons/label.png" alt="<?php echo $lang['set_user_groups_tags']; ?>" title="<?php echo $lang['set_user_groups_tags']; ?>" /></td>
<td><img src="stuff/img/icons/camera.png" alt="<?php echo $lang['set_user_groups_galleries']; ?>" title="<?php echo $lang['set_user_groups_galleries']; ?>" /></td>
<td><img src="stuff/img/icons/software.png" alt="<?php echo $lang['set_user_groups_files']; ?>" title="<?php echo $lang['set_user_groups_files']; ?>"></td>
<td><img src="stuff/img/icons/comments.png" alt="<?php echo $lang['set_user_groups_comments']; ?>" title="<?php echo $lang['set_user_groups_comments']; ?>" /></td>
<td><img src="stuff/img/icons/gear.png" alt="<?php echo $lang['set_user_groups_setting']; ?>" title="<?php echo $lang['set_user_groups_setting']; ?>" /></td>
<td><img src="stuff/img/icons/bricks.png" alt="<?php echo $lang['set_user_groups_templates']; ?>" title="<?php echo $lang['set_user_groups_templates']; ?>" /></td>
<td><img src="stuff/img/icons/no.png" alt="<?php echo $lang['set_user_groups_banlist']; ?>" title="<?php echo $lang['set_user_groups_banlist']; ?>" /></td>
<td><img src="stuff/img/icons/wizard.png" alt="<?php echo $lang['set_user_groups_integration']; ?>" title="<?php echo $lang['set_user_groups_integration']; ?>" /></td>
<td><img src="stuff/img/icons/users.png" alt="<?php echo $lang['set_user_groups_users']; ?>" title="<?php echo $lang['set_user_groups_users']; ?>" /></td>
<td><img src="stuff/img/icons/user group.png" alt="<?php echo $lang['set_user_groups_user_groups']; ?>" title="<?php echo $lang['set_user_groups_user_groups']; ?>" /></td>
<td class="last"></td>
</tr>    
</table>
<br /><br />
<p class="prava_des">
<img src="stuff/img/icons/dot_per_1.png" alt="<?php echo $lang['set_user_groups_per_1']; ?>" /> - <?php echo $lang['set_user_groups_per_1_des']; ?><br />
<img src="stuff/img/icons/dot_per_2.png" alt="<?php echo $lang['set_user_groups_per_2']; ?>" /> - <?php echo $lang['set_user_groups_per_2_des']; ?><br />
<img src="stuff/img/icons/dot_per_3.png" alt="<?php echo $lang['set_user_groups_per_3']; ?>" /> - <?php echo $lang['set_user_groups_per_3_des']; ?><br />
</p>                       

<script type="text/javascript">
function smaz_skup_null(id, nazev){
jConfirm("<?php echo $lang['set_user_groups_really_del_1']; ?> "+nazev+"?", "<?php echo $lang['set_user_groups_really_del_headline']; ?>", function(r) {
    if (r == true) {location.replace("set_user_groups.php?action=delete-null&id="+id);};
});
};

function smaz_skup(id, nazev, pocet){
jConfirm("<?php echo $lang['set_user_groups_really_del_1']; ?> "+nazev+"? <?php echo $lang['set_user_groups_really_del_2']; ?> "+pocet+" <?php echo $lang['set_user_groups_really_del_3']; ?>", "<?php echo $lang['set_user_groups_really_del_headline']; ?>", function(r) {
    if (r == true) {location.replace("set_user_groups.php?action=delete&id="+id);};
});
};
</script>
 
<?php
};

include_end();
?>