<?php
  ///////////////////////////////////////////////////
  //2011 (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['tip-title'];
  $helppage = $TEXT['tip-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['add-new']; ?>" src= "../img/insert.png" height="15" align="top" /><a class="boldit" href="addform-tip.php" title="<?php echo $TEXT['add-new-tit']; ?>"><?php echo $TEXT['add-new']; ?></a>
 <br />
 <br />
 <span class="tabledata"><?php echo $TEXT['supp-tip-text1']; ?></span>
<table class="table" border="1" cellpadding="4" cellspacing="0" width="60%">
<?php
     $query = "SELECT * FROM `tbl_tip_resurs` ORDER BY `position`";
     $result = mysql_query($query);
     if(!$result) puterror2($TEXT['error-tbl38']);
       if(mysql_num_rows($result)>0);
         {
           echo "<tr class='tableheadercat'>
            <td>".$TEXT['inst-field1']."</td>
            <td>".$TEXT['tbl-nazv']."</td>
            <td>".$TEXT['tip-pref']."</td>
            <td>".$TEXT['tbl-position']."</td>
            <td colspan=3>".$TEXT['tbl-action']."</td>
                 </tr>";
             while($result_tip = mysql_fetch_array($result,MYSQL_ASSOC))
              {
                $edit = "<a href=editform-tip.php?tip_id=".$result_tip['tip_id']." title='".$TEXT['supp-tip-edit-tit']."'>".$TEXT['tbl-edit']."</a>";
                $delete = "<a href=deleteform-tip.php?tip_id=".$result_tip['tip_id']." title='".$TEXT['supp-tip-del-tit']."'>".$TEXT['tbl-delete']."</a>";

		        if(!empty($result_tip['pic_tip'])) $picture = "<img alt='".$result_tip['tip_name']."' width='16' height='16' src='../".$result_tip['pic_tip']."' />";
		         else $picture = $TEXT['res-field17'];

                if($result_tip['prefix'] == "") $prefix = "---";
                 else $prefix = $result_tip['prefix'];

                $move_up = "<a href=up-down-tip.php?tip_id=".$result_tip['tip_id']."&amp;position=".$result_tip['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-tip.php?tip_id=".$result_tip['tip_id']."&amp;position=".$result_tip['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 align="center"><?php echo $picture; ?></td>
                      <td><?php echo $result_tip['tip_name']; ?></td>
                      <td><?php echo $prefix; ?></td>
                      <td><?php echo $result_tip['position']; ?></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";
?>