• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to locate the specified class: Session.php

#11
Finally I got it working. In my Menu.php library, I made the following changes:

PHP Code:
<?php
    if 
(!defined('BASEPATH'))
 
       exit('No direct script access allowed');

 
   class Menu //extends MY_Controller -> REMOVED

 
       protected $CI//ADDED

 
       function __construct() {
 
           //parent::__construct(); -> REMOVED
 
           $this->CI =& get_instance(); //ADDED 
 
           $this->CI->load->model('menu_model''menu'); //Replace "$this" by "$this->CI"
 
       }

 
       public function getMenu() {
 
           $menu = array();
 
           $model = new Menu_model();

 
           $perfil $this->getPerfilUser();

 
           $modulos $model->getModulos($perfil);
 
           $funcoes $model->getFuncoes($perfil);

 
           for ($i 0$i sizeof($modulos); $i++) {
 
               $menu[$i]['nome'] = $modulos[$i]['modulo_nome'];
 
               for ($j 0$j sizeof($funcoes); $j++) {
 
                   if ($menu[$i]['nome'] == $funcoes[$j]['modulo_nome']) {
 
                       $menu[$i]['funcoes'][$j] = $funcoes[$j];
 
                   }
 
               }
 
           }
 
           return $menu;
 
       }

 
       function getPerfilUser() {
 
          return $this->CI->session->userdata['user_id_perfil']; //HERE
 
       }

 
       function getIdUser() {
 
           return $this->CI->session->userdata['user_id']; //HERE
 
       }

 
       function exibirMenu() {
 
           echo '<pre>';
 
               print_r($this->getMenu());
 
           echo '</pre>';
 
       }
 
   
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.