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/kanvakanva.com/public_html/application/controllers/admin/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Popup extends Admin_Controller { function __construct() { parent::__construct(); $this->load->model('popup_m'); } function index() { redirect('admin/popup/edit'); } //to EDIT workshop in admin public function edit($id = 1) { $this->data['popup'] = $this->popup_m->get($id); $config = array( array( 'field' => 'voucher_code', 'label' => 'voucher code', 'rules' => 'trim|required' ), ); $this->form_validation->set_rules($config); $this->form_validation->set_error_delimiters('<div class="error">', '</div>'); if($this->form_validation->run() == TRUE) { //image upload $config['upload_path'] = './uploads/popup_voucher/img'; $config['allowed_types'] = 'jpg|png'; $config['max_size'] = 300; $config['max_width'] = 800; $config['max_height'] = 500; $this->load->library('upload', $config); if ( ! $this->upload->do_upload('userfile')) { $error = array('error' => $this->upload->display_errors()); $this->session->set_flashdata('error', '<br><p style="background:red; color:white; padding:5px; font-weight:bold;">'.$error["error"].'</p>'); } else { $upload_data = $this->upload->data(); $file_name = $upload_data['file_name']; } $data = array( 'voucher_code' => $this->input->post('voucher_code'), 'email_input' => $this->input->post('email_input'), // 'img_banner' => $file_name, 'active' => $this->input->post('active'), ); if (isset($file_name)) { $data['img_banner'] = $file_name; } $this->popup_m->edit_popup($id, $data); $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Pop-up Edit Successful. Click "Dashboard" to go back</p>'); redirect('admin/popup/edit'); } $this->data['all_data'] = $this->db->get('popup_subscription')->result(); // print_r($this->data['all_data']); $this->data['error'] = ''; $this->data['subview'] = 'admin/popup/edit'; $this->load->view('admin/templates/header', $this->data); $this->load->view('admin/_layout_main', $this->data); $this->load->view('admin/templates/footer', $this->data); } }