356 lines
16 KiB
PHP
356 lines
16 KiB
PHP
<?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');
|
|
|
|
}
|
|
|
|
public function getStudentList_post() {
|
|
$reqData = $this->post('data');
|
|
$loginUserId = $reqData['localUserID'];
|
|
$loginUserBranchId = $reqData['localBranchID'];
|
|
$loginUserType = $reqData['localType'];
|
|
|
|
$studentListDetails = $this->student_model->get_student_list( $loginUserId, $loginUserBranchId, $loginUserType );// 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 getStudentCourseList_post() {
|
|
$studentID = $this->post('studentID');
|
|
$studentCourse = $this->student_model->get_student_course_list( $studentID );// 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['BatchCode'] = $data['BatchCode'];
|
|
$req['DOJ'] = $data['DOJ'];
|
|
$req['IsActive'] = $data['IsActive'];
|
|
$req['BranchID'] = $data['BranchID'];
|
|
$req['EnrollmentID'] = $data['EnrollmentID'];
|
|
$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
|
|
}
|
|
}
|
|
|
|
public function updateStudentExistDetail_post(){
|
|
$data = $this->post('data');
|
|
$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['IsActive'] = $data['IsActive'];
|
|
|
|
$req['UpdatedBy'] = $updatedBy;
|
|
$date = date('Y-m-d H:i:s');
|
|
$req['UpdatedOn'] = $date;
|
|
$studentUpdate = $this->student_model->update_student( $req, $updateStudent );// 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
|
|
}
|
|
|
|
}
|
|
|
|
// 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['BatchCode'] = $coursedata['batch'];
|
|
$reqCourse['DOJ'] = $coursedata['dateofjoining'];
|
|
$reqCourse['EnrollmentID'] = $coursedata['enrollmentid'];
|
|
$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
|
|
}
|
|
}
|
|
|
|
// add student
|
|
public function addStudent_post() {
|
|
$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['BranchCode'] = $createdBranch;
|
|
|
|
$req['CreatedBy'] = $createdBy;
|
|
$date = date('Y-m-d H:i:s');
|
|
$req['CreatedOn'] = $date;
|
|
|
|
$reqCourse['UniversityID'] = $coursedata['university'];
|
|
$reqCourse['CourseID'] = $coursedata['course'];
|
|
$reqCourse['BatchCode'] = $coursedata['batch'];
|
|
$reqCourse['DOJ'] = $coursedata['dateofjoining'];
|
|
$reqCourse['BranchID'] = $createdBranch;
|
|
$reqCourse['IsActive'] = $data['switchsetting'];
|
|
$reqCourse['EnrollmentID'] = $coursedata['enrollmentid'];
|
|
$reqCourse['CreatedBy'] = $createdBy;
|
|
$date = date('Y-m-d H:i:s');
|
|
$reqCourse['CreatedOn'] = $date;
|
|
|
|
|
|
$studentAdd = $this->student_model->add_student( $req , $reqCourse);// 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
|
|
}
|
|
}
|
|
|
|
|
|
}
|