apollodec/Apollo/api/application/controllers/HallTickets_Controller.php
2019-01-28 13:19:10 +05:30

686 lines
21 KiB
PHP

<?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
$this->methods['BatchUploadDataDetails_post']['limit'] = 500;
// 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 shedule time and date from T_Batch_Schedule_Child
* created by TamilBala
* */
public function getSheduleDetails_post()
{
$courseDetails =$this->post('courseDetails');
//print_r($courseDetails);
$CourseID = $courseDetails['CourseID'];
$universityID= $courseDetails['UniversityID'];
//print_r($courseDetails);
$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,$CourseID,$universityID);
//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
}
}
public function CourseSemDetails_post()
{
$CourseID = $this->post('CourseId');
$GetCourseDetails = $this->Hallticket_model->Get_Select_CourseDetails($CourseID);
if ($GetCourseDetails)
{
$GetCourseDetails['status'] = REST_Controller::HTTP_OK;
$this->response($GetCourseDetails, REST_Controller::HTTP_OK);
}
else
{
$this->response([
'message' => 'No records found!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND);
}
}
/*
* 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
}
}
/*
* 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);
}
}
/*
* get semester and subjects list for sem course mapping
* created by Bala
* */
public function getExistingMapping_post()
{
$universityID = $this->post('universityID');
$courseIDS = $this->post('courseID');
$requestedBy = $this->post('requestedBy');
$branchId = $this->post('branchId');
$Sem_Year = $this->post('Sem_Year');
$tempCourseArray = array();
foreach($courseIDS as $val)
{
foreach($val as $v){
$tempCourseArray[] = $v;
}
//print_r($value);
}
$data['subjectDetails'] = $this->Hallticket_model->getExistDetails($universityID,$tempCourseArray,$branchId,$Sem_Year);
// print_r( $data['subjectDetails']);
// die();
//$data['semesterDetails'] = $this->Hallticket_model->getSemesterDetails($universityID,$tempCourseArray);
//1000 it means already data exist http sents 1000//
if($data['subjectDetails'] == 1 )
{
$this->response([
'message' => 'Already Exist',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND);
}
else 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 getBatchAndCenterDetails_post()
{
$requestedBy = $this->post('requestedBy');
$branchId = $this->post('branchId');
$result = $this->Hallticket_model->getBatchAndCenterDetailsModel($branchId);
//print_r($result['batchDetails']);die();
if(!empty($result['batchDetails']) && !empty($result['centerDetails']))
{
$data['status'] = REST_Controller::HTTP_OK;
$data['batchDetails'] = $result['batchDetails'];
$data['centerDetails'] = $result['centerDetails'];
$this->response($data, REST_Controller::HTTP_OK);
}
else
{
$this->response([
'message' => 'Batch OR Center Details Not Available',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND);
}
}
public function getStudentDetailsForExamAttendance_post()
{
$requestedBy = $this->post('requestedBy');
$branchId = $this->post('branchId');
$centerName = $this->post('centerName');
$examDate = $this->post('examDate');
//$examDate = strtotime($examDate);
$examDate = date_create($examDate);
$examDate = date_format(date_add($examDate,date_interval_create_from_date_string("1 days")),'Y-m-d');
$batch = $this->post('batch');
$exam_attendance = $this->post('exam_attendance');
//echo $exam_attendance;die();
//echo $examDate;
$universityID = $this->post('university');
//print_r($universityID);die();
$result = $this->Hallticket_model->getExamAttendance_model($universityID['universityID'],$branchId,$centerName,$examDate,$batch,$exam_attendance);
if($result)
{
$data['status'] = REST_Controller::HTTP_OK;
$data['studentDetails'] = $result;
$this->response($data, REST_Controller::HTTP_OK);
}
else
{
$this->response([
'message' => 'No Data 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 BatchUploadDataDetails_post()
{
// echo 'hai';
$university= $this->post('universityDetails');
$courseArray = $this->post('courseDetails');
$filedetails = $this->post('details');
$requestedBy = $this->post('requestedBy');
$branchId = $this->post('branchId');
$Sem_Year = $this->post('Sem_Year');
$Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata'));
$CreatedOn = $Cdate->format('Y-m-d H:i:s');
$fileArray = array();
foreach($filedetails as $filedetailsarray)
{
$fileArray[]=$filedetailsarray['SubjectID'];
}
// print_r( $fileArray);
$data['subjectDetails'] = $this->Hallticket_model->getExistDetailsfileupload($university,$courseArray,$branchId);
// print_r( $data['subjectDetails']);
if($data['subjectDetails'] == 1 )
{
$data['SubjectMappingDetails'] = $this->Hallticket_model->getSubjectMappingDetails($university,$courseArray,$branchId);
$maparray=array();
foreach ( $data['SubjectMappingDetails'] as $object)
{
$maparray[]=$object->SubjectCode;
}
$result=array_diff($fileArray,$maparray);
$unmatched= sizeof($result);
if ($unmatched == 0 )
{
foreach($courseArray as $CourseDatialArray)
{
$course=$CourseDatialArray;
$schedulemaster = array('UniversityID'=>$university,'CourseID'=>$course,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy,'CreatedOn'=>$CreatedOn,'SEM_Year'=>$Sem_Year);
$schedulemasteradd = $this->Hallticket_model->AddBatchScheduleMasterFile($schedulemaster,$filedetails);
}
$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);
}
}
else
{
$this->response([
'message' => 'Records Do Not Match With Mapped Subjects!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND);
}
}
// else if($data['subjectDetails'] == 0)
else
{
$this->response([
'message' => ' Course Mapping for the Subject Not Found !',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND);
}
}
public function SaveAllBatchSchedule_post()
{
$detailArray = $this->post('scheduleDetails');
$university =$this->post('getuniversityid');
//$courseid= $this->post('getcourseid');
$requestedBy = $this->post('requestedBy');
$branchId = $this->post('branchId');
$Sem_Year = $this->post('Sem_Year');
$Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata'));
$CreatedOn = $Cdate->format('Y-m-d H:i:s');
$CourseDatialArray = $this->post('courseDetails');
foreach($CourseDatialArray as $coursedetails)
{
$course=$coursedetails;
$schedulemaster = array('UniversityID'=>$university,'CourseID'=>$course,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy,'CreatedOn'=>$CreatedOn,'SEM_Year'=>$Sem_Year);
$schedulemasteradd = $this->Hallticket_model->AddBatchScheduleMaster($schedulemaster,$detailArray,$Sem_Year);
}
//print_r($CourseDatialArray);
// echo $courseIDS.'-'.$UniversityID;
$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);
}
}
public function updateSheduleDetails_post()
{
$schedulearray = $this->post('updatescheduledetails');
$updateBy = $this->post('createdBy');
$scheduleID = $this->post('scheduleID');
$res = $this->Hallticket_model->scheduleUpdate($schedulearray,$updateBy,$scheduleID);
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 getAllSemesterSubjects_post()
{
//echo 'f';die();
$branchId = $this->post('BranchID');
//echo $branchId; die();
$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');
$center = $this->post('center');
//print_r($center);die();
$res = $this->Hallticket_model->getStudentListForHallTicketmodel($UID,$courseID,$batch,$requestedBy,$branchId,$center);
// echo "CON";
// print_r($res);die();
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,$branchId,$studentIDs,$centerName,$batch,$requestedBy);
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);
}
}
public function getSubjectDetaillist_post()
{
$sub['SubjectCode'] =$this->post('SubjectCode');
$sub['requestedBy'] = $this->post('requestedBy');
$sub['branchId'] = $this->post('branchCode');
$sublistdet = $this->Hallticket_model->GetSubListDetails($sub);
if($sublistdet)
{
$sublistdet['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($sublistdet, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
$this->response([
'message' => 'No records found!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND);
}
}
}