object_seo.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class Object_Seo extends oxAdminDetails
00007 {
00008 
00016     public function render()
00017     {
00018         parent::render();
00019 
00020         if ($sType = $this->_getType()) {
00021             $oObject = oxNew($sType);
00022             if ($oObject->load($this->getEditObjectId())) {
00023                 $oOtherLang = $oObject->getAvailableInLangs();
00024                 if (!isset($oOtherLang[$iLang])) {
00025                     $oObject->loadInLang(key($oOtherLang), $this->getEditObjectId());
00026                 }
00027                 $this->_aViewData['edit'] = $oObject;
00028             }
00029 
00030         }
00031 
00032         $iLang = $this->getEditLang();
00033         $aLangs = oxRegistry::getLang()->getLanguageNames();
00034         foreach ($aLangs as $sLangId => $sLanguage) {
00035             $oLang = new stdClass();
00036             $oLang->sLangDesc = $sLanguage;
00037             $oLang->selected = ($sLangId == $iLang);
00038             $this->_aViewData['otherlang'][$sLangId] = clone $oLang;
00039         }
00040 
00041         return 'object_seo.tpl';
00042     }
00043 
00047     public function save()
00048     {
00049         // saving/updating seo params
00050         if (($sOxid = $this->_getSaveObjectId())) {
00051             $aSeoData = oxRegistry::getConfig()->getRequestParameter('aSeoData');
00052             $iShopId = $this->getConfig()->getShopId();
00053             $iLang = $this->getEditLang();
00054 
00055             // checkbox handling
00056             if (!isset($aSeoData['oxfixed'])) {
00057                 $aSeoData['oxfixed'] = 0;
00058             }
00059 
00060             $oEncoder = $this->_getEncoder();
00061 
00062             // marking self and page links as expired
00063             $oEncoder->markAsExpired($sOxid, $iShopId, 1, $iLang);
00064 
00065             // saving
00066             $oEncoder->addSeoEntry(
00067                 $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     }
00073 
00079     protected function _getSaveObjectId()
00080     {
00081         return $this->getEditObjectId();
00082     }
00083 
00091     public function getEntryMetaData($sMetaType)
00092     {
00093         return $this->_getEncoder()->getMetaData($this->getEditObjectId(), $sMetaType, $this->getConfig()->getShopId(), $this->getEditLang());
00094     }
00095 
00101     public function isEntryFixed()
00102     {
00103         $iLang = (int) $this->getEditLang();
00104         $iShopId = $this->getConfig()->getShopId();
00105 
00106         $sQ = "select oxfixed from oxseo where
00107                    oxseo.oxobjectid = " . oxDb::getDb()->quote($this->getEditObjectId()) . " and
00108                    oxseo.oxshopid = '{$iShopId}' and oxseo.oxlang = {$iLang} and oxparams = '' ";
00109 
00110         return (bool) oxDb::getDb()->getOne($sQ, false, false);
00111     }
00112 
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 
00150     protected function _getAltSeoEntryId()
00151     {
00152     }
00153 
00159     protected function _getSeoEntryType()
00160     {
00161         return $this->_getType();
00162     }
00163 
00171     public function processParam($sParam)
00172     {
00173         return $sParam;
00174     }
00175 
00179     protected function _getEncoder()
00180     {
00181     }
00182 
00186     public function getEntryUri()
00187     {
00188     }
00189 
00195     public function isEntrySuffixed()
00196     {
00197         return false;
00198     }
00199 
00205     public function isSuffixSupported()
00206     {
00207         return false;
00208     }
00209 
00215     public function showCatSelect()
00216     {
00217         return false;
00218     }
00219 
00225     public function getActCatType()
00226     {
00227         return false;
00228     }
00229 }