134 lines
5.3 KiB
PHP
Executable File
134 lines
5.3 KiB
PHP
Executable File
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class Approve_assessment extends MX_Controller {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
$this->load->model('Approve_assessment_model');
|
|
// if (!$this->ion_auth->in_group(array('admin','Caregiver'))) {
|
|
// redirect('home/permission');
|
|
// }
|
|
if (!$this->ion_auth->in_group('admin')) {
|
|
if(!$this->ion_auth->coordinator_permission('caregivers')){
|
|
redirect('home/permission');
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function index() {
|
|
$this->load->view('home/dashboard'); // just the header file
|
|
$this->load->view('list');
|
|
$this->load->view('home/footer');
|
|
}
|
|
function approve(){
|
|
$id=$this->input->get('id');
|
|
// $id = base64_dec($id);
|
|
$output=$this->Approve_assessment_model->approve($id);
|
|
|
|
if($output){
|
|
|
|
// ------------Send Push Notification --------------
|
|
$getFcmToken = $this->Approve_assessment_model->getFcmTokenByAssesmentId($id);
|
|
$fcm_token = $getFcmToken->fcm_token;
|
|
$post_title='Notification From Admin';
|
|
$post_message='Your assesment has been approved by the admin';
|
|
$type='caregiver';
|
|
sendNotification($fcm_token,$post_title,$post_message,$type);
|
|
// ------------Send Push Notification ---------------
|
|
$this->session->set_flashdata('success','Approved successfully.');
|
|
}
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
function getList()
|
|
{
|
|
$requestData = $_REQUEST;
|
|
$start = $requestData['start'];
|
|
$limit = $requestData['length'];
|
|
$orderColumn=$requestData['order'][0]['column'];
|
|
$orderType=$requestData['order'][0]['dir'];
|
|
$search = $this->input->post('search')['value'];
|
|
if(!empty($search))
|
|
{
|
|
$data['assessment'] = $this->Approve_assessment_model->getNameByLimitBySearch($limit, $start, $search,$orderColumn, $orderType);
|
|
}else{
|
|
$data['assessment'] = $this->Approve_assessment_model->getNameByLimit($limit, $start, $orderColumn, $orderType);
|
|
}
|
|
// _die($data['assessment']);
|
|
$listCount = sizeof($data['assessment']);
|
|
//$slno = 1;
|
|
foreach ($data['assessment'] as $data) {
|
|
// pre($data);
|
|
if($data->reporting_approval=='0'){
|
|
// $options1 = '<a class="btn btn-primary btn-sm" title="' . lang(' Approve') .'" href="approve_assessment/approve/'. base64_enc($data->id) .'" ><i class="la la-thumbs-o-up"></i>' . lang(' Approve') .' </a>';
|
|
$options1 = '<a class="btn btn-primary btn-sm" title="' . lang(' Approve') .'" href="approve_assessment/approve?id='.$data->id.'" ><i class="la la-thumbs-o-up"></i>' . lang(' Approve') .' </a>';
|
|
}else{
|
|
$options1 = '<span class="btn btn-success btn-sm" title="' . lang(' Approved') .'"><i class="la la-thumbs-o-up"></i>' . lang(' Approved') .' </span>';
|
|
}
|
|
// $options2 = '<a class="btn btn-info btn-sm" title="' . lang(' View') .'" href="assessment/view'. base64_enc($data->id) .'/'.base64_enc($data->schedule_id).'" ><i class="la la-eye"></i>' . lang(' View') .' </a>';
|
|
$options2 = '<a class="btn btn-info btn-sm" title="' . lang(' View') .'" href="assessment/view?id='.$data->patient_id .'&scheduleId='.$data->schedule_id.'" ><i class="la la-eye"></i>' . lang(' View') .' </a>';
|
|
if($data->assessment_type=='initial_assessment'){
|
|
$assessment_type='Initial Assessment';
|
|
}else{
|
|
$assessment_type='Re Assessment';
|
|
}
|
|
if($data->timeIn!=null)
|
|
{
|
|
$timeIn = date("g:i A",strtotime($data->timeIn));
|
|
}
|
|
else
|
|
{
|
|
$timeIn = "Not set";
|
|
}
|
|
if($data->timeOut!=null)
|
|
{
|
|
$timeOut = date("g:i A",strtotime($data->timeOut));
|
|
}
|
|
else
|
|
{
|
|
$timeOut = "Not set";
|
|
}
|
|
$info[] = array(
|
|
//$slno,
|
|
date("m/d/Y",strtotime($data->date)),
|
|
$timeIn,
|
|
$timeOut,
|
|
$assessment_type,
|
|
$data->patient_name,
|
|
$data->caregiver_name,
|
|
$options1.' '.$options2,
|
|
);
|
|
//$slno++;
|
|
}
|
|
// print_r($info);
|
|
// die;
|
|
$csrf_name = $this->security->get_csrf_token_name();
|
|
$csrf_hash = $this->security->get_csrf_hash();
|
|
if ($listCount > 0) {
|
|
$output = array(
|
|
"draw" => intval($requestData['draw']),
|
|
"recordsTotal" => $listCount,
|
|
"recordsFiltered" => $listCount,
|
|
"data" => $info
|
|
);
|
|
}
|
|
else {
|
|
$output = array(
|
|
// "draw" => 1,
|
|
"recordsTotal" => 0,
|
|
"recordsFiltered" => 0,
|
|
"data" => []
|
|
);
|
|
$output[$csrf_name] = $csrf_hash;
|
|
}
|
|
echo json_encode($output);
|
|
}
|
|
}
|
|
|
|
/* End of file nurse.php */
|
|
/* Location: ./application/modules/nurse/controllers/nurse.php */
|