<section class="content-header">
    <h1>
        Menu Dinamis
        <small>Seting Menu Dinamis</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-suitcase"></i>Seting</a></li>
        <li class="active">Menu Dinamis</li>
    </ol>
</section>
<section class="content">   

    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class='box-header with-border'>
                    <h3 class='box-title'><a href="<?php echo base_url('menu/add'); ?>" class="btn btn-primary btn-small">
                            <i class="glyphicon glyphicon-plus"></i> Tambah Data</a></h3>
                            <label calss='control-label' ></label>
                </div>
                <div class="box-body table-responsive">
                    <table id="example1" class="table table-bordered table-striped" cellspacing="0" width="100%">
                        <thead>
                            <tr>
                                <th>No.</th>
                                <th>Nama Menu</th>
                                <th>Icon</th>
                                <th>Link</th>
                                <th>Kat. Menu</th> 
								<th>Status</th> 
								<th>Akses</th>  
                                <th>Edit</th>   
                                <th>Delete</th>                                 
                            </tr>
                        </thead>
                       <?php
					   $no=1;
                       function chek($id) {
                            $CI = get_instance();
                            $result = $CI->db->get_where('menu', array('id_menu' => $id))->row_array();
                            return $result['nama_menu'];
                        }
					   foreach ($record as $r){    
                        $katmenu = $r->kat_menu == 0 ? 'Menu Utama' : chek($r->kat_menu);  
							if ($r->hakakses == 0) {
								$akses="Semua";
							} if ($r->hakakses == 1) {
								$akses="Admin";
							} if ($r->hakakses == 2) {
								$akses="Guru";
							} if ($r->hakakses == 3) {
								$akses="Siswa";
							} if ($r->hakakses == 4) {
								$akses="Proktor";
							}
							if ($r->status == 0) {
								$status="Disable";
							} else {
								$status="Enable";
							}
						   echo"
							   <tr>
							   <td>$no</td>
							   <td>".$r->nama_menu."</td>
							   <td>".$r->icon."</td>
							   <td>".$r->link."</td>
							   <td>".$katmenu."</td>	
							   <td>".$status."</td>
								<td>".$akses."</td>
							   <td>" . anchor('menu/edit/' . $r->id_menu, '<i class="btn btn-info btn-sm glyphicon glyphicon-edit" data-toggle="tooltip" title="Edit"></i>') . "</td>
							   <td>" . anchor('menu/delete/' . $r->id_menu, '<i class="btn-sm btn-info glyphicon glyphicon-trash" data-toggle="tooltip" title="Delete"></i>', array('onclick' => "return confirm('Data Akan di Hapus?')")) . "</td>
                               </tr>";
						   $no++;
					   }
					   ?>
                    </Table> 
                </div><!-- /.box-body -->
            </div><!-- /.box -->
        </div>
    </div>
</section><!-- /.content -->
