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             }
00066         return parent::__get( $sName );
00067     }
00068 
00072     public function __construct()
00073     {
00074         parent::__construct();
00075         $this->init( 'oxcontents' );
00076     }
00077 
00083     public function getExpanded()
00084     {
00085         if ( !isset( $this->_blExpanded ) ) {
00086             $this->_blExpanded = ( $this->getId() == oxConfig::getParameter( 'oxcid' ) );
00087         }
00088         return $this->_blExpanded;
00089     }
00090 
00098     public function loadByIdent( $sLoadId )
00099     {
00100         $sSelect = $this->buildSelectString( array( 'oxcontents.oxloadid' => $sLoadId,
00101                                                     'oxcontents.'.$this->getSqlFieldName( 'oxactive' ) => '1',
00102                                                     'oxcontents.oxshopid' => $this->getConfig()->getShopId() ) );
00103 
00104         $sRes = $this->assignRecord( $sSelect );
00105         return $sRes;
00106     }
00107 
00115     public function assign( $dbRecord )
00116     {
00117 
00118         parent::assign( $dbRecord );
00119         $this->oxcontents__oxcontent->setValue(str_replace( '&amp;', '&', $this->oxcontents__oxcontent->value ), oxField::T_RAW);
00120         $this->getLink();
00121     }
00122 
00131     public function getLink($iLang = null)
00132     {
00133         if (isset($iLang)) {
00134             $iLang = (int) $iLang;
00135             if ($iLang == (int) $this->getLanguage()) {
00136                 $iLang = null;
00137             }
00138         }
00139         if ( $this->_sNoparamlink === null || isset($iLang) ) {
00140             if ( oxUtils::getInstance()->seoIsActive() ) {
00141                 $sNoparamlink = oxSeoEncoderContent::getInstance()->getContentUrl( $this, $iLang );
00142             } else {
00143                 $sNoparamlink = $this->getStdLink($iLang);
00144             }
00145 
00146             if (isset($iLang)) {
00147                 return $sNoparamlink;
00148             } else {
00149                 $this->_sNoparamlink = $sNoparamlink;
00150             }
00151         }
00152 
00153         return $this->_sNoparamlink;
00154     }
00155 
00163     public function getStdLink($iLang = null)
00164     {
00165         $sAdd = '';
00166 
00167         if (isset($iLang) && !oxUtils::getInstance()->seoIsActive()) {
00168             $iLang = (int) $iLang;
00169             if ($iLang != (int) $this->getLanguage()) {
00170                 $sAdd .= "&amp;lang={$iLang}";
00171             }
00172         }
00173         if ($this->oxcontents__oxcatid->value && $this->oxcontents__oxcatid->value != 'oxrootid') {
00174             $sParentId = oxDb::getDb()->getOne("select oxparentid from oxcategories where oxid = '{$this->oxcontents__oxcatid->value}'");
00175             if ($sParentId && 'oxrootid' != $sParentId) {
00176                 $sAdd .= "&amp;cnid=$sParentId";
00177             }
00178         }
00179         return $this->getConfig()->getShopHomeURL() . "cl=content&amp;oxcid=" . $this->getId() . $sAdd;
00180     }
00181 
00191     protected function _setFieldData( $sFieldName, $sValue, $iDataType = oxField::T_TEXT)
00192     {
00193         if ('oxcontent' === strtolower($sFieldName) || 'oxcontents__oxcontent' === strtolower($sFieldName)) {
00194             $iDataType = oxField::T_RAW;
00195         }
00196 
00197         return parent::_setFieldData($sFieldName, $sValue, $iDataType);
00198     }
00199 
00207     public function delete( $sOXID = null)
00208     {
00209         if (parent::delete($sOXID)) {
00210             oxSeoEncoderContent::getInstance()->onDeleteContent($this);
00211             return true;
00212         }
00213         return false;
00214     }
00215 }

Generated on Wed Apr 22 12:26:31 2009 for OXID eShop CE by  doxygen 1.5.5