https://t.me/RX1948
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/blue-sky.co.id/public_html/application/controllers/admin/Home_content.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Home_content extends Admin_Controller
{

    function __construct()
    {

        parent::__construct();
    }

    //this is to list all menus
    public function index()
    {

        //Add pagination
        // $this->load->helper('pagination_helper');
        // $quer_body_rooms_count = $this->db->get("body_rooms")->num_rows(); 

        // add_pagination(base_url() . 'admin/home_content/index', $quer_body_rooms_count, 100, 4);

        // $this->data['dt_body_rooms'] = $this->db->select('*')
        // ->from('body_rooms')->order_by('id', 'ASC')
        // ->limit(100, $this->uri->segment(4))->get()->result(); 


        $this->data['subview'] = 'admin/home_content/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 body_rooms()
    {
        //Add pagination
        $this->load->helper('pagination_helper');
        $quer_body_rooms_count = $this->db->get("body_rooms")->num_rows();

        add_pagination(base_url() . 'admin/home_content/body_rooms/index', $quer_body_rooms_count, 100, 4);

        $this->data['dt_body_rooms'] = $this->db->select('*')
            ->from('body_rooms')->order_by('id', 'ASC')
            ->limit(100, $this->uri->segment(4))->get()->result();


        $this->data['subview'] = 'admin/home_content/body_rooms/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 pagination
        $this->load->helper('pagination_helper');
        $quer_events_count = $this->db->get("events")->num_rows();

        add_pagination(base_url() . 'admin/home_content/events/index', $quer_events_count, 100, 4);

        $this->data['dt_events'] = $this->db->select('*')
            ->from('events')->order_by('event_date', 'DESC')
            ->limit(100, $this->uri->segment(4))->get()->result();


        $this->data['subview'] = 'admin/home_content/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->judul_header_text = '';
        $quer_events->content_text = '';
        $quer_events->event_date = '';

        $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_error_delimiters('<div class="error">', '</div>'); //above is to add class to form validation error, to be styled	
        $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']  = '580';
                    // $config['max_height'] = '306';

                    $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/events_add');
                    } else {
                        $image1 = $this->upload->data();
                        $image1_filename = $image1['file_name'];
                        // $this->resize_single_image('580','306','events/',$image1_filename);	 
                    }
                }

                $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/events_add');
                    } else {
                        $image2 = $this->upload->data();
                        $image2_filename = $image2['file_name'];
                        //$this->resize_single_image('800', '500', 'events/', $image2_filename);
                    }
                }

                $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->insert('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/events');
            }
        }

        $this->data['subview'] = 'admin/home_content/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("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_error_delimiters('<div class="error">', '</div>'); //above is to add class to form validation error, to be styled	
        $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']    = '3800';
                    // $config['max_width']  = '580';
                    // $config['max_height'] = '306';

                    $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/events_edit/' . $id);
                    } else {
                        $image1 = $this->upload->data();
                        $image1_filename = $image1['file_name'];
                        // $this->resize_single_image('580','306','events/',$image1_filename);	 
                    }
                }

                $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/events_edit/' . $id);
                    } else {
                        $image2 = $this->upload->data();
                        $image2_filename = $image2['file_name'];
                        //$this->resize_single_image('800', '500', 'events/', $image2_filename);
                    }
                }

                $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')),
                   
                    'url_link' => $this->security->xss_clean($this->input->post('url_link')),
                    '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('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/events');
            }
        }

        $this->data['subview'] = 'admin/home_content/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 home_about($id = NULL)
    {

        //check if id exist. If not exist, show 404.
        $quer_home_about = $this->db->get_where("home_about", array(
            "id" => $id
        ));

        $count = $quer_home_about->num_rows();

        if ($count == 0) {
            //page not exist
            show_404();
        }

        $this->data['dt_home_about'] = $quer_home_about->row();

        // header_text
        // header_text_en
        // content_text
        // content_text_en
        // button_text
        // button_text_en
        // target_loc

        //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_error_delimiters('<div class="error">', '</div>'); //above is to add class to form validation error, to be styled	
        $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']  = '500';
                    $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/home_about/' . $id);
                    } else {
                        $image1 = $this->upload->data();
                        $image1_filename = $image1['file_name'];
                        // $this->resize_single_image('580','500','home_about/',$image1_filename);	 
                    }
                }
                if ($_FILES['image2']['size'] !== 0) {
                    $config['upload_path'] = './uploads/home_about/';
                    $config['allowed_types'] = 'jpg|png';
                    $config['max_size']    = '300';
                    $config['max_width']  = '500';
                    $config['max_height'] = '500';

                    $this->load->library('upload', $config);
                    $this->upload->initialize($config);

                    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>');
                        redirect('admin/home_content/home_about/' . $id);
                    } else {
                        $image2 = $this->upload->data();
                        $image2_filename = $image2['file_name'];
                        // $this->resize_single_image('580','500','home_about/',$image2_filename);	 
                    }
                }
                if ($_FILES['image3']['size'] !== 0) {
                    $config['upload_path'] = './uploads/home_about/';
                    $config['allowed_types'] = 'jpg|png';
                    $config['max_size']    = '300';
                    $config['max_width']  = '500';
                    $config['max_height'] = '500';

                    $this->load->library('upload', $config);
                    $this->upload->initialize($config);

                    if (!$this->upload->do_upload('image3')) {
                        $this->session->set_flashdata('error3', '<br>
							<p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>');
                        redirect('admin/home_content/home_about/' . $id);
                    } else {
                        $image3 = $this->upload->data();
                        $image3_filename = $image3['file_name'];
                        // $this->resize_single_image('580','500','home_about/',$image3_filename);	 
                    }
                }
                if ($_FILES['image4']['size'] !== 0) {
                    $config['upload_path'] = './uploads/home_about/';
                    $config['allowed_types'] = 'jpg|png';
                    $config['max_size']    = '300';
                    $config['max_width']  = '500';
                    $config['max_height'] = '500';

                    $this->load->library('upload', $config);
                    $this->upload->initialize($config);

                    if (!$this->upload->do_upload('image4')) {
                        $this->session->set_flashdata('error4', '<br>
							<p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>');
                        redirect('admin/home_content/home_about/' . $id);
                    } else {
                        $image4 = $this->upload->data();
                        $image4_filename = $image4['file_name'];
                        // $this->resize_single_image('580','500','home_about/',$image3_filename);	 
                    }
                }
                if ($_FILES['image5']['size'] !== 0) {
                    $config['upload_path'] = './uploads/home_about/';
                    $config['allowed_types'] = 'jpg|png';
                    $config['max_size']    = '300';
                    $config['max_width']  = '500';
                    $config['max_height'] = '500';

                    $this->load->library('upload', $config);
                    $this->upload->initialize($config);

                    if (!$this->upload->do_upload('image5')) {
                        $this->session->set_flashdata('error5', '<br>
							<p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>');
                        redirect('admin/home_content/home_about/' . $id);
                    } else {
                        $image5 = $this->upload->data();
                        $image5_filename = $image5['file_name'];
                        // $this->resize_single_image('580','500','home_about/',$image3_filename);	 
                    }
                }


                $data = array(
                    'header_text' => $this->security->xss_clean($this->input->post('header_text')),
                    '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;
                } else {
                    $data['img_name'] = @explode(' | ', $this->data['dt_home_about']->img_name)[0];
                }

                //image upload
                if (isset($image2_filename)) {
                    $data['img_name'] .= ' | ' . $image2_filename;
                } else {
                    $data['img_name'] .= ' | ' . @explode(' | ', $this->data['dt_home_about']->img_name)[1];
                }

                //image upload
                if (isset($image3_filename)) {
                    $data['img_name'] .= ' | ' . $image3_filename;
                } else {
                    $data['img_name'] .= ' | ' . @explode(' | ', $this->data['dt_home_about']->img_name)[2];
                }

                //image upload
                if (isset($image4_filename)) {
                    $data['img_name'] .= ' | ' . $image4_filename;
                } else {
                    $data['img_name'] .= ' | ' . @explode(' | ', $this->data['dt_home_about']->img_name)[3];
                }

                //image upload
                if (isset($image5_filename)) {
                    $data['img_name'] .= ' | ' . $image5_filename;
                } else {
                    $data['img_name'] .= ' | ' . @explode(' | ', $this->data['dt_home_about']->img_name)[4];
                }

                $this->db->where('id', $id)->update('home_about', $data);

                // $this->db->insert('home_slideshow', $data);	
                // return $this->db->insert_id();

                $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/home_about/1');
            }
        }

        $this->data['subview'] = 'admin/home_content/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 body_rooms_add()
    {
        $quer_body_rooms = new stdClass();
        $quer_body_rooms->header_text = '';
        $quer_body_rooms->content_text = '';
        $quer_body_rooms->content_text_en = '';
        $quer_body_rooms->button_text = '';
        $quer_body_rooms->target_loc = '';
        $quer_body_rooms->type = '';
        $quer_body_rooms->active = '1';

        $this->data['dt_body_rooms'] = $quer_body_rooms;

        //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_error_delimiters('<div class="error">', '</div>'); //above is to add class to form validation error, to be styled	
        $this->form_validation->set_rules($config);

        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')) {
                        $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/body_rooms_add');
                    } else {
                        $image1 = $this->upload->data();
                        $image1_filename = $image1['file_name'];
                        // $this->resize_single_image('570', '290', 'body_rooms/', $image1_filename);
                    }
                }


                $data = array(
                    'header_text' => $this->security->xss_clean($this->input->post('header_text')),
                    'content_text' => $this->security->xss_clean($this->input->post('content_text')),
                    'promo' => $this->security->xss_clean($this->input->post('promo')),
                    'active' => $this->security->xss_clean($this->input->post('active'))
                );

                //image upload
                if (isset($image1_filename)) {
                    $data['img_name'] = $image1_filename;
                }

                // $this->db->where('id', $id)->update('body_rooms', $data);

                $this->db->insert('body_rooms', $data);
                $id = $this->db->insert_id();

                $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Body room berhasil diedit</p>');

                redirect('admin/home_content/body_rooms');
            }
        }

        $this->data['subview'] = 'admin/home_content/body_rooms/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 body_rooms_edit($id = NULL)
    {
        //check if id exist. If not exist, show 404.
        $quer_body_rooms = $this->db->get_where("body_rooms", array(
            "id" => $id
        ));

        $count = $quer_body_rooms->num_rows();

        if ($count == 0) {
            //page not exist
            show_404();
        }

        $this->data['dt_body_rooms'] = $quer_body_rooms->row();

        // header_text
        // header_text_en
        // content_text
        // content_text_en
        // button_text
        // button_text_en
        // target_loc

        //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_error_delimiters('<div class="error">', '</div>'); //above is to add class to form validation error, to be styled	
        $this->form_validation->set_rules($config);
       
        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';
                    $config['max_size']    = '800';
                    // $config['max_width']  = 570;
                    // $config['max_height'] = 290;

                    $this->load->library('upload', $config);

                    if (!$this->upload->do_upload('image1')) {
                        $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/body_rooms/edit/' . $id);
                    } else {
                        $image1 = $this->upload->data();
                        $image1_filename = $image1['file_name'];
                        // $this->resize_single_image('570', '290', 'body_rooms/', $image1_filename);
                    }
                }


                $data = array(
                    'header_text' => $this->security->xss_clean($this->input->post('header_text')),
                    'content_text' => $this->security->xss_clean($this->input->post('content_text')),
                    'promo' => $this->security->xss_clean($this->input->post('promo')),
                    'active' => $this->security->xss_clean($this->input->post('active'))
                );

                //image upload
                if (isset($image1_filename)) {
                    $data['img_name'] = $image1_filename;
                }

                $this->db->where('id', $id)->update('body_rooms', $data);

                // $this->db->insert('home_slideshow', $data);	
                // return $this->db->insert_id();

                $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Body room berhasil diedit</p>');

                redirect('admin/home_content/body_rooms');
            }
        }

        $this->data['subview'] = 'admin/home_content/body_rooms/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 body_rooms_delete_all()
    {
        $checkbox_for_del = $this->input->post('checkbox_del');
        if (empty($checkbox_for_del)) {
            redirect('admin/home_content/body_rooms');
        }

        for ($i = 0; $i < count($checkbox_for_del); $i++) {
            $id = $checkbox_for_del[$i];

            $this->db->where('id', $id)->delete('body_rooms');
        }

        $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Body room berhasil dihapus</p>');
        echo json_encode(array(
            'result' => 'sukses',
        ));
    }

    public function events_delete_all()
    {
        $checkbox_for_del = $this->input->post('checkbox_del');
        if (empty($checkbox_for_del)) {
            redirect('admin/home_content/events');
        }

        for ($i = 0; $i < count($checkbox_for_del); $i++) {
            $id = $checkbox_for_del[$i];

            $this->db->where('id', $id)->delete('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',
        ));
    }

    //to delete a brand
    public function body_rooms_delete($id)
    {

        $quer_body_rooms = $this->db->get_where("body_rooms", array(
            "id" => $id
        ));

        $count = $quer_body_rooms->num_rows();

        if ($count == 0) {
            //page not exist 
            show_404();
        }


        $this->db->where('id', $id)->delete('body_rooms');

        $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/body_rooms');
    }


    public function events_delete($id)
    {

        $quer_events = $this->db->get_where("events", array(
            "id" => $id
        ));

        $count = $quer_events->num_rows();

        if ($count == 0) {
            //page not exist 
            show_404();
        }


        $this->db->where('id', $id)->delete('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/events');
    }

    public function ajax_get_type()
    {

        $this->load->helper('form');

        //test if ajax call to prevent direct access
        if (!$this->input->is_ajax_request()) {
            exit('No direct script access allowed');
        }

        $type = $this->input->post('type');
        $current_id = $this->input->post('current_id');

        if ($type == 'promo') {
            if ($current_id == NULL) {

                $this->load->view('admin/home_content/body_rooms/ajax_get_section_promo');
            } else {

                //get current external link
                $this->db->select('promo')->from('body_rooms')->where(
                    'id',
                    (int) $current_id
                );
                $data['current_promo'] = $this->db->get()->row();

                $this->load->view('admin/home_content/body_rooms/ajax_get_section_promo', $data);
            }
        }
    }
}

https://t.me/RX1948 - 2025