apollodec/Apollo/api/application/controllers/HallTickets_Controller.php
2018-05-19 15:49:44 +05:30

270 lines
7.9 KiB
PHP
Executable File

<?php
/**
* Created by PhpStorm.
* User: karthi
* Date: 2/14/18
* Time: 4:51 PM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
/** @noinspection PhpIncludeInspection */
require_once APPPATH . '/libraries/REST_Controller.php';
class HallTickets_Controller extends REST_Controller {
function __construct()
{
// Construct the parent class
parent::__construct();
// Configure limits on our controller methods
// Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
$this->methods['getCourseSubjectDetails_post']['limit'] = 500; // 500 requests per hour per user/key
// load the model
$this->load->model('Hallticket_model', 'Hallticket_model');
}
/*
* get university and course details for semester course mappinig
* created by velz
* */
public function getUniversityCourseDetails_post()
{
$branchId = $this->post('branchId');
$getUnivDetails = $this->Hallticket_model->getUniversityDetails($branchId);
$getCenterDetails = $this->Hallticket_model->getCenterDetails($branchId);
if ($getUnivDetails)
{
$getUnivDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getUnivDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records found!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
/*
* get semester and subjects list for sem course mapping
* created by velz
* */
public function getSemesterSubjectDetails_post()
{
$universityID = $this->post('universityID');
$courseIDS = $this->post('courseID');
$requestedBy = $this->post('requestedBy');
$branchId = $this->post('branchId');
$tempCourseArray = array();
foreach($courseIDS as $val)
{
foreach($val as $v){
$tempCourseArray[] = $v;
}
//print_r($value);
}
$data['subjectDetails'] = $this->Hallticket_model->getSubjectDetails($universityID,$tempCourseArray,$branchId);
//$data['semesterDetails'] = $this->Hallticket_model->getSemesterDetails($universityID,$tempCourseArray);
if($data['subjectDetails'])
{
$data['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($data, REST_Controller::HTTP_OK);
}
else{
$this->response([
'message' => 'No records found!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND);
}
}
public function saveAllSemesterSubjectMapping_post()
{
$UID = $this->post('universityID');
$courseIDS = $this->post('courseID');
$requestedBy = $this->post('requestedBy');
$branchId = $this->post('branchId');
$semArray = $this->post('Semesters');
$res = $this->Hallticket_model->saveAllSemesterSubjectMappingmodel($UID,$courseIDS,$requestedBy,$branchId,$semArray,$requestedBy);
if($res['insert'] == true and $res['exist'] == false)
{
$data['status'] = REST_Controller::HTTP_OK;
$data['txtStatus'] = '1';
$this->response($data, REST_Controller::HTTP_OK);
}
else if($res['insert'] == false and $res['exist'] == true)
{
$data['status'] = REST_Controller::HTTP_OK;
$data['txtStatus'] = '2';
$this->response($data, REST_Controller::HTTP_OK);
}
else if($res['insert'] == false and $res['exist'] == false)
{
$this->response([
'message' => 'Something Went Wrong!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND);
}
}
public function getAllSemesterSubjects_get()
{
$branchId = $this->post('branchId');
$res = $this->Hallticket_model->getAllSemesterSubjectsmodel($branchId);
//$result_array = array();
if(count($res) > 0 )
{
$data['semsubstatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;;
$data['semsubjects'] = $res;
$this->response($data, REST_Controller::HTTP_OK);
}
else
{
$this->response([
'message' => 'Something Went Wrong!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND);
}
}
public function getIndividualCourseSemMappingDetails_post()
{
$universityID = $this->post('universityID');
$courseID = $this->post('courseID');
$branchId = $this->post('branchId');
$res = $this->Hallticket_model->getIndividualCourseSemMappingDetailsmodel($universityID,$courseID,$branchId);
//print_r($res);
if(count($res['mappedSubjects']) == 0)
{
$data['subjectStatus'] = false;
$data['status'] = REST_Controller::HTTP_OK;
$data['subjects'] = "";
$this->response($data, REST_Controller::HTTP_OK);
}
else
{
$data['subjectStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['subjects'] = $res['mappedSubjects'];
$data['overAllSubjects'] = $res['overAllSubjects'];
$this->response($data, REST_Controller::HTTP_OK);
}
}
public function updateAllSemesterSubjectMapping_post()
{
$UID = $this->post('universityID');
$courseIDS = $this->post('courseID');
$requestedBy = $this->post('requestedBy');
$branchId = $this->post('branchId');
$semArray = $this->post('Semesters');
$res = $this->Hallticket_model->updateAllSemesterSubjectMappingmodel($UID,$courseIDS,$requestedBy,$branchId,$semArray,$requestedBy);
if($res)
{
$data['status'] = REST_Controller::HTTP_OK;
$data['txtStatus'] = true;
$this->response($data, REST_Controller::HTTP_OK);
}
else
{
$this->response([
'message' => 'Something Went Wrong!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND);
}
}
public function getStudentListForHallTicket_post()
{
$UID = $this->post('university');
$courseID = $this->post('course');
$batch = $this->post('batch');
$requestedBy = $this->post('requestedBy');
$branchId = $this->post('branchId');
$res = $this->Hallticket_model->getStudentListForHallTicketmodel($UID,$courseID,$batch,$requestedBy,$branchId);
if(count($res) > 0)
{
$data['status'] = REST_Controller::HTTP_OK;
$data['studentStatus'] = true;
$data['studentDetails'] = $res;
$this->response($data, REST_Controller::HTTP_OK);
}
else
{
$this->response([
'message' => 'Something Went Wrong!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND);
}
}
public function getHallTicket_post()
{
$UID = $this->post('universityID');
$courseID = $this->post('courseID');
$batch = $this->post('batchName');
$requestedBy = $this->post('requestedBy');
$branchId = $this->post('branchId');
$studentIDs = $this->post('StudentIDs');
$centerName = $this->post('centerName');
$res['UniversityDetails'] = $this->Hallticket_model->getUniversityDetials($UID,$branchId);
$res['studentDetails'] = $this->Hallticket_model->getStudentDetails($UID,$courseID,$branchId,$studentIDs);
if(count($res['UniversityDetails']) != 0 || count($res['studentDetails']) != 0 )
{
$data['status'] = REST_Controller::HTTP_OK;
$data['hallTicketStatus'] = true;
$data['hallTicketData'] = $res;
$data['semDataType'] = $res['studentDetails']['NUMTYPE'];
$this->response($data, REST_Controller::HTTP_OK);
}
else
{
$this->response([
'message' => 'Something Went Wrong!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND);
}
}
}