apollodec/Apollo/api/application/controllers/HallTickets_Controller.php
2018-05-29 13:52:21 +05:30

415 lines
12 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
$this->methods['getUniversityCourseDetails_post']['limit'] = 500; // 500 requests per hour per user/key
$this->methods['updateSheduleDetails_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);
}
}
//////////////////////////////////////////////////////////////////////////
/*
* get shedule time and date from T_Batch_Schedule_Child
* created by TamilBala
* */
public function getSheduleDetails_post()
{
$mapid = $this->post('mapid');
$subid = $this->post('subid');
$branchcode = $this->post('branchcode');
//$getSheduleData = $this->Hallticket_model->getShedules($mapid);
$get_unShedules = $this->Hallticket_model->get_unShedules($mapid,$subid,$branchcode);
//print_r($get_unShedules);
if ($get_unShedules)
{
//echo "model";
$getSheduleinfo['status'] = REST_Controller::HTTP_OK;
$getSheduleinfo['getunSheduleDetailsinfo']=$get_unShedules;
//print_r($getSheduleinfo['getunSheduleDetailsinfo']);
// Set the response and exit
$this->response($getSheduleinfo, 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 universityid and courseid details for Shedule view
* created by TamilBala
* */
public function getUniversityCourseId_post()
{
$branchCode = $this->post('branchCode');
//print_r($branchCode);
$getUnivDetailsid = $this->Hallticket_model->getUniversityid($branchCode);
if ($getUnivDetailsid)
{
$getUnivinfo['status'] = REST_Controller::HTTP_OK;
$getUnivinfo['getUnivDetailsinfo'] = $getUnivDetailsid;
// Set the response and exit
$this->response($getUnivinfo, 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
}
}
/*
* save schduledate and time
* created by TamilBala
* */
public function SaveAllBatchSchedule_post()
{
$detailArray = $this->post('scheduleDetails');
//print_r($detailArray);
$university =$this->post('getuniversityid');
$courseid= $this->post('getcourseid');
//echo $courseid;
$requestedBy = $this->post('requestedBy');
$branchId = $this->post('branchId');
$Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata'));
$CreatedOn = $Cdate->format('Y-m-d H:i:s');
// echo $courseIDS.'-'.$UniversityID;
$schedulemaster = array('UniversityID'=>$university,'CourseID'=>$courseid,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy,'CreatedOn'=>$CreatedOn);
$schedulemasteradd = $this->Hallticket_model->AddBatchScheduleMaster($schedulemaster,$detailArray);
$SchId = '';
if(count($schedulemasteradd)>0)
{
$SchId = $schedulemasteradd[0]['SchId'];
}
if((count($schedulemasteradd)>0))
{
$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);
}
}
/*
* update schduledate and time
* created by TamilBala
* */
public function updateSheduleDetails_post()
{
$schedulearray = $this->post('updatescheduledetails');
$updateBy = $this->post('createdBy');
$res = $this->Hallticket_model->scheduleUpdate($schedulearray,$updateBy);
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);
}
}
}