6515996f87
Role, Employee, Department, Degree, Semester, Subject, Faculty Edit Completed
62 lines
1.6 KiB
PHP
62 lines
1.6 KiB
PHP
<?php
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class Semester_model extends CI_Model {
|
|
|
|
public function __construct() {
|
|
parent::__construct();
|
|
}
|
|
|
|
function list_semester()
|
|
{
|
|
$this->db->select('s.id,s.name,s.year,sub.id as subId,sub.name as subName,dep.id as depId,dep.name as depName,deg.id as degId,deg.name as degName');
|
|
$this->db->from('Semester as s');
|
|
$this->db->join('subject as sub','sub.id=s.subjectId','INNER');
|
|
$this->db->join('department as dep','dep.id=s.departmentId','INNER');
|
|
$this->db->join('degree as deg','deg.id=s.degreeId','INNER');
|
|
$this->db->where(array('s.status'=>1,));
|
|
$query = $this->db->get();
|
|
//'sub.status'=>1,'dep.status'=>1,'deg.status'=>1
|
|
//echo $this->db->last_query();exit;
|
|
return $query;
|
|
}
|
|
|
|
function listSubject()
|
|
{
|
|
$this->db->select('id,name');
|
|
$this->db->from('subject');
|
|
$this->db->where(array('status'=>1));
|
|
$query = $this->db->get();
|
|
//echo $this->db->last_query();exit;
|
|
return $query;
|
|
}
|
|
function listDepartment()
|
|
{
|
|
$this->db->select('id,name');
|
|
$this->db->from('department');
|
|
$this->db->where(array('status'=>1));
|
|
$query = $this->db->get();
|
|
//echo $this->db->last_query();exit;
|
|
return $query;
|
|
} function listDegree()
|
|
{
|
|
$this->db->select('id,name');
|
|
$this->db->from('degree');
|
|
$this->db->where(array('status'=>1));
|
|
$query = $this->db->get();
|
|
//echo $this->db->last_query();exit;
|
|
return $query;
|
|
}
|
|
function getSemester($id)
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('semester');
|
|
$this->db->where(array('status'=>1,'id'=>$id));
|
|
$query = $this->db->get();
|
|
//echo $this->db->last_query();exit;
|
|
return $query;
|
|
}
|
|
|
|
}
|