whoami7 - Manager
:
/
home
/
papecmvm
/
public_html
/
application
/
controllers
/
webapp
/
master
/
Upload File:
files >> //home/papecmvm/public_html/application/controllers/webapp/master/Group.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Group 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() { //$data['group'] = $this->model->getDatamodel('tbl_group'); $this->db2->from('tbl_group'); $this->db2->order_by("gid", "DESC"); $data['group'] = $this->db2->get()->result_array(); $this->load->view("webapp/master/group/view", $data); } public function add() { if($this->input->post('save')=='save') { $data = array('gname'=>$this->input->post('name'), 'gdesc'=>$this->input->post('gdesc')); $this->model->insertData('tbl_group', $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/group'); }else{ $this->load->view("webapp/master/group/add"); } } public function edit($enc_id) { $gid = $this->model->decryptdata($enc_id); if($this->input->post('save')=='save') { $data = array('gname'=>$this->input->post('name'), 'gdesc'=>$this->input->post('gdesc')); $where = array('gid' => $enc_id); $this->model->UpdateData('tbl_group', $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/group'); }else{ $where = array('gid' => $gid); $data['group'] = $this->model->DetailData('tbl_group', $where); $this->load->view("webapp/master/group/add", $data); } } public function trash($enc_id) { $gid = $this->model->decryptdata($enc_id); $where = array('gid' => $gid); $this->model->DeleteData('tbl_group', $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/group'); } public function grouped_voucher(){ $data['grouped_voucher'] = $this->model->getGroupedVoucher(); $this->load->view("webapp/master/group/gv_view", $data); } public function add_gv(){ if($this->input->post('save')=='save') { $userdata = $this->session->userdata('reg_info'); $rid = $userdata[0]['rid']; $data = array( 'voucher' => $this->input->post('voucher'), 'gid'=> $this->input->post('gid'), 'sg_id'=> $this->input->post('sg_id'), 'updated_by'=>$rid ); $this->model->insertData('tbl_grouped_voucher', $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/group/grouped_voucher'); }else{ $data['group'] = $this->model->getDatamodel('tbl_group'); $this->load->view("webapp/master/group/gv_add", $data); } } public function edit_gv($enc_gvid){ $gvid = $this->model->decryptdata($enc_gvid); if($this->input->post('save')=='save') { $gid = implode('|', $this->input->post('gid')); $userdata = $this->session->userdata('reg_info'); $rid = $userdata[0]['rid']; $data = array( 'gid'=> $this->input->post('gid'), 'sg_id'=> $this->input->post('sg_id'), 'updated_by'=>$rid ); $where = array('gv_id' => $enc_gvid); $this->model->UpdateData('tbl_grouped_voucher', $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/group/grouped_voucher'); }else{ $data['group'] = $this->model->getDatamodel('tbl_group'); $where = array('gv_id' => $gvid); $data['gv'] = $this->model->DetailData('tbl_grouped_voucher', $where); $gid = $data['gv'][0]['gid']; $data['sub_group'] = $this->db2->get_where('tbl_subgroup', array('gid' => $gid))->result_array(); $this->load->view("webapp/master/group/gv_edit", $data); } } }
Copyright ©2021 || Defacer Indonesia