<?php
  ///////////////////////////////////////////////////
  //2007 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

  $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0,2);
  if(is_file ("../lang/".$lang."/".$lang.".php")) include "../lang/".$lang."/".$lang.".php";
     else include "../lang/ru/ru.php";

  $title=$titlepage = $TEXT['supp-tema-title'];
  $helppage = $TEXT['supp-tema-help'];
  require_once "../config.php";
  require_once "../util/top_layer1.php";

  if($result2['user'] == 1) puterror2($TEXT['error-loginform4']);
  if($result2['master'] == 1) puterror2($TEXT['error-loginform4']);
  if($result2['manager'] == 1) puterror2($TEXT['error-loginform4']);
?>
 <img alt="<?php echo $TEXT['supp-tema-add-new']; ?>" src= "../img/insert.png" height="15" align="top" /><a class="boldit" href="addform-tema.php" title="<?php echo $TEXT['supp-tema-add-new-tit']; ?>"><?php echo $TEXT['supp-tema-add-new']; ?></a>
 <br />
 <br />
 <span class="tabledata"><?php echo $TEXT['supp-tema-text1']; ?></span>
<table class="table" border="1" cellpadding="4" cellspacing="0" width="60%">
<?php
     $query = "SELECT * FROM `tbl_supp_tema` ORDER BY `position`";
     $result = mysql_query($query);
     if(!$result) puterror2($TEXT['error-tbl22']);
       if(mysql_num_rows($result)>0);
         {
           echo "<tr class='tableheadercat'>
            <td>".$TEXT['supp-tema-title']."</td>
            <td>".$TEXT['tbl-shablon']."</td>
            <td>".$TEXT['tbl-position']."</td>
            <td>".$TEXT['tbl-visible']."</td>
            <td colspan=3>".$TEXT['tbl-action']."</td>
                 </tr>";
             while($result_tema = mysql_fetch_array($result,MYSQL_ASSOC))
              {
                $edit = "<a href=editform-tema.php?tema_id=".$result_tema['tema_id']." title='".$TEXT['supp-tema-edit-tit']."'>".$TEXT['tbl-edit']."</a>";
                $delete = "<a href=deleteform-tema.php?tema_id=".$result_tema['tema_id']." title='".$TEXT['supp-tema-del-tit']."'>".$TEXT['tbl-delete']."</a>";

                if($result_tema['visible']=='show') $tema_vis="<img alt='".$TEXT['tbl-for-all']."' src='../img/tema_all.png' height='16' width='16' align='top' />";
                 elseif($result_tema['visible']=='hide') $tema_vis="<img alt='".$TEXT['tbl-for-otv']."' src='../img/tema_otv.png' height='16' width='16' align='top' />";
                  else $tema_vis="<img alt='".$TEXT['tbl-for-it']."' src='../img/tema_it.png' height='16' width='16' align='top' />";

                if(!empty($result_tema['shablon'])) $shablon_est = $TEXT['res-field16'];
                 else $shablon_est = "---";

                $move_up = "<a href=up-down-tema.php?tema_id=".$result_tema['tema_id']."&amp;position=".$result_tema['position']."&amp;moving=up title='".$TEXT['global-up-down-tit']."'><img alt='picture' src='../img/up.png' height='16' width='16' align='top' /></a>";
                $move_down = "<a href=up-down-tema.php?tema_id=".$result_tema['tema_id']."&amp;position=".$result_tema['position']."&amp;moving=down title='".$TEXT['global-up-down-tit']."'><img alt='picture' src='../img/down.png' height='16' width='16' align='top' /></a>";
                ?>
                <tr class="tabledata" onmouseover="this.style.backgroundColor='#cccccc';" onmouseout="this.style.backgroundColor='#ffffff';">
                      <td><?php echo $result_tema['tema']; ?></td>
                      <td title="<?php echo $result_tema['shablon']; ?>"><?php echo $shablon_est; ?></td>
                      <td><?php echo $result_tema['position']; ?></td>
                      <td><?php echo $tema_vis; ?></td>
                      <td><?php echo $move_up; ?> <?php echo $move_down; ?></td>
                      <td><?php echo $edit; ?></td>
                      <td><?php echo $delete; ?></td>
                </tr>
                <?php
              }
         }
?>
</table>
<?php
  require_once "../util/bottom.php";
?>