Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /proc/self/root/var/www/blue-sky.co.id/public_html/application/models/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class hotel_page_m extends MY_Model { protected $_table_name = 'hotel_pages'; protected $_primary_key = 'id_hotel_pages'; protected $_order_by = 'id_hotel_pages'; public $rules = array( array( 'field' => 'page_title', 'label' => 'hotel_page Title', 'rules' => 'trim|required|callback__cek_existing_page_title' ), array( 'field' => 'page_title_en', 'label' => 'hotel_page Title en', 'rules' => 'trim' ), array( 'field' => 'status', 'label' => 'status', 'rules' => 'trim|required' ), array( 'field' => 'body_text', 'label' => 'Body Text', 'rules' => 'trim' ), array( 'field' => 'body_text_en', 'label' => 'Body Text En', 'rules' => 'trim' ), array( 'field' => 'meta_description', 'label' => 'meta_description', 'rules' => 'trim' ), array( 'field' => 'meta_keywords', 'label' => 'meta_keywords', 'rules' => 'trim' ), ); function __construct() { parent::__construct(); } //pagination included function get_all_hotel_pages() { $this->db->select('*'); $this->db->from('hotel_pages'); $this->db->where('id_hotel_pages !=', '0'); $this->db->where('hotel_id', $this->session->userdata('hotel_id')); $this->db->order_by('id_hotel_pages'); $query = $this->db->get(); return $query->result(); } public function get_all_parent_hotel_pages($limit, $start) { $this->db->select('id_hotel_pages, page_title, parent, priority, status'); $this->db->from('hotel_pages'); $this->db->where('parent', NULL); // $this->db->where('id_hotel_pages !=', 23); $this->db->order_by('priority', 'ASC'); $this->db->limit($limit, $start); $query = $this->db->get(); return $query->result(); } //function count all record for hotel_pages public function record_count() { return $this->db->get('hotel_pages')->num_rows(); } //function count if existing record exist public function count_exist($id) { $this->db->select('*'); $this->db->from('hotel_pages'); $this->db->where('id_hotel_pages', $id); $query = $this->db->get(); return $query->num_rows(); } function get_hotel_page($slug) { $this->db->select('*'); $this->db->from('hotel_pages'); $this->db->where('slug', $slug); $query = $this->db->get(); return $query->row(); } //function to display new hotel_page, where all fields are empty public function get_new() { $hotel_pages = new stdClass(); $hotel_pages->page_title = ''; $hotel_pages->page_title_en = ''; $hotel_pages->body_text = ''; $hotel_pages->body_text_en = ''; $hotel_pages->status = ''; $hotel_pages->meta_description = ''; $hotel_pages->meta_keywords = ''; $hotel_pages->parent = ''; $hotel_pages->priority = ''; $hotel_pages->img_descr = ''; $hotel_pages->img_descr_en = ''; $hotel_pages->active_map = 'no'; $hotel_pages->active_gallery = 'no'; $hotel_pages->active_all_product = 'no'; $hotel_pages->active_contact = 'no'; $hotel_pages->active_content = 'no'; $hotel_pages->active_banner_slider = 'no'; $hotel_pages->active_center_img = 'no'; $hotel_pages->header_text = ''; $hotel_pages->header_text_en = ''; return $hotel_pages; } //function add new hotel_page function add_hotel_page($data) { $this->db->insert('hotel_pages', $data); return $this->db->insert_id(); } //function edit hotel_page function edit_hotel_page($id, $data) { $this->db->where('id_hotel_pages', $id); $this->db->update('hotel_pages', $data); } //cek if hotel_page title already exist public function cek_existing_page_title($str, $hotel_page_id) { $this->db->select('id_hotel_pages'); $this->db->from('hotel_pages'); $this->db->where('page_title', $str); $this->db->where('hotel_id', $this->session->userdata('hotel_id')); if ($hotel_page_id != NULL) { $this->db->where('id_hotel_pages !=', $hotel_page_id); } $query = $this->db->get(); return $query->num_rows(); } //cek if hotel_page title already exist public function cek_existing_page_en_title($str, $hotel_page_id) { $this->db->select('id_hotel_pages'); $this->db->from('hotel_pages'); $this->db->where('page_title_en', $str); $this->db->where('hotel_id', $this->session->userdata('hotel_id')); if ($hotel_page_id != NULL) { $this->db->where('id_hotel_pages !=', $hotel_page_id); } $query = $this->db->get(); return $query->num_rows(); } public function get_parent_hotel_pages() { $this->db->select('*')->from('hotel_pages')->where('parent', NULL); $query = $this->db->get(); $parent_hotel_pages = $query->result(); return $parent_hotel_pages; } }