Add icons to project sidebar
This commit is contained in:
@@ -58,9 +58,13 @@ class Project extends CI_Model {
|
||||
* @return array The user's projects.
|
||||
*/
|
||||
public function getOwn() {
|
||||
$query = $this->db->where(array('owner' => $this->session->userdata('user_id')))
|
||||
->order_by('lastaccess', 'desc')
|
||||
->get('projects');
|
||||
$this->db->select('projects.*, COUNT(shares.user_id) AS shares');
|
||||
$this->db->join('shares', 'shares.project_id = projects.id', 'left');
|
||||
$this->db->group_by('shares.project_id');
|
||||
$this->db->where(array('owner' => $this->session->userdata('user_id')));
|
||||
|
||||
$query = $this->db->order_by('last_access DESC')->get('projects');
|
||||
|
||||
return $this->_addShortNames($query->result_array());
|
||||
}
|
||||
|
||||
@@ -71,7 +75,7 @@ class Project extends CI_Model {
|
||||
*/
|
||||
public function getShared() {
|
||||
$this->load->library('session');
|
||||
$this->db->select('*')->from('shares')->order_by('lastaccess', 'desc')->where(array('user_id' => $this->session->userdata('user_id')));
|
||||
$this->db->select('*')->from('shares')->order_by('last_access DESC')->where(array('user_id' => $this->session->userdata('user_id')));
|
||||
$this->db->join('projects', 'projects.id = shares.project_id');
|
||||
$query = $this->db->get();
|
||||
|
||||
@@ -118,7 +122,7 @@ class Project extends CI_Model {
|
||||
*/
|
||||
public function getById($projectId) {
|
||||
$result = $this->db->get_where('projects', array('id' => $projectId))->row_array();
|
||||
$this->db->where('id', $projectId)->update('projects', array('lastaccess' => mysql_now()));
|
||||
$this->db->where('id', $projectId)->update('projects', array('last_access' => mysql_now()));
|
||||
|
||||
if ($result) {
|
||||
return $this->_addShortName($result);
|
||||
@@ -189,7 +193,7 @@ class Project extends CI_Model {
|
||||
|
||||
$data['owner'] = '215cd70f310ae6ae'; //$this->session->userdata('user_id');
|
||||
$data['created'] = mysql_now();
|
||||
$data['lastaccess'] = mysql_now();
|
||||
$data['last_access'] = mysql_now();
|
||||
|
||||
do {
|
||||
$data['id'] = random_hash();
|
||||
|
||||
Reference in New Issue
Block a user