whoami7 - Manager
:
/
proc
/
self
/
root
/
home
/
papecmvm
/
www
/
application
/
controllers
/
webapp
/
master
/
Upload File:
files >> //proc/self/root/home/papecmvm/www/application/controllers/webapp/master/Item_cat.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Item_cat extends CI_Controller { function __construct() { parent::__construct(); $this->load->model('app', "model"); $CI = & get_instance(); $this->db = $CI->load->database('default', TRUE); $this->db2 = $CI->load->database('db2', TRUE); } public function index($offset = '0') { //$data['item'] = $this->model->getDatamodel('tbl_item_cat'); $this->db2->from('tbl_item_cat'); $this->db2->order_by("cid", "DESC"); $cnt_data['data'] = $this->db2->get()->result_array(); $cnt=count($cnt_data['data']); $this->load->library('pagination'); $config['base_url'] = base_url().'webapp/master/item_cat/index'; $config['total_rows'] = $cnt; $config['per_page'] = 20; $config['full_tag_open'] = '<div class="pagination"><ul class="list-inline">'; $config['full_tag_close'] = '</ul></div>'; $config['first_link'] = '« First'; $config['first_tag_open'] = '<li class="prev page">'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Last »'; $config['last_tag_open'] = '<li class="next page">'; $config['last_tag_close'] = '</li>'; $config['next_link'] = 'Next →'; $config['next_tag_open'] = '<li class="next page">'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '← Previous'; $config['prev_tag_open'] = '<li class="prev page">'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a href="">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li class="page">'; $config['num_tag_close'] = '</li>'; $this->pagination->initialize($config); $data['item'] = $this->model->get_pagination('tbl_item_cat', $config['per_page'], $offset); $this->load->view("webapp/master/item/view", $data); } public function add() { if($this->input->post('save')=='save') { $data = array('cname'=>$this->input->post('name')); $this->model->insertData('tbl_item_cat', $data); $this->session->set_flashdata('msg', ' <div class="alert alert-success alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button> <strong>Success!</strong> Data has been Inserted. </div>'); redirect('webapp/master/item_cat'); }else{ $this->load->view("webapp/master/item/add"); } } public function edit($enc_id) { $cid = $this->model->decryptdata($enc_id); if($this->input->post('save')=='save') { $data = array('cname'=>$this->input->post('name')); $where = array('cid' => $enc_id); $this->model->UpdateData('tbl_item_cat', $data, $where); $this->session->set_flashdata('msg', ' <div class="alert alert-success alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button> <strong>Success!</strong> Data has been Uploaded. </div>'); redirect('webapp/master/item_cat'); }else{ $where = array('cid' => $cid); $data['item'] = $this->model->DetailData('tbl_item_cat', $where); $this->load->view("webapp/master/item/add", $data); } } public function trash($enc_id) { $cid = $this->model->decryptdata($enc_id); $where = array('cid' => $cid); $this->model->DeleteData('tbl_item_cat', $where); $this->session->set_flashdata('msg', ' <div class="alert alert-success alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button> <strong>Success!</strong> Data has been Deleted. </div>'); redirect('webapp/master/item_cat'); } public function search() { $search = $this->input->post('src'); $this->db2->like('cname', $search); $result = $this->db2->get('tbl_item_cat')->result_array(); foreach ($result as $key => $value) { $enc_id = $this->model->encryptdata($value['cid']); echo '<tr> <td class="text-capitalize">'.$value["cname"].'</td> <td><a href="'.base_url().'webapp/master/item_cat/edit/'.$enc_id.'" class="btn btn-info"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a> <a href="'.base_url().'webapp/master/item_cat/trash/'.$enc_id.'" class="btn btn-danger"><i class="fa fa-trash" aria-hidden="true"></i></a> </td> </tr>'; } } public function default_cat($offset = '0') { //$data['item'] = $this->model->getDatamodel('tbl_item_cat'); $this->db2->from('tbl_item_cat'); $this->db2->order_by("cid", "DESC"); $cnt_data['data'] = $this->db2->get()->result_array(); $cnt=count($cnt_data['data']); $this->load->library('pagination'); $config['base_url'] = base_url().'webapp/master/default_cat'; $config['total_rows'] = $cnt; $config['per_page'] = 20; $config['full_tag_open'] = '<div class="pagination"><ul class="list-inline">'; $config['full_tag_close'] = '</ul></div>'; $config['first_link'] = '« First'; $config['first_tag_open'] = '<li class="prev page">'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Last »'; $config['last_tag_open'] = '<li class="next page">'; $config['last_tag_close'] = '</li>'; $config['next_link'] = 'Next →'; $config['next_tag_open'] = '<li class="next page">'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '← Previous'; $config['prev_tag_open'] = '<li class="prev page">'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a href="">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li class="page">'; $config['num_tag_close'] = '</li>'; $this->pagination->initialize($config); $result = $this->model->get_pagination('tbl_item_cat', $config['per_page'], $offset); foreach ($result as $key => $value) { $enc_id = $this->model->encryptdata($value['cid']); echo '<tr> <td class="text-capitalize">'.$value["cname"].'</td> <td><a href="'.base_url().'webapp/master/item_cat/edit/'.$enc_id.'" class="btn btn-info"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a> <a href="'.base_url().'webapp/master/item_cat/trash/'.$enc_id.'" class="btn btn-danger"><i class="fa fa-trash" aria-hidden="true"></i></a> </td> </tr>'; } } }
Copyright ©2021 || Defacer Indonesia