oxcontent.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class oxContent extends oxI18n
00009 {
00015     protected $_sCoreTbl = 'oxcontents';
00016 
00022     protected $_sClassName = 'oxcontent';
00023 
00030     protected $_aSkipSaveFields = array( 'oxtimestamp' );
00031 
00037     protected $_sNoparamlink = null;
00038 
00044     protected $_blExpanded = null;
00045 
00051     protected $_blIsSeoObject = true;
00052 
00060     public function __get( $sName )
00061     {
00062         switch ( $sName ) {
00063             case 'expanded':
00064                 return $this->getExpanded();
00065                 break;
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( 'oxcid' ) );
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;oxcid=" . $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 
00208     public function delete( $sOXID = null)
00209     {
00210         if (parent::delete($sOXID)) {
00211             oxSeoEncoderContent::getInstance()->onDeleteContent($this);
00212             return true;
00213         }
00214         return false;
00215     }
00216 }

Generated on Tue Aug 18 09:21:05 2009 for OXID eShop CE by  doxygen 1.5.5