apollo_developers/api/application/controllers/Student_Controller.php
venbatechnologies@gmail.com 1809bcf9c9 fixed table for student details
2018-04-23 18:34:11 +05:30

782 lines
34 KiB
PHP
Executable File

<?php
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';
/**
* This is an example of a few basic user interaction methods you could use
* all done with a hardcoded array
*
* @package CodeIgniter
* @subpackage Rest Server
* @category Controller
* @author
* @license MIT
* @link
*/
class Student_Controller extends REST_Controller {
/*
* get student details
* params:
* created by kdk
* */
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['addStudent_post']['limit'] = 100;
// load the employee model
$this->load->model('Student_model', 'student_model');
}
// list of branch for admin student add screen
public function getBranchListDetails_post() {
$reqData = $this->post('data');
$branchListDetails = $this->student_model->get_branch_list();// Get Branch list
if ($branchListDetails)
{
$branchListDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($branchListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
// check the branch active for add a new student
public function getBranchActiveStatusforStuAdd_post() {
$reqData = $this->post('data');
$branchId = $reqData['localBranchID'];
// print_r($reqData);exit();
$checkBranchActiveStatis = $this->student_model->getBranchActiveStatusforStuAdd($branchId);// Get Branch list
if ($checkBranchActiveStatis)
{
$checkBranchActiveStatis['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($checkBranchActiveStatis, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function getStudentList_post() {
$reqData = $this->post('data');
$searchReqData = $this->post('search');
$loginUserId = $reqData['localUserID'];
$loginUserBranchId = $reqData['localBranchID'];
$loginUserType = $reqData['localType'];
$studentListDetails = $this->student_model->get_student_list( $loginUserId, $loginUserBranchId, $loginUserType, $searchReqData);// Check if the employee exist
if ($studentListDetails)
{
$studentListDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($studentListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function getStudentUniversity_post() {
$reqData = $this->post('data');
$loginUserId = $reqData['localUserID'];
$loginUserBranchId = $reqData['localBranchID'];
$loginUserType = $reqData['localType'];
$getUniversityListDetails = $this->student_model->get_university_list();// Check if the employee exist
if ($getUniversityListDetails)
{
$getUniversityListDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getUniversityListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No list were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function getStudentCourseList_post() {
$studentID = $this->post('studentID');
$reqData = $this->post('updatedBy');
$studentCourse = $this->student_model->get_student_course_list( $studentID, $reqData );// Check if the employee exist
if ($studentCourse)
{
$studentCourse['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($studentCourse, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function getStudentCourseDetails_post() {
$studentCourseID = $this->post('studentcourseId');
$studentCourse = $this->student_model->get_student_course( $studentCourseID );// Check if the employee exist
if ($studentCourse)
{
$studentCourse['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($studentCourse, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function chkUpdateStuExistDetail_post() {
$exceptId = $this->post('exceptId');
$datas = $this->post('datas');
$checkFor = $this->post('check');
$checkRes = $this->student_model->check_update_exist( $exceptId, $datas, $checkFor );// Check if the employee exist
if ($checkRes)
{
$checkRes['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($checkRes, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function updateStudentCourseDetail_post() {
$data = $this->post('data');
$updatedBy = $this->post('updatedBy');
$id = $data['ID'];
$req['StudentID'] = $data['StudentID'];
$req['UniversityID'] = $data['UniversityID'];
$req['CourseID'] = $data['CourseID'];
$req['SessionID'] = $data['SessionID'];
$req['DOJ'] = $data['DOJ'];
$req['IsActive'] = $data['IsActive'];
$req['BranchID'] = $data['BranchID'];
$req['EnrollmentID'] = $data['EnrollmentID'];
$req['Specilization1'] = $data['Specilization1'];
$req['Specilization2'] = $data['Specilization2'];
$req['DeactiveComments'] = $data['IsActive'] == 1 ? '': $data['DeactiveComments'];
$req['UpdatedBy'] = $updatedBy;
$date = date('Y-m-d H:i:s');
$req['UpdatedOn'] = $date;
$studentCourseUpdate = $this->student_model->update_student_course( $req, $id );
if ($studentCourseUpdate)
{
$studentCourseUpdate['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($studentCourseUpdate, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
// get student entrollment document details
public function getListofStuDocDetails_post() {
$StudentID = $this->post('exceptId');
$localdata = $this->post('localData');
$studentDocDetails = $this->student_model->getStudent_doc_details($StudentID);
if ($studentDocDetails)
{
$studentDocDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($studentDocDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function deleteStuDocDetails_post() {
$StudentID = $this->post('exceptId');
$docEntryId = $this->post('docDetailsID');
$localdata = $this->post('localData');
$stuDocDeleteDetails = $this->student_model->deleteStu_doc_details($StudentID, $docEntryId);
if ($stuDocDeleteDetails)
{
$stuDocDeleteDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($stuDocDeleteDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function addStudentEntrollDocDetails_post() {
// echo $this->post('stuDocProof_Status');exit();
$docName = $_FILES['stuDocProof']['name'] ;
$docsize = $_FILES['stuDocProof']['size'] ;
$docSource = $_FILES['stuDocProof']['tmp_name'];
$temp= $this->post('data');
$data = json_decode($temp, true);
$updatedBy = $this->post('updatedBy');
$studentId = $this->post('studentID');
$doc_upload_status = $this->post('stuDocProof_Status');
$req['doc_name'] = $docName;
$req['doc_size'] = $docsize;
$req['doc_source'] = $docSource;
$req['document_type_name'] = $data['documentName'];
$req['document_status'] = '';
$req['document_comments'] = $data['documentComments'];
$req['student_id'] = $studentId;
$req['CreatedBy'] = $updatedBy;
$date = date('Y-m-d H:i:s');
$req['CreatedOn'] = $date;
$studentEntrollDocAdd = $this->student_model->student_entroll_doc_add( $req, $doc_upload_status);// Check if the employee exist
if ($studentEntrollDocAdd)
{
$studentEntrollDocAdd['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($studentEntrollDocAdd, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
// print_r($temp);
// echo $docName, $studentId, $data['documentName'];
// exit();
}
// get student pending enrollment document details
public function getListofStuPendingDocDetails_post() {
$StudentID = $this->post('exceptId');
$localdata = $this->post('localData');
$studentPendingDocDetails = $this->student_model->getStudent_PendingDoc_Details($StudentID);
if ($studentPendingDocDetails)
{
$studentPendingDocDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($studentPendingDocDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function addStudentEnrollPendingDocDetails_post() {
$updateDetails = $this->post('updateDetails');
$localdata = $this->post('localData');
$reqData['StudentID'] = $updateDetails['student'];
$reqData['Details'] = $updateDetails['doc_Details'];
$reqData['Status'] = $updateDetails['checkTracking'];
$reqData['CreatedBy'] = $localdata['localUserID'];
$date = date('Y-m-d H:i:s');
$reqData['CreatedOn'] = $date;
$addStudentPendingDocDetails = $this->student_model->addStu_PendingDoc_Details($reqData,$localdata);
if ($addStudentPendingDocDetails)
{
$addStudentPendingDocDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($addStudentPendingDocDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
// delete pending enrollment document details
public function deleteDocPendingDetails_post() {
$expID = $this->post('exceptId');
$localData = $this->post('localData');
// echo $expID;
// print_r($localData);exit();
$stuEnrollPendingDocDeleteDetails = $this->student_model->deleteStu_entrollPending_doc_details($expID);
if ($stuEnrollPendingDocDeleteDetails)
{
$stuEnrollPendingDocDeleteDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($stuEnrollPendingDocDeleteDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function updateStudentImgDetails_post() {
$imagename = $_FILES['idStuUpProof']['name'];
$size = $_FILES['idStuUpProof']['size'];
$imageSource = $_FILES['idStuUpProof']['tmp_name'];
$temp= $this->post('data');
$data = json_decode($temp, true);
$updatedBy = $this->post('updatedBy');
$updateStudent = $data['StudentID'];
$req['MobileNumber'] = $data['MobileNumber'];
$req['Firstname'] = $data['Firstname'];
$req['Lastname'] = $data['Lastname'];
$req['Fathername'] = $data['Fathername'];
$req['EmailID'] = $data['EmailID'];
$req['MotherName'] = $data['MotherName'];
$req['AlternateNumber'] = $data['AlternateNumber'];
$req['Gender'] = $data['Gender'];
$req['DOB'] = $data['DOB'];
$req['PresentAddress'] = $data['PresentAddress'];
$req['PermanentAddress'] = $data['PermanentAddress'];
$req['AadharNumber'] = $data['AadharNumber'];
$req['OtherID'] = $data['OtherID'];
$req['OtherIDDetails'] = $data['OtherIDDetails'];
$req['Qualification'] = $data['Qualification'];
$req['PreQualification'] = $data['PreQualification'];
$req['Caste'] = $data['Caste'];
$req['Category'] = $data['Category'];
$req['Religion'] = $data['Religion'];
$req['Nationality'] = $data['Nationality'];
$req['Occupation'] = $data['Occupation'];
$req['Designation'] = $data['Designation'];
$req['Companyname'] = $data['Companyname'];
$req['ReferredBy'] = $data['ReferredBy'];
$req['ReferersMobileNumber'] = $data['ReferersMobileNumber'];
$req['ProfilePicPath'] = $data['ProfilePicPath'];
$req['Comments'] = $data['Comments'];
$req['DeactiveComments'] = $data['IsActive'] == 1 ? '': $data['DeactiveComments'];
$req['IsActive'] = $data['IsActive'];
$req['LoginAccess'] = $data['LoginAccess'] == 1 ? "1" : "0";
$req['UpdatedBy'] = $updatedBy;
$date = date('Y-m-d H:i:s');
$req['UpdatedOn'] = $date;
$studentUpdate = $this->student_model->update_student( $req, $updateStudent, $imagename, $imageSource, $size );// Check if the employee exist
if ($studentUpdate)
{
$studentUpdate['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($studentUpdate, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function updateStudentExistDetail_post(){
$data = $this->post('data');
$updatedBy = $this->post('updatedBy');
$updateStudent = $data['StudentID'];
$imagename = '';
$size = '';
$imageSource = '';
$req['MobileNumber'] = $data['MobileNumber'];
$req['Firstname'] = $data['Firstname'];
$req['Lastname'] = $data['Lastname'];
$req['Fathername'] = $data['Fathername'];
$req['EmailID'] = $data['EmailID'];
$req['MotherName'] = $data['MotherName'];
$req['AlternateNumber'] = $data['AlternateNumber'];
$req['Gender'] = $data['Gender'];
$req['DOB'] = $data['DOB'];
$req['PresentAddress'] = $data['PresentAddress'];
$req['PermanentAddress'] = $data['PermanentAddress'];
$req['AadharNumber'] = $data['AadharNumber'];
$req['OtherID'] = $data['OtherID'];
$req['OtherIDDetails'] = $data['OtherIDDetails'];
$req['Qualification'] = $data['Qualification'];
$req['PreQualification'] = $data['PreQualification'];
$req['Caste'] = $data['Caste'];
$req['Category'] = $data['Category'];
$req['Religion'] = $data['Religion'];
$req['Nationality'] = $data['Nationality'];
$req['Occupation'] = $data['Occupation'];
$req['Designation'] = $data['Designation'];
$req['Companyname'] = $data['Companyname'];
$req['ReferredBy'] = $data['ReferredBy'];
$req['ReferersMobileNumber'] = $data['ReferersMobileNumber'];
$req['ProfilePicPath'] = $data['ProfilePicPath'];
$req['Comments'] = $data['Comments'];
$req['DeactiveComments'] = $data['IsActive'] == 1 ? '': $data['DeactiveComments'];
$req['IsActive'] = $data['IsActive'] == 1 ? "1" : "0";
$req['LoginAccess'] = $data['LoginAccess'] == 1 ? "1" : "0";
$req['UpdatedBy'] = $updatedBy;
$date = date('Y-m-d H:i:s');
$req['UpdatedOn'] = $date;
$studentUpdate = $this->student_model->update_student( $req, $updateStudent, $imagename, $imageSource, $size );// Check if the employee exist
if ($studentUpdate)
{
$studentUpdate['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($studentUpdate, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function getCourseBatch_post() {
$data = $this->post('data');
$getCourseBatchListDetails = $this->student_model->get_courseBatch_list($data);// Check if the employee exist
if ($getCourseBatchListDetails)
{
$getCourseBatchListDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getCourseBatchListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No list were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function chkStudentExistDetail_post() {
$data = $this->post('data');
$checkData = $this->post('check');
$checkRes = $this->student_model->check_exist( $data, $checkData );// Check if the employee exist
if ($checkRes)
{
$checkRes['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($checkRes, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function getExistingStudentDetails_post() {
$data = $this->post('data');
$reqDetails = $this->post('check');
$checkExisRes = $this->student_model->get_exist_stu_details( $data, $reqDetails );// Check if the employee exist
if ($checkExisRes)
{
$checkExisRes['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($checkExisRes, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
// add new course for student
public function insertStudentCourse_post(){
$addStudent = $this->post('addStudent');
$coursedata = $this->post('coursedata');
$createdBy = $this->post('createdBy');
$createdBranch = $this->post('loginBranch');
$reqCourse['StudentID'] = $addStudent;
$reqCourse['UniversityID'] = $coursedata['university'];
$reqCourse['CourseID'] = $coursedata['course'];
$reqCourse['SessionID'] = $coursedata['batch'];
$reqCourse['DOJ'] = $coursedata['dateofjoining'];
$reqCourse['EnrollmentID'] = $coursedata['enrollmentid'];
$reqCourse['Specilization1'] = $coursedata['specilization1'];
$reqCourse['Specilization2'] = $coursedata['specilization2'];
$reqCourse['BranchID'] = $createdBranch;
$reqCourse['IsActive'] = '1';
$reqCourse['CreatedBy'] = $createdBy;
$date = date('Y-m-d H:i:s');
$reqCourse['CreatedOn'] = $date;
// print_r($reqCourse);exit();
$studentAddCourse = $this->student_model->add_student_course( $addStudent , $reqCourse);// Check if the employee exist
if ($studentAddCourse)
{
$studentAddCourse['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($studentAddCourse, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function insertStudentImg_post() {
// print_r($this->post('idProof'));exit();
$imagename = $_FILES['idStuProof']['name'];
$size = $_FILES['idStuProof']['size'];
$imageSource = $_FILES['idStuProof']['tmp_name'];
// echo $size;exit();
$temp = $this->post('data');
$tempBranch = $this->post('coursedata');
$data = json_decode($temp, true);
$coursedata = json_decode($tempBranch, true);
$createdBy = $this->post('createdBy');
$createdBranch = $this->post('loginBranch');
$req['Firstname'] = $data['firstname'];
$req['Lastname'] = $data['lastname'];
$req['Fathername'] = $data['fathername'];
$req['EmailID'] = $data['emailId'];
$req['MotherName'] = $data['mothername'];
$req['MobileNumber'] = $data['primaryPhone'];
$req['AlternateNumber'] = $data['secondaryPhone'];
$req['Gender'] = $data['gender'];
$req['DOB'] = $data['dateofbirth'];
$req['PresentAddress'] = $data['address2'];
$req['PermanentAddress'] = $data['address1'];
$req['AadharNumber'] = $data['aadharNumber'];
$req['OtherID'] = $data['otherId'];
$req['OtherIDDetails'] = $data['otherIdDetails'];
$req['Caste'] = $data['caste'];
$req['Category'] = $data['category'];
$req['Religion'] = $data['religion'];
$req['Nationality'] = $data['nationality'];
$req['Occupation'] = $data['occupation'];
$req['Designation'] = $data['designation'];
$req['Companyname'] = $data['companyname'];
$req['ReferredBy'] = $data['referredby'];
$req['ReferersMobileNumber'] = $data['referredmobilenumber'];
$req['PreQualification'] = $data['prequalification'];
$req['IsActive'] = $data['switchsetting'];
$req['Comments'] = $data['Comments'];
$req['BranchCode'] = $createdBranch;
$req['DeactiveComments'] = $data['switchsetting'] == 1 ? '': $data['DeactiveComments'];
$req['CreatedBy'] = $createdBy;
$date = date('Y-m-d H:i:s');
$req['CreatedOn'] = $date;
$reqCourse['UniversityID'] = $coursedata['university'];
$reqCourse['CourseID'] = $coursedata['course'];
$reqCourse['SessionID'] = $coursedata['batch'];
$reqCourse['DOJ'] = $coursedata['dateofjoining'];
$reqCourse['BranchID'] = $createdBranch;
$reqCourse['IsActive'] = $data['switchsetting'];
$reqCourse['EnrollmentID'] = $coursedata['enrollmentid'];
$reqCourse['Specilization1'] = $coursedata['specilization1'];
$reqCourse['Specilization2'] = $coursedata['specilization2'];
$reqCourse['CreatedBy'] = $createdBy;
$date = date('Y-m-d H:i:s');
$reqCourse['CreatedOn'] = $date;
$studentAdd = $this->student_model->add_student( $req , $reqCourse, $imagename, $imageSource, $size);// Check if the employee exist
if ($studentAdd) {
$studentAdd['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($studentAdd, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
} else {
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
// add student
public function addStudent_post() {
$imagename = '';
$size = '';
$imageSource = '';
$data = $this->post('data');
$coursedata = $this->post('coursedata');
$createdBy = $this->post('createdBy');
$createdBranch = $this->post('loginBranch');
$req['Firstname'] = $data['firstname'];
$req['Lastname'] = $data['lastname'];
$req['Fathername'] = $data['fathername'];
$req['EmailID'] = $data['emailId'];
$req['MotherName'] = $data['mothername'];
$req['MobileNumber'] = $data['primaryPhone'];
$req['AlternateNumber'] = $data['secondaryPhone'];
$req['Gender'] = $data['gender'];
$req['DOB'] = $data['dateofbirth'];
$req['PresentAddress'] = $data['address2'];
$req['PermanentAddress'] = $data['address1'];
$req['AadharNumber'] = $data['aadharNumber'];
$req['OtherID'] = $data['otherId'];
$req['OtherIDDetails'] = $data['otherIdDetails'];
$req['Caste'] = $data['caste'];
$req['Category'] = $data['category'];
$req['Religion'] = $data['religion'];
$req['Nationality'] = $data['nationality'];
$req['Occupation'] = $data['occupation'];
$req['Designation'] = $data['designation'];
$req['Companyname'] = $data['companyname'];
$req['ReferredBy'] = $data['referredby'];
$req['ReferersMobileNumber'] = $data['referredmobilenumber'];
$req['PreQualification'] = $data['prequalification'];
$req['IsActive'] = $data['switchsetting'];
$req['Comments'] = $data['Comments'];
$req['BranchCode'] = $createdBranch;
$req['DeactiveComments'] = $data['switchsetting'] == 1 ? '': $data['DeactiveComments'];
$req['CreatedBy'] = $createdBy;
$date = date('Y-m-d H:i:s');
$req['CreatedOn'] = $date;
$reqCourse['UniversityID'] = $coursedata['university'];
$reqCourse['CourseID'] = $coursedata['course'];
$reqCourse['SessionID'] = $coursedata['batch'];
$reqCourse['DOJ'] = $coursedata['dateofjoining'];
$reqCourse['BranchID'] = $createdBranch;
$reqCourse['IsActive'] = $data['switchsetting'];
$reqCourse['EnrollmentID'] = $coursedata['enrollmentid'];
$reqCourse['Specilization1'] = $coursedata['specilization1'];
$reqCourse['Specilization2'] = $coursedata['specilization2'];
$reqCourse['CreatedBy'] = $createdBy;
$date = date('Y-m-d H:i:s');
$reqCourse['CreatedOn'] = $date;
$studentAdd = $this->student_model->add_student( $req , $reqCourse, $imagename, $imageSource, $size);// Check if the employee exist
if ($studentAdd) {
$studentAdd['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($studentAdd, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
} else {
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
}