public function isNew($user = null) { $user = KunenaUserHelper::get($user); if (!KunenaFactory::getConfig()->shownew || !$user->exists()) { return false; } $session = KunenaFactory::getSession(); if ($this->time < $session->lasttime) { return false; } $allreadtime = KunenaForumCategoryUserHelper::get($this->getCategory(), $user)->allreadtime; if ($allreadtime && $this->time < JFactory::getDate($allreadtime)->toUnix()) { return false; } $read = KunenaForumTopicUserReadHelper::get($this->getTopic(), $user); if ($this->id == $read->message_id || $this->time < $read->time) { return false; } return true; }
/** * @param mixed $user * * @return bool */ public function markRead($user = null) { $user = KunenaUserHelper::get($user); if (!KunenaFactory::getConfig()->shownew || !$user->exists()) { return false; } $read = KunenaForumTopicUserReadHelper::get($this, $user); $read->time = JFactory::getDate()->toUnix(); $read->message_id = $this->last_post_id; $read->save(); return true; }
/** * @return KunenaForumTopicUserRead */ public function getTopic() { return KunenaForumTopicUserReadHelper::get($this->topic_id); }