McGansWebsite/admin/application/models/Subject_model.php
dotwingssoftware f2a40c268b 20230207
1. Have to test and deploy in server.  2. add faculty detail into employee table and student detail  into employee table, 3. Change Teaching Assistant into multiple select 4. User Profile
2023-02-07 18:41:26 +05:30

86 lines
2.2 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 semesterList()
{
$this->db->select('id,name,year');
$this->db->from('semester');
$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;
}
function getMultipleImage($id)
{
$this->db->select('id,title,image,subjectId');
$this->db->from('subjectdetail');
$this->db->where(array('status'=>1,'subjectId'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();
return $query;
}
}