<?php
class Profile extends CI_Controller {

	function __construct(){
		parent::__construct();
		$this->load->model('master_model');
		//error_reporting(E_ALL);
	}

	function index(){	
		//$this->load->view('index.php');
	}
	function show_profile(){	
	   	$user_id = $this->session->userdata('user_id');
	   	$this->page_data['page_title']="User Profile";
	   	$this->page_data['bredcrum']=array(			                           
										'User Profile'=>'#',
	 									);
	  	$condition = array();
        $condition[] = array('join',TABLE_COMPANY_BRANCH.' as c','c.company_branch_id = u.company_branch_id','left');
        $condition[] = array('join',TABLE_USER_TYPE.' as ut','ut.user_type_id = u.user_type_id','left');
        $condition[] = array('where','u.user_id',$user_id);
		$selected_array = array( 
			                   'table_name' =>TABLE_USERS. ' as u',
			                   'table_fields' =>'u.user_name,u.first_name,u.last_name,u.accessible_branches,u.email_id,u.designation,u.mobile_no,u.company_branch_id,u.address,u.state,u.city,u.pincode,u.user_type_id,c.company_branch_name,ut.user_type',
			                   'condition'=>$condition,
			                   'order_by_field'=>'',
			                   'limit'=>'',
			                   'offset'=>'',
			                   'order'=>'DESC'
		);
		$profile['profile'] = $this->master_model->select_data($selected_array);
		if(!empty($profile['profile'] )&& is_array($profile['profile'] )){
							
				 $this->page_data['profile'] =   $profile['profile'] ;
		 	

  	    }else{
  	    	$this->page_data['profile']='';
  	    }
             
  	    $this->load->view('gc/view_profile',$this->page_data);
	}

}
?>