<?php
///////////////////////////////////////////////////
//Карпухин Павел
//2010 (C)
///////////////////////////////////////////////////
require_once "../utils/chlang.php";

$title=$titlepage = $TEXT['menu-btn26-title'];

require_once "../config_a.php";
require_once "../utils/functions.php";
require_once "../utils/top_adm.php";

if($result2['administrator'] == 0) {puterror($result2['skin'],$TEXT['error-loginform2']); require_once "../utils/bottom_adm.php"; exit();}
?>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="50%">
<tr align="right">
<td><img alt="<?php echo $TEXT['add-new']; ?>" src="../skins/<?php echo $result2['skin']; ?>/add.png"><a class="bold_it" href="addform.php" title="<?php echo $TEXT['add-new-tit']; ?>"><?php echo $TEXT['add-new']; ?></a></td>
</tr>
</table>
<table align="center" class="table" border="1" cellpadding="3" cellspacing="0" width="50%">
<?php
     $query10 = "SELECT * FROM `tbl_obraschenie` ORDER BY `obr_id`";
     $result10 = mysqli_query($dbcnx,$query10);
     if(!$result10) {puterror($result2['skin'],$TEXT['error-tbl18']); require_once "../utils/bottom_adm.php"; exit();}
       if(mysqli_num_rows($result10)>0)
         {
           echo " <thead>
              <tr class='tableheadercat'>
                 <td width='60%'>".$TEXT['tbl-obr']."</td>
                 <td colspan='2'>".$TEXT['tbl-action']."</td>
              </tr>
             </thead>
            <tbody id='tab'>";
             while($result_obr = mysqli_fetch_array($result10))
               {
              $edit_pic = "<img alt='".$TEXT['edit-new']."' src='../skins/".$result2['skin']."/edit.png' />";
              $edit = $edit_pic."&nbsp;<a href='editform.php?obr_id=".$result_obr['obr_id']."' title='".$TEXT['edit-tit']."'>".$TEXT['edit-new']."</a>";

              $query_login_obr = mysqli_query($dbcnx,"SELECT COUNT(obr_id) AS c_obr_id FROM tbl_statistik WHERE obr_id='".$result_obr['obr_id']."'");
	      $coun_login_obr = mysqli_fetch_array($query_login_obr);
              if($coun_login_obr['c_obr_id'] > 0)
               {
                $delete_pic = "<img alt='".$TEXT['global-lock']."' src='../skins/".$result2['skin']."/nodelete.png' />";
                $delete =$delete_pic."&nbsp;".$TEXT['delete-new'];
               }
                else
                 {
                  $delete_pic = "<img alt='".$TEXT['delete-new']."' src='../skins/".$result2['skin']."/delete.png' />";
                  $delete = $delete_pic."&nbsp;<a href='delete.php?obr_id=".$result_obr['obr_id']."' title='".$TEXT['delete-tit']."'>".$TEXT['delete-new']."</a>";
                 }
           ?>
           <tr>
              <td><?php echo $result_obr['kachestvo']; ?></td>
              <td><?php echo $edit; ?></td>
              <td><?php echo $delete; ?></td>
            </tr>
           <?php
               }
               echo "</tbody>";
         }
?>
</table>
<?php
require_once "../utils/bottom_adm.php";
?>