oxseoencodermanufacturer.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxSeoEncoderManufacturer extends oxSeoEncoder
00008 {
00012     protected static $_instance = null;
00013 
00019     public static function getInstance()
00020     {
00021         if (!self::$_instance) {
00022             self::$_instance = oxNew("oxSeoEncoderManufacturer");
00023         }
00024         return self::$_instance;
00025     }
00026 
00035     public function getManufacturerUri( $oManufacturer, $iLang = null )
00036     {
00037         if (!isset($iLang)) {
00038             $iLang = $oManufacturer->getLanguage();
00039         }
00040         // load from db
00041         if ( !( $sSeoUrl = $this->_loadFromDb( 'oxmanufacturer', $oManufacturer->getId(), $iLang ) ) ) {
00042 
00043             if ($iLang != $oManufacturer->getLanguage()) {
00044                 $sId = $oManufacturer->getId();
00045                 if ($sId == 'root') {
00046                     $oManufacturer = oxManufacturer::getRootManufacturer( $iLang );
00047                 } else {
00048                     $oManufacturer = oxNew('oxmanufacturer');
00049                     $oManufacturer->loadInLang($iLang, $sId);
00050                 }
00051             }
00052 
00053             $sSeoUrl = '';
00054             if ( $oManufacturer->getId() != 'root' ) {
00055                 $sSeoUrl .= $this->getManufacturerUri( oxManufacturer::getRootManufacturer( $iLang ), $iLang );
00056             }
00057 
00058             $sSeoUrl .= $this->_prepareTitle( $oManufacturer->oxmanufacturers__oxtitle->value .'/' );
00059             $sSeoUrl  = $this->_getUniqueSeoUrl( $sSeoUrl, '/', $oManufacturer->getId(), $iLang );
00060 
00061             // save to db
00062             $this->_saveToDb( 'oxmanufacturer', $oManufacturer->getId(), $oManufacturer->getStdLink(), $sSeoUrl, $iLang );
00063         }
00064         return $sSeoUrl;
00065     }
00066 
00077     public function getManufacturerPageUrl( $oManufacturer, $iPage, $iLang = null, $blFixed = false )
00078     {
00079         if (!isset($iLang)) {
00080             $iLang = $oManufacturer->getLanguage();
00081         }
00082         $sStdUrl = $oManufacturer->getStdLink() . '&amp;pgNr=' . $iPage;
00083         $sParams = sprintf( "%0" . ceil( $this->_iCntPages / 10 + 1 ) . "d", $iPage + 1 );
00084 
00085         $sStdUrl = $this->_trimUrl( $sStdUrl, $iLang );
00086         $sSeoUrl = $this->getManufacturerUri( $oManufacturer, $iLang ) . $sParams . "/";
00087 
00088         return $this->_getFullUrl( $this->_getPageUri( $oManufacturer, 'oxmanufacturers', $sStdUrl, $sSeoUrl, $sParams, $iLang, $blFixed ), $iLang );
00089     }
00090 
00099     public function getManufacturerUrl( $oManufacturer, $iLang = null )
00100     {
00101         if (!isset($iLang)) {
00102             $iLang = $oManufacturer->getLanguage();
00103         }
00104         return $this->_getFullUrl( $this->getManufacturerUri( $oManufacturer, $iLang ), $iLang );
00105     }
00106 
00114     public function onDeleteManufacturer($oManufacturer)
00115     {
00116         $sId = oxDb::getDb()->quote($oManufacturer->getId());
00117         oxDb::getDb()->execute("delete from oxseo where oxobjectid = $sId and oxtype = 'oxmanufacturers'");
00118     }
00119 }

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