<?php

defined('BASEPATH') or exit('No direct script access allowed');

require_once 'Da_project.php';

class M_project extends Da_project
{

	public function __construct()
	{
		parent::__construct();
	}

	public function get_all()
	{
		$sql = "SELECT * FROM {$this->db_name}.project
		order by project_id DESC";
        $query = $this->db->query($sql);
        return $query;
	}

	public function get_all_year()
	{
		$sql = "SELECT date FROM {$this->db_name}.project
		GROUP BY date";
        $query = $this->db->query($sql);
        return $query;
	}

	public function get_all_user($id)
	{
		$sql = "SELECT * FROM {$this->db_name}.project
		Where user_id = $id order by project_id DESC";
        $query = $this->db->query($sql);
        return $query;
	}

	public function get_all_year_user($id)
	{
		$sql = "SELECT date FROM {$this->db_name}.project
		Where user_id = $id
		GROUP BY date";
        $query = $this->db->query($sql);
        return $query;
	}

	public function get_project_by_id($id){
		$sql = "SELECT * FROM {$this->db_name}.project
		join company on project.company_id = company.company_id
		Where project_id = $id";
        $query = $this->db->query($sql);
        return $query;
	}
}
