D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
public_html
/
alumni
/
application
/
models
/
admin
/
Filename :
NotificationManagement.php
back
Copy
<?php /** * Description of User * * @author Softpro India Pvt. Ltd. */ class NotificationManagement extends CI_Model { //put your code here function saveNotification($notificationDetails) { $this->db->insert("tbl_notifications_by_admin", $notificationDetails); return $this->db->insert_id(); } function getNotifications() { $this->db->select("*"); $this->db->from("tbl_notifications_by_admin nba"); $this->db->join("tbl_admins a", "a.admin_id = nba.admin_id"); $this->db->order_by("n_date_added", "DESC"); return $this->db->get(); } function getNotificationById($n_id) { $this->db->select("*"); $this->db->from("tbl_notifications_by_admin n"); $this->db->join("tbl_admins a", "a.admin_id = n.admin_id"); $this->db->where("n.n_id", $n_id); return $this->db->get(); } function getNumOfNotifications($user_role) { $this->db->select("*"); $this->db->from("tbl_notifications_by_admin n"); $this->db->join("tbl_admins a", "a.admin_id = n.admin_id"); $this->db->where("n.n_status", "t"); $this->db->where("n.n_for In ('Both','$user_role')"); $this->db->Where("n.n_status", "t"); return $this->db->get()->num_rows(); } function getNotificationsForUserDashboard($userid, $user_role, $all = 'f', $per_page = 0, $offset = 0) { $this->db->select("*"); $this->db->from("tbl_notifications_by_admin n"); $this->db->join("tbl_admins a", "a.admin_id = n.admin_id"); $this->db->where("n.n_status", "t"); $this->db->where("n.n_for In ('Both','$user_role')"); if ($all == 'f') { $this->db->where("n.n_id Not In (select n_id from tbl_notification_read_status where userid='$userid')"); $this->db->limit(5); } if ($per_page > 0 || $offset != null || $offset != "") { $this->db->limit($per_page, $offset); } $this->db->order_by("n.n_date_added", "DESC"); return $this->db->get(); } function makeNotificationSeen($seenNotifcationsData) { $this->db->insert_batch("tbl_notification_read_status", $seenNotifcationsData); return $this->db->affected_rows(); } function getNotificationByIdForUser($n_id) { $this->db->select("*"); $this->db->from("tbl_notifications_by_admin n"); $this->db->from("tbl_admins a", "a.admin_id = n.admin_id"); //$this->db->join("tbl_notification_read_status s", "n.n_id=s.n_id"); $this->db->where("n.n_id", $n_id); //$this->db->where("n.n_status", "t"); return $this->db->get(); } function updateNotification($notificationData,$n_id){ $this->db->where("n_id",$n_id); return $this->db->update("tbl_notifications_by_admin",$notificationData); } }