McGansWebsite/admin/application/models/Project_model.php

159 lines
4.5 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 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');
2023-01-10 09:41:20 +00:00
$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');
2023-01-10 09:41:20 +00:00
$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;
}
2023-01-11 07:17:57 +00:00
function get_sub()
{
$this->db->select('id,name');
2023-01-11 07:17:57 +00:00
$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');
$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');
$this->db->from('projectdetail');
$this->db->where(array('status'=>1,'projectId'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();
return $query;
}
2023-01-10 09:41:20 +00:00
}