SOLVED:[help]Jqgrid master detail list in another page!

#5
[eluser]cestaz18[/eluser]
CONTROLLER (sec_users.php)

Code:
function post()
    {
        $c = "";    
        $data['action'] = $this->input->post('action');    
        $item = $this->input->post('item');    
        
        if ($data['action']=='view')
        {

            $dt['user_id'] = $this->input->post('item');
            $details = $this->User->getDetails($dt);

            if ($details)
            {
                $data['db'] = array('item'=>$dt['user_id'],
                                    'username'=>$details['username'],    
                                    'last_name'=>$details['last_name'],                                    
                                    'first_name'=>$details['first_name'],
                                    'middle_initial'=>$details['middle_initial'],
                                    'role_id'=>$details['role_id'],                                    
                                    'role_code'=>$details['role_code'],
                                    'role_desc'=>$details['role_desc'],                                        
                                    'dept_id'=>$details['dept_id'],                                    
                                    'dept_code'=>$details['dept_code'],
                                    'dept_desc'=>$details['dept_desc']
                            
                                                                
                                    //'a.first_name'=>$details['a.first_name'],
                                    //'a.middle_initial'=>$details['a.middle_initial']                                    
                                    );
                $data['count'] = $this->User->countDetailList($dt);                                    
                #$data['count'] = 0;
            }
    
            $data['response'] = $c;
            $json['json'] = $data;            
            $this->load->vars($data);
            $this->load->view('template/ajax',$json);    
        }
        
        //language
        elseif ($data['action']=="language")
        {
            $lang_select =  $this->input->post('language');
            $this->lang->load('login', $lang_select);//login(module) & lang_select(language)
            $data['dt'] = array('h1'=>lang('h1'),
                                'instruction'=>lang('instruction'),
                                'login'=>lang('login'),
                                'pass'=>lang('pass'),
                                'company'=>lang('company'),
                                'lang_select'=>lang('language'),
                                'remember'=>lang('rememberme'),
                                'log'=>lang('log'),
                                'forgot'=>lang('forgot'),
                                'get_pass'=>lang('get_pass'),
                                'instruction2'=>lang('instruction2'),
                                'username2'=>lang('username2'),
                                'email'=>lang('email'),
                                'get'=>lang('get'),
                                'irmp'=>lang('irmp'),
                                'js'=>lang('js'));    
                                          
            $data['response'] = $c;
            $data['action'] = 'language';
            
            $json['json'] = $data;
            
        }
        
        elseif ($data['action']=='save')
        {
            $item = $this->input->post("item");    
            $dt['username'] = $this->input->post('username');
            $sec_exist = $this->User->getDetails($dt);
            
            if ($sec_exist && $item!=$sec_exist['user_id'])
            {
                $c .= 'User ID already exists.';
                $data['action'] = 'exist';
            }
            else
            {
                $fields = array(
                        "username"
                        ,"last_name"
                        ,"first_name"
                        ,"middle_initial"
                        ,"role_id"
                        ,"dept_id"                    
                        );
                
            foreach ($fields as $field)
            {
                if (isset($_POST[$field])) $dt[$field] = $this->input->post($field);
            }
            
            $item = $this->input->post("item");        
            
        /*    $data['item'] = $this->User->save($dt,$item);
            $company = $this->session->userdata('company');
            $dt['company_id'] = $company['company_id'];*/    
                    
            $rows = $this->input->post("row0");
            $data['item'] = $this->User->save($dt,$item,$rows);    
            
            $c .= lang('users_saved_item');                        
            }    
            $data['response'] = $c;
            
            
            $json['json'] = $data;
        }
        
        elseif ($data['action']=='delete')
        {
            $dt['user_id'] = $this->input->post("item");    
            $dt['username'] = $this->input->post("username");    
            $data['deleted_row'] = $this->User->delete($dt);
            
            $c .= lang('users_deleted_item').$data['deleted_row'];
            $data['response'] = $c;
        
            $json['json'] = $data;    
        }

function listview()
    {
        $data = $this->User->getList();    
        $this->load->view('template/table',$data);
    }
    
//----------------------------------------------------------------------------
    function detaillistview()
    {
        $data = $this->User->getDetailList($this->uri->segment(3));    
        $this->load->view('template/table',$data);
    }


Messages In This Thread
SOLVED:[help]Jqgrid master detail list in another page! - by El Forum - 01-28-2010, 01:59 AM
SOLVED:[help]Jqgrid master detail list in another page! - by El Forum - 01-28-2010, 02:03 AM
SOLVED:[help]Jqgrid master detail list in another page! - by El Forum - 01-28-2010, 02:04 AM
SOLVED:[help]Jqgrid master detail list in another page! - by El Forum - 02-01-2010, 11:49 PM
SOLVED:[help]Jqgrid master detail list in another page! - by El Forum - 02-01-2010, 11:52 PM
SOLVED:[help]Jqgrid master detail list in another page! - by El Forum - 02-01-2010, 11:53 PM
SOLVED:[help]Jqgrid master detail list in another page! - by El Forum - 02-01-2010, 11:54 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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