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 : /var/www/blue-sky.co.id/public_html/application/controllers/admin/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Home_content_hotel extends Admin_Controller { function __construct() { parent::__construct(); } public function index() { $this->data['subview'] = 'admin/home_content_hotel/index'; $this->load->view('admin/templates/header', $this->data_header); $this->load->view('admin/_layout_main', $this->data); $this->load->view('admin/templates/footer'); } public function home_about($hotel_id = NULL) { //check if hotel id exist. If not exist, show 404. $quer_home_about = $this->db->get_where('home_about_hotel',array( 'hotel_id' => $hotel_id, )); $count = $quer_home_about->num_rows(); if ($count == 0) { //page not exist show_404(); } $this->data['dt_home_about'] = $quer_home_about->row(); //validation check in action $config = array( array( 'field' => 'header_text', 'label' => 'Judul', 'rules' => 'trim|required' ), array( 'field' => 'content_text', 'label' => 'Text Konten', 'rules' => 'trim|required' ), ); $this->load->library('form_validation'); $this->form_validation->set_rules($config); $this->form_validation->set_error_delimiters('<div class="error">', '</div>'); if($this->form_validation->run() == TRUE) { if($_POST) { //check & processing image banner upload files if ($_FILES['image1']['size'] !== 0) { $config['upload_path'] = './uploads/home_about/'; $config['allowed_types'] = 'jpg|png'; $config['max_size'] = '300'; $config['max_width'] = '600'; $config['max_height'] = '470'; $this->load->library('upload', $config); $this->upload->initialize($config); if ( ! $this->upload->do_upload('image1')) { $this->session->set_flashdata('error1', '<br> <p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>'); redirect('admin/home_content_hotel/home_about/'.$id); } else { $image1 = $this->upload->data(); $image1_filename = $image1['file_name']; } } $data = array( 'header_text' => $this->security->xss_clean($this->input->post('header_text')), 'header_text_en' => $this->security->xss_clean($this->input->post('header_text_en')), 'content_text' => $this->security->xss_clean($this->input->post('content_text')), 'content_text_en' => $this->security->xss_clean($this->input->post('content_text_en')) ); //image upload if (isset($image1_filename)) { $data['img_name'] = $image1_filename; } $this->db->where('hotel_id', $hotel_id)->update('home_about_hotel', $data); $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Home About berhasil diedit</p>'); redirect('admin/home_content_hotel/home_about/' . $this->session->userdata('hotel_id')); } } $this->data['subview'] = 'admin/home_content_hotel/home_about/edit'; $this->load->view('admin/templates/header', $this->data_header); $this->load->view('admin/_layout_main', $this->data); $this->load->view('admin/templates/footer'); } public function hotel_promotions() { $this->data['promotions'] = $this->db->select('*')->from('hotel_promotions')->where('hotel_id', $this->session->userdata('hotel_id'))->order_by('id', 'ASC')->get()->result(); $this->data['subview'] = 'admin/home_content_hotel/hotel_promotions/index'; $this->load->view('admin/templates/header', $this->data_header); $this->load->view('admin/_layout_main', $this->data); $this->load->view('admin/templates/footer'); } public function hotel_promotions_add() { $quer_hotel_promotions = new stdClass(); $quer_hotel_promotions->header_text = ''; $quer_hotel_promotions->judul_text = ''; $quer_hotel_promotions->judul_text_en = ''; $quer_hotel_promotions->content_text = ''; $quer_hotel_promotions->content_text_en = ''; $quer_hotel_promotions->button_text = ''; $quer_hotel_promotions->target_loc = ''; $quer_hotel_promotions->type_offer = 'current'; $quer_hotel_promotions->type = 'specialoffers'; $this->data['hotel_promotions'] = $quer_hotel_promotions; //validation check in action $config = array( array( 'field' => 'header_text', 'label' => 'Judul', 'rules' => 'trim|required' ), //array( // 'field' => 'content_text', // 'label' => 'Text Konten', // 'rules' => 'trim|required' // ), ); $this->load->library('form_validation'); $this->form_validation->set_rules($config); $this->form_validation->set_error_delimiters('<div class="error">', '</div>'); if($this->form_validation->run() == TRUE) { if($_POST) { //check & processing image banner upload files if ($_FILES['image1']['size'] !== 0) { $config['upload_path'] = './uploads/body_rooms/'; $config['allowed_types'] = 'jpg|png|jpeg'; $config['max_size'] = '800'; // $config['max_width'] = 570; // $config['max_height'] = 290; $this->load->library('upload', $config); if ( ! $this->upload->do_upload('image1')) { echo $this->upload->display_errors(); die(); $this->session->set_flashdata('error', '<br> <p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>'); redirect('admin/home_content_hotel/hotel_promotions/add'); } else { $image1 = $this->upload->data(); $image1_filename = $image1['file_name']; } } $data = array( 'header_text' => $this->security->xss_clean($this->input->post('header_text')), // 'judul_text' => $this->security->xss_clean($this->input->post('judul_text')), // 'judul_text_en' => $this->security->xss_clean($this->input->post('judul_text_en')), // 'content_text' => $this->security->xss_clean($this->input->post('content_text')), // 'content_text_en' => $this->security->xss_clean($this->input->post('content_text_en')), // 'button_text' => $this->security->xss_clean($this->input->post('button_text')).' | '.$this->security->xss_clean($this->input->post('button_text_en')), 'target_loc' => $this->security->xss_clean($this->input->post('target_loc')), 'hotel_id' => $this->session->userdata('hotel_id'), 'type_offer' => $this->security->xss_clean($this->input->post('type_offer')), 'type' => $this->security->xss_clean($this->input->post('type')) ); //image upload if (isset($image1_filename)) { $data['img_name'] = $image1_filename; } $this->db->insert('hotel_promotions', $data); $id = $this->db->insert_id(); $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Home Promition berhasil diedit</p>'); redirect('admin/home_content_hotel/hotel_promotions'); } } $this->data['subview'] = 'admin/home_content_hotel/hotel_promotions/edit'; $this->load->view('admin/templates/header', $this->data_header); $this->load->view('admin/_layout_main', $this->data); $this->load->view('admin/templates/footer'); } //to edit brand in admin public function hotel_promotions_edit($id = NULL) { //check if id exist. If not exist, show 404. $quer_hotel_promotions = $this->db->get_where("hotel_promotions",array( 'id'=>$id, 'hotel_id' => $this->session->userdata('hotel_id') )); $count = $quer_hotel_promotions->num_rows(); if ($count == 0) { //page not exist show_404(); } $this->data['hotel_promotions'] = $quer_hotel_promotions->row(); //validation check in action $config = array( array( 'field' => 'header_text', 'label' => 'Judul', 'rules' => 'trim|required' ), // array( // 'field' => 'content_text', // 'label' => 'Text Konten', // 'rules' => 'trim|required' // ), // array( // 'field' => 'button_text', // 'label' => 'Button Text', // 'rules' => 'trim|required' // ), // array( // 'field' => 'target_loc', // 'label' => 'Target Lokasi', // 'rules' => 'trim' // ), ); $this->load->library('form_validation'); $this->form_validation->set_rules($config); $this->form_validation->set_error_delimiters('<div class="error">', '</div>'); if($this->form_validation->run() == TRUE) { if($_POST) { //check & processing image banner upload files if ($_FILES['image1']['size'] !== 0) { $config['upload_path'] = './uploads/body_rooms/'; $config['allowed_types'] = 'jpg|png|jpeg'; $config['max_size'] = '800'; // $config['max_width'] = 570; // $config['max_height'] = 290; $this->load->library('upload', $config); if ( ! $this->upload->do_upload('image1')) { echo $this->upload->display_errors(); die(); $this->session->set_flashdata('error', '<br> <p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>'); redirect('admin/home_content_hotel/hotel_promotions/edit/' . $id); } else { $image1 = $this->upload->data(); $image1_filename = $image1['file_name']; } } $data = array( 'header_text' => $this->security->xss_clean($this->input->post('header_text')), // 'judul_text' => $this->security->xss_clean($this->input->post('judul_text')), // 'judul_text_en' => $this->security->xss_clean($this->input->post('judul_text_en')), // 'content_text' => $this->security->xss_clean($this->input->post('content_text')), // 'content_text_en' => $this->security->xss_clean($this->input->post('content_text_en')), // 'button_text' => $this->security->xss_clean($this->input->post('button_text')).' | '.$this->security->xss_clean($this->input->post('button_text_en')), 'target_loc' => $this->security->xss_clean($this->input->post('target_loc')), 'type_offer' => $this->security->xss_clean($this->input->post('type_offer')), 'type' => $this->security->xss_clean($this->input->post('type')) ); //image upload if (isset($image1_filename)) { $data['img_name'] = $image1_filename; } $this->db->where('id', $id)->update('hotel_promotions', $data); $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Banner berhasil diedit</p>'); redirect('admin/home_content_hotel/hotel_promotions_edit/' . $id); } } $this->data['subview'] = 'admin/home_content_hotel/hotel_promotions/edit'; $this->load->view('admin/templates/header', $this->data_header); $this->load->view('admin/_layout_main', $this->data); $this->load->view('admin/templates/footer'); } public function hotel_promotions_delete_all() { $checkbox_for_del = $this->input->post('checkbox_del'); if (empty($checkbox_for_del)) { redirect('admin/home_content_hotel/hotel_promotions'); } for ($i=0; $i<count($checkbox_for_del) ; $i++) { $id = $checkbox_for_del[$i]; $this->db->where('id', $id)->delete('hotel_promotions'); } $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Promotions berhasil dihapus</p>'); echo json_encode(array( 'result'=>'sukses', )); } public function hotel_promotions_delete($id) { $quer_hotel_promotions = $this->db->get_where("hotel_promotions",array( "id"=>$id )); $count = $quer_hotel_promotions->num_rows(); if ($count == 0) { //page not exist show_404(); } $this->db->where('id', $id)->delete('hotel_promotions'); $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Promotion berhasil dihapus</p>'); redirect('admin/home_content_hotel/hotel_promotions'); } public function events() { //Add pagination $this->load->helper('pagination_helper'); $quer_events_count = $this->db->select('id')->from('hotel_events')->where('hotel_id', $this->session->userdata('hotel_id'))->get()->num_rows(); add_pagination(base_url() . 'admin/home_content_hotel/events/index', $quer_events_count, 100, 4); $this->data['dt_events'] = $this->db->select('*') ->from('hotel_events')->where('hotel_id', $this->session->userdata('hotel_id'))->order_by('id', 'ASC') ->limit(100, $this->uri->segment(4))->get()->result(); $this->data['subview'] = 'admin/home_content_hotel/events/index'; $this->load->view('admin/templates/header', $this->data_header); $this->load->view('admin/_layout_main', $this->data); $this->load->view('admin/templates/footer'); } public function events_add(){ $quer_events = new stdClass(); $quer_events->header_text = ''; $quer_events->content_text = ''; $quer_events->content_text_en = ''; $quer_events->event_date = ''; $quer_events->judul_header_text = ''; $this->data['dt_events'] = $quer_events; //validation check in action $config = array( array( 'field' => 'header_text', 'label' => 'Judul', 'rules' => 'trim|required' ), array( 'field' => 'content_text', 'label' => 'Text Konten', 'rules' => 'trim|required' ), array( 'field' => 'event_date', 'label' => 'Tanggal event', 'rules' => 'trim|required' ), ); $this->load->library('form_validation'); $this->form_validation->set_rules($config); $this->form_validation->set_error_delimiters('<div class="error">', '</div>'); if($this->form_validation->run() == TRUE) { if($_POST) { $config = []; //check & processing image banner upload files if ($_FILES['image1']['size'] !== 0) { $config['upload_path'] = './uploads/events/'; $config['allowed_types'] = 'jpg|png|jpeg'; $config['max_size'] = '800'; // $config['max_width'] = '370'; // $config['max_height'] = '500'; $this->load->library('upload', $config); $this->upload->initialize($config); if ( ! $this->upload->do_upload('image1')) { $this->session->set_flashdata('error1', '<br> <p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>'); redirect('admin/home_content_hotel/events_add/'); } else { $image1 = $this->upload->data(); $image1_filename = $image1['file_name']; } } $config2 = []; if ($_FILES['image2']['size'] !== 0) { $config2['upload_path'] = './uploads/events/'; $config2['allowed_types'] = 'jpg|png|jpeg'; $config2['max_size'] = '800'; // $config2['max_width'] = '800'; // $config2['max_height'] = '500'; $this->load->library('upload', $config2); $this->upload->initialize($config2); if ( ! $this->upload->do_upload('image2')) { $this->session->set_flashdata('error2', '<br> <p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>'); // $this->upload->display_errors() redirect('admin/home_content_hotel/events_add/'); } else { $image2 = $this->upload->data(); $image2_filename = $image2['file_name']; } } $data = array( 'header_text' => $this->security->xss_clean($this->input->post('header_text')), 'slug' => url_title($this->security->xss_clean($this->input->post('header_text'))), 'content_text' => $this->security->xss_clean($this->input->post('content_text')), 'event_date' => $this->security->xss_clean($this->input->post('event_date')), 'judul_header_text' => $this->security->xss_clean($this->input->post('judul_header_text')), 'hotel_id' => $this->session->userdata('hotel_id') ); $data['img_name'] = ''; //image upload if (isset($image1_filename)) { $data['img_name'] = $image1_filename; }else{ $data['img_name'] = @explode(' | ', $this->data['dt_events']->img_name)[0]; } if (isset($image2_filename)) { $data['img_name'] .= ' | '.$image2_filename; }else{ $data['img_name'] .= ' | '.@explode(' | ', $this->data['dt_events']->img_name)[1]; } $this->db->insert('hotel_events', $data); $id = $this->db->insert_id(); $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Event berhasil diedit</p>'); redirect('admin/home_content_hotel/events'); } } $this->data['subview'] = 'admin/home_content_hotel/events/edit'; $this->load->view('admin/templates/header', $this->data_header); $this->load->view('admin/_layout_main', $this->data); $this->load->view('admin/templates/footer'); } public function events_edit($id=null) { //check if id exist. If not exist, show 404. $quer_events = $this->db->get_where("hotel_events",array( "id"=>$id )); $count = $quer_events->num_rows(); if ($count == 0) { //page not exist show_404(); } $this->data['dt_events'] = $quer_events->row(); //validation check in action $config = array( array( 'field' => 'header_text', 'label' => 'Judul', 'rules' => 'trim|required' ), array( 'field' => 'content_text', 'label' => 'Text Konten', 'rules' => 'trim|required' ), array( 'field' => 'event_date', 'label' => 'Tanggal event', 'rules' => 'trim|required' ), ); $this->load->library('form_validation'); $this->form_validation->set_rules($config); $this->form_validation->set_error_delimiters('<div class="error">', '</div>'); if($this->form_validation->run() == TRUE) { if($_POST) { $config = []; //check & processing image banner upload files if ($_FILES['image1']['size'] !== 0) { $config['upload_path'] = './uploads/events/'; $config['allowed_types'] = 'jpg|png'; $config['max_size'] = '800'; // $config['max_width'] = '370'; // $config['max_height'] = '500'; $this->load->library('upload', $config); $this->upload->initialize($config); if ( ! $this->upload->do_upload('image1')) { $this->session->set_flashdata('error1', '<br> <p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>'); redirect('admin/home_content_hotel/events_edit/'.$id); } else { $image1 = $this->upload->data(); $image1_filename = $image1['file_name']; } } $config2 = []; if ($_FILES['image2']['size'] !== 0) { $config2['upload_path'] = './uploads/events/'; $config2['allowed_types'] = 'jpg|png'; $config2['max_size'] = '800'; // $config2['max_width'] = '800'; // $config2['max_height'] = '500'; $this->load->library('upload', $config2); $this->upload->initialize($config2); if ( ! $this->upload->do_upload('image2')) { $this->session->set_flashdata('error2', '<br> <p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>'); // $this->upload->display_errors() redirect('admin/home_content_hotel/events_edit/'.$id); } else { $image2 = $this->upload->data(); $image2_filename = $image2['file_name']; } } $data = array( 'header_text' => $this->security->xss_clean($this->input->post('header_text')), 'slug' => url_title($this->security->xss_clean($this->input->post('header_text'))), 'content_text' => $this->security->xss_clean($this->input->post('content_text')), 'event_date' => $this->security->xss_clean($this->input->post('event_date')), 'judul_header_text' => $this->security->xss_clean($this->input->post('judul_header_text')), ); $data['img_name'] = ''; //image upload if (isset($image1_filename)) { $data['img_name'] = $image1_filename; }else{ $data['img_name'] = @explode(' | ', $this->data['dt_events']->img_name)[0]; } if (isset($image2_filename)) { $data['img_name'] .= ' | '.$image2_filename; }else{ $data['img_name'] .= ' | '.@explode(' | ', $this->data['dt_events']->img_name)[1]; } $this->db->where('id', $id)->update('hotel_events', $data); $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Event berhasil diedit</p>'); redirect('admin/home_content_hotel/events_edit/' . $id); } } $this->data['subview'] = 'admin/home_content_hotel/events/edit'; $this->load->view('admin/templates/header', $this->data_header); $this->load->view('admin/_layout_main', $this->data); $this->load->view('admin/templates/footer'); } public function events_delete_all(){ $checkbox_for_del = $this->input->post('checkbox_del'); if (empty($checkbox_for_del)) { redirect('admin/home_content_hotel/events'); } for ($i=0; $i<count($checkbox_for_del) ; $i++) { $id = $checkbox_for_del[$i]; $this->db->where('id', $id)->delete('hotel_events'); } $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Event berhasil dihapus</p>'); echo json_encode(array( 'result'=>'sukses', )); } public function events_delete($id) { $quer_events = $this->db->get_where("hotel_events",array( "id"=>$id )); $count = $quer_events->num_rows(); if ($count == 0) { //page not exist show_404(); } $this->db->where('id', $id)->delete('hotel_events'); $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Body room berhasil dihapus</p>'); redirect('admin/home_content_hotel/events'); } }