| // +---------------------------------------------------------------------------+ /** * Add comment block. Makes link to comment modules default form * * @package block */ require_once SGL_MOD_DIR . '/comment/classes/CommentContainer.php'; class Comment_Block_CommentTree { var $template = 'commentList.html'; var $templatePath = 'comment'; function init(&$output, $block_id, &$aParams) { SGL::logMessage(null, PEAR_LOG_DEBUG); return $this->getBlockContent($output, $aParams); } function getBlockContent(&$output, &$aParams) { SGL::logMessage(null, PEAR_LOG_DEBUG); $thisurl = $output->aProps['request']->getUri(); $cc = new CommentContainer($thisurl); $cc->buildTree(); $cCount = $cc->getCount(); $html = ''; if ($cCount > 0) { $html = $cc->getSubjectsAsHtmlSnippet(); } // add "add a comment" button // first try to find a default subject for new post if found (can be changed by user) if (!empty($output->pageTitle)) {$subject = $output->pageTitle;} elseif (!empty($output->leadArticle['title'])) {$subject = $output->leadArticle['title'];} $html .= '

'.SGL_String::translate('Total of').' '. $cCount.' '.SGL_String::translate('comments for this page','vprintf') .'

'; return $html; } } ?>