McGansWebsite/application/models/WelcomeModel.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

153 lines
4.5 KiB
PHP

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class WelcomeModel extends CI_Model {
public function __construct() {
parent::__construct();
}
function dep_list()
{
$this->db->select('*');
$this->db->from('department');
$this->db->where(array('status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function getName($depId)
{
$this->db->select('id,name');
$this->db->from('degree');
$this->db->where(array('status'=>1,'departmentId'=>$depId));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function semesterList()
{
$this->db->select('*');
$this->db->from('semester');
$this->db->order_by('id', 'desc');
$this->db->where(array('status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function getSubjectImage($id)
{
$this->db->select('id,title,image');
$this->db->from('subjectdetail');
$this->db->where(array('status'=>1,'subjectId'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
//have to remove below function
function subject_list($id)
{
$this->db->select('s.code,s.name,s.id,d.name as degName,s.facultyId');
$this->db->from('subject as s');
$this->db->join('degree as d','d.id=s.degreeId','INNER');
$this->db->where(array('s.status'=>1,'degreeId'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function getSubject($id)
{
$this->db->select('s.image,s.code,s.name,s.id,d.name as degName,s.facultyId');
$this->db->from('subject as s');
$this->db->join('degree as d','d.id=s.degreeId','INNER');
$this->db->where(array('s.status'=>1,'degreeId'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function subject_Detail($id)
{
$this->db->select('id,code,name,facultyId,description,subtitle,teachingAssistant');
$this->db->from('subject');
//$this->db->join('degree as d','d.id=s.degreeId','INNER');
$this->db->where(array('status'=>1,'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 getProjectList($subjectId)
{
$this->db->select('p.id,p.projectName,s.name as studentName,p.image');
$this->db->from('project as p');
$this->db->join('student as s','s.id=p.studentId','INNER');
$this->db->where(array('p.status'=>1,'p.subjectId'=>$subjectId));
$query = $this->db->get();
///echo $this->db->last_query();
return $query;
}
function project_details($subjectId)
{
$this->db->select('p.id,p.projectName,s.name as studentName');
$this->db->from('project as p');
$this->db->join('student as s','s.id=p.studentId','INNER');
$this->db->where(array('p.status'=>1,'p.subjectId'=>$subjectId));
$query = $this->db->get();
///echo $this->db->last_query();
return $query;
}
function projectDetail($projectId)
{
$this->db->select('p.id,p.projectName,p.description,s.name as studentName,p.vedio,p.drivelink');
$this->db->from('project as p');
$this->db->join('student as s','s.id=p.studentId','INNER');
$this->db->where(array('p.status'=>1,'p.id'=>$projectId));
$query = $this->db->get();
///echo $this->db->last_query();
return $query;
}
function getGalleryList($projectId)
{
$this->db->select('id,title,image,description');
$this->db->from('projectdetail');
$this->db->where(array('status'=>1,'projectId'=>$projectId));
$query = $this->db->get();
///echo $this->db->last_query();
return $query;
}
function getLastId()
{
$this->db->select('id,name,year');
$this->db->from('semester');
$this->db->order_by('id', 'desc');
$this->db->limit(1);
$this->db->where(array('status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function getDepartment($id)
{
$this->db->select('SD.id,dep.id as depId,dep.name as depName,dep.code as depCode,dep.image as depImage');
$this->db->from('semesterdetail as SD');
$this->db->join('degree as d','d.id=SD.degreeId','INNER');
$this->db->join('department as dep','dep.id=d.departmentId','INNER');
$this->db->where(array('SD.status'=>1,'SD.semesterId'=>$id));
$this->db->group_by('dep.name');
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
}