content.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class Content extends oxUBase
00007 {
00012     protected $_sContentId = null;
00013 
00018     protected $_oContent = null;
00019 
00024     protected $_sThisTemplate = 'content.tpl';
00025 
00030     protected $_sThisPlainTemplate = 'content_plain.tpl';
00031 
00036      protected $_oContentCat = null;
00037 
00043     public function init()
00044     {
00045         if ( oxUtils::getInstance()->seoIsActive() ) {
00046             // cleaning category id tracked by SEO
00047             $this->setSessionCategoryId( null );
00048         }
00049 
00050         parent::init();
00051     }
00052 
00058     public function getViewId()
00059     {
00060         if ( isset( $this->_sViewId ) ) {
00061             return $this->_sViewId;
00062         }
00063         return $this->_sViewId = parent::getViewId().'|'.oxConfig::getParameter( 'tpl' );
00064     }
00065 
00076     public function render()
00077     {
00078         parent::render();
00079 
00080         $this->_aViewData['tpl'] = $this->getContentId();
00081         $this->_aViewData['oContent'] = $this->getContent();
00082 
00083         // generating meta info
00084         $this->setMetaDescription( $this->getContent()->oxcontents__oxtitle->value, 200, true );
00085         $this->setMetaKeywords( $this->getContent()->oxcontents__oxtitle->value );
00086 
00087         // sometimes you need to display plain templates (e.g. when showing popups)
00088         if ( $this->showPlainTemplate() ) {
00089             $this->_sThisTemplate = $this->_sThisPlainTemplate;
00090         }
00091         return $this->_sThisTemplate;
00092     }
00093 
00099     public function getContentCategory()
00100     {
00101         if ( $this->_oContentCat === null ) {
00102             // setting default status ..
00103             $this->_oContentCat = false;
00104             if ( ( $oContent = $this->getContent() ) && $oContent->oxcontents__oxtype->value == 2 ) {
00105                 $this->_oContentCat = $oContent;
00106             }
00107         }
00108         return $this->_oContentCat;
00109     }
00110 
00116     public function showPlainTemplate()
00117     {
00118         return (bool) oxConfig::getParameter( 'plain' );
00119     }
00120 
00126     protected function _getSeoObjectId()
00127     {
00128         return oxConfig::getParameter( 'tpl' );
00129     }
00130 
00136     public function getContentId()
00137     {
00138         if ( $this->_oContentId === null ) {
00139             $this->_oContentId = false;
00140             $sContentId = oxConfig::getParameter( 'tpl' );
00141             $oContent   = oxNew( 'oxcontent' );
00142             if ( $oContent->load( $sContentId ) && $oContent->oxcontents__oxactive->value ) {
00143                 $this->_oContentId = $sContentId;
00144                 $this->_oContent = $oContent;
00145             }
00146         }
00147         return $this->_oContentId;
00148     }
00149 
00155     public function getContent()
00156     {
00157         if ( $this->_oContent === null ) {
00158             $this->_oContent = false;
00159             if ( $this->getContentId() ) {
00160                 return $this->_oContent;
00161             }
00162         }
00163         return $this->_oContent;
00164     }
00165 
00172     protected function getSubject()
00173     {
00174         return $this->getContent();
00175     }
00176 }

Generated on Thu Feb 19 15:02:22 2009 for OXID eShop CE by  doxygen 1.5.5