[ Mini Kiebo ]
Server: Windows NT DESKTOP-5B8S0D4 6.2 build 9200 (Windows 8 Professional Edition) i586
Path:
D:
/
xampp182
/
htdocs
/
repository
/
application
/
controllers
/
[
Home
]
File: Types.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Types extends CI_Controller { function __construct() { parent::__construct(); chek_session(); $this->load->model('Types_model'); $this->load->library('form_validation'); } public function index() { $types = $this->Types_model->get_all(); $data = array( 'types_data' => $types ); $this->template->load('template','types_list', $data); } public function read($id) { $row = $this->Types_model->get_by_id($id); if ($row) { $data = array( 'id' => $row->id, 'type' => $row->type, ); $this->template->load('template','types_read', $data); } else { $this->session->set_flashdata('message', 'Record Not Found'); redirect(site_url('types')); } } public function create() { $data = array( 'button' => 'Create', 'action' => site_url('types/create_action'), 'id' => set_value('id'), 'type' => set_value('type'), ); $this->template->load('template','types_form', $data); } public function create_action() { $this->_rules(); if ($this->form_validation->run() == FALSE) { $this->create(); } else { $data = array( 'type' => $this->input->post('type',TRUE), ); $this->Types_model->insert($data); $this->session->set_flashdata('message', 'Create Record Success'); redirect(site_url('types')); } } public function update($id) { $row = $this->Types_model->get_by_id($id); if ($row) { $data = array( 'button' => 'Update', 'action' => site_url('types/update_action'), 'id' => set_value('id', $row->id), 'type' => set_value('type', $row->type), ); $this->template->load('template','types_form', $data); } else { $this->session->set_flashdata('message', 'Record Not Found'); redirect(site_url('types')); } } public function update_action() { $this->_rules(); if ($this->form_validation->run() == FALSE) { $this->update($this->input->post('id', TRUE)); } else { $data = array( 'type' => $this->input->post('type',TRUE), ); $this->Types_model->update($this->input->post('id', TRUE), $data); $this->session->set_flashdata('message', 'Update Record Success'); redirect(site_url('types')); } } public function delete($id) { $row = $this->Types_model->get_by_id($id); if ($row) { //$this->Types_model->delete($id); //$this->session->set_flashdata('message', 'Delete Record Success'); redirect(site_url('types')); } else { $this->session->set_flashdata('message', 'Record Not Found'); redirect(site_url('types')); } } public function _rules() { $this->form_validation->set_rules('type', 'type', 'trim|required'); $this->form_validation->set_rules('id', 'id', 'trim'); $this->form_validation->set_error_delimiters('<span class="text-danger">', '</span>'); } } /* End of file Types.php */ /* Location: ./application/controllers/Types.php */ /* Please DO NOT modify this information : */ /* Generated by Harviacode Codeigniter CRUD Generator 2019-05-06 09:26:39 */ /* http://harviacode.com */