<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Web management</title>
<link rel="stylesheet" href="styles.css" type="text/css">
<?php include 'codes.php';?>
</head>
<body text="#000000" style="margin:0">
<table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
    
<div><img src="img/frame-list.png" width="180" height="37" alt=""></div>
<div class="frame">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="text">
  <tr>
    <td align="center"><div class="titles">
        <?php
			$sql = "SELECT * FROM infocategories";
			$result = mysql_query($sql);
			$nu_row = mysql_num_rows($result);
?>
        <?php echo $nu_row  ?> </div></td>
  </tr>
  <tr>
    <td><?php
			$sql1 = "SELECT * FROM infocategories WHERE level='1' ORDER BY priority";
			$result1 = mysql_query($sql1);
        	while ($myrow=mysql_fetch_array($result1)) {
			$id=$myrow['id'];
			$category=$myrow['category'];
			$publish=$myrow['publish'];
			$priority=$myrow['priority'];
?></td>
  </tr>
  <tr>
    <td>
    <table width="100%" border="0" cellspacing="1" cellpadding="4" class="text">
        <tr valign="top">
          <td width="30" bgcolor="#F2F2F2"><?php echo $priority ?></td> 
          <td width="200" bgcolor="#F2F2F2">
		  <?php
			$sql3 = "SELECT * FROM info WHERE category_id='$id'";
			$result3= mysql_query($sql3);
			$nu_row3 = mysql_num_rows($result3);
?>
            <?php 
	if  ( ( $nu_row3==0)) {
	?>
            <?php echo $category ?>
            <?php } else {?>
            <a href="all-info.php?catid=<?php echo $id?>" class="links"> <?php echo $category ?></a> <b> [<?php echo $nu_row3  ?>] </b>
          <?php } ?>
          <?php if ($publish=='no') { ?>
            <div style="color:#666666; font-weight:bold; padding-top:5px;">&raquo; ΔΗΜΟΣΙΕΥΣΗ <font color="#d64111">ΟΧΙ</font></div><?php } ?>
            </td>
          <td><?php 
			$sql2 = "SELECT * FROM infocategories WHERE level='2' AND parent='$id' ORDER BY priority";
			$result2 = mysql_query($sql2);
			$nu_row2 = mysql_num_rows($result2);
	        while ($myrow=mysql_fetch_array($result2)) {
			$id2=$myrow['id'];
			$category2=$myrow['category'];
			$publish=$myrow['publish'];
			$priority2=$myrow['priority'];
?>
            <table width="100%" border="0" cellspacing="1" cellpadding="2" class="text">
              <tr valign="top">
                <td width="30" bgcolor="#F2F2F2"><?php echo $priority2 ?></td>
                <td bgcolor="#F2F2F2"> 
                  <?php
			$sql4 = "SELECT * FROM info WHERE category_id='$id2'";
			$result4= mysql_query($sql4);
			$nu_row4 = mysql_num_rows($result4);
?>
            <?php 
	if  ( ( $nu_row4==0)) {
	?>
            <?php echo $category2 ?>
            <?php } else {?>
            <a href="all-info.php?catid=<?php echo $id2?>" class="links"> <?php echo $category2 ?></a> <b> [<?php echo $nu_row4  ?>] </b>
          <?php } ?>
          <?php if ($publish=='no') { ?>
            <div style="color:#666666; font-weight:bold; padding-top:5px;">&raquo; ΔΗΜΟΣΙΕΥΣΗ <font color="#d64111">ΟΧΙ</font></div><?php } ?>
                 </td>
                <td width="70" bgcolor="#F2F2F2"> 
                  <div align="center"><a href="edit-infocategory.php?id=<?php echo $id2?>" class="link">ΑΛΛΑΓΗ</a></div>
                </td>
                <td width="70" bgcolor="#F2F2F2"> 
                  <div align="center"><a href="delete-infocategory.php?id=<?php echo $id2?>" class="link">ΔΙΑΓΡΑΦΗ</a></div>
                </td>
              </tr>
            </table><?php } ?>
          </td>
          <td width="70" bgcolor="#F2F2F2"><div align="center"><a href="edit-infocategory.php?id=<?php echo $id?>" class="link">ΑΛΛΑΓΗ</a></div></td>
          <td width="70" bgcolor="#F2F2F2">
          <?php if ($nu_row2=='0') { ?>
          <div align="center"><a href="delete-infocategory.php?id=<?php echo $id?>" class="link">ΔΙΑΓΡΑΦΗ</a></div>
          <?php } ?>
          </td>
        </tr>
      </table>
    <hr></td>
  </tr>
  <tr>
    <td><?php } ?></td>
  </tr>
</table>
</div>
</td>
  </tr>
</table>


<?php include 'menudown.php';?>
</body>
</html>
