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_footer extends Admin_Controller { function __construct() { parent::__construct(); //admin role module check $this->check_admin_role('footer'); //method from Admin_controller $this->load->model('home_footer_m'); } //this is to list all home_footer public function index() { //pagination in action. 10 results per page $this->load->library('pagination'); $config['base_url'] = base_url() . 'admin/home_footer/index'; $config['per_page'] = 20; $config["uri_segment"] = 4; //fetch all home_footer $config['total_rows'] = $this->home_footer_m->record_count(); $this->pagination->initialize($config); $this->data['home_footer'] = $this->home_footer_m->get_all_home_footer($config["per_page"], $this->uri->segment(4)); //load view $this->data['subview'] = 'admin/home_footer/index'; $this->load->view('admin/templates/header', $this->data_header); $this->load->view('admin/_layout_main', $this->data); $this->load->view('admin/templates/footer'); } function ajax_del_footer_link(){ $this_id = $this->input->post('this_id'); $this->db->delete("home_footer_link",array("id"=>$this_id)); echo json_encode(array( "result"=>'sukses', )); } function ajax_addnew_footer_link(){ $id_home_footer = $this->input->post('id_home_footer'); $inp_judul_link_idn = $this->input->post('inp_judul_link_idn'); $inp_judul_link_eng = $this->input->post('inp_judul_link_eng'); $inp_pilih_halaman = $this->input->post('inp_pilih_halaman'); $query_pages = $this->db->get_where("pages",array( "id_pages"=>$inp_pilih_halaman, ))->row(); $this->db->insert("home_footer_link",array( "home_footer_id"=>$id_home_footer, "page_id"=>$inp_pilih_halaman, "link_english"=>$inp_judul_link_eng, "link_indonesian"=>$inp_judul_link_idn, )); $id_home_footer_link = $this->db->insert_id(); $this_fill = "<tr> <td>".$inp_judul_link_idn."</td> <td>".$inp_judul_link_eng."</td> <td>".ucwords($query_pages->page_title.' / '.$query_pages->page_title_en)."</td> <td>". "<button onclick='del_homefooter_link(".$id_home_footer_link.");' type='button' class='btn btn-sm btn-default'> <i class='fa fa-close'></i> </button>". "</td> </tr>"; echo json_encode(array( "this_fill"=>$this_fill, )); } //to edit brand in admin public function edit($id = NULL) { //check if id exist. If not exist, show 404. $count = $this->home_footer_m->count_exist($id); if ($count == 0) { //page not exist show_404(); } $this->data['home_footer'] = $this->home_footer_m->get($id); //validation check in action $config = array( array( 'field' => 'title', 'label' => 'Footer Title', 'rules' => 'trim|required' ), array( 'field' => 'title_en', 'label' => 'Footer Title English', 'rules' => 'trim|required' ), array( 'field' => 'description', 'label' => 'description', 'rules' => 'trim' ), array( 'field' => 'description_en', 'label' => 'description english', 'rules' => 'trim' ), array( 'field' => 'status', 'label' => 'status', '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) { $data = array( 'title' => $this->security->xss_clean($this->input->post('title')), 'title_en' => $this->security->xss_clean($this->input->post('title_en')), 'description' => $this->security->xss_clean($this->input->post('description')), 'description_en' => $this->security->xss_clean($this->input->post('description_en')), 'status' => $this->input->post('status'), 'maps' => $this->input->post('maps'), ); $this->home_footer_m->edit_home_footer($id, $data); $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Home Footer Berhasil Di Edit</p>'); redirect('admin/home_footer'); } } $this->data['subview'] = 'admin/home_footer/edit'; $this->load->view('admin/templates/header', $this->data_header); $this->load->view('admin/_layout_main', $this->data); $this->load->view('admin/templates/footer'); } }