80 lines
2.5 KiB
PHP
Executable File
80 lines
2.5 KiB
PHP
Executable File
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class Website_messages_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) {
|
|
|
|
// $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);
|
|
$query = $this->db->get('website_contact_message');
|
|
return $query->result();
|
|
}
|
|
function getNameByLimit($limit, $start, $orderColumn, $orderType) {
|
|
|
|
if($orderColumn==0)
|
|
$this->db->order_by('id', $orderType);
|
|
else if($orderColumn==1)
|
|
$this->db->order_by('name', $orderType);
|
|
else if($orderColumn==5)
|
|
$this->db->order_by('status', $orderType);
|
|
|
|
$this->db->limit($limit, $start);
|
|
//$this->db->where('To_ionId', $user_id);
|
|
$query = $this->db->get('website_contact_message');
|
|
//echo $this->db->last_query();die;
|
|
return $query->result();
|
|
}
|
|
|
|
function status_change($post){
|
|
$id = $post['id'];
|
|
$stat = $post['val'];
|
|
// pre($post);
|
|
// die;
|
|
$this->db->set('status', $stat);
|
|
$this->db->where('id', $id);
|
|
$this->db->update('website_contact_message');
|
|
//return $this->db->last_query();
|
|
if($stat == '0')
|
|
{
|
|
return 'Status set read';
|
|
}
|
|
else{
|
|
return 'Status set unread';
|
|
}
|
|
}
|
|
}
|