whoami7 - Manager
:
/
home
/
papecmvm
/
public_html
/
application
/
controllers
/
webapp
/
master
/
Upload File:
files >> //home/papecmvm/public_html/application/controllers/webapp/master/Subgroup.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Subgroup 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() { $this->db2->select('a.*, b.gname'); $this->db2->from('tbl_subgroup as a'); $this->db2->order_by("a.sg_id", "DESC"); $this->db2->join('tbl_group as b', 'b.gid = a.gid', 'left'); $data['subgroup'] = $this->db2->get()->result_array(); $this->load->view("webapp/master/subgroup/view", $data); } public function add() { if($this->input->post('save')=='save') { $data = array('gid'=>$this->input->post('gid'), 'sg_name'=>$this->input->post('sg_name'), 'sg_desc'=>$this->input->post('sg_desc')); $this->model->insertData('tbl_subgroup', $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/subgroup'); }else{ $data['group'] = $this->model->getDatamodel('tbl_group'); $this->load->view("webapp/master/subgroup/add", $data); } } public function edit($enc_id) { $sg_id = $this->model->decryptdata($enc_id); if($this->input->post('save')=='save') { $data = array('gid'=>$this->input->post('gid'), 'sg_name'=>$this->input->post('sg_name'), 'sg_desc'=>$this->input->post('sg_desc')); $where = array('sg_id' => $enc_id); $this->model->UpdateData('tbl_subgroup', $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/subgroup'); }else{ $where = array('sg_id' => $sg_id); $data['subgroup'] = $this->model->DetailData('tbl_subgroup', $where); $data['group'] = $this->model->getDatamodel('tbl_group'); $this->load->view("webapp/master/subgroup/add", $data); } } public function trash($enc_id) { $sg_id = $this->model->decryptdata($enc_id); $where = array('sg_id' => $sg_id); $this->model->DeleteData('tbl_subgroup', $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/subgroup'); } }
Copyright ©2021 || Defacer Indonesia