McGansWebsite/admin/application/models/Subject_model.php
dotwingssoftware 6515996f87 20230121
Role, Employee, Department, Degree, Semester, Subject, Faculty Edit Completed
2023-01-21 19:11:47 +05:30

68 lines
1.7 KiB
PHP

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Subject_model extends CI_Model {
public function __construct() {
parent::__construct();
}
function degreeList()
{
$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 facultyList()
{
$this->db->select('id,name');
$this->db->from('faculty');
$this->db->where(array('status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function list_subject()
{
$this->db->select('s.id ,s.name,s.code,d.name as depName');
$this->db->from('subject as s');
$this->db->join('degree as d','d.id=s.degreeId','INNER');
$this->db->where(array('s.status'=>1,'d.status'=>1));
$query = $this->db->get();
return $query;
}
function get_sub($id)
{
$this->db->select('*');
$this->db->from('subject');
$this->db->where(array('status'=>1,'id'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function viewSubject($id)
{
$this->db->select('sub.*,deg.name as degName,f.id as facId,f.name as facName');
$this->db->from('subject as sub');
$this->db->join('degree as deg','deg.id=sub.degreeId','INNER');
$this->db->join('faculty as f','f.id=sub.facultyId','INNER');
$this->db->where(array('sub.status'=>1,'sub.id'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_faculty($id)
{
$this->db->select('*');
$this->db->from('faculty');
$this->db->where(array('id'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();
return $query;
}
}