예제 #1
0
 /**
  * Mark this topic as viewed
  * @since Version 3.2
  * @version 3.10.0
  * @author Michael Greenhill
  * @param int $userId
  * @return \Railpage\Forums\Thread
  */
 public function viewed($userId = false)
 {
     if (!filter_var($this->id)) {
         throw new Exception("Can't mark this thread as viewed because no thread ID exists");
     }
     if (filter_var($userId, FILTER_VALIDATE_INT)) {
         $this->Viewer = UserFactory::CreateUser($userId);
     }
     if ($this->Viewer instanceof User) {
         Utility\ForumsUtility::updateUserThreadView($this, $this->Viewer);
     }
     return;
     /*
     if (filter_var($userId, FILTER_VALIDATE_INT) && $userId > 0) {
         $query = "CALL update_viewed_thread(?, ?)";
         $params = array(
             $this->id,
             $userId
         );
         
         $result = $this->db->query($query, $params); 
         $result->fetchAll();
         $result->closeCursor();
     }
     
     return $this;
     */
 }
예제 #2
0
 /**
  * @depends testAddForum
  * @depends testCreateUser
  */
 public function testAddThread($forum_id, $User)
 {
     $Forum = ForumsFactory::CreateForum($forum_id);
     $Thread = new Thread();
     $Thread->setAuthor($User)->setForum($Forum);
     $Thread->title = "Test thread";
     $Thread->commit();
     $Post = new Post();
     $Post->setAuthor($User)->setThread($Thread);
     $Post->text = "asdfasffasasfa87s9fsas989sfa9ffds";
     $Post->commit();
     $NewThread = ForumsFactory::CreateThread($Thread->id);
     $NewPost = ForumsFactory::CreatePost($Post->id);
     $Index = ForumsFactory::CreateIndex();
     ForumsUtility::updateUserThreadView($Thread, $User);
     ForumsUtility::updateUserThreadView($Thread);
     ForumsUtility::getForumNotifications($User);
 }