<?php
$table='school_staff';
// $this->session->userdata('user_name');
$user_id=$this->session->userdata('tid');
$acedemic_session=$this->session->userdata('acedemic_session');
$active_acedemic_session=$this->session->userdata('active_acedemic_session');
$ac_year=$this->session->userdata('ac_year');
$fee_permission=$this->session->userdata('fee_permission');
$school_management=$this->session->userdata('school_management');
$all_permission=$this->session->userdata('all_permission');
$attendence=$this->session->userdata('attendence');
$doc_permission=$this->session->userdata('documents');
$admin=$this->session->userdata('admin');
$user=$this->session->userdata('user');
$teacher_name=$this->session->userdata('teacher_name');
$tid=$this->session->userdata('tid');
$class_teacher=$this->session->userdata('class_teacher');
$class_teacher_section=$this->session->userdata('class_teacher_section');
$y1=$this->session->userdata('y1');
$y2=$this->session->userdata('y2');
                                    
// $get_user_data=$this->WelcomeModel->get_item_data($user_id,$table);
// if($get_user_data){
//     foreach($get_user_data as $data){
//         $admin=$data['admin'];
//         $school_management=$data['school_management'];
//         $all_permission=$data['all_permission'];
//         $fee_permission=$data['fee_permission'];
//         $doc_permission=$data['documents'];
//     }
// }
            

$this->load->view('newtheme/navbar'); 
?>
 <!-- partial:partials/_sidebar.html -->
<nav class="sidebar sidebar-offcanvas" id="sidebar">
    <ul class="nav">
        <li class="nav-item">
             
            <a class="nav-link" data-toggle="collapse" href="#acedemic-session" aria-expanded="false" aria-controls="acedemic-session">
                <i class="icon-layout menu-icon"></i>
                <span class="menu-title"><?php echo $this->session->userdata('ac_year'); ?></span>
                <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="acedemic-session">
                <select name="ac_session" class="list-group-item list-group-item-action bg-light ac_session" style="border-radius:none;box-shadow:unset;outline:0;">    
                <?php 
                $acedemic_session_table='academic_session_details';
                $acedemic_session=$this->session->userdata('acedemic_session');
                $acedemic_session_data=$this->NewFeeModel->get_data($acedemic_session_table);
                if($acedemic_session_data){
                    foreach($acedemic_session_data as $data){
                ?>

                    <option value="<?php echo $data['id']; ?>" <?php if($data['id'] == $acedemic_session){ echo "selected"; } ?> ><?php echo $data['year_long'];?></option>

                <?php
                    }
                }   
                ?>
                </select>   
            </div>
        </li>
        
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url(); ?>Welcome">
              <i class="icon-grid menu-icon"></i>
              <span class="menu-title">Home</span>
            </a>
        </li>
        <?php 
        if($fee_permission ==1 || $admin == 1 || $all_permission==1 || $school_management==1){
        ?>  
        <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#Enquiry" aria-expanded="false" aria-controls="form-elements">
              <i class="icon-columns menu-icon"></i>
              <span class="menu-title">Enquiry</span>
              <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="Enquiry">
                <ul class="nav flex-column sub-menu">
                    <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>Enquiry/new_enquiry">New Enquiry</a></li>
                    <li class="nav-item"><a class="nav-link" href="<?php echo base_url();?>Enquiry/list_enquiry">All Enquiry</a></li>
                </ul>
            </div>
        </li>        
        <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#Fee" aria-expanded="false" aria-controls="Fee">
              <i class="icon-columns menu-icon"></i>
              <span class="menu-title">Fee</span>
              <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="Fee">
              <ul class="nav flex-column sub-menu">
                <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>OpeningFee">Opening Fee</a></li>
                <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>Fee/all_students">Pay Fee</a></li>
                <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>Fee/defaulters">Fee Defaulters</a></li>
                <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>FeeManagement">Fee Collection</a></li>
                <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>Fee/invoices">Fee Invoices</a></li>
                <li class="nav-item"><a href="<?php echo base_url(); ?>Enquiry/invoices" class="nav-link">Enquiry Fee Invoices</a></li>
                <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>OpeningFee/all_invoices">Opening Fee Invoices</a></li>
                <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>Fee/deleted_invoices">Fee Deleted Invoices</a></li>
                <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>OpeningFee/deleted_invoices">Opening Fee Deleted Invoices</a></li>
              </ul>
            </div>
          </li>
          <li class="nav-item">
              <a class="nav-link" data-toggle="collapse" href="#transport" aria-expended="false" aria-controls="transport">
                  <i class="icon-columns menu-icon"></i>
                  <span>Transport</span>
                  <i class="menu-arrow"></i>
              </a>
              <div class="collapse" id="transport">
              <ul class="nav flex-column sub-menu">
                <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Transport/routes"> Transport Routes</a></li>
                <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Transport/add_new_route">Add New Route</a></li>
              </ul>
            </div>
          </li>
          <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#Students" aria-expanded="false" aria-controls="Students">
              <i class="icon-head menu-icon"></i>
              <span class="menu-title">Students</span>
              <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="Students">
              <ul class="nav flex-column sub-menu">
                <li class="nav-item"> <a class="nav-link" href="<?php echo base_url();?>School/students">All Students</a></li>
              </ul>
            </div>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url();?>Certificate/dashboard">
              <i class="icon-paper menu-icon"></i>
              <span class="menu-title">Documentation</span>
            </a>
          </li>
          
          <?php 
        }
        if($admin == 1 || $all_permission==1 || $school_management==1 ){
          ?>
          <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#exam" aria-expanded="false" aria-controls="exam">
              <i class="icon-bar-graph menu-icon"></i>
              <span class="menu-title">Exam</span>
              <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="exam">
              <ul class="nav flex-column sub-menu">
                <li class="nav-item"> <a class="nav-link" href="<?php echo base_url();?>Examination/dashboard">Exam</a></li>
              </ul>
            </div>
          </li>
          
          <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#tables" aria-expanded="false" aria-controls="tables">
              <!--<i class="icon-grid-2 menu-icon"></i>-->
              <i class="icon-head menu-icon"></i>
              <span class="menu-title">Staff</span>
              <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="tables">
              <ul class="nav flex-column sub-menu">
                <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Management/view_staff">All Staff</a></li>
                <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Management/add_teacher">Add Staff</a></li>
                <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Management/add_class_teacher">Class Teachers</a></li>
                <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>official_permissions">Permissions</a></li>
              </ul>
            </div>
          </li>
          <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#icons" aria-expanded="false" aria-controls="icons">
              <i class="icon-contract menu-icon"></i>
              <span class="menu-title">Courses</span>
              <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="icons">
              <ul class="nav flex-column sub-menu">
                <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>School/add_courses">Add New Courses</a></li>
                <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>School/courses">All Courses</a></li>
              </ul>
            </div>
          </li>
          <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#auth" aria-expanded="false" aria-controls="auth">
              <i class="icon-head menu-icon"></i>
              <span class="menu-title">Attendance</span>
              <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="auth">
              <ul class="nav flex-column sub-menu">
                <li class="nav-item"> <a class="nav-link" href="#"> Staff Attendance </a></li>
                <li class="nav-item"> <a class="nav-link" href="#">Student Attendance </a></li>
              </ul>
            </div>
          </li>
          
          <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#error" aria-expanded="false" aria-controls="error">
              <i class="icon-ban menu-icon"></i>
              <span class="menu-title">Acedemic Session</span>
              <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="error">
              <ul class="nav flex-column sub-menu">
                <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Fee/add_acedemic_session"> Add New Ac. Session</a></li>
                <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Fee/all_acedemic_sessions"> All Ac. Sessions </a></li>
              </ul>
            </div>
          </li>
          
          <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url(); ?>School/circular">
              <i class="icon-paper menu-icon"></i>
              <span class="menu-title">Circular</span>
            </a>
          </li>
        <?php 
        }
        if($class_teacher !=''){
        ?>
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url(); ?>Student/my_class_students">
              <i class="icon-paper menu-icon"></i>
              <span class="menu-title">Circular</span>
            </a>
         </li>
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url(); ?>School/circular">
              <i class="icon-paper menu-icon"></i>
              <span class="menu-title">Circular</span>
            </a>
         </li>
         
         
        <?php 
            if($active_acedemic_session == $acedemic_session){
        ?>
         <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url(); ?><?php echo base_url();?>Teacher/daily_attendence">
              <i class="icon-paper menu-icon"></i>
              <span class="menu-title">Attendance</span>
            </a>
          </li>
        <?php 
            }else{
        ?>
          <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url();?>Teacher/attendance_history">
              <i class="icon-paper menu-icon"></i>
              <span class="menu-title">Attendance</span>
            </a>
          </li>
        <?php 
            }
        
        ?>
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url();?>Fee/my_class_students">
              <i class="icon-paper menu-icon"></i>
              <span class="menu-title">Fee</span>
            </a>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url();?>Examination/my_class_students">
              <i class="icon-paper menu-icon"></i>
              <span class="menu-title">Exam</span>
            </a>
        </li>
        <?php 
        }
        ?>
    </ul>
</nav>

      <!-- partial -->
      <div class="main-panel">
        <div class="content-wrapper">

          