66 lines
2.1 KiB
PHP
Executable File
66 lines
2.1 KiB
PHP
Executable File
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class ValidatingDoctor extends CI_Controller
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('nano_health_model');
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
if ($this->isLogged()){
|
|
$data['active'] = "dashboard";
|
|
$data['network_id'] = $data['id_network'] = $this->session->userdata('network_id');
|
|
|
|
if ($this->input->get('history')) {
|
|
$this->historique($this->input->get('d'), $this->input->get('f'), $this->input->get('history'), $data);
|
|
}else{
|
|
|
|
$data['count_d_traite'] = $this->nano_health_model->getCountCareRequests(null,$this->session->userdata('agent_id'), 'ACCEPTED');
|
|
$data['count_d_no_traite'] = $this->nano_health_model->getCountCareRequests($data['network_id'], null, 'UNDER_VALIDATION');
|
|
$data['count_d_no_canceled'] = $this->nano_health_model->getCountCareRequests(null,$this->session->userdata('agent_id'), 'REJECTED');
|
|
$data['count_d_no_used'] = $this->nano_health_model->getCountCareRequests(null,$this->session->userdata('agent_id'), 'USED');
|
|
|
|
$this->load->view('nano_health/validating_doctor/header', $data);
|
|
$this->load->view('nano_health/validating_doctor/dashboard', $data);
|
|
$this->load->view('footer');
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private function historique($startDate, $endDate,$type , $data)
|
|
{
|
|
|
|
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
|
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
|
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
|
$endDate = Date('Y-m-d', strtotime($endDate . "+1 day"));
|
|
|
|
if ($type == 'care-requests')
|
|
$data['active'] = 'care_requests';
|
|
|
|
$this->load->view('nano_health/validating_doctor/header', $data);
|
|
if ($type == 'care-requests')
|
|
$this->load->view('nano_health/validating_doctor/care_requests');
|
|
$this->load->view('footer');
|
|
}
|
|
|
|
private function isLogged()
|
|
{
|
|
if (!$this->session->userdata('email')) {
|
|
$this->session->set_flashdata('error', 'log in first');
|
|
|
|
$data['alert'] = "ok";
|
|
$data['message'] = "Login first!";
|
|
|
|
redirect('index.php', $data);
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|