Uname:
Linux webm016.cluster127.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Software:
Apache
PHP version:
7.4.33 [ PHP INFO ] PHP os:
Linux
Server Ip:
54.36.31.145
Your Ip:
216.73.216.182
User:
homesquasz (91404) | Group:
users (100)
Safe Mode:
OFF
Disable Function:
_dyuweyrj4,_dyuweyrj4r,dl
<?php
/*
* Generated by CRUDigniter v3.2
* www.crudigniter.com
*/
class Centrepaie extends CI_Controller{
function __construct()
{
parent::__construct();
$this->load->model('Centrepaie_model');
}
/*
* Listing of centrepaie
*/
function index()
{
$params['limit'] = RECORDS_PER_PAGE;
$params['offset'] = ($this->input->get('per_page')) ? $this->input->get('per_page') : 0;
$config = $this->config->item('pagination');
$config['base_url'] = site_url('centrepaie/index?');
$config['total_rows'] = $this->Centrepaie_model->get_all_centrepaie_count();
$this->pagination->initialize($config);
$data['centrepaie'] = $this->Centrepaie_model->get_all_centrepaie($params);
$data['_view'] = 'centrepaie/index';
$this->load->view('layouts/main',$data);
}
/*
* Adding a new centrepaie
*/
function add()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('libelle','Libelle','required');
if($this->form_validation->run())
{
$params = array(
'libelle' => $this->input->post('libelle'),
);
$centrepaie_id = $this->Centrepaie_model->add_centrepaie($params);
redirect('centrepaie/index');
}
else
{
$data['_view'] = 'centrepaie/add';
$this->load->view('layouts/main',$data);
}
}
/*
* Editing a centrepaie
*/
function edit($id)
{
// check if the centrepaie exists before trying to edit it
$data['centrepaie'] = $this->Centrepaie_model->get_centrepaie($id);
if(isset($data['centrepaie']['id']))
{
$this->load->library('form_validation');
$this->form_validation->set_rules('libelle','Libelle','required');
if($this->form_validation->run())
{
$params = array(
'libelle' => $this->input->post('libelle'),
);
$this->Centrepaie_model->update_centrepaie($id,$params);
redirect('centrepaie/index');
}
else
{
$data['_view'] = 'centrepaie/edit';
$this->load->view('layouts/main',$data);
}
}
else
show_error('The centrepaie you are trying to edit does not exist.');
}
/*
* Deleting centrepaie
*/
function remove($id)
{
$centrepaie = $this->Centrepaie_model->get_centrepaie($id);
// check if the centrepaie exists before trying to delete it
if(isset($centrepaie['id']))
{
$this->Centrepaie_model->delete_centrepaie($id);
redirect('centrepaie/index');
}
else
show_error('The centrepaie you are trying to delete does not exist.');
}
}