object_seo.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class Object_Seo extends oxAdminDetails
00007 {
00015     public function render()
00016     {
00017         parent::render();
00018 
00019         if ( $sType = $this->_getType() ) {
00020             $oObject = oxNew( $sType );
00021             if ( $oObject->load( $this->getEditObjectId() ) ) {
00022                 $oOtherLang = $oObject->getAvailableInLangs();
00023                 if ( !isset( $oOtherLang[$iLang] ) ) {
00024                     $oObject->loadInLang( key( $oOtherLang ), $this->getEditObjectId() );
00025                 }
00026                 $this->_aViewData['edit'] = $oObject;
00027             }
00028 
00029         }
00030 
00031         $iLang  = $this->getEditLang();
00032         $aLangs = oxLang::getInstance()->getLanguageNames();
00033         foreach ( $aLangs as $sLangId => $sLanguage ) {
00034             $oLang = new oxStdClass();
00035             $oLang->sLangDesc = $sLanguage;
00036             $oLang->selected  = ( $sLangId == $iLang );
00037             $this->_aViewData['otherlang'][$sLangId] = clone $oLang;
00038         }
00039 
00040         return 'object_seo.tpl';
00041     }
00042 
00048     public function save()
00049     {
00050         // saving/updating seo params
00051         if ( ( $sOxid = $this->_getSaveObjectId() ) ) {
00052             $aSeoData = oxConfig::getParameter( 'aSeoData' );
00053             $iShopId  = $this->getConfig()->getShopId();
00054             $iLang    = $this->getEditLang();
00055 
00056             // checkbox handling
00057             if ( !isset( $aSeoData['oxfixed'] ) ) {
00058                 $aSeoData['oxfixed'] = 0;
00059             }
00060 
00061             $oEncoder = $this->_getEncoder();
00062 
00063             // marking self and page links as expired
00064             $oEncoder->markAsExpired( $sOxid, $iShopId, 1, $iLang );
00065 
00066             // saving
00067             $oEncoder->addSeoEntry( $sOxid, $iShopId, $iLang, $this->_getStdUrl( $sOxid ),
00068                                     $aSeoData['oxseourl'], $this->_getSeoEntryType(), $aSeoData['oxfixed'],
00069                                     trim( $aSeoData['oxkeywords'] ), trim( $aSeoData['oxdescription'] ), $this->processParam( $aSeoData['oxparams'] ), true, $this->_getAltSeoEntryId() );
00070         }
00071     }
00072 
00078     protected function _getSaveObjectId()
00079     {
00080         return $this->getEditObjectId();
00081     }
00082 
00090     public function getEntryMetaData( $sMetaType )
00091     {
00092         return $this->_getEncoder()->getMetaData( $this->getEditObjectId(), $sMetaType, $this->getConfig()->getShopId(), $this->getEditLang() );
00093     }
00094 
00100     public function isEntryFixed()
00101     {
00102         $iLang   = (int) $this->getEditLang();
00103         $iShopId = $this->getConfig()->getShopId();
00104 
00105         $sQ = "select oxfixed from oxseo where
00106                    oxseo.oxobjectid = ".oxDb::getDb()->quote( $this->getEditObjectId() )." and
00107                    oxseo.oxshopid = '{$iShopId}' and oxseo.oxlang = {$iLang} and oxparams = '' ";
00108         return (bool) oxDb::getDb()->getOne( $sQ );
00109     }
00110 
00116     protected function _getType()
00117     {
00118     }
00119 
00127     protected function _getStdUrl( $sOxid )
00128     {
00129         if ( $sType = $this->_getType() ) {
00130             $oObject = oxNew( $sType );
00131             if ( $oObject->load( $sOxid ) ) {
00132                return $oObject->getBaseStdLink( $this->getEditLang(), true, false );
00133             }
00134         }
00135     }
00136 
00142     public function getEditLang()
00143     {
00144         return $this->_iEditLang;
00145     }
00146 
00152     protected function _getAltSeoEntryId()
00153     {
00154     }
00155 
00161     protected function _getSeoEntryType()
00162     {
00163         return $this->_getType();
00164     }
00165 
00173     public function processParam( $sParam )
00174     {
00175         return $sParam;
00176     }
00177 
00183     protected function _getEncoder()
00184     {
00185     }
00186 
00192     public function getEntryUri()
00193     {
00194     }
00195 
00201     public function isEntrySuffixed()
00202     {
00203         return false;
00204     }
00205 
00211     public function isSuffixSupported()
00212     {
00213         return false;
00214     }
00215 
00221     public function showCatSelect()
00222     {
00223         return false;
00224     }
00225 
00231     public function getActCatType()
00232     {
00233         return false;
00234     }
00235 
00236 }