oxcontent.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class oxContent extends oxI18n
00010 {
00016     protected $_sCoreTbl = 'oxcontents';
00017 
00023     protected $_sClassName = 'oxcontent';
00024 
00031     protected $_aSkipSaveFields = array( 'oxtimestamp' );
00032 
00038     protected $_sNoparamlink = null;
00039 
00045     protected $_blExpanded = null;
00046 
00052     protected $_blIsSeoObject = true;
00053 
00061     public function __get( $sName )
00062     {
00063         switch ( $sName ) {
00064             case 'expanded':
00065                 return $this->getExpanded();
00066             }
00067         return parent::__get( $sName );
00068     }
00069 
00073     public function __construct()
00074     {
00075         parent::__construct();
00076         $this->init( 'oxcontents' );
00077     }
00078 
00084     public function getExpanded()
00085     {
00086         if ( !isset( $this->_blExpanded ) ) {
00087             $this->_blExpanded = ( $this->getId() == oxConfig::getParameter( 'tpl' ) );
00088         }
00089         return $this->_blExpanded;
00090     }
00091 
00099     public function loadByIdent( $sLoadId )
00100     {
00101         $sSelect = $this->buildSelectString( array( 'oxcontents.oxloadid' => $sLoadId,
00102                                                     'oxcontents.'.$this->getSqlFieldName( 'oxactive' ) => '1',
00103                                                     'oxcontents.oxshopid' => $this->getConfig()->getShopId() ) );
00104 
00105         $sRes = $this->assignRecord( $sSelect );
00106         return $sRes;
00107     }
00108 
00116     public function assign( $dbRecord )
00117     {
00118 
00119         parent::assign( $dbRecord );
00120         $this->oxcontents__oxcontent->setValue(str_replace( '&amp;', '&', $this->oxcontents__oxcontent->value ), oxField::T_RAW);
00121         $this->getLink();
00122     }
00123 
00132     public function getLink($iLang = null)
00133     {
00134         if (isset($iLang)) {
00135             $iLang = (int) $iLang;
00136             if ($iLang == (int) $this->getLanguage()) {
00137                 $iLang = null;
00138             }
00139         }
00140         if ( $this->_sNoparamlink === null || isset($iLang) ) {
00141             if ( oxUtils::getInstance()->seoIsActive() ) {
00142                 $sNoparamlink = oxSeoEncoderContent::getInstance()->getContentUrl( $this, $iLang );
00143             } else {
00144                 $sNoparamlink = $this->getStdLink($iLang);
00145             }
00146 
00147             if (isset($iLang)) {
00148                 return $sNoparamlink;
00149             } else {
00150                 $this->_sNoparamlink = $sNoparamlink;
00151             }
00152         }
00153 
00154         return $this->_sNoparamlink;
00155     }
00156 
00164     public function getStdLink($iLang = null)
00165     {
00166         $sAdd = '';
00167 
00168         if (isset($iLang) && !oxUtils::getInstance()->seoIsActive()) {
00169             $iLang = (int) $iLang;
00170             if ($iLang != (int) $this->getLanguage()) {
00171                 $sAdd .= "&amp;lang={$iLang}";
00172             }
00173         }
00174         if ($this->oxcontents__oxcatid->value && $this->oxcontents__oxcatid->value != 'oxrootid') {
00175             $sParentId = oxDb::getDb()->getOne("select oxparentid from oxcategories where oxid = '{$this->oxcontents__oxcatid->value}'");
00176             if ($sParentId && 'oxrootid' != $sParentId) {
00177                 $sAdd .= "&amp;cnid=$sParentId";
00178             }
00179         }
00180         return $this->getConfig()->getShopHomeURL() . "cl=content&amp;tpl=" . $this->getId() . $sAdd;
00181     }
00182 
00192     protected function _setFieldData( $sFieldName, $sValue, $iDataType = oxField::T_TEXT)
00193     {
00194         if ('oxcontent' === strtolower($sFieldName) || 'oxcontents__oxcontent' === strtolower($sFieldName)) {
00195             $iDataType = oxField::T_RAW;
00196         }
00197 
00198         return parent::_setFieldData($sFieldName, $sValue, $iDataType);
00199     }
00200 
00201 }

Generated on Thu Dec 4 12:04:56 2008 for OXID eShop CE by  doxygen 1.5.5