oxseoencoderrecomm.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxSeoEncoderRecomm extends oxSeoEncoder
00008 {
00012     protected static $_instance = null;
00013 
00021     public static function getInstance()
00022     {
00023         return oxRegistry::get("oxSeoEncoderRecomm");
00024     }
00025 
00034     public function getRecommUri( $oRecomm, $iLang = null )
00035     {
00036         if ( !( $sSeoUrl = $this->_loadFromDb( 'dynamic', $oRecomm->getId(), $iLang ) ) ) {
00037             $myConfig = $this->getConfig();
00038 
00039             // fetching part of base url
00040             $sSeoUrl = $this->_getStaticUri(
00041                         $oRecomm->getBaseStdLink( $iLang, false ),
00042                         $myConfig->getShopId(),
00043                         $iLang
00044                     )
00045                     .
00046                     $this->_prepareTitle( $oRecomm->oxrecommlists__oxtitle->value, false, $iLang );
00047 
00048             // creating unique
00049             $sSeoUrl = $this->_processSeoUrl( $sSeoUrl, $oRecomm->getId(), $iLang );
00050 
00051             // inserting
00052             $this->_saveToDb( 'dynamic', $oRecomm->getId(), $oRecomm->getBaseStdLink( $iLang ), $sSeoUrl, $iLang, $myConfig->getShopId() );
00053         }
00054 
00055         return $sSeoUrl;
00056     }
00057 
00066     public function getRecommUrl( $oRecomm, $iLang = null)
00067     {
00068         if (!isset($iLang)) {
00069             $iLang = oxRegistry::getLang()->getBaseLanguage();
00070         }
00071         return $this->_getFullUrl( $this->getRecommUri( $oRecomm, $iLang ), $iLang );
00072     }
00073 
00084     public function getRecommPageUrl( $oRecomm, $iPage, $iLang = null, $blFixed = false )
00085     {
00086         if (!isset($iLang)) {
00087             $iLang = oxRegistry::getLang()->getBaseLanguage();
00088         }
00089         $sStdUrl = $oRecomm->getBaseStdLink( $iLang ) . '&amp;pgNr=' . $iPage;
00090         $sParams = (int) ($iPage + 1);
00091 
00092         $sStdUrl = $this->_trimUrl( $sStdUrl, $iLang );
00093         $sSeoUrl = $this->getRecommUri( $oRecomm, $iLang ) . $sParams . "/";
00094 
00095         return $this->_getFullUrl( $this->_getPageUri( $oRecomm, 'dynamic', $sStdUrl, $sSeoUrl, $sParams, $iLang, $blFixed ), $iLang );
00096     }
00097 }