1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
class Venue_model extends CI_Model {
public function _consruct(){
parent::_construct();
}
public function getVenueData($venue_id='',$view=''){
$cond = (!empty($view))?" VNE.status IN ($view) ":" VNE.status != '2' ";
$cond .= (!empty($venue_id))?" AND VNE.id='$venue_id' ":"";
$sql = "SELECT VNE.id AS venue_id,VNE.*,REG.name AS region_name,HST.host_category,HST.show_layout
FROM venue AS VNE
INNER JOIN region AS REG ON (VNE.region_id=REG.id)
INNER JOIN host_categories AS HST ON (HST.host_cat_id=VNE.host_cat_id)
WHERE $cond";
$venueData = $this->db->query($sql);
if(!empty($venueData)){
return (empty($venue_id))?$venueData->result():$venueData->row();
}
return 0;
}
public function createVenue($venueData = array(),$locality = ''){
if(empty($venueData)){
return 0;
}
if(!empty($locality)){
$status = $this->db->insert('locality',
array('locality'=>$locality,'region_id'=>$venueData['region_id']));
if($status){
$venueData['locality_id'] = $this->db->insert_id();
}
}
$status = $this->db->insert('venue',$venueData);
return $status;
}
public function updateVenues($venue_id = '', $venueData = array()){
if(empty($venue_id) || empty($venueData)){
return 0;
}
$status = $this->db->update('venue',$venueData,array('id'=>$venue_id));
return $status;
}
public function changeStatus($venue_id = '', $status = '0'){
if(empty($venue_id)){
return 0;
}
$status = $this->db->update('venue',array('status'=>$status),array('id'=>$venue_id));
return $status;
}
}
?>