[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/view/ -> viewarticleview.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/view/blogview.class.php" );
   4      
   5      define( "VIEW_ARTICLE_TEMPLATE", "postandcomments" );    
   6      
   7      /**
   8       * \ingroup View
   9       * @private
  10       *
  11       * this view renders an article on the screen, with support for caching
  12       *
  13       * @see BlogView
  14       */
  15      class ViewArticleView extends BlogView
  16      {
  17      
  18          /**
  19           * creates the view
  20           */
  21  		function ViewArticleView( $blogInfo, $data = Array())
  22          {
  23              $this->BlogView( $blogInfo, VIEW_ARTICLE_TEMPLATE, SMARTY_VIEW_CACHE_CHECK, $data );
  24          }
  25          
  26          /**
  27           * sets the article that we're going to show
  28           *
  29           * @param an Article object
  30           * @return true
  31           */
  32  		function setArticle( $article )
  33          {
  34              $this->setValue( "post", $article );    
  35              
  36              return true;
  37          }
  38          
  39          /** 
  40           * Provides a meaningful page title. The pre-defined format is "blog name | post title"
  41           *
  42           * @return a page title
  43           */
  44  		function getPageTitle()
  45          {
  46              $article = $this->getValue( "post" );
  47              return( $this->_blogInfo->getBlog()." | ".$article->getTopic());
  48          }        
  49          
  50          /**
  51           * renders this view
  52           *
  53           * @return nothing
  54           */
  55  		function render()
  56          {
  57              // if our view is cached, there is not much to do here...
  58              if( $this->isCached()) {
  59                  parent::render();
  60                  return true;    
  61              }
  62              
  63              // get the next and previous articles, based on the article we're going to show
  64              $article = $this->getValue( 'post' );
  65              
  66              // notify of certain events
  67              $postText = $article->getIntroText();
  68              $postExtendedText = $article->getExtendedText();
  69              $this->_pm->notifyEvent( EVENT_TEXT_FILTER, Array( 'text' => &$postText ));
  70              $this->_pm->notifyEvent( EVENT_TEXT_FILTER, Array( 'text' => &$postExtendedText ));
  71              $article->setIntroText( $postText );
  72              $article->setExtendedText( $postExtendedText );            
  73              // and yet one event more
  74              $this->_pm->notifyEvent( EVENT_POST_LOADED, Array( 'article' => &$article ));
  75              
  76              // once ready, put the article back to the context of the view
  77              $this->setValue( 'post', $article );            
  78              //$this->setValue( 'comments', $article->getComments());
  79              $this->setValue( 'user', $article->getUser());
  80              $this->setValue( 'trackbacks', $article->getTrackbacks());
  81  
  82              // are comments allowed?
  83              $blogSettings = $this->_blogInfo->getSettings();
  84              $allowComments = ($blogSettings->getValue( "comments_enabled" ) && $article->getCommentsEnabled());
  85              $this->setValue( "allowComments", $allowComments );
  86              
  87              // render the main view
  88              parent::render();        
  89          }
  90      }
  91  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics