public function getFoldedEntityPreview($ident)
 {
     $type = $this->pp->getPostType();
     $postCP = $this->pp->getPostContentProviderByIdent($ident);
     $hasInDb = is_object($postCP);
     $post = null;
     if ($hasInDb) {
         $post = $postCP->getPost();
     } else {
         //Сделаем его форсированно загружаемым из шаблона
         $virtualPostParams['b_tpl'] = 1;
         $post = $this->pp->getVirtualPost($ident, $virtualPostParams);
         $postCP = ContentProviderFactory::getContentProvider($post);
     }
     //Накачиваем страницу
     $PARAMS = array('type' => $type, 'full' => '', 'short' => '', 'error' => '');
     try {
         $PARAMS['full'] = $postCP->getPostContent()->getContent();
         $PARAMS['short'] = $postCP->getPostContentShowcase()->getContent();
     } catch (Exception $ex) {
         $PARAMS['error'] = ExceptionHandler::getHtml($ex);
     }
     $info = $hasInDb ? $this->pp->postHref($post, null, null, null, true) : PsHtml::gray($post->isVirtual() ? 'Пост не зарегистрирован в базе' : 'Пост зарегистрирован в базе, но не виден пользователю');
     $content = PSSmarty::template('post/folded_prev.tpl', $PARAMS)->fetch();
     return array('info' => $info, 'content' => $content);
 }
 public function getFoldedEntityPreview($ident)
 {
     $type = $this->rp->getPostType();
     $rubricCP = $this->rp->getRubricContentProviderByIdent($ident);
     $hasInDb = is_object($rubricCP);
     $rubric = null;
     if ($hasInDb) {
         $rubric = $rubricCP->getRubric();
     } else {
         //Сделаем его форсированно загружаемым из шаблона
         $virtualRubricParams['b_tpl'] = 1;
         $rubric = $this->rp->getVirtualRubric($ident, $virtualRubricParams);
         $rubricCP = ContentProviderFactory::getContentProvider($rubric);
     }
     //Накачиваем страницу
     $PARAMS = array('type' => $type, 'full' => '', 'error' => '');
     try {
         $PARAMS['full'] = $rubricCP->getContent();
     } catch (Exception $ex) {
         $PARAMS['error'] = ExceptionHandler::getHtml($ex);
     }
     $info = $hasInDb ? $this->rp->rubricHref($rubric) : PsHtml::gray($rubric->isVirtual() ? 'Рубрика не зарегистрирована в базе' : 'Рубрика зарегистрирована в базе, но не видна пользователю');
     $content = PSSmarty::template('rubric/folded_prev.tpl', $PARAMS)->fetch();
     return array('info' => $info, 'content' => $content);
 }
Exemple #3
0
function smarty_block_gray($params, $content, Smarty_Internal_Template &$smarty)
{
    if ($content) {
        echo PsHtml::gray($content);
    }
}