oxseoencodervendor.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxSeoEncoderVendor extends oxSeoEncoder
00008 {
00014     protected static $_instance = null;
00015 
00021     protected $_aRootVendorUri = null;
00022 
00028     public static function getInstance()
00029     {
00030         if (!self::$_instance) {
00031             self::$_instance = oxNew("oxSeoEncoderVendor");
00032         }
00033         return self::$_instance;
00034     }
00035 
00041     protected function _getUrlExtension()
00042     {
00043         return '/';
00044     }
00045 
00054     public function getVendorUri( $oVendor, $iLang = null )
00055     {
00056         if (!isset($iLang)) {
00057             $iLang = $oVendor->getLanguage();
00058         }
00059         // load from db
00060         if ( !( $sSeoUrl = $this->_loadFromDb( 'oxvendor', $oVendor->getId(), $iLang ) ) ) {
00061 
00062             if ($iLang != $oVendor->getLanguage()) {
00063                 $sId = $oVendor->getId();
00064                 $oVendor = oxNew('oxvendor');
00065                 $oVendor->loadInLang( $iLang, $sId );
00066             }
00067 
00068             $sSeoUrl = '';
00069             if ( $oVendor->getId() != 'root' ) {
00070                 if ( !isset( $this->_aRootVendorUri[$iLang] ) ) {
00071                     $oRootVendor = oxNew('oxvendor');
00072                     $oRootVendor->loadInLang( $iLang, 'root' );
00073                     $this->_aRootVendorUri[$iLang] = $this->getVendorUri( $oRootVendor, $iLang );
00074                 }
00075                 $sSeoUrl .= $this->_aRootVendorUri[$iLang];
00076             }
00077 
00078             $sSeoUrl .= $this->_prepareTitle( $oVendor->oxvendor__oxtitle->value .'/' );
00079             $sSeoUrl  = $this->_processSeoUrl( $sSeoUrl, $oVendor->getId(), $iLang );
00080 
00081             // save to db
00082             $this->_saveToDb( 'oxvendor', $oVendor->getId(), $oVendor->getStdLink(), $sSeoUrl, $iLang );
00083         }
00084         return $sSeoUrl;
00085     }
00086 
00097     public function getVendorPageUrl( $oVendor, $iPage, $iLang = null, $blFixed = false )
00098     {
00099         if (!isset($iLang)) {
00100             $iLang = $oVendor->getLanguage();
00101         }
00102         $sStdUrl = $oVendor->getStdLink() . '&amp;pgNr=' . $iPage;
00103         $sParams = sprintf( "%0" . ceil( $this->_iCntPages / 10 + 1 ) . "d", $iPage + 1 );
00104 
00105         $sStdUrl = $this->_trimUrl( $sStdUrl, $iLang );
00106         $sSeoUrl = $this->getVendorUri( $oVendor, $iLang ) . $sParams . "/";
00107 
00108         return $this->_getFullUrl( $this->_getPageUri( $oVendor, 'oxvendor', $sStdUrl, $sSeoUrl, $sParams, $iLang, $blFixed ), $iLang );
00109     }
00110 
00119     public function getVendorUrl( $oVendor, $iLang = null )
00120     {
00121         if (!isset($iLang)) {
00122             $iLang = $oVendor->getLanguage();
00123         }
00124         return $this->_getFullUrl( $this->getVendorUri( $oVendor, $iLang ), $iLang );
00125     }
00126 
00134     public function onDeleteVendor($oVendor)
00135     {
00136         $sId = oxDb::getDb()->quote($oVendor->getId());
00137         oxDb::getDb()->execute("delete from oxseo where oxobjectid = $sId and oxtype = 'oxvendor'");
00138     }
00139 }

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