McGansWebsite/admin/application/models/Subject_model.php

77 lines
2.0 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 Subject_model extends CI_Model {
public function __construct() {
parent::__construct();
}
function degreeList()
2023-01-10 09:41:20 +00:00
{
$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');
2023-01-10 09:41:20 +00:00
$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;
}
2023-01-10 09:41:20 +00:00
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;
}
2023-01-10 09:41:20 +00:00
}