McGansWebsite/admin/application/models/Semester_model.php

62 lines
1.6 KiB
PHP
Raw Normal View History

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();
}
function list_semester()
2023-01-10 09:41:20 +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();
//'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;
}
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');
$this->db->where(array('status'=>1,'id'=>$id));
2023-01-10 09:41:20 +00:00
$query = $this->db->get();
//echo $this->db->last_query();exit;
2023-01-10 09:41:20 +00:00
return $query;
}
}