| Server IP : 68.178.202.69 / Your IP : 216.73.216.122 Web Server : Apache System : Linux 69.202.178.68.host.secureserver.net 3.10.0-1160.139.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Nov 3 13:30:41 UTC 2025 x86_64 User : ikioworld ( 1005) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/ikioworld/public_html/application/models/ |
Upload File : |
<?php
class Downmodel extends CI_Model
{
function __construct()
{
parent::__construct();
$this->load->database();
$this->table_name = 'downloads';
}
function add($data){
if(!empty($data)){
// print_r($data);exit;
unset($data['sbt']);
unset($data['down_color']);
unset($data['down_size']);
unset($data['down_material']);
unset($data['down_images']);
$data['status']="Active";
$this->db->insert($this->table_name,$data);
$insert_id = $this->db->insert_id();
return $insert_id;
// echo $this->db->last_query(); die;
}
}
function edit($id,$data){
if(!empty($data) && $id!=''){
unset($data['sbt']);
unset($data['down_color']);
unset($data['down_size']);
unset($data['down_material']);
unset($data['down_images']);
$this->db->where('id',$id);
return $this->db->update($this->table_name,$data);
//echo $this->db->last_query(); die;
}
}
function fetch_details($id){
if($id!=''){
$this->db->select('*');
$this->db->from('downloads');
$this->db->where('downloads.id',$id);
$query = $this->db->get();
return $query->row();
}
}
function get_total_records(){
return $query = $this->db->count_all_results($this->table_name);
}
function get_contents($start, $limit){
$this->db->select('*');
$this->db->order_by($this->table_name.".id", "desc");
$query = $this->db->get($this->table_name);
return $query->result();
}
function deletedown($id){
$this->db->where('id', $id);
$this->db->delete($this->table_name);
}
function getAllCategories()
{
$query = $this->db->get('category');
return $query->result();
}
function fetch_subcategory($item_id)
{
$this->db->where('category_type', $item_id);
$this->db->order_by('name', 'ASC');
$query = $this->db->get('subcategory');
$output = '<option value="">Select Sub Category</option>';
foreach($query->result() as $row)
{
$output .= '<option value="'.$row->subcategory_id.'">'.$row->subcategory_name.'</option>';
}
return $output;
}
function get_category(){
$this->db->select('*');
$query = $this->db->get('category');
return $query->result();
}
function get_subcategory($item_id){
if($item_id!=''){
$this->db->select('*');
$this->db->order_by("name", "ASC");
$query = $this->db->where('category_type',$item_id);
$query = $this->db->get('subcategory');
return $query->result();
}
}
function getCatalogue()
{
$this->db->select('*');
$this->db->select('downloads.id as downID');
$this->db->from('downloads');
$this->db->where("downloads.download_category = 'catalogs' ");
$this->db->where("downloads.status='active'");
$query = $this->db->get();
return $query->result();
}
function getPromotion()
{
$this->db->select('*');
$this->db->select('downloads.id as downID');
$this->db->from('downloads');
$this->db->where("downloads.download_category = 'promotion' ");
$this->db->where("downloads.status='active'");
$query = $this->db->get();
return $query->result();
}
function getWarranty()
{
$this->db->select('*');
$this->db->select('downloads.id as downID');
$this->db->from('downloads');
$this->db->where("downloads.download_category = 'warranty' ");
$this->db->where("downloads.status='active'");
$query = $this->db->get();
return $query->result();
}
function getPolicy()
{
$this->db->select('*');
$this->db->select('downloads.id as downID');
$this->db->from('downloads');
$this->db->where("downloads.download_category = 'policy' ");
$this->db->where("downloads.status='active'");
$query = $this->db->get();
return $query->result();
}
function getIkioDocuments()
{
$this->db->select('*');
$this->db->select('downloads.id as downID');
$this->db->from('downloads');
$this->db->where("downloads.download_category = 'ikio_documents' ");
$this->db->where("downloads.status='active'");
$query = $this->db->get();
return $query->result();
}
function get_details($id){
$this->db->select('down.*');
$this->db->select('down_images.image');
$this->db->from('down');
$this->db->join('down_images',"down.id=down_images.down_id and down_images.features='yes'");
$this->db->where('down.id',$id);
$this->db->where('down_images.down_id',$id);
$query = $this->db->get();
return $query->result();
}
function count_feature_down($down_id){
$this->db->where('down_id',$down_id);
$this->db->where('features','yes');
return $query = $this->db->count_all_results('down_images');
}
function get_export_data(){
$this->db->select(['sku','down_name','down_tagline','down_short_description','down_long_description','heading1','data1','heading2','data2','heading3','data3','heading4','data4','heading5','data5','heading6','data6','heading7','data7','heading8','data8','heading9','data9','heading10','data10','heading11','data11','heading12','data12','heading13','data13','heading14','data14','heading15','data15','heading16','data16','document','tags']);
$this->db->order_by($this->table_name.".id", "desc");
$query = $this->db->get($this->table_name);
return $query->result_array();
}
function delete_downloads($id)
{
$this->db->where('id', $id);
$this->db->delete('downloads');
}
function make_featured($id)
{
$this->db->set('is_featured','yes');
$this->db->where('id', $id);
$this->db->update('downloads');
}
function remove_featured($id)
{
$this->db->set('is_featured','no');
$this->db->where('id', $id);
$this->db->update('downloads');
}
function make_activated($id)
{
$this->db->set('status','active');
$this->db->where('id', $id);
$this->db->update('downloads');
}
function remove_activated($id)
{
$this->db->set('status','inactive');
$this->db->where('id', $id);
$this->db->update('downloads');
}
}