You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

50 lines
1.5 KiB

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Event_author_works_model extends CI_Model {
public function __construct() {
parent::__construct();
$this->db->query("SET @@group_concat_max_len =30000");
}
public function save_work($work) {
$data = array(
'work' => $work['work'],
'image' => $work['image'],
'link' => $work['link'],
'event_id' => $work['event_id']
);
$this->db->insert('author_works', $data);
}
public function get_works_by_event_id($event_id) {
$this->db->select('*');
$this->db->where('event_id', $event_id);
$this->db->where('status', 0);
return $this->db->get('author_works')->result();
}
public function get_works_by_id($id) {
$this->db->select('*');
$this->db->where('id', $id);
$this->db->where('status', 0);
return $this->db->get('author_works')->num_rows();
}
public function update_work($work_id, $work) {
$data = array(
'work' => $work['work'],
'image' => $work['image'],
'link' => $work['link']
);
$this->db->where('id', $work_id);
$this->db->update('author_works', $data);
}
public function delete_work($id) {
$data = array(
'status' => 1
);
$this->db->where('id', $id);
$this->db->update('author_works', $data);
}
}