示例#1
0
function smarty_modifier_post_meta(PostContentProvider $postCP, $news = false)
{
    $post = $postCP->getPost();
    $postId = $post->getId();
    $type = $post->getPostType();
    $pp = Handlers::getInstance()->getPostsProcessorByPostType($type);
    $rp = Handlers::getInstance()->getRubricsProcessorByPostType($type, false);
    $trStateToggle = null;
    $rubHref = null;
    $commentsHref = null;
    $name = null;
    if ($news) {
        $name = $post->getName();
        $name = "<span class=\"name\">{$name}</span>";
    }
    if (!$news && $post->getPostType() == POST_TYPE_TRAINING && AuthManager::isAuthorized()) {
        $trStateToggle = '<a href="#' . $postId . '" title="Изменить состояние урока" class="toggle">Пройден</a>';
    }
    $rubHref = $rp ? $rp->rubricHref($post->getRubricId(), null, 'rubric') : null;
    //    if (!$news) {
    $commentsCnt = $post->getCommentsCount();
    $commentsHref = $pp->postHref($post, "Комментариев: {$commentsCnt}", 'comments', array('class' => 'commentcount'));
    //    }
    if ($name || $trStateToggle || $rubHref || $commentsHref) {
        echo '<div class="post_meta">';
        echo "{$name}&nbsp;{$trStateToggle} {$rubHref} {$commentsHref}";
        echo '</div>';
    }
}
function smarty_modifier_post_content_showcase(PostContentProvider $cp)
{
    if ($cp->getPost()->is(POST_TYPE_ISSUE)) {
        return SmartyModifiers::post_anons_placeholder($cp);
    }
    return $cp->getPostContentShowcase()->getContent();
}
示例#3
0
function smarty_modifier_post_full_read(PostContentProvider $postCP)
{
    $post = $postCP->getPost();
    $type = $post->getPostType();
    $text = 'Читать полностью &raquo;';
    switch ($type) {
        case POST_TYPE_ISSUE:
            $text = 'Читать выпуск полностью &raquo;';
            break;
        case POST_TYPE_TRAINING:
            $text = 'Перейти к занятию &raquo;';
            break;
    }
    $tpl = PSSmarty::template('post/full_read.tpl');
    $tpl->assign('text', $text);
    $tpl->assign('post', $post);
    $tpl->display();
}
示例#4
0
function smarty_modifier_post_bottom(PostContentProvider $postCP)
{
    $tpl = PSSmarty::template('post/bottom.tpl');
    $tpl->assign('post', $postCP->getPost());
    $tpl->display();
}
示例#5
0
/**
 * Заголовок поста
 */
function smarty_modifier_post_header(PostContentProvider $postCP, $buildControl = true)
{
    return PSSmarty::template('common/post_header.tpl', array('post' => $postCP->getPost(), 'controls' => $buildControl))->fetch();
}
function smarty_modifier_post_discussion(PostContentProvider $postCP, $limited = true)
{
    $post = $postCP->getPost();
    echo Handlers::getInstance()->getCommentsProcessorByPostType($post->getPostType())->buildDiscussion($post->getId(), $limited);
}
示例#7
0
文件: print.php 项目: ilivanoff/www
 public function getTitle()
 {
     return $this->postCP->getPost()->getName() . ' (версия для печати)';
 }