%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/ugotscom/public_html/sterren/application/modules/users/models/
Upload File :
Create Path :
Current File : /home/ugotscom/public_html/sterren/application/modules/users/models/User_model.php

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class User_model extends CI_Model {

   

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }
	
	/////////////////////////TO FETCH ALL USERS/////////////////////////////////////////
	public function all_users(){
		$this->db->select('users.user_id,users.name,users.image,users.email,users.phone,user_type.user_type,users.status,username');
		$this->db->from('users');
		$this->db->join('user_type',"user_type.user_type_id=users.user_type_id","left");
		$this->db->where("users.user_type_id!='1' AND users.user_type_id!='2'");
		$this->db->order_by('users.user_id','DESC');
		$query = $this->db->get();
		$row = $query->result_array();
		return $row;
		//return $this->db->last_query();
			
	}
	//////////////////////////////User Type List//////////////////////////////////////
	public function user_type_list(){
		$this->db->select('*');
		$this->db->from('user_type');
		$this->db->where('user_type_id!=','1');
		$this->db->where('user_type_id!=','2');
		$query = $this->db->get();
		$row = $query->result_array();
		return $row;
			
	}
	/////////////////////////TO GET DETAILS OF ONE USER ////////////////////////////////
	public function user_details($id){
		$this->db->select('users.*');
		$this->db->from('users');
		$this->db->where('user_id',$id);
		$query = $this->db->get();
		$row = $query->row();
		return $row;	
	}
	/////////////////////////////Insert Data/////////////////////////////////////////////
	public function insert_data($insert_array)
	{
		$row = $this->db->insert('users',$insert_array);
		return $row;
	}
	////////////////////////Module List//////////////////////////////////////////
	public function category_list(){
		$this->db->select('*');
		$this->db->from('category');
		$this->db->where('status','1');
		$query = $this->db->get();
		$row = $query->result_array();
		return $row;	
	}
	///////////////////////////User Modules////////////////////////////////
	public function user_category($user_id){
		$this->db->select('*');
		$this->db->from('user_category');
		$this->db->where('user_id',$user_id);
		$query = $this->db->get();
		$row1	= $query->result_array();
		if ($row1) {
			foreach($row1 as $row)
		    {
		        $array[] = $row['category_id']; 
		    }
		}else{
			$array[]="";
		}
		return $array;
	}
	////////////////////Insert Modules//////////////
	public function insert_category($insert_array)
	{
		$row = $this->db->insert('user_category',$insert_array);
		return $row;
	}
	////////////////////update User/////////////////////////////
	public function update_data($update_array,$user_id)
	{
		$row=$this->db->update('users',$update_array,array('user_id'=>$user_id));
		return $row;
	}
	/////////////////////////Delete Modules//////////////////////////////////////
	public function delete_category($user_id)
	{
		$this->db->where('user_id',$user_id);
		$row=$this->db->delete('user_category');
		return $row;
	}
	//////////////////////////Month List/////////////////////
	public function month_list(){
		$this->db->select('*');
		$this->db->from('months');
		$query = $this->db->get();
		$row = $query->result_array();
		return $row;	
	}
	////////////////////////////////////////////////////////////////////////////////
}
	
  ?>  

Zerion Mini Shell 1.0