| 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/www/application/models/ |
Upload File : |
<?php
class Eventmodel extends CI_Model
{
function __construct()
{
parent::__construct();
$this->load->database();
$this->table_name = 'event';
}
function add($data){
if(!empty($data)){
// print_r($data);exit;
unset($data['sbt']);
unset($data['event_color']);
unset($data['event_size']);
unset($data['event_material']);
unset($data['event_images']);
$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['event_color']);
unset($data['event_size']);
unset($data['event_material']);
unset($data['event_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('event');
$this->db->where('event.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 deleteevent($id){
$this->db->where('id', $id);
$this->db->delete($this->table_name);
}
function deleteallevent($id){
$this->db->where('id', $id);
$this->db->delete('event_images');
}
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 getevent()
{
$now = date('Y-m-d H:i:s');
$this->db->select('*');
$this->db->select('event.id as eventID');
$this->db->select('event_images.features');
$this->db->from('event');
$this->db->join('event_images',"event.id=event_images.event_id and event_images.features='yes'");
$this->db->where("event.status='active'");
$this->db->where('event.event_start <', $now);
$this->db->order_by('event.event_start','DESC');
$query = $this->db->get();
return $query->result();
}
function getevents()
{
$now = date('Y-m-d H:i:s');
$this->db->select('*');
$this->db->select('event.id as eventID');
$this->db->select('event_images.features');
$this->db->from('event');
$this->db->join('event_images',"event.id=event_images.event_id and event_images.features='yes'");
$this->db->where("event.status='active'");
$this->db->where('event.event_start >', $now);
$this->db->order_by('event.event_start','DESC');
$query = $this->db->get();
return $query->result();
}
function get_details($id){
$this->db->select('event.*');
$this->db->select('event_images.image');
$this->db->from('event');
$this->db->join('event_images',"event.id=event_images.event_id and event_images.features='yes'");
$this->db->where('event.id',$id);
$this->db->where('event_images.event_id',$id);
$query = $this->db->get();
return $query->result();
}
function count_feature_event($event_id){
$this->db->where('event_id',$event_id);
$this->db->where('features','yes');
return $query = $this->db->count_all_results('event_images');
}
function get_export_data(){
$this->db->select(['sku','event_name','event_tagline','event_short_description','event_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_event($id)
{
$this->db->where('id', $id);
$this->db->delete('event');
}
function make_featured($id)
{
$this->db->set('is_featured','yes');
$this->db->where('id', $id);
$this->db->update('event');
}
function remove_featured($id)
{
$this->db->set('is_featured','no');
$this->db->where('id', $id);
$this->db->update('event');
}
function make_activated($id)
{
$this->db->set('status','active');
$this->db->where('id', $id);
$this->db->update('event');
}
function remove_activated($id)
{
$this->db->set('status','inactive');
$this->db->where('id', $id);
$this->db->update('event');
}
}