McGansWebsite/application/models/WelcomeModel.php

120 lines
3.3 KiB
PHP
Raw Normal View History

<?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('name');
$this->db->from('department');
$this->db->where(array('id'=>$depId));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function semesterList()
{
$this->db->select('*');
$this->db->from('semester');
$this->db->where(array('status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
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 subject_Detail($id)
{
$this->db->select('id,code,name,facultyId,description');
$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');
$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');
$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;
}
}