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 Demanderh extends FrontApplication{
function __construct()
{
parent::__construct();
$this->load->model('Demanderh_model');
}
/*
* Listing of demanderh
*/
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('demanderh/index?');
$config['total_rows'] = $this->Demanderh_model->get_all_demanderh_count();
$this->pagination->initialize($config);
$data['demanderh'] = $this->Demanderh_model->get_all_demanderh($params);
$data['_view'] = 'demanderh/index';
$this->load->view('layouts/main',$data);
}
/*
* Adding a new demanderh
*/
function add()
{
$user = $this->session->userdata("auth");
$this->load->library('form_validation');
$this->form_validation->set_rules('papier_id','Papier Id','required');
if($this->form_validation->run())
{
$params = array(
'papier_id' => $this->input->post('papier_id'),
'date' => date("Y-m-d H:i"),
'users_id' =>$user["iduser"],
'motif' => $this->input->post('motif'),
);
$demanderh_id = $this->Demanderh_model->add_demanderh($params);
$data["user"]=$user;
$this->load->model('Notifier_model');
$notifieds = $this->Notifier_model->get_notified_by_user_id($user["iduser"]);
foreach ($notifieds as $notified) {
$data["isnotifed"]= ($user["responsable_id"]==$notified["notifyto"])? true : false;
$message = $this->load->view("mail/demanderh",$data,true);
$this->email->from("si.support@groupe-hammami.com", 'Notification:'."Demanderh");
$this->email->to($notified["email"]);
$this->email->subject("Notification de demande papier");
$this->email->message($message);
$this->email->send();
}
redirect('demanderh/index');
}
else
{
$this->load->model('Papier_model');
$data['all_papier'] = $this->Papier_model->get_all_papier();
$this->load->model('User_model');
$data['all_users'] = $this->User_model->get_all_users();
$data['_view'] = 'demanderh/add';
$this->load->view('layouts/main',$data);
}
}
/*
* Editing a demanderh
*/
function edit($id)
{
// check if the demanderh exists before trying to edit it
$data['demanderh'] = $this->Demanderh_model->get_demanderh($id);
if(isset($data['demanderh']['id']))
{
$this->load->library('form_validation');
$this->form_validation->set_rules('papier_id','Papier Id','required');
if($this->form_validation->run())
{
$params = array(
'papier_id' => $this->input->post('papier_id'),
'date' => $this->input->post('date'),
'users_id' => $this->input->post('users_id'),
'motif' => $this->input->post('motif'),
);
$this->Demanderh_model->update_demanderh($id,$params);
redirect('demanderh/index');
}
else
{
$this->load->model('Papier_model');
$data['all_papier'] = $this->Papier_model->get_all_papier();
$data['_view'] = 'demanderh/edit';
$this->load->view('layouts/main',$data);
}
}
else
show_error('The demanderh you are trying to edit does not exist.');
}
/*
* Deleting demanderh
*/
function remove($id)
{
$demanderh = $this->Demanderh_model->get_demanderh($id);
// check if the demanderh exists before trying to delete it
if(isset($demanderh['id']))
{
$this->Demanderh_model->delete_demanderh($id);
redirect('demanderh/index');
}
else
show_error('The demanderh you are trying to delete does not exist.');
}
}