apollodec/Apollo/api/application/models/Studentview_model.php
2017-12-22 13:49:06 +05:30

54 lines
1.7 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: karthi
* Date: 12/21/17
* Time: 3:46 PM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Studentview_model extends CI_Model
{
/*
* student details
* created by kms
* */
// get student list based on login user
public function getStudentInfo($requestedBy=null)
{
$this->db->select('ST.*');
$this->db->from( LOGIN . ' as LO');
$this->db->join( STUDENTS . ' as ST', 'LO.StaffID = ST.StudentID');
$this->db->where('LO.ID', $requestedBy);
$studentDetails = $this->db->get()->first_row();
if($studentDetails){
$result['studentStatus'] = true;
$result['studentDetails'] = $studentDetails;
// get student course details
$result['courseDetails'] = $this->getStudentCourse($studentDetails->StudentID);
}
else{
$result['studentStatus'] = false;
$result['studentInfo'] = "";
}
return $result;
}
/*
* get student course details
* created by kms
* */
public function getStudentCourse($studentId=null){
$this->db->select('CU.CourseID,CU.CourseName,US.UniversityID,US.UniversityName,BA.BatchName');
$this->db->from( STUDENTCOURSE . ' as SCU');
$this->db->join( COURSE . ' as CU', 'CU.CourseID = SCU.CourseID');
$this->db->join( UNIVERSITY . ' as US', 'US.UniversityID = SCU.UniversityID');
$this->db->join( BATCH . ' as BA', 'BA.BatchCode = SCU.BatchCode');
$this->db->where('SCU.StudentID', $studentId);
$courseDetails = $this->db->get();
return $courseDetails->result();
}
}