public function moderate($id, $show) { $comment = Comment::createFromId($this, $id); if (!$this->canModerate()) { $this->errorCollection->addOne(new Error(Loc::getMessage("FORUM_CM_RIGHTS4"), self::ERROR_PERMISSION)); } else { $comment->moderate($show); if ($comment->hasErrors()) { $this->errorCollection->add($comment->getErrors()); } else { return $comment->getComment(); } } return false; }
/** * Creates new * @param Feed $feed * @param $id * @return Comment */ public static function createFromId(Feed $feed, $id) { $forum = $feed->getForum(); $comment = new Comment($forum["ID"], $feed->getEntity()->getFullId()); $comment->setComment($id); return $comment; }
/** * Creates new * @param Feed $feed * @param $id * @return Comment */ public static function create(Feed $feed) { $forum = $feed->getForum(); $comment = new Comment($forum["ID"], $feed->getEntity()->getFullId()); $comment->getEntity()->setPermission($feed->getEntity()->getPermission()); return $comment; }