Example #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>';
    }
}
Example #2
0
 public function buildContent()
 {
     //Можно и не устанавливать, т.к. к popup окнам мы не подключаем спрайты
     PsDefines::setReplaceFormulesWithSprites(false);
     $params = array('prinvView' => $this->postCP->getPostPrintVariant());
     return $this->getFoldedEntity()->fetchTpl($params);
 }
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();
}
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();
}
Example #5
0
function smarty_modifier_short_tr_info(PostContentProvider $postCP)
{
    $fetchData = $postCP->getPostParams();
    /*
     * Обработаем данные плагинов
     */
    $PLUGIN_TESTINGS = array();
    $pluginsData = $fetchData->getPluginsData();
    foreach ($pluginsData as $pldata) {
        $ident = $pldata[0];
        $data = $pldata[1];
        //#1
        switch ($ident) {
            case PluginsManager::PLUGIN_TESTING:
                $testingId = $data;
                $PLUGIN_TESTINGS[] = array(TestingBean::inst()->getTestingById($testingId), TestingManager::getInstance()->getTestingResults($testingId));
                break;
        }
        //#1
    }
    PSSmarty::template('tr/short_info.tpl', array('data' => $fetchData, 'testings' => $PLUGIN_TESTINGS))->display();
}
Example #6
0
function smarty_modifier_post_bottom(PostContentProvider $postCP)
{
    $tpl = PSSmarty::template('post/bottom.tpl');
    $tpl->assign('post', $postCP->getPost());
    $tpl->display();
}
Example #7
0
function smarty_modifier_post_content(PostContentProvider $cp)
{
    echo $cp->getPostContent()->getContent();
}
Example #8
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);
}