| Server IP : 103.48.194.25 / Your IP : 216.73.217.33 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 8.2.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/pundarikanail.com-bk/wadmin/components/cauhinh/models/ |
Upload File : |
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class cauhinh_model extends CI_Model
{
public function __construct()
{
parent::__construct();
}
function get_all($num=20, $offset=0)
{
$this->db->where('bl_active !=', -1);
$this->db->order_by('dt_create', 'DESC');
return $this->db->get('sys_config', $num, $offset)->result();
}
function count_all()
{
$this->db->where('bl_active !=', -1);
return $this->db->get('sys_config')->num_rows();
}
function del_banner($id)
{
$data['bl_active'] = -1 ;
$data['dt_create'] = date("Y-m-d H:i:s") ;
$this->db->where('banner_id',$id);
if($this->db->update('sys_config', $data)){
return true;
}else{
return false;
}
}
function remove()
{
$date = new DateTime();
$date->modify('-3 month');
$date_del = $date->format('Y-m-d H:i:s');
$this->db->where('bl_active', -1);
$this->db->where('dt_create <', $date_del);
if($this->db->delete('sys_config')){
return true;
}else{
return false;
}
}
function save($data)
{
$id = (int)$this->uri->segment(3);
if($id != 0){
$this->db->where('id',$id);
return $this->db->update('sys_config', $data);
}else{
$this->db->insert('sys_config',$data);
return $this->db->insert_id() ;
}
}
public function get_id($table, $where='', $value=0)
{
if(!empty($value)) $this->db->where($where, $value) ;
$this->db->where('bl_active',1) ;
$query = $this->db->get($table) ;
return $query->row() ;
}
function get_banner($id=0)
{
$this->db->where('banner_id',$id);
return $this->db->get('sys_config')->row();
}
function get_list_country()
{
$this->db->order_by('lb_country','ASC');
return $this->db->get('fm_country')->result();
}
}