SHARE
TWEET

sidebar

imaduddin Apr 26th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sidebar_menu()
  2. {
  3.     $ci = get_instance();
  4.  
  5.     $role_id   = $ci->session->userdata('role_id');
  6.     $queryMenu = "SELECT `user_menu`.`id`, `menu`
  7.                     FROM `user_menu` JOIN `user_access_menu`
  8.                       ON `user_menu`.`id` = `user_access_menu`.`menu_id`
  9.                    WHERE `user_access_menu`.`role_id` = $role_id
  10.                 ORDER BY `user_access_menu`.`menu_id` ASC";
  11.  
  12.     $menu      = $ci->db->query($queryMenu)->result_array();
  13.  
  14.     foreach ($menu as $m)
  15.     {
  16.         echo '<div class="sidebar-heading">';
  17.                 $m['menu'];
  18.         echo '</div>';
  19.  
  20.         $menuId = $m['id'];
  21.         $querySubMenu = "SELECT *
  22.                            FROM `user_sub_menu` JOIN `user_menu`
  23.                              ON `user_sub_menu`.`menu_id` = `user_menu`.`id`
  24.                           WHERE `user_sub_menu`.`menu_id` = $menuId
  25.                             AND `user_sub_menu`.`is_active` = 1";
  26.         $subMenu = $ci->db->query($querySubMenu)->result_array();  
  27.  
  28.         foreach ($subMenu as $sm)
  29.         {
  30.             if ($title == $sm['title']) {
  31.                echo '<li class="nav-item active">';
  32.             } else {
  33.                 echo '<li class="nav-item">';
  34.             }
  35.                 echo '<a href="'. base_url($sm['url']).'" class="nav-link pb-0">';
  36.                 echo '<i class="'. $sm['icon']. '"></i>';
  37.                 echo '<span>'.$sm['title'].'</span>';
  38.                 echo '</a>';
  39.                 echo '</li>';
  40.             }
  41.            
  42.         }
  43.        
  44.         echo '<hr class="sidebar-divider mt-3">';            
  45.     }  
  46. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top