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 Papier extends CI_Controller{
function __construct()
{
parent::__construct();
$this->load->model('Papier_model');
}
/*
* Listing of papier
*/
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('papier/index?');
$config['total_rows'] = $this->Papier_model->get_all_papier_count();
$this->pagination->initialize($config);
$data['papier'] = $this->Papier_model->get_all_papier($params);
$data['_view'] = 'papier/index';
$this->load->view('layouts/main',$data);
}
/*
* Adding a new papier
*/
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'),
);
$papier_id = $this->Papier_model->add_papier($params);
redirect('papier/index');
}
else
{
$data['_view'] = 'papier/add';
$this->load->view('layouts/main',$data);
}
}
/*
* Editing a papier
*/
function edit($id)
{
// check if the papier exists before trying to edit it
$data['papier'] = $this->Papier_model->get_papier($id);
if(isset($data['papier']['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->Papier_model->update_papier($id,$params);
redirect('papier/index');
}
else
{
$data['_view'] = 'papier/edit';
$this->load->view('layouts/main',$data);
}
}
else
show_error('The papier you are trying to edit does not exist.');
}
/*
* Deleting papier
*/
function remove($id)
{
$papier = $this->Papier_model->get_papier($id);
// check if the papier exists before trying to delete it
if(isset($papier['id']))
{
$this->Papier_model->delete_papier($id);
redirect('papier/index');
}
else
show_error('The papier you are trying to delete does not exist.');
}
}