Welcome Guest, Not a member yet? Register   Sign In
[Solved] stuck model id issue
#2

Problem solved I had to use db query inside my in_array to make it work with out errors showing

PHP Code:
<?php

class Users_group_update extends Admin_Controller {

    public function 
__construct() {
        
parent::__construct();
        
$this->load->model('admin/user/model_user_group');
    }

    public function 
index() {

        
$data['title'] = "Users Group Update";

        
$controller_files $this->getInstalled($this->uri->segment(3)); 

        
$data['controller_files'] = array();

        
$files glob(FCPATH 'application/modules/admin/controllers/*/*.php');

        if (
$files) {

            foreach (
$files as $file) {
                
$controller  basename(strtolower($file), '.php');

                
$do_not_list = array(
                    
'customer_total',
                    
'dashboard',
                    
'footer',
                    
'header',
                    
'login',
                    
'logout',
                    
'menu',
                    
'online',
                    
'permission',
                    
'register',
                    
'user_total'
                
); 

                if (!
in_array($controller$do_not_list)) {

                    
$this->db->where('name'$this->uri->segment(3));
                    
$this->db->where('controller'$controller);
                    
$query $this->db->get($this->db->dbprefix 'user_group');

                    if (
$query->num_rows()) {

                    
$row $query->row();

                    
$data['controller_files'][] = array(
                        
'name' => $controller,
                        
'installed' => in_array($controller$controller_files),
                        
'edit' => site_url('admin/users_group_controller_update' .'/'$row->user_group_id)
                    );

                    }
                }
            }
        }

        
$this->load->view('template/user/users_group_form_update'$data);
    }

    public function 
getInstalled($name) {
        
$controller_data = array();

        
$this->db->select();
        
$this->db->from($this->db->dbprefix 'user_group');
        
$this->db->where('name'$name);
        
$query $this->db->get();

        foreach (
$query->result_array() as $result) {
            
$controller_data[] = $result['controller'];
        }

        return 
$controller_data;
    }

There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
[Solved] stuck model id issue - by wolfgang1983 - 03-19-2015, 06:59 AM
RE: [Solved] stuck model id issue - by wolfgang1983 - 03-19-2015, 04:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB