apollodec/Apollo/api/application/controllers/Reregister_Controller.php
2020-11-02 16:19:57 +05:30

202 lines
6.4 KiB
PHP

<?php
/**
* Created by Visual Studio.
* User: sriram
* Date: 6/12/18
*/
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 Reregister_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
// load the model
$this->load->model('Reregister_model', 'Reregister_model');
}
// For Get University and Batch Details for PROMOTE BATCH MODULE
public function getUniversityBatchDetails_post()
{
$branchId = $this->post('branchId');
$getUnivBatchDetails = $this->Reregister_model->getUniversityBatchDetails($branchId);
if ($getUnivBatchDetails)
{
$getUnivBatchDetails['status'] = REST_Controller::HTTP_OK;
$this->response($getUnivBatchDetails, 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 student list for promote Batch Listing Screen
public function getStudentListForPromoteBatch_post()
{
$UID = $this->post('university');
$batch = $this->post('batch');
$batch = explode('###',$batch);
$batchCode = $batch[0];
$batchDate = $batch[1];
$branchId = $this->post('branchId');
$res = $this->Reregister_model->getStudentListForPromoteBatchmodal($UID,$batchCode,$branchId,$batchDate);
//print_r($res['studentList']);die();
if(count($res['finalStudentList']) > 0)
{
$data['status'] = REST_Controller::HTTP_OK;
$data['studentStatus'] = true;
$data['studentDetails'] = $res['finalStudentList'];
$data['nextbatchDetails'] = $res['nextBatch'];
$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);
}
}
//Promote one Batch to anthor Batch
public function promoteBatchInfomation_post()
{
$UniversityID = $this->post('UniversityID');
$BatchDetails = $this->post('BatchDetails');
$StudentDetails = $this->post('StudentDetails');
$FirstDueDate = $this->post('FirstDueDate');
$SecondDueDate = $this->post('SecondDueDate');
$CreadtedBy = $this->post('requestedBy');
$BranchId = $this->post('branchId');
$FirstDueDate = date_format(date_create($FirstDueDate),'d-m-Y');
$SecondDueDate = date_format(date_create($SecondDueDate),'d-m-Y');
// print_r($StudentDetails);
//die();
$result = $this->Reregister_model->savePromotedBatchDeatils($UniversityID,$BatchDetails,$StudentDetails,$FirstDueDate,$SecondDueDate,$CreadtedBy,$BranchId);
if($result)
{
$data['status'] = REST_Controller::HTTP_OK;
$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);
}
}
/*
*Created by Visual Studio.
* User: sriram
* Date: 6/12/18
* Reregiter function
*/
public function getUniversityCourseDetailsforms_post(){
$branchId = $this->post('branchId');
$getUnivDetails = $this->Reregister_model->getUniversityDetails($branchId);
//$getCenterDetails = $this->Reregister_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
}
}
public function getStudentListForReregister_post(){
// echo "function in";die;
$UID = $this->post('university');
$courseID = $this->post('course');
$batch = $this->post('batch');
$requestedBy = $this->post('requestedBy');
$branchId = $this->post('branchId');
//echo $branchId;die;
$res = $this->Reregister_model->getStudentListForReregistermodel($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 getSubject_post(){
$Sem = $this->post('SemNum');
$SemesterID = ucfirst($Sem);
$branchId = $this->post('branchId');
$course = $this->post('Course');
$sem = '';
if(strlen($SemesterID) ==5){
if($SemesterID == 'Year1'){
$sem = '1';
}else if($SemesterID == 'Year2'){
$sem = '3';
}else if($SemesterID == 'Year3'){
$sem = '5';
}else{
$sem = '7';
}
}else{
$sem = substr($SemesterID,3);
}
//echo $sem;die;
$subjectDetails[] = $this->Reregister_model->getsubject($sem,$branchId,$course);
// }
// }
if(sizeof($subjectDetails)>0){
$data['status'] = REST_Controller::HTTP_OK;
$data['SubjectStatus'] = true;
$data['SubjectDetails'] = $subjectDetails;
$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);
}
}
}