78 lines
2.4 KiB
PHP
Executable File
78 lines
2.4 KiB
PHP
Executable File
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class Notification_model extends CI_model {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
$this->load->database();
|
|
}
|
|
|
|
function getAllCoordinator(){
|
|
$this->db->where('status', '1');
|
|
$query = $this->db->get('coordinator')->result();
|
|
return $query;
|
|
}
|
|
function getCaregiverExpireDocs($expdate){
|
|
$this->db->where('status', '1');
|
|
$this->db->where('ExpirationDate <', $expdate);
|
|
$query = $this->db->get('caregiver_doc_expire_details')->result();
|
|
return $query;
|
|
}
|
|
function createNotification($data){
|
|
//pre($data);
|
|
$this->db->insert('notification', $data);
|
|
return $this->db->insert_id();
|
|
}
|
|
function getAllUnreadNotification($userId){
|
|
$this->db->where('status !=', '3');
|
|
$this->db->where('To_ionId', $userId);
|
|
$query = $this->db->get('notification')->result();
|
|
return $query;
|
|
}
|
|
|
|
function getNameByLimitBySearch($limit, $start, $search,$user_id) {
|
|
|
|
// $this->db->like('id', $search);
|
|
// $this->db->order_by('id', 'desc');
|
|
// $this->db->or_like('name', $search);
|
|
// $this->db->or_like('status', $search);
|
|
$this->db->limit($limit, $start);
|
|
$this->db->where('To_ionId', $user_id);
|
|
$query = $this->db->get('notification');
|
|
return $query->result();
|
|
}
|
|
function getNameByLimit($limit, $start, $orderColumn, $orderType, $user_id) {
|
|
|
|
// if($orderColumn==0)
|
|
// $this->db->order_by('id', $orderType);
|
|
// else if($orderColumn==1)
|
|
// $this->db->order_by('name', $orderType);
|
|
// else if($orderColumn==2)
|
|
// $this->db->order_by('status', $orderType);
|
|
$this->db->limit($limit, $start);
|
|
$this->db->where('To_ionId', $user_id);
|
|
$query = $this->db->get('notification');
|
|
//echo $this->db->last_query();die;
|
|
return $query->result();
|
|
}
|
|
|
|
function status_change($post){
|
|
$id = $post['id'];
|
|
$stat = $post['val'];
|
|
$this->db->set('status', $stat);
|
|
$this->db->where('id', $id);
|
|
$this->db->update('notification');
|
|
//return $this->db->last_query();
|
|
if($stat == '3')
|
|
{
|
|
return 'Status set read';
|
|
}
|
|
else{
|
|
return 'Status set unread';
|
|
}
|
|
}
|
|
}
|