Server IP : 103.191.208.50 / Your IP : 216.73.216.53 Web Server : LiteSpeed System : Linux orion.herosite.pro 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64 User : celkcksm ( 1031) PHP Version : 7.4.33 Disable Function : show_source, system, shell_exec, passthru, popen, exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/celkcksm/ecampus.ncriptech.com/application/models/asm/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php defined('BASEPATH') OR exit('No direct script access allowed'); /** * */ class Assets_model extends BaseModel { function __constuct(){ parent::__construct(); } //Asset categories public function store_assets_category($data,$return_query=FALSE){ $this->table='institute_assets_category'; return $this->store($data,FALSE,$return_query); } public function update_assets_category($data,$param,$batch=FALSE,$return_query=FALSE){ $this->table='institute_assets_category'; return $this->modify($data,$param,$batch,$return_query); } public function delete_assets_category($param,$return_query=FALSE){ $this->table='institute_assets_category'; return $this->remove($param,0,$return_query); } public function get_assets_category($param=null,$single_row=TRUE,$return_query=FALSE){ $this->table='institute_assets_category'; if($single_row==TRUE){ return $this->get_one($param,'',$return_query); }else if($single_row==FALSE){ return $this->get_many($param,null,null,$return_query); } } public function _get_assets_category($post=array(),$param=array(),$count=FALSE,$return_query=FALSE){ $this->_db->select('institute_assets_category.*'); $i = 0; $this->_db->where('category_inst_id',$param['category_inst_id']); $this->_db->where('category_inst_type',$param['category_inst_type']); if(isset($param['column_search'])){ foreach ($param['column_search'] as $item) { if(isset($post['search']['value']) && $post['search']['value']) { if($i===0) { $this->_db->group_start(); $this->_db->like($item, $post['search']['value']); } else { $this->_db->or_like($item, $post['search']['value']); } if(count($param['column_search']) - 1 == $i) $this->_db->group_end(); } $i++; } } if(isset($post['order'])) { $column_order=$param['column_order']; $this->_db->order_by($column_order[$post['order']['0']['column']], $post['order']['0']['dir']); } else if(isset($param['order'])) { $order = $param['order']; $this->_db->order_by(key($order), $order[key($order)]); } if($count==FALSE){ if(isset($post['length']) && $post['length'] != -1){ $this->_db->limit($post['length'],$post['start']); } $query = $this->_db->get('institute_assets_category'); if($return_query==FALSE){ return $query->result(); }else if($return_query==TRUE){ return $this->_db->last_query(); } }else if($count==TRUE){ $query = $this->_db->get('institute_assets_category'); if($return_query==FALSE){ return $query->num_rows(); }else if($return_query==TRUE){ return $this->_db->last_query(); } } } //Assets public function store_assets($data,$return_query=FALSE){ $this->table='institute_assets'; return $this->store($data,FALSE,$return_query); } public function update_assets($data,$param,$batch=FALSE,$return_query=FALSE){ $this->table='institute_assets'; return $this->modify($data,$param,$batch,$return_query); } public function delete_assets($param,$return_query=FALSE){ $this->table='institute_assets'; return $this->remove($param,0,$return_query); } public function get_assets($param=null,$single_row=TRUE,$return_query=FALSE){ $this->table='institute_assets'; if($single_row==TRUE){ return $this->get_one($param,'',$return_query); }else if($single_row==FALSE){ return $this->get_many($param,null,null,$return_query); } } public function _get_assets($post=array(),$param=array(),$count=FALSE,$return_query=FALSE){ $this->_db->select('institute_assets.*,institute_assets_category.category_id,institute_assets_category.category_name'); $this->_db->join('institute_assets_category','institute_assets_category.category_id=institute_assets.asset_category_id','LEFT'); $i = 0; $this->_db->where('asset_inst_id',$param['asset_inst_id']); if(isset($param['asset_category_id']) && empty($param['asset_category_id'])){ $this->_db->where('asset_category_id',$param['asset_category_id']); } if(isset($param['column_search'])){ foreach ($param['column_search'] as $item) { if(isset($post['search']['value']) && $post['search']['value']) { if($i===0) { $this->_db->group_start(); $this->_db->like($item, $post['search']['value']); } else { $this->_db->or_like($item, $post['search']['value']); } if(count($param['column_search']) - 1 == $i) $this->_db->group_end(); } $i++; } } if(isset($post['order'])) { $column_order=$param['column_order']; $this->_db->order_by($column_order[$post['order']['0']['column']], $post['order']['0']['dir']); } else if(isset($param['order'])) { $order = $param['order']; $this->_db->order_by(key($order), $order[key($order)]); } if($count==FALSE){ if(isset($post['length']) && $post['length'] != -1){ $this->_db->limit($post['length'],$post['start']); } $query = $this->_db->get('institute_assets'); if($return_query==FALSE){ return $query->result(); }else if($return_query==TRUE){ return $this->_db->last_query(); } }else if($count==TRUE){ $query = $this->_db->get('institute_assets'); if($return_query==FALSE){ return $query->num_rows(); }else if($return_query==TRUE){ return $this->_db->last_query(); } } } //Assets Suplliers public function store_assets_suppliers($data,$return_query=FALSE){ $this->table='institute_assets_suppliers'; return $this->store($data,FALSE,$return_query); } public function update_assets_suppliers($data,$param,$batch=FALSE,$return_query=FALSE){ $this->table='institute_assets_suppliers'; return $this->modify($data,$param,$batch,$return_query); } public function delete_assets_suppliers($param,$return_query=FALSE){ $this->table='institute_assets_suppliers'; return $this->remove($param,0,$return_query); } public function get_assets_suppliers($param=null,$single_row=TRUE,$return_query=FALSE){ $this->table='institute_assets_suppliers'; if($single_row==TRUE){ return $this->get_one($param,'',$return_query); }else if($single_row==FALSE){ return $this->get_many($param,null,null,$return_query); } } public function _get_assets_suppliers($post=array(),$param=array(),$count=FALSE,$return_query=FALSE){ $this->_db->select('institute_assets_suppliers.*'); $i = 0; $this->_db->where('supplier_inst_id',$param['supplier_inst_id']); $this->_db->where('supplier_inst_type',$param['supplier_inst_type']); if(isset($param['column_search'])){ foreach ($param['column_search'] as $item) { if(isset($post['search']['value']) && $post['search']['value']) { if($i===0) { $this->_db->group_start(); $this->_db->like($item, $post['search']['value']); } else { $this->_db->or_like($item, $post['search']['value']); } if(count($param['column_search']) - 1 == $i) $this->_db->group_end(); } $i++; } } if(isset($post['order'])) { $column_order=$param['column_order']; $this->_db->order_by($column_order[$post['order']['0']['column']], $post['order']['0']['dir']); } else if(isset($param['order'])) { $order = $param['order']; $this->_db->order_by(key($order), $order[key($order)]); } if($count==FALSE){ if(isset($post['length']) && $post['length'] != -1){ $this->_db->limit($post['length'],$post['start']); } $query = $this->_db->get('institute_assets_suppliers'); if($return_query==FALSE){ return $query->result(); }else if($return_query==TRUE){ return $this->_db->last_query(); } }else if($count==TRUE){ $query = $this->_db->get('institute_assets_suppliers'); if($return_query==FALSE){ return $query->num_rows(); }else if($return_query==TRUE){ return $this->_db->last_query(); } } } //Assets Stores public function store_assets_stores($data,$return_query=FALSE){ $this->table='institute_assets_stores'; return $this->store($data,FALSE,$return_query); } public function update_assets_stores($data,$param,$batch=FALSE,$return_query=FALSE){ $this->table='institute_assets_stores'; return $this->modify($data,$param,$batch,$return_query); } public function delete_assets_stores($param,$return_query=FALSE){ $this->table='institute_assets_stores'; return $this->remove($param,0,$return_query); } public function get_assets_stores($param=null,$single_row=TRUE,$return_query=FALSE){ $this->table='institute_assets_stores'; if($single_row==TRUE){ return $this->get_one($param,'',$return_query); }else if($single_row==FALSE){ return $this->get_many($param,null,null,$return_query); } } public function _get_assets_stores($post=array(),$param=array(),$count=FALSE,$return_query=FALSE){ $this->_db->select('institute_assets_stores.*'); $i = 0; $this->_db->where('store_inst_id',$param['store_inst_id']); $this->_db->where('store_inst_type',$param['store_inst_type']); if(isset($param['column_search'])){ foreach ($param['column_search'] as $item) { if(isset($post['search']['value']) && $post['search']['value']) { if($i===0) { $this->_db->group_start(); $this->_db->like($item, $post['search']['value']); } else { $this->_db->or_like($item, $post['search']['value']); } if(count($param['column_search']) - 1 == $i) $this->_db->group_end(); } $i++; } } if(isset($post['order'])) { $column_order=$param['column_order']; $this->_db->order_by($column_order[$post['order']['0']['column']], $post['order']['0']['dir']); } else if(isset($param['order'])) { $order = $param['order']; $this->_db->order_by(key($order), $order[key($order)]); } if($count==FALSE){ if(isset($post['length']) && $post['length'] != -1){ $this->_db->limit($post['length'],$post['start']); } $query = $this->_db->get('institute_assets_stores'); if($return_query==FALSE){ return $query->result(); }else if($return_query==TRUE){ return $this->_db->last_query(); } }else if($count==TRUE){ $query = $this->_db->get('institute_assets_stores'); if($return_query==FALSE){ return $query->num_rows(); }else if($return_query==TRUE){ return $this->_db->last_query(); } } } //Brands Stores public function store_brand_stores($data,$return_query=FALSE){ $this->table='institute_assets_brands'; return $this->store($data,FALSE,$return_query); } public function update_brand_stores($data,$param,$batch=FALSE,$return_query=FALSE){ $this->table='institute_assets_brands'; return $this->modify($data,$param,$batch,$return_query); } public function delete_brand($param,$return_query=FALSE){ $this->table='institute_assets_brands'; return $this->remove($param,0,$return_query); } public function get_brands($param=null,$single_row=TRUE,$return_query=FALSE){ $this->table='institute_assets_brands'; if($single_row==TRUE){ return $this->get_one($param,'',$return_query); }else if($single_row==FALSE){ return $this->get_many($param,null,null,$return_query); } } public function _get_brands($post=array(),$param=array(),$count=FALSE,$return_query=FALSE){ $this->_db->select('institute_assets_brands.*'); $i = 0; $this->_db->where('brand_inst_id',$param['brand_inst_id']); $this->_db->where('brand_inst_type',$param['brand_inst_type']); if(isset($param['column_search'])){ foreach ($param['column_search'] as $item) { if(isset($post['search']['value']) && $post['search']['value']) { if($i===0) { $this->_db->group_start(); $this->_db->like($item, $post['search']['value']); } else { $this->_db->or_like($item, $post['search']['value']); } if(count($param['column_search']) - 1 == $i) $this->_db->group_end(); } $i++; } } if(isset($post['order'])) { $column_order=$param['column_order']; $this->_db->order_by($column_order[$post['order']['0']['column']], $post['order']['0']['dir']); } else if(isset($param['order'])) { $order = $param['order']; $this->_db->order_by(key($order), $order[key($order)]); } if($count==FALSE){ if(isset($post['length']) && $post['length'] != -1){ $this->_db->limit($post['length'],$post['start']); } $query = $this->_db->get('institute_assets_brands'); if($return_query==FALSE){ return $query->result(); }else if($return_query==TRUE){ return $this->_db->last_query(); } }else if($count==TRUE){ $query = $this->_db->get('institute_assets_brands'); if($return_query==FALSE){ return $query->num_rows(); }else if($return_query==TRUE){ return $this->_db->last_query(); } } } //Asset issues public function store_assets_issues($data,$return_query=FALSE){ $this->table='institute_assets_issues'; return $this->store($data,FALSE,$return_query); } public function update_assets_issues($data,$param,$batch=FALSE,$return_query=FALSE){ $this->table='institute_assets_issues'; return $this->modify($data,$param,$batch,$return_query); } public function delete_assets_issues($param,$return_query=FALSE){ $this->table='institute_assets_issues'; return $this->remove($param,0,$return_query); } public function get_assets_issues($param=null,$single_row=TRUE,$return_query=FALSE){ $this->table='institute_assets_issues'; if($single_row==TRUE){ return $this->get_one($param,'',$return_query); }else if($single_row==FALSE){ return $this->get_many($param,null,null,$return_query); } } public function _get_assets_issues($post=array(),$param=array(),$count=FALSE,$return_query=FALSE){ $this->_db->select('institute_assets_issues.*'); $i = 0; // $this->_db->where('category_inst_id',$param['category_inst_id']); // $this->_db->where('category_inst_type',$param['category_inst_type']); if(isset($param['column_search'])){ foreach ($param['column_search'] as $item) { if(isset($post['search']['value']) && $post['search']['value']) { if($i===0) { $this->_db->group_start(); $this->_db->like($item, $post['search']['value']); } else { $this->_db->or_like($item, $post['search']['value']); } if(count($param['column_search']) - 1 == $i) $this->_db->group_end(); } $i++; } } if(isset($post['order'])) { $column_order=$param['column_order']; $this->_db->order_by($column_order[$post['order']['0']['column']], $post['order']['0']['dir']); } else if(isset($param['order'])) { $order = $param['order']; $this->_db->order_by(key($order), $order[key($order)]); } if($count==FALSE){ if(isset($post['length']) && $post['length'] != -1){ $this->_db->limit($post['length'],$post['start']); } $query = $this->_db->get('institute_assets_issues'); if($return_query==FALSE){ return $query->result(); }else if($return_query==TRUE){ return $this->_db->last_query(); } }else if($count==TRUE){ $query = $this->_db->get('institute_assets_issues'); if($return_query==FALSE){ return $query->num_rows(); }else if($return_query==TRUE){ return $this->_db->last_query(); } } } }