1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Pointage extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('Pointage_model');
$this->load->library('form_validation');
}
public function index()
{
$pointage = $this->Pointage_model->get_all();
$data = array(
'pointage_data' => $pointage
);
$this->load->view('pointage/pointage_list', $data);
}
public function read($id)
{
$row = $this->Pointage_model->get_by_id($id);
if ($row) {
$data = array(
'idP' => $row->idP,
'matricule' => $row->matricule,
'nom' => $row->nom,
'groupe' => $row->groupe,
'date1' => $row->date1,
'date2' => $row->date2,
'hE1' => $row->hE1,
'hS1' => $row->hS1,
'hN1' => $row->hN1,
'hSup1' => $row->hSup1,
);
$this->load->view('pointage/pointage_read', $data);
} else {
$this->session->set_flashdata('message', 'Record Not Found');
redirect(site_url('pointage'));
}
}
public function create()
{
$data = array(
'button' => 'Create',
'action' => site_url('pointage/create_action'),
'idP' => set_value('idP'),
'matricule' => set_value('matricule'),
'nom' => set_value('nom'),
'groupe' => set_value('groupe'),
'date1' => set_value('date1'),
'date2' => set_value('date2'),
'hE1' => set_value('hE1'),
'hS1' => set_value('hS1'),
'hSup1' => set_value('hSup1'),
'tHSup' => set_value('tHSup'),
);
$this->load->view('pointage/pointage_form', $data);
}
public function create_action()
{
$this->_rules();
if ($this->form_validation->run() == FALSE) {
$this->create();
} else {
$data = array(
'matricule' => $this->input->post('matricule',TRUE),
'nom' => $this->input->post('nom',TRUE),
'groupe' => $this->input->post('groupe',TRUE),
'date1' => $this->input->post('date1',TRUE),
'date2' => $this->input->post('date2',TRUE),
'hE1' => $this->input->post('hE1',TRUE),
'hS1' => $this->input->post('hS1',TRUE),
'hSup1' => $this->input->post('hSup1',TRUE),
);
$this->Pointage_model->insert($data);
$this->session->set_flashdata('message', 'Create Record Success');
redirect(site_url('pointage'));
}
} |