<?php
$staf='';
//include('config.php');
//session_start();
$user=$_SESSION['user_idd'];
$pos=$_SESSION['pos'];

$result = mysqli_query($con,"SELECT * FROM Staffs where Status='Active'");
$num_rows1 = mysqli_num_rows($result);
{
$staf=htmlentities($num_rows1); 
}

$query = mysqli_query($con,"SELECT * FROM users where userid='$user'");
while($row=mysqli_fetch_array($query))
{
  $leev=htmlentities($row['Level']);
  $sadmn=htmlentities($row['Sadmin']);
}
?>

<style>
  .sidebar .nav-item
  {
      background: linear-gradient(to bottom, #0099ff 0%, #003366 100%);
    margin-bottom: 2px;
  }

   .sidebar .nav-item a
  {
        color:#FFF;
  }

</style>
  <!-- Main Sidebar Container -->
  <aside class="main-sidebar  elevation-4">
    <!-- Brand Logo -->
    <a href="index.php?page=dashboard" class="brand-link">
      <img src="../images/schicon.ico" alt="<?php echo $schname; ?>" class="brand-image img-circle elevation-3" style="opacity: .8">
      <span class="brand-text font-weight-light">Version 2.1.0</span>
    </a>

    <!-- Sidebar -->
    <div class="sidebar">
      <!-- Sidebar user panel (optional) -->
      <div class="user-panel mt-3 pb-3 mb-3 d-flex">
        <div class="image">
          <img src="../images/admin.png" class="img-circle elevation-2" alt="User Image">
        </div>
        <div class="info">
          <a href="#" class="d-block"> <marquee><?php echo $schname; ?></marquee></a>
        </div>
      </div>
      <!-- Sidebar Menu -->
      <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
          <?php
          if($pos=='Teacher')
          {
           ?>
            <li class="nav-item">
            <a href="index.php?page=dashboard" class="nav-link active">
              <i class="nav-icon fas fa-tachometer-alt"></i>
              <p>
                Dashboard
                <span class="nav-icon "></span>
              </p>
            </a>
          </li>
          
          <li class="nav-item">
            <a href="Exams.php?page=Home" class="nav-link">
              <i class="fa fa-solid fa-user-graduate"></i>
              <p>
                 Exams Management
                <span class="right badge badge-danger"></span>
              </p>
            </a>
          </li>
          
        <li class="nav-item">
            <a href="index.php?page=Messaging" class="nav-link">
              <i class="fa fa-paper-plane"></i>
              <p>
                 Messaging System
                <span class="right badge badge-danger"></span>
              </p>
            </a>
          </li>
         
           <?php   
          }else
          {
          ?>
          <li class="nav-item">
            <a href="index.php?page=dashboard" class="nav-link">
              <i class="nav-icon fas fa-tachometer-alt"></i>
              <p>
                Dashboard
                <span class="nav-icon "></span>
              </p>
            </a>
          </li>
         
          <li class="nav-item">
            <a href="index.php?page=Staffs" class="nav-link">
              <i class="nav-icon fas fa-user-lock"></i>
              <p>
                 Staff Members
                <span class="right badge badge-danger"><?php echo $staf; ?></span>
              </p>
            </a>
          </li>
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-users"></i>
              <p>
                Learners' Data
                <i class="fas fa-angle-left right"></i>
                <span class="badge badge-info right"></span>
              </p>
            </a>
            <ul class="nav nav-treeview">
              <li class="nav-item">
                <a href="Pupils.php?page=Manage" class="nav-link text-info bg-white">
                  <i class="far fa-circle nav-icon"></i>
                  <p>Manage Learners' data</p>
                </a>
              </li>
              <li class="nav-item">
                <a href="Pupils.php?page=Enrollment" class="nav-link text-info bg-white">
                  <i class="far fa-circle nav-icon"></i>
                  <p>Enrolment</p>
                </a>
              </li>
          
            </ul>
          </li>
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-chart-pie"></i>
              <p>
                Income
                <i class="right fas fa-angle-left"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
              <li class="nav-item">
                <a href="Pupils.php?page=Manage_Fee" class="nav-link bg-white">
                  <i class="far fa-dollar nav-icon"></i>
                  <p>Fees</p>
                </a>
              </li>

              <li class="" style="color:green">
                <a href="index.php?page=Manage_Bus" class="nav-link bg-white">
                  <i class="far fa-car nav-icon"></i>
                  <p>Bus Hire</p>
                </a>
              </li>
              <li class="nav-item">
                <a href="index.php?page=Farm" class="nav-link bg-white">
                  <i class="far fa-money nav-icon"></i>
                  <p>Farm Income</p>
                </a>
              </li>
              <li class="nav-item">
                <a href="index.php?page=Other_Earning" class="nav-link bg-white">
                  <i class="far fa-bank nav-icon"></i>
                  <p>Other Income</p>
                </a>
              </li>
            </ul>
          </li>
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-truck fa-solid "></i>
              <p>
                Expenses
                <i class="fas fa-angle-left right"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
             
               <li class="nav-item" class="alert-success">
                <a href="Expenditure.php?page=Projects" class="nav-link text-warning bg-white">
                  <i class="far fa-circle nav-icon"></i>
                  <p>Projects</p>
                </a>
              </li>
              <li class="nav-item">
                <a href="Expenditure.php?page=Imprest" class="nav-link text-warning bg-white">
                  <i class="far fa-circle nav-icon"></i>
                  <p>Imprest</p>
                </a>
              </li>
              <?php
                 if($sadmn=='Yes')
                 { }else{
                   ?>
              <li class="nav-item">
                <a href="Expenditure.php?page=Payroll" class="nav-link text-warning bg-white">
                  <i class="far fa-circle nav-icon"></i>
                  <p>Employee Cost/Payroll</p>
                </a>
              </li>
              <?php
                 }
                 ?>
              
               <li class="nav-item">
                <a href="index.php?page=Expenses" disabled="" class="nav-link text-warning bg-white">
                  <i class="far fa-circle nav-icon"></i>
                  <p>Other Expenses/Cheques</p>
                </a>
              </li>
            </ul>
          </li>
         
          <li class="nav-item">
            <a href="#" class="nav-link">
          
              <i class="nav-icon fas fa-sharp fa-solid fa-folder-open"></i>
              <p>
                Reports
                <i class="fas fa-angle-left right"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
              
              <!--li class="nav-item">
                <a href="index.php?page=Income_Filter" class="nav-link bg-white">
                  <i class="far fa-circle nav-icon"></i>
                  <p>Income Per Category</p>
                </a>
              </li-->
               <!--li class="nav-item">
                <a href="Expenditure.php?page=NSSF" class="nav-link bg-white">
                  <i class="far fa-circle nav-icon"></i>
                  <p>NSSF/SHA</p>
                </a>
              </li-->
            
       
              <li class="nav-item">
                <a href="index.php?page=Proforma"  class="nav-link bg-white">
                  <i class="far fa-circle nav-icon"></i>
                  <p>Proforma</p>
                </a>
              </li>

               <li class="nav-item">
                <a href="index.php?page=Income-Expenses" class="nav-link bg-white">
                  <i class="far fa-circle nav-icon"></i>
                  <p>Analysis Report</p>
                </a>
              </li>
            </ul>
          </li>
          
          <li class="nav-item">
            <a href="Exams.php?page=Home" class="nav-link">
              <i class="fa fa-solid fa-user-graduate"></i>
              <p>
                 Exams Management
                <span class="right badge badge-danger"></span>
              </p>
            </a>
          </li>
          
          <li class="nav-item">
            <a href="index.php?page=Messaging" class="nav-link">
              <i class="fa fa-paper-plane"></i>
              <p>
                 Messaging System
                <span class="right badge badge-danger"></span>
              </p>
            </a>
          </li>
         
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-plus"></i>
              <p>
                Extras
                <i class="fas fa-angle-left right"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
               <?php
               if($leev=='Admin')
               {
                 if($sadmn=='Yes')
                 { }else{
                   ?>
              <li class="nav-item">
                <a href="index.php?page=users" class="nav-link text-warning bg-white">
                  <i class="far fa-circle nav-icon"></i>
                  <p>Manage Users </p>
                </a>
              </li>
              <?php
               }
               }
               ?>
              <li class="nav-item">
                <a href="index.php?page=setup" class="nav-link text-warning bg-white">
                  <i class="fa fa-database nav-icon"></i>
                  <p>School Data</p>
                </a>
              </li>
            
              <li class="nav-item">
                <a href="Pupils.php?page=Fee" class="nav-link text-warning bg-white">
                  <i class="fa fa-cog nav-icon"></i>
                  <p>Fees Setting</p>
                </a>
              </li>
              
              
              <li class="nav-item">
                <a href="index.php?page=Set" class="nav-link text-warning bg-white">
                  <i class="fa fa-cogs nav-icon"></i>
                  <p>Other Settings</p>
                </a>
              </li>
              <li class="nav-item">
                <a href="Events.php" class="nav-link text-warning bg-white">
                  <i class="fa fa-calendar nav-icon"></i>
                  <p>Calendar of events</p>
                </a>
              </li>
              
               <!--li class="nav-item">
                <a href="index.php?page=Emails" class="nav-link text-warning">
                  <i class="fa fa-paper-plane nav-icon"></i>
                  <p>Email Messaging</p>
                </a>
              </li-->
               <li class="nav-item">
                <a href="The_Backup.php" class="nav-link text-warning">
                  <i class="fa fa-database  nav-icon"></i>
                  <p>Back-up Database</p>
                   <i class="fa fa-cloud-download  nav-icon"></i>
                </a>
              </li>
              
              <!--li class="nav-item">
                <a href="index.php?page=Bulk_Upload" class="nav-link text-warning">
                  <i class="fa fa-cloud nav-icon"></i>
                  <p>Bulk Data Upload</p>
                </a>
              </li-->
               <?php
          }
          ?>
            </ul>
          </li>
    
        </ul>
      </nav>
      <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
  </aside>