<?php
$log_lang = htmlspecialchars(trim($_SESSION['lang']), ENT_QUOTES, 'UTF-8');

if($log_lang == 1) { ?>
<style>
.only_eng {
/*display: block;*/
}
.only_others {
	display: none;
}
</style>
<?php } if($log_lang != 1) { ?>
<style>
.only_eng {
	display: none;
}
.only_others {
/*display: block;*/
}
</style>
<?php } ?>

<div class="user-panel">
  <div class="pull-left image"> <img  src="dist/img/user2-160x160.png" class="img-circle" alt="User Image"> </div>
  <div class="pull-left info">
    <p><?php echo $name; ?></p>
    <a href="#"><i class="fa fa-circle text-success"></i> Online</a> </div>
</div>
<!-- search form --> 
<br>
<ul class="sidebar-menu">
  <li class="header"><font color="#00CCFF">MAIN NAVIGATION &nbsp;(
    <?php if($log_lang == 1) { echo 'ENGLISH'; } if($log_lang == 2) { echo 'SINHALA'; } if($log_lang == 3) { echo 'TAMIL'; } ?>
    )</font></li>
  <li class="treeview"> <a href="home.php" target="_parent"> <i class="fa fa-home"></i> <span>Dashboard</span> <i class="fa fa-angle-left pull-right"></i> </a> </li>
  <?php 
  $icons = array('fa-globe','fa-user-plus', 'fa-book', 'fa-cab', 'fa-money','fa-file-text-o', 'fa-cogs');
  $x = 0;
  
  $sql_ct = mysqli_query($conn, "SELECT * FROM user_priv_q WHERE emp_id='$emp_id' AND user='$log' GROUP BY cat_id ORDER BY cat_oid ASC");  
  while($row_ct = mysqli_fetch_array($sql_ct)) { $main_cat = $row_ct['cat_id']; ?>
  <li class="treeview"> <a href="#" target="_parent"> <i class="fa <?php echo $icons[$x]; ?>"></i> <span><?php echo $row_ct['category'];?></span> <i class="fa fa-angle-left pull-right"></i> </a>
    <ul class="treeview-menu">
      <?php $sql_menu = mysqli_query($conn, "SELECT * FROM user_priv_q WHERE emp_id='$emp_id' AND user='$log' AND cat_id='$main_cat' ORDER BY menu_oid ASC"); 

while($row_menu = mysqli_fetch_array($sql_menu)) { ?>
      <li><a href="<?php echo $row_menu['url']; ?>?menu=<?php echo $row_menu['menu_id'];?>" target="_parent"><i class="fa fa-circle-o"></i> <?php echo $row_menu['menu']; ?></a></li>
      <?php } ?>
    </ul>
  </li>
  <?php $x++; } ?>
</ul>