function render() { // check if there is a notification for the article set up by this user if ($this->_article) { $notifications = new ArticleNotifications(); $userNotification = $notifications->getUserArticleNotification($this->_article->getId(), $this->_blogInfo->getId(), $this->_userInfo->getId()); // decide wether or not we should notify the user based on what we've just // fetched from the database if ($userNotification) { $this->setValue("sendNotification", true); } else { $this->setValue("sendNotification", false); } // set information about the post itself into the view $this->setValue("postTopic", $this->_article->getTopic()); $this->setValue("postText", preg_replace('/&/', '&', $this->_article->getIntroText())); $this->setValue("postExtendedText", preg_replace('/&/', '&', $this->_article->getExtendedText())); $this->setValue("postSlug", $this->_article->getPostSlug()); $this->setValue("postId", $this->_article->getId()); if ($this->_article->getCommentsEnabled()) { $commentsEnabled = true; } else { $commentsEnabled = false; } $this->setValue("postCommentsEnabled", $commentsEnabled); $this->setValue("postCategories", $this->_article->getCategoryIds()); $this->setValue("postStatus", $this->_article->getStatus()); // we need to play a bit with the values of the fields, as the editpost.template page is // expecting them in a bit different way than if we just do an $article->getFields() $customFieldValues = $this->_article->getFields(); $customField = array(); foreach ($customFieldValues as $fieldValue) { $customField[$fieldValue->getFieldId()] = $fieldValue->getValue(); } $this->setValue("customField", $customField); // related to the date $postDate = $this->_article->getDateObject(); $this->setValue("postYear", $postDate->getYear()); $this->setValue("postMonth", $postDate->getMonth()); $this->setValue("postDay", $postDate->getDay()); $this->setValue("postHour", $postDate->getHour()); $this->setValue("postMinutes", $postDate->getMinutes()); } // let our parent class do the rest... parent::render(); }