D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
public_html
/
alumni
/
application
/
controllers
/
user
/
Filename :
Notification.php
back
Copy
<?php /** * Description of User * * @author Softpro India Pvt. Ltd. */ class Notification extends CI_Controller { //put your code here public function __construct() { parent::__construct(); $this->load->model("admin/NotificationManagement"); $this->load->library('pagination'); } public function setNotificationSeenData() { if ($this->sessionvalidator->validateSession('userData')) { $userData = $this->session->userdata("userData"); $seenNotifcationsData = array(); $topNotifications = $this->NotificationManagement->getNotificationsForUserDashboard($userData["userid"], $userData["user_role"])->result(); foreach ($topNotifications as $n) { array_push($seenNotifcationsData, array( "n_id" => $n->n_id, "userid" => $userData["userid"], "seen_status" => "t" )); } if ($this->NotificationManagement->makeNotificationSeen($seenNotifcationsData) > 0) { $responseData = array( 'csrfName' => $this->security->get_csrf_token_name(), 'csrfHash' => $this->security->get_csrf_hash() ); echo json_encode($responseData); } } else { redirect("Home#loginModal"); } } public function notificationDetails($n_id) { if ($this->sessionvalidator->validateSession('userData')) { if ($this->NotificationManagement->getNotificationByIdForUser($n_id)->num_rows() > 0) { $userData = $this->session->userdata("userData"); $viewData["notificationList"] = $this->NotificationManagement->getNotificationsForUserDashboard($userData["userid"], $userData["user_role"])->result(); $viewData["notification"] = $this->NotificationManagement->getNotificationByIdForUser($n_id)->result()[0]; $this->load->view("user/notificationDetails", $viewData); } else { //$this->session->set_flashdata("errorMessage", "Notification Not Found Against Your Entered NotificationID ."); redirect("user/Notification"); } } else { redirect("Home#loginModal"); } } public function index($offset = 0) { if ($this->sessionvalidator->validateSession('userData')) { $userData = $this->session->userdata("userData"); $totalRows = $this->NotificationManagement->getNumOfNotifications($userData["user_role"]); //echo $this->db->last_query(); //exit; $config = [ 'base_url' => site_url("user/Notification/index"), 'per_page' => 6, 'total_rows' => $totalRows, 'full_tag_open' => "<ul class='pagination justify-content-end'>", 'full_tag_close' => "</ul>", 'next_tag_open' => "<li class='page-item'>", 'next_tag_close' => "</li>", 'prev_tag_open' => "<li class='page-item'>", 'prev_tag_close' => "</li>", 'num_tag_open' => "<li class='page-item'>", 'num_tag_close' => "<li>", 'cur_tag_open' => "<li class='page-item active'><a class='page-link'>", 'cur_tag_close' => "</a></li>", 'attributes' => array('class' => 'page-link'), 'prev_link' => "Prev", 'next_link' => "Next" ]; $this->pagination->initialize($config); $viewData["noOfTotalNotifications"] = $totalRows; $viewData["per_page"] = $config['per_page']; $viewData["offset"] = $offset; $viewData["notificationList"] = $this->NotificationManagement->getNotificationsForUserDashboard($userData["userid"], $userData["user_role"])->result(); $viewData["notifications"] = $this->NotificationManagement->getNotificationsForUserDashboard($userData["userid"], $userData["user_role"], 't', $config['per_page'], $offset)->result(); $this->load->view("user/notifications", $viewData); } else { redirect("Home#loginModal"); } } }