2023-01-10 09:41:20 +00:00
|
|
|
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
|
|
exit('No direct script access allowed');
|
|
|
|
|
|
|
|
class Semester_model extends CI_Model {
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
2023-01-21 13:41:47 +00:00
|
|
|
function list_semester()
|
2023-01-10 09:41:20 +00:00
|
|
|
{
|
2023-01-21 13:41:47 +00:00
|
|
|
$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,));
|
2023-01-10 09:41:20 +00:00
|
|
|
$query = $this->db->get();
|
2023-01-21 13:41:47 +00:00
|
|
|
//'sub.status'=>1,'dep.status'=>1,'deg.status'=>1
|
2023-01-10 09:41:20 +00:00
|
|
|
//echo $this->db->last_query();exit;
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
|
2023-01-21 13:41:47 +00:00
|
|
|
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)
|
2023-01-10 09:41:20 +00:00
|
|
|
{
|
|
|
|
$this->db->select('*');
|
|
|
|
$this->db->from('semester');
|
2023-01-21 13:41:47 +00:00
|
|
|
$this->db->where(array('status'=>1,'id'=>$id));
|
2023-01-10 09:41:20 +00:00
|
|
|
$query = $this->db->get();
|
2023-01-21 13:41:47 +00:00
|
|
|
//echo $this->db->last_query();exit;
|
2023-01-10 09:41:20 +00:00
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|