/** * Displays and handles the form view. * * @author Christian Achatz * @version * Version 0.1, 22.08.2007<br /> * Version 0.2, 08.11.2007 (Implemented multi-language support)<br /> * Version 0.3, 28.12.2007 (Added a captcha)<br /> * Version 0.4, 13.06.2009 (Removed the captcha handling, introduced the captcha module)<br /> */ public function transformContent() { $form = $this->getForm('AddComment'); if ($form->isSent() == true) { /* @var $m ArticleCommentManager */ $m = $this->getServiceObject(ArticleCommentManager::class, [$this->getCategoryKey()]); if ($form->isValid() == true) { $articleComment = new ArticleComment(); $name = $form->getFormElementByName('Name'); $articleComment->setName($name->getAttribute('value')); $email = $form->getFormElementByName('EMail'); $articleComment->setEmail($email->getAttribute('value')); $comment = $form->getFormElementByName('Comment'); $articleComment->setComment($comment->getContent()); $m->saveEntry($articleComment); } else { $this->buildForm(); } } else { $this->buildForm(); } }
/** * Maps a database result set into s domain object. * * @param string[] $resultSet MySQL (database) result array. * * @return ArticleComment A initialized domain object. * * @author Christian W.Schäfer * @version * Version 0.1, 22.08.2007<br /> */ private function mapArticleComment2DomainObject($resultSet) { $comment = new ArticleComment(); $comment->setId($resultSet['ArticleCommentID']); $comment->setName($resultSet['Name']); $comment->setEmail($resultSet['EMail']); $comment->setComment($resultSet['Comment']); $comment->setDate($resultSet['Date']); $comment->setTime($resultSet['Time']); return $comment; }