86 lines
3.1 KiB
PHP
86 lines
3.1 KiB
PHP
<?php
|
|
/**
|
|
* Date: 11/9/17
|
|
* Time: 5:28 PM
|
|
*/
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Student_model extends CI_Model
|
|
{
|
|
|
|
/*
|
|
* student details
|
|
*
|
|
* created by kdk
|
|
* */
|
|
|
|
//get course for university
|
|
|
|
public function get_courseBatch_list($univId) {
|
|
|
|
$this->db->select('C.CourseID, C.CourseName');
|
|
$this->db->from(COURSE.' as C');
|
|
$this->db->where('UniversityID',$univId);
|
|
$this->db->where('IsActive',1);
|
|
$courseDetails = $this->db->get();
|
|
if($courseDetails->result()){
|
|
$this->db->select('B.BatchCode, B.BatchName');
|
|
$this->db->from(BATCH.' as B');
|
|
$this->db->where('UniversityID',$univId);
|
|
$this->db->where('IsActive',1);
|
|
$batchDetails = $this->db->get();
|
|
if( $batchDetails->result()) {
|
|
$result['courseStatus'] = true;
|
|
$result['course_details'] = $courseDetails->result();
|
|
$result['batch_details'] = $batchDetails->result();
|
|
} else {
|
|
$result['courseStatus'] = false;
|
|
$result['message'] = "No records found!";
|
|
}
|
|
}
|
|
else {
|
|
$result['courseStatus'] = false;
|
|
$result['message'] = "No records found!";
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
// add student
|
|
public function add_employee($empArr, $createdBy)
|
|
{
|
|
$this->db->insert(STAFF, $empArr);
|
|
if ($this->db->affected_rows() == '1') {
|
|
$branchArr['StaffID'] = $empArr['StaffID'];
|
|
$branchArr['BranchCode'] = $empArr['BranchCode'];
|
|
$branchArr['IsActive'] = $empArr['IsActive'];
|
|
$branchArr['CreatedBy'] = $createdBy;
|
|
$this->db->insert(STAFF_BRANCH, $branchArr);
|
|
if ($this->db->affected_rows() == '1') {
|
|
$loginArr['StaffID'] = $empArr['StaffID'];
|
|
$loginArr['ListCode'] = $empArr['ListCode'];
|
|
$loginArr['MobileNumber'] = $empArr['MobileNumber'];
|
|
$loginArr['EmailId'] = $empArr['EmailID'];
|
|
$loginArr['IsActive'] = $empArr['IsActive'];
|
|
$loginArr['CreatedBy'] = $createdBy;
|
|
$loginArr['Password'] = ENCR_PASSWORD;
|
|
$this->db->insert(LOGIN, $loginArr);
|
|
if ($this->db->affected_rows() == '1') {
|
|
$result['addEmpStatus'] = true;
|
|
$result['message'] = "Successfully employee details added";
|
|
} else {
|
|
$result['addEmpStatus'] = false;
|
|
$result['message'] = "Something went wrong.please try again";
|
|
}
|
|
} else {
|
|
$result['addEmpStatus'] = false;
|
|
$result['message'] = "Something went wrong.please try again";
|
|
}
|
|
} else {
|
|
$result['addEmpStatus'] = false;
|
|
$result['message'] = "Something went wrong.please try again";
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
} |