GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.133.157.231
Web Server : Apache
System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : jnclnmuac ( 1026)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/jnclnmuac/public_html/web/../web/../alumni/application/controllers/user/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../web/../alumni/application/controllers/user/Notification.php
<?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");
        }
    }

}

KBHT - 2023