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/indolok.id/application/controllers/admin/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Bundling extends Admin_Controller { private $bundle_current_id; function __construct() { parent::__construct(); $this->load->model('bundling_m'); $this->load->model('category_m'); if (!in_array('products', $this->data['allowed_module'])) { $this->data['allowed'] = false; } else { $this->data['allowed'] = true; } } //this is to list all homepage public function index() { //load view $this->data['subview'] = 'admin/bundling/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 list() { $this->db->select('*')->from('bundle')->order_by('id','DESC'); $this->data['bundlings'] = $this->db->get()->result(); //load view $this->data['subview'] = 'admin/bundling/list'; $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 add() { if($this->data['allowed'] == false) { redirect('admin/bundling/list'); } $this->data['new_product'] = 'yes'; /*get product data*/ $this->data['bundlings'] = $this->bundling_m->get_new(); /*get product non bundle from products table*/ $this->data['product'] = $this->db->select('id_products,title')->from('products')->where('bundling','no')->order_by('title','ASC')->get()->result(); /*get warehouse*/ $this->data['warehouses'] = $this->db->select('id,name')->from('warehouse')->order_by('name','ASC')->get()->result(); /*get product type*/ $this->data['product_type'] = $this->db->select('*')->from('product_type')->order_by('id','ASC')->get()->result(); /*get market place price*/ $this->data['marketplace'] = $this->db->select('*')->from('marketplace')->order_by('id','ASC')->get()->result(); /*get stock*/ $this->data['stock'] = $this->db->select('*')->from('warehouse')->order_by('location','ASC')->get()->result(); /*get shipment method*/ $this->data['shipment'] = $this->db->select('*')->from('shipment_method')->order_by('id','ASC')->get()->result(); $this->data['parent_categories'] = $this->category_m->get_parent_categories(); //get ordering number and display at add form $this->db->select_max('priority')->from('bundle'); $current_priority = $this->db->get()->row()->priority; if($current_priority == NULL) { $this->data['bundlings']->priority = 1; } else { $this->data['bundlings']->priority = $current_priority + 1; } $config = $this->bundling_m->rules; $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($this) == TRUE) { echo "lolos";die(); } //load view $this->data['subview'] = 'admin/bundling/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 edit($id) { //load view $this->data['subview'] = 'admin/bundling/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 approval() { //load view $this->data['subview'] = 'admin/bundling/approval'; $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 _cek_existing_bundle_code($str) { $num_rows = $this->bundling_m->cek_existing_bundle_code($str, $this->bundle_current_id); if ($num_rows != 0 ) { $this->form_validation->set_message('_cek_existing_bundle_code', 'Bundle code already exist !'); return FALSE; } else { return TRUE; } } public function _cek_existing_bundle_name($str) { $num_rows = $this->bundling_m->cek_existing_bundle_name($str, $this->bundle_current_id); if ($num_rows != 0 ) { $this->form_validation->set_message('_cek_existing_bundle_name', 'Bundle name already exist !'); return FALSE; } else { return TRUE; } } }