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 Typecontrat extends FrontApplication{
function __construct()
{
parent::__construct();
$this->load->model('Typecontrat_model');
}
/*
* Listing of typecontrat
*/
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('typecontrat/index?');
$config['total_rows'] = $this->Typecontrat_model->get_all_typecontrat_count();
$this->pagination->initialize($config);
$this->data['typecontrat'] = $this->Typecontrat_model->get_all_typecontrat($params);
$this->data['_view'] = 'typecontrat/index';
$this->load->view('layouts/main',$this->data);
}
/*
* Adding a new typecontrat
*/
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'),
);
$typecontrat_id = $this->Typecontrat_model->add_typecontrat($params);
redirect('typecontrat/index');
}
else
{
$this->data['_view'] = 'typecontrat/add';
$this->load->view('layouts/main',$this->data);
}
}
/*
* Editing a typecontrat
*/
function edit($id)
{
// check if the typecontrat exists before trying to edit it
$this->data['typecontrat'] = $this->Typecontrat_model->get_typecontrat($id);
if(isset($this->data['typecontrat']['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->Typecontrat_model->update_typecontrat($id,$params);
redirect('typecontrat/index');
}
else
{
$this->data['_view'] = 'typecontrat/edit';
$this->load->view('layouts/main',$this->data);
}
}
else
show_error('The typecontrat you are trying to edit does not exist.');
}
/*
* Deleting typecontrat
*/
function remove($id)
{
$typecontrat = $this->Typecontrat_model->get_typecontrat($id);
// check if the typecontrat exists before trying to delete it
if(isset($typecontrat['id']))
{
$this->Typecontrat_model->delete_typecontrat($id);
redirect('typecontrat/index');
}
else
show_error('The typecontrat you are trying to delete does not exist.');
}
}