public function read($id = null) { if ($id != null) { $message = new privateMessageModel(); $message->markRead($id); header("location: " . $this->_link(array("index")) . ""); } else { header("location: " . $this->_link(array("index")) . ""); } }
public function archive() { $privateMessages = new privateMessageModel(); $this->view->privateMessages = $privateMessages->loadExpired(); }
private function loadSupervisorMessages() { $user = new userModel(); $userId = $user->getId(); $date = new DateTime(); $date->setTime(0, 0, 0); $sql = "SELECT id FROM privateMessages WHERE supervisorId = '" . $userId . "' AND expireDate >= '" . $date->format('U') . "' ORDER BY postDate ASC"; $query = $this->db->query($sql); $data = array(); while ($result = $query->fetch_assoc()) { $message = new privateMessageModel(); $data[] = $message->supervisorLoad($result['id']); } return $data; }