McGansWebsite/admin/application/models/Project_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

167 lines
4.7 KiB
PHP

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Project_model extends CI_Model {
public function __construct() {
parent::__construct();
}
function list_pro()
{
$this->db->select('p.*,d.name as depName,s.name as studentName,sem.name as semName,sub.name as subName');
$this->db->from('project as p');
$this->db->join('student as s','s.id=p.studentId','INNER');
$this->db->join('semester as sem','sem.id=p.semesterId','INNER');
$this->db->join('department as d','d.id=p.departmentId','INNER');
$this->db->join('subject as sub','sub.id=p.subjectId','INNER');
$this->db->where(array('p.status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_pro($id)
{
$this->db->select('*');
$this->db->from('project');
$this->db->where(array('status'=>1,'id'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_dep()
{
$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 get_stu()
{
$this->db->select('*');
$this->db->from('student');
$this->db->where(array('status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_fac()
{
$this->db->select('*');
$this->db->from('faculty');
$this->db->where(array('status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_sub()
{
$this->db->select('id,name');
$this->db->from('subject');
$this->db->where(array('status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_semester()
{
$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 viewProject($id)
{
$this->db->select('p.projectName,p.date as pDate,p.studentId,p.code,p.description,p.image,
p.vedio,p.driveLink,s.name as studentName,sem.name as semName,d.name as depName,sub.name as subName');
$this->db->from('project as p');
$this->db->join('student as s','s.id=p.studentId','INNER');
$this->db->join('semester as sem','sem.id=p.semesterId','INNER');
$this->db->join('department as d','d.id=p.departmentId','INNER');
$this->db->join('subject as sub','sub.id=p.subjectId','INNER');
$this->db->where(array('p.status'=>1,'p.id'=>$id));
$query = $this->db->get();
return $query;
}
function recentlyAddedProject()
{
$this->db->select('p.*,d.name as depName,s.name as studentName,sem.name as semName,sub.name as subName');
$this->db->from('project as p');
$this->db->order_by("p.id", "desc");
$this->db->limit(10);
$this->db->join('student as s','s.id=p.studentId','INNER');
$this->db->join('semester as sem','sem.id=p.semesterId','INNER');
$this->db->join('department as d','d.id=p.departmentId','INNER');
$this->db->join('subject as sub','sub.id=p.subjectId','INNER');
$this->db->where(array('p.status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function totalProjects()
{
//orders
$this->db->select('count(id) as tProjects');
$this->db->from('project');
$this->db->where(array('status'=>1));
$result = $this->db->get();
//echo $this->db->last_query(); exit;
return $result;
}
function totalStudents()
{
//orders
$this->db->select('count(id) as tStudents');
$this->db->from('student');
$this->db->where(array('status'=>1));
$result = $this->db->get();
//echo $this->db->last_query(); exit;
return $result;
}
function totalSubject()
{
//orders
$this->db->select('count(id) as tSubjects');
$this->db->from('subject');
$this->db->where(array('status'=>1));
$result = $this->db->get();
//echo $this->db->last_query(); exit;
return $result;
}
function totalFaculties()
{
//orders
$this->db->select('count(id) as tFaculties');
$this->db->from('faculty');
$this->db->where(array('status'=>1));
$result = $this->db->get();
//echo $this->db->last_query(); exit;
return $result;
}
function getMultipleImage($id)
{
$this->db->select('id,title,image,projectId,description as muldescription');
$this->db->from('projectdetail');
$this->db->where(array('status'=>1,'projectId'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();
return $query;
}
function getOldPassword($id)
{
$this->db->select('password');
$this->db->from('employee');
$this->db->where(array('status'=>1,'id'=>$id));
$result = $this->db->get();
return $result;
}
}