D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
public_html
/
admission
/
application
/
controllers
/
admin
/
Filename :
Exam.php
back
Copy
<?php /** * Controller class for handling all requests related to exams. * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class Exam extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('admin/ExamManagement'); $this->load->model('admin/CourseManagement'); } public function getAllExamsByCourseCategory() { $course_id = $_POST['course_id']; $courseInfo = $this->CourseManagement->getCoursesByID($course_id)->result()[0]; if ($courseInfo->course_category == "UG") { $query = $this->ExamManagement->getAllExamsUptoCategory("UG"); } else if ($courseInfo->course_category == "PG") { $query = $this->ExamManagement->getAllExamsUptoCategory("PG"); } else { $query = $this->ExamManagement->getAllExamsUptoCategory(); } $examsList = $query->result(); if (sizeof($examsList)) { $exams = array(); for ($i = 0; $i < sizeof($examsList); $i++) { $thisExam = array( 'exam_id' => $examsList[$i]->exam_id, 'exam_name' => ($examsList[$i]->exam_name == "" || $examsList[$i]->exam_name == NULl) ? "" : $examsList[$i]->exam_name, 'exam_title' => ($examsList[$i]->exam_title == "" || $examsList[$i]->exam_title == NULl) ? "" : $examsList[$i]->exam_title, 'exam_description' => ($examsList[$i]->exam_description == "" || $examsList[$i]->exam_description == NULl) ? "" : $examsList[$i]->exam_description, 'exam_type_flag' => $examsList[$i]->exam_type_flag, ); array_push($exams, $thisExam); } $responseData = array( 'csrfName' => $this->security->get_csrf_token_name(), 'csrfHash' => $this->security->get_csrf_hash(), 'exams_found' => 1, 'exam_list' => $exams, 'message' => 'Exams Available!' ); } else { $responseData = array( 'csrfName' => $this->security->get_csrf_token_name(), 'csrfHash' => $this->security->get_csrf_hash(), 'exams_found' => 0, 'exam_list' => array(), 'message' => 'Sorry! No Exams Available For This Course Category!' ); } echo json_encode($responseData); } }