/** * Draws {@link COMMENT}s and {@link ATTACHMENT}s. * @param ENTRY $obj * @param OBJECT_RENDERER_OPTIONS $options */ public function display($obj, $options = null) { $folder = $obj->parent_folder(); if ($this->login->is_allowed(Privilege_set_attachment, Privilege_view, $folder)) { $attachment_query = $obj->attachment_query(); if ($attachment_query->size()) { ?> <h2 id="attachments"> Attachments </h2> <div class="grid-content"> <?php $class_name = $this->app->final_class_name('ATTACHMENT_GRID', 'webcore/gui/attachment_grid.php'); /** @var $grid ATTACHMENT_GRID */ $grid = new $class_name($this->app); $grid->pager->page_anchor = 'attachments'; $grid->pager->page_number_var_name = 'attachment_page_number'; $grid->set_page_size(Default_page_size); $grid->set_query($attachment_query); $grid->display(); ?> </div> <?php } } if ($this->login->is_allowed(Privilege_set_comment, Privilege_view, $folder)) { $com_query = $obj->comment_query(); if ($com_query->size()) { $class_name = $this->app->final_class_name('COMMENT_LIST_RENDERER', 'webcore/gui/comment_renderer.php'); /** @var $com_renderer COMMENT_LIST_RENDERER */ $com_renderer = new $class_name($com_query, $obj); ?> <h2 id="comments" class="clear-both"> Comments </h2> <?php $commands = $com_renderer->make_commands(); if ($commands->num_executable_commands() > 0) { ?> <div class="button-content"> <span class="field"><?php echo $com_renderer->size(); ?> </span> Replies <?php $menu_renderer = $this->app->make_menu_renderer(); $menu_renderer->content_mode = Menu_show_as_buttons; $menu_renderer->display($commands); ?> </div> <?php } ?> <div class="grid-content"> <?php $com_renderer->display(); ?> </div> <?php } } }
/** * Draw the comments for the object. * Called from {@link draw()}. * @param ENTRY $entry * @access private */ protected function _draw_comments($entry) { if ($this->preview->options->show_comments != Print_comments_off) { $com_query = $entry->comment_query(); $num_comments = $com_query->size(); if ($num_comments) { $this->_draw_comments_start($num_comments); $this->_draw_comments_body($entry, $com_query); $this->_draw_comments_finish($num_comments); } } }