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 Transport extends FrontApplication{
function __construct()
{
parent::__construct();
$this->load->model('Transport_model');
}
/*
* Listing of transport
*/
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('transport/index?');
$config['total_rows'] = $this->Transport_model->get_all_transport_count();
$this->pagination->initialize($config);
$this->data['transport'] = $this->Transport_model->get_all_transport($params);
$this->data['_view'] = 'transport/index';
$this->load->view('layouts/main',$this->data);
}
/*
* Adding a new transport
*/
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'),
);
$transport_id = $this->Transport_model->add_transport($params);
redirect('transport/index');
}
else
{
$this->data['_view'] = 'transport/add';
$this->load->view('layouts/main',$this->data);
}
}
/*
* Editing a transport
*/
function edit($id)
{
// check if the transport exists before trying to edit it
$this->data['transport'] = $this->Transport_model->get_transport($id);
if(isset($this->data['transport']['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->Transport_model->update_transport($id,$params);
redirect('transport/index');
}
else
{
$this->data['_view'] = 'transport/edit';
$this->load->view('layouts/main',$this->data);
}
}
else
show_error('The transport you are trying to edit does not exist.');
}
/*
* Deleting transport
*/
function remove($id)
{
$transport = $this->Transport_model->get_transport($id);
// check if the transport exists before trying to delete it
if(isset($transport['id']))
{
$this->Transport_model->delete_transport($id);
redirect('transport/index');
}
else
show_error('The transport you are trying to delete does not exist.');
}
}