function OnPreRender() { /* @var $o_top_level Category */ $review_item = $this->o_topic->GetReviewItem(); $s_suggested_title = urlencode(StringFormatter::PlainText(trim($review_item->GetTitle()))); $s_page = urlencode($_SERVER['REQUEST_URI']); $s_subscribe_link = '/play/subscribe.php?type=' . $review_item->GetType() . '&item=' . $review_item->GetId() . '&title=' . $s_suggested_title . '&page=' . $s_page; $s_subscribe_title = 'Get an email alert every time there are new comments on this page'; $this->AddControl('<div class="forumSubscribe"><a href="' . $s_subscribe_link . '" title="' . $s_subscribe_title . '">Subscribe to comments</a></div>'); if (!$this->authentication_manager->GetUser()->Permissions()->HasPermission(PermissionType::ForumAddMessage())) { $add = $this->o_topic->GetCount() ? 'Add your comments' : 'Be the first to add your comments!'; $this->AddControl('<div class="forumPost"><a href="' . Html::Encode($this->authentication_manager->GetPermissionUrl()) . urlencode('#forumMessageForm') . '">' . $add . '</a></div>'); } }
private function DisplayComments() { # Display review topic listing require_once 'forums/forum-topic-listing.class.php'; require_once 'forums/forum-comments-topic-navbar.class.php'; if (!isset($this->topic)) { $this->topic = new ForumTopic($this->GetSettings()); } $this->topic->SetReviewItem($this->review_item); $signed_in = AuthenticationManager::GetUser()->IsSignedIn(); echo '<div id="comments-topic"'; if ($signed_in) { echo ' class="signed-in"'; } echo '>'; if ($this->topic->GetCount() or !$signed_in) { echo '<h2>Comments</h2>'; } $navbar = new ForumCommentsTopicNavbar($this->topic, $this->GetAuthenticationManager()); echo $navbar; $o_review_topic = new ForumTopicListing($this->GetSettings(), AuthenticationManager::GetUser(), $this->topic); echo $o_review_topic; if ($this->topic->GetCount() and !$signed_in) { echo $navbar; } # Add comment if (AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::ForumAddMessage())) { # create form $this->LoadClientScript("/scripts/tiny_mce/jquery.tinymce.js"); $this->LoadClientScript("/scripts/tinymce.js"); require_once 'forums/forum-message-form.class.php'; $o_form = new ForumMessageForm(); echo $o_form->GetForm(); } echo '</div>'; }
function OnPreRender() { if ($this->topic->GetCount()) { $this->AddControl($this->GetFormattedMessages()); } }