/** * Method to generate the markdown HTML render of the article content. * * @param array $fields Hash array of HTML fields to pass to the template. * * @since 1.0 * * @return string */ public function markdownView($fields = array()) { $config = ConfigProvider::getInstance(); $markdown = new MarkdownFacade($this->BO); $fields['markdownContent'] = $markdown->getContent(); return $this->loadTemplate($this->BO, 'markdown', $fields); }
/** * Method to generate the markdown HTML render of the ArticleComment content. * * @param array $fields hash array of HTML fields to pass to the template * * @since 1.0 * * @return string */ public function markdownView($fields = array()) { $config = ConfigProvider::getInstance(); $sessionProvider = $config->get('session.provider.name'); $session = SessionProviderFactory::getInstance($sessionProvider); $markdown = new MarkdownFacade($this->BO); $author = new Person(); $id = $this->BO->getCreatorID(); $author->load($id->getValue()); $html = '<blockquote class="usercomment">'; $createTS = $this->BO->getCreateTS(); $updateTS = $this->BO->getUpdateTS(); $html .= '<p>Posted by ' . ($author->get('URL') == '' ? $author->get('displayname') : '<a href="' . $author->get('URL') . '" target="new window">' . $author->get('displayname') . '</a>') . ' at ' . $createTS->getValue() . '.'; $html .= ' ' . $author->get('displayname') . ' has posted [' . $author->getCommentCount() . '] comments on articles since joining.'; $html .= '</p>'; if ($config->get('cms.comments.allowed') && $session->get('currentUser') != null && $session->get('currentUser')->getID() == $author->getID()) { $html .= $this->editView($fields); } else { $html .= $markdown->getContent(); } if ($createTS->getValue() != $updateTS->getValue()) { $updator = new Person(); $id = $this->BO->getCreatorID(); $updator->load($id->getValue()); $html .= '<p>Updated by ' . ($updator->get('URL') == '' ? $updator->get('displayname') : '<a href="' . $updator->get('URL') . '" target="new window">' . $updator->get('displayname') . '</a>') . ' at ' . $updateTS->getValue() . '.</p>'; } $html .= '</blockquote>'; return $html; }