Implement newly shared projects

This commit is contained in:
Eike Foken
2011-09-20 22:22:36 +02:00
parent 11b3e4f109
commit 986bf7b251
4 changed files with 128 additions and 0 deletions

View File

@@ -72,6 +72,28 @@ class Share extends CI_Model {
return $this->db->get_where('shares', array('user_id' => $userId))->result_array();
}
/**
* Counts all unseen shares.
*/
public function countUnseen() {
return $this->db->where('user_id', $this->session->userdata('user_id'))
->where('seen', 0)->count_all_results('shares');
}
/**
* Marks a shared project as seen.
*
* @param string $projectId
* @return boolean Returns TRUE on success.
*/
public function markSeen($projectId) {
$this->db->where('project_id', $projectId)
->where('user_id', $this->session->userdata('user_id'))
->update('shares', array('seen' => 1));
return $this->db->affected_rows() > 0;
}
/**
* Creates a share.
*