oxviewconfig.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class oxViewConfig extends oxSuperCfg
00009 {
00015     protected $_oShop = null;
00016 
00022     protected $_aViewData = null;
00023 
00029     protected $_aConfigParams = array();
00030 
00036     protected $_sHelpPageLink = null;
00037 
00043     protected $_oCountryList = null;
00044 
00050     public function getHomeLink()
00051     {
00052         if ( ( $sValue = $this->getViewConfigParam( 'homeLink' ) ) === null ) {
00053             $myConfig = $this->getConfig();
00054             $myUtils  = oxUtils::getInstance();
00055             $oLang    = oxLang::getInstance();
00056             $iLang = $oLang->getBaseLanguage();
00057 
00058             $sValue = null;
00059 
00060             $blAddStartCl = $myUtils->seoIsActive() && ( $iLang != $myConfig->getConfigParam( 'sDefaultLang' ) );
00061 
00062 
00063             if ( $blAddStartCl ) {
00064                 $sValue = oxSeoEncoder::getInstance()->getStaticUrl( $this->getSelfLink() . 'cl=start', $iLang );
00065                 $sValue = oxUtilsUrl::getInstance()->appendUrl(
00066                         $sValue,
00067                         oxUtilsUrl::getInstance()->getBaseAddUrlParams()
00068                     );
00069                 $sValue = getStr()->preg_replace('/(\?|&(amp;)?)$/', '', $sValue);
00070             }
00071 
00072             if ( !$sValue ) {
00073                 $sValue = getStr()->preg_replace('#index.php\??$#', '', $this->getSelfLink());
00074             }
00075 
00076             $this->setViewConfigParam( 'homeLink', $sValue );
00077         }
00078         return $sValue;
00079     }
00080 
00086     public function getActTplName()
00087     {
00088         $sTplName = oxConfig::getParameter( 'tpl' );
00089         // #M1176: Logout from CMS page
00090         if ( !$sTplName ) {
00091             $sTplName = $this->getViewConfigParam('tpl');
00092         }
00093         return $sTplName ? basename( $sTplName ) : null;
00094     }
00095 
00101     public function getLogoutLink()
00102     {
00103         $sClass         = $this->getActionClassName();
00104         $sCatnid        = $this->getActCatId();
00105         $sArtnid        = $this->getActArticleId();
00106         $sTplName       = $this->getActTplName();
00107         $sSearchParam   = $this->getActSearchParam();
00108         $sSearchTag     = $this->getActSearchTag();
00109         $sListType      = $this->getActListType();
00110 
00111 
00112         return $this->getConfig()->getShopHomeURL()
00113             ."cl={$sClass}"
00114             . ( $sCatnid ? "&amp;cnid={$sCatnid}" : '' )
00115             . ( $sArtnid ? "&amp;anid={$sArtnid}" : '' )
00116             . ( $sSearchParam ? "&amp;searchparam={$sSearchParam}" : '' )
00117             . ( $sSearchTag ? "&amp;searchtag={$sSearchTag}" : '' )
00118             . ( $sListType ? "&amp;listtype={$sListType}" : '' )
00119             . "&amp;fnc=logout"
00120             . ( $sTplName ? "&amp;tpl=".basename( $sTplName ) : '' )
00121             . "&amp;redirect=1";
00122     }
00123 
00129     public function getHelpPageLink()
00130     {
00131         if ( $this->_sHelpPageLink === null ) {
00132             $oConfig  = $this->getConfig();
00133             $sClass   = $this->getActiveClassName();
00134             $sLink    = false;
00135             $sAddQ    = "oxshopid = '".$oConfig->getShopId()."' and oxactive = 1 and";
00136             $sViewName = getViewName( 'oxcontents' );
00137 
00138             // checking if there is a custom content for help page
00139             $sQ  = "select oxid from {$sViewName} where {$sAddQ} oxloadid = 'oxhelp".strtolower( $sClass )."' union ";
00140             $sQ .= "select oxid from {$sViewName} where {$sAddQ} oxloadid = 'oxhelpdefault'";
00141 
00142             if ( $sContentId = oxDb::getDb()->getOne( $sQ ) ) {
00143                 $oContent = oxNew( "oxcontent" );
00144                 $oContent->load( $sContentId );
00145                 $sLink = $oContent->getLink();
00146             }
00147 
00148             $this->_sHelpPageLink = $sLink ? $sLink : $this->getHelpLink();
00149         }
00150         return $this->_sHelpPageLink;
00151     }
00152 
00158     public function getHelpLink()
00159     {
00160         $sTplName = $this->getActTplName();
00161         $sClass   = $this->getActiveClassName();
00162         return $this->getConfig()->getShopCurrentURL()."cl=help&amp;page={$sClass}".( $sTplName ? "&amp;tpl={$sTplName}" : '' );
00163     }
00164 
00170     public function getActCatId()
00171     {
00172         return oxConfig::getParameter( 'cnid' );
00173     }
00174 
00180     public function getActArticleId()
00181     {
00182         return oxConfig::getParameter( 'anid' );
00183     }
00184 
00190     public function getActSearchParam()
00191     {
00192         return oxConfig::getParameter( 'searchparam' );
00193     }
00194 
00200     public function getActSearchTag()
00201     {
00202         return oxConfig::getParameter( 'searchtag' );
00203     }
00204 
00210     public function getActListType()
00211     {
00212         return oxConfig::getParameter( 'listtype' );
00213     }
00214 
00220     public function getActManufacturerId()
00221     {
00222         return oxConfig::getParameter( 'mnid' );
00223     }
00224 
00236     public function setViewConfigParam( $sName, $sValue )
00237     {
00238         startProfile('oxviewconfig::setViewConfigParam');
00239 
00240         $this->_aConfigParams[$sName] = $sValue;
00241 
00242         stopProfile('oxviewconfig::setViewConfigParam');
00243     }
00244 
00252     public function getViewConfigParam( $sName )
00253     {
00254         startProfile('oxviewconfig::getViewConfigParam');
00255 
00256         if ( $this->_oShop && isset( $this->_oShop->$sName ) ) {
00257             $sValue = $this->_oShop->$sName;
00258         } elseif ( $this->_aViewData && isset( $this->_aViewData[ $sName ] ) ) {
00259             $sValue = $this->_aViewData[ $sName ];
00260         } else {
00261             $sValue = ( isset( $this->_aConfigParams[ $sName ] ) ? $this->_aConfigParams[ $sName ] : null );
00262         }
00263 
00264         stopProfile('oxviewconfig::getViewConfigParam');
00265 
00266         return $sValue;
00267     }
00268 
00278     public function setViewShop( $oShop, $aViewData )
00279     {
00280         $this->_oShop     = $oShop;
00281         $this->_aViewData = $aViewData;
00282     }
00283 
00289     public function getSessionId()
00290     {
00291         if ( ( $sValue = $this->getViewConfigParam( 'sessionid' ) ) === null ) {
00292             $sValue = $this->getSession()->getId();
00293             $this->setViewConfigParam( 'sessionid', $sValue );
00294         }
00295         return $sValue;
00296     }
00297 
00303     public function getHiddenSid()
00304     {
00305         if ( ( $sValue = $this->getViewConfigParam( 'hiddensid' ) ) === null ) {
00306             $sValue = $this->getSession()->hiddenSid();
00307 
00308             // appending language info to form
00309             if ( ( $sLang = oxLang::getInstance()->getFormLang() ) ) {
00310                 $sValue .= "\n{$sLang}";
00311             }
00312 
00313 
00314             $this->setViewConfigParam( 'hiddensid', $sValue );
00315         }
00316         return $sValue;
00317     }
00318 
00324     public function getSelfLink()
00325     {
00326         if ( ( $sValue = $this->getViewConfigParam( 'selflink' ) ) === null ) {
00327             $sValue = $this->getConfig()->getShopHomeURL();
00328             $this->setViewConfigParam( 'selflink', $sValue );
00329         }
00330         return $sValue;
00331     }
00332 
00338     public function getSslSelfLink()
00339     {
00340         if ( ( $sValue = $this->getViewConfigParam( 'sslselflink' ) ) === null ) {
00341             $sValue = $this->getConfig()->getShopSecureHomeURL();
00342             $this->setViewConfigParam( 'sslselflink', $sValue );
00343         }
00344         return $sValue;
00345     }
00346 
00352     public function getBaseDir()
00353     {
00354         if ( ( $sValue = $this->getViewConfigParam( 'basedir' ) ) === null ) {
00355             $sValue = $this->getConfig()->getShopURL();
00356             $this->setViewConfigParam( 'basedir', $sValue );
00357         }
00358         return $sValue;
00359     }
00360 
00366     public function getCoreUtilsDir()
00367     {
00368         if ( ( $sValue = $this->getViewConfigParam( 'coreutilsdir' ) ) === null ) {
00369             $sValue = $this->getConfig()->getCoreUtilsURL();
00370             $this->setViewConfigParam( 'coreutilsdir', $sValue );
00371         }
00372         return $sValue;
00373     }
00374 
00380     public function getSelfActionLink()
00381     {
00382         if ( ( $sValue = $this->getViewConfigParam( 'selfactionlink' ) ) === null ) {
00383             $sValue = $this->getConfig()->getShopCurrentUrl();
00384             $this->setViewConfigParam( 'selfactionlink', $sValue );
00385         }
00386         return $sValue;
00387     }
00388 
00394     public function getCurrentHomeDir()
00395     {
00396         if ( ( $sValue = $this->getViewConfigParam( 'currenthomedir' ) ) === null ) {
00397             $sValue = $this->getConfig()->getCurrentShopUrl();
00398             $this->setViewConfigParam( 'currenthomedir', $sValue );
00399         }
00400         return $sValue;
00401     }
00402 
00408     public function getBasketLink()
00409     {
00410         if ( ( $sValue = $this->getViewConfigParam( 'basketlink' ) ) === null ) {
00411             $sValue = $this->getConfig()->getShopHomeURL()   . 'cl=basket';
00412             $this->setViewConfigParam( 'basketlink', $sValue );
00413         }
00414         return $sValue;
00415     }
00416 
00422     public function getOrderLink()
00423     {
00424         if ( ( $sValue = $this->getViewConfigParam( 'orderlink' ) ) === null ) {
00425             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=user';
00426             $this->setViewConfigParam( 'orderlink', $sValue );
00427         }
00428         return $sValue;
00429     }
00430 
00436     public function getPaymentLink()
00437     {
00438         if ( ( $sValue = $this->getViewConfigParam( 'paymentlink' ) ) === null ) {
00439             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=payment';
00440             $this->setViewConfigParam( 'paymentlink', $sValue );
00441         }
00442         return $sValue;
00443     }
00444 
00450     public function getExeOrderLink()
00451     {
00452         if ( ( $sValue = $this->getViewConfigParam( 'exeorderlink' ) ) === null ) {
00453             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order&amp;fnc=execute';
00454             $this->setViewConfigParam( 'exeorderlink', $sValue );
00455         }
00456         return $sValue;
00457     }
00458 
00464     public function getOrderConfirmLink()
00465     {
00466         if ( ( $sValue = $this->getViewConfigParam( 'orderconfirmlink' ) ) === null ) {
00467             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order';
00468             $this->setViewConfigParam( 'orderconfirmlink', $sValue );
00469         }
00470         return $sValue;
00471     }
00472 
00478     public function getResourceUrl()
00479     {
00480         if ( ( $sValue = $this->getViewConfigParam( 'basetpldir' ) ) === null ) {
00481             $sValue = $this->getConfig()->getResourceUrl( null, $this->isAdmin() );
00482             $this->setViewConfigParam( 'basetpldir', $sValue );
00483         }
00484         return $sValue;
00485     }
00486 
00492     public function getTemplateDir()
00493     {
00494         if ( ( $sValue = $this->getViewConfigParam( 'templatedir' ) ) === null ) {
00495             $sValue = $this->getConfig()->getTemplateDir( $this->isAdmin() );
00496             $this->setViewConfigParam( 'templatedir', $sValue );
00497         }
00498         return $sValue;
00499     }
00500 
00506     public function getUrlTemplateDir()
00507     {
00508         if ( ( $sValue = $this->getViewConfigParam( 'urltemplatedir' ) ) === null ) {
00509             $sValue = $this->getConfig()->getTemplateUrl( $this->isAdmin() );
00510             $this->setViewConfigParam( 'urltemplatedir', $sValue );
00511         }
00512         return $sValue;
00513     }
00514 
00520     public function getImageUrl()
00521     {
00522         if ( ( $sValue = $this->getViewConfigParam( 'imagedir' ) ) === null ) {
00523             $sValue = $this->getConfig()->getImageUrl( $this->isAdmin() );
00524             $this->setViewConfigParam( 'imagedir', $sValue );
00525         }
00526         return $sValue;
00527     }
00528 
00534     public function getNoSslImageDir()
00535     {
00536         if ( ( $sValue = $this->getViewConfigParam( 'nossl_imagedir' ) ) === null ) {
00537             $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), false );
00538             $this->setViewConfigParam( 'nossl_imagedir', $sValue );
00539         }
00540         return $sValue;
00541     }
00542 
00549     public function getPictureDir()
00550     {
00551         if ( ( $sValue = $this->getViewConfigParam( 'picturedir' ) ) === null ) {
00552             $sValue = $this->getConfig()->getPictureUrl( null, $this->isAdmin() );
00553             $this->setViewConfigParam( 'picturedir', $sValue );
00554         }
00555         return $sValue;
00556     }
00557 
00563     public function getAdminDir()
00564     {
00565         if ( ( $sValue = $this->getViewConfigParam( 'sAdminDir' ) ) === null ) {
00566             $sValue = $this->getConfig()->getConfigParam( 'sAdminDir' );
00567             $this->setViewConfigParam( 'sAdminDir', $sValue );
00568         }
00569         return $sValue;
00570     }
00571 
00577     public function getActiveShopId()
00578     {
00579         if ( ( $sValue = $this->getViewConfigParam( 'shopid' ) ) === null ) {
00580             $sValue = $this->getConfig()->getShopId();
00581             $this->setViewConfigParam( 'shopid', $sValue );
00582         }
00583         return $sValue;
00584     }
00585 
00591     public function isSsl()
00592     {
00593         if ( ( $sValue = $this->getViewConfigParam( 'isssl' ) ) === null ) {
00594             $sValue = $this->getConfig()->isSsl();
00595             $this->setViewConfigParam( 'isssl', $sValue );
00596         }
00597         return $sValue;
00598     }
00599 
00600 
00606     public function getRemoteAddress()
00607     {
00608         if ( ( $sValue = $this->getViewConfigParam( 'ip' ) ) === null ) {
00609             $sValue = oxUtilsServer::getInstance()->getRemoteAddress();
00610             $this->setViewConfigParam( 'ip', $sValue );
00611         }
00612         return $sValue;
00613     }
00614 
00620     public function getPopupIdent()
00621     {
00622         if ( ( $sValue = $this->getViewConfigParam( 'popupident' ) ) === null ) {
00623             $sValue = md5( $this->getConfig()->getShopUrl() );
00624             $this->setViewConfigParam( 'popupident', $sValue );
00625         }
00626         return $sValue;
00627     }
00628 
00634     public function getPopupIdentRand()
00635     {
00636         if ( ( $sValue = $this->getViewConfigParam( 'popupidentrand' ) ) === null ) {
00637             $sValue = md5( time() );
00638             $this->setViewConfigParam( 'popupidentrand', $sValue );
00639         }
00640         return $sValue;
00641     }
00642 
00648     public function getArtPerPageForm()
00649     {
00650         if ( ( $sValue = $this->getViewConfigParam( 'artperpageform' ) ) === null ) {
00651             $sValue = $this->getConfig()->getShopCurrentUrl();
00652             $this->setViewConfigParam( 'artperpageform', $sValue );
00653         }
00654         return $sValue;
00655     }
00656 
00662     public function isBuyableParent()
00663     {
00664         return $this->getConfig()->getConfigParam( 'blVariantParentBuyable' );
00665     }
00666 
00672     public function showBirthdayFields()
00673     {
00674         return $this->getConfig()->getConfigParam( 'blShowBirthdayFields' );
00675     }
00676 
00682     public function showFinalStep()
00683     {
00684         return $this->getConfig()->getConfigParam( 'blShowFinalStep' );
00685     }
00686 
00692     public function getNrOfCatArticles()
00693     {
00694         // checking if all needed data is set
00695         switch (oxSession::getVar( 'ldtype' )) {
00696             case 'grid':
00697                 return $this->getConfig()->getConfigParam( 'aNrofCatArticlesInGrid' );
00698                 break;
00699             case 'line':
00700             case 'infogrid':
00701             default:
00702                 return $this->getConfig()->getConfigParam( 'aNrofCatArticles' );
00703         }
00704     }
00705 
00711     public function getShowWishlist()
00712     {
00713         return $this->getConfig()->getConfigParam( 'bl_showWishlist' );
00714     }
00715 
00721     public function getShowCompareList()
00722     {
00723         $myConfig = $this->getConfig();
00724         $blShowCompareList = true;
00725 
00726         if ( !$myConfig->getConfigParam( 'bl_showCompareList' ) ||
00727             ( $myConfig->getConfigParam( 'blDisableNavBars' ) && $myConfig->getActiveView()->getIsOrderStep() ) ) {
00728             $blShowCompareList = false;
00729         }
00730 
00731         return $blShowCompareList;
00732     }
00733 
00739     public function getShowListmania()
00740     {
00741         return $this->getConfig()->getConfigParam( 'bl_showListmania' );
00742     }
00743 
00749     public function getShowVouchers()
00750     {
00751         return $this->getConfig()->getConfigParam( 'bl_showVouchers' );
00752     }
00753 
00759     public function getShowGiftWrapping()
00760     {
00761         return $this->getConfig()->getConfigParam( 'bl_showGiftWrapping' );
00762     }
00763 
00769     public function isAutoSearchOnCat()
00770     {
00771         return $this->getConfig()->getConfigParam( 'blAutoSearchOnCat' );
00772     }
00773 
00779     public function getActLanguageId()
00780     {
00781         if ( ( $sValue = $this->getViewConfigParam( 'lang' ) ) === null ) {
00782             $iLang = oxConfig::getParameter( 'lang' );
00783             $sValue = ( $iLang !== null ) ? $iLang : oxLang::getInstance()->getBaseLanguage();
00784             $this->setViewConfigParam( 'lang', $sValue );
00785         }
00786         return $sValue;
00787     }
00788 
00794     public function getActiveClassName()
00795     {
00796         return $this->getConfig()->getActiveView()->getClassName();
00797     }
00798 
00804     public function getArtPerPageCount()
00805     {
00806         return $this->getViewConfigParam( 'iartPerPage' );
00807     }
00808 
00814     public function getNavUrlParams()
00815     {
00816         if ( ( $sParams = $this->getViewConfigParam( 'navurlparams' ) ) === null ) {
00817             $sParams = '';
00818             $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00819             foreach ( $aNavParams as $sName => $sValue ) {
00820                 if ( isset( $sValue ) ) {
00821                     if ( $sParams ) {
00822                         $sParams .= '&amp;';
00823                     }
00824                     $sParams .= "{$sName}=".rawurlencode( $sValue );
00825                 }
00826             }
00827             if ( $sParams ) {
00828                 $sParams = '&amp;'.$sParams;
00829             }
00830             $this->setViewConfigParam( 'navurlparams', $sParams );
00831         }
00832 
00833         return $sParams;
00834     }
00835 
00841     public function getNavFormParams()
00842     {
00843 
00844         if ( ( $sParams = $this->getViewConfigParam( 'navformparams' ) ) === null ) {
00845             $oStr = getStr();
00846             $sParams = '';
00847             $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00848             foreach ( $aNavParams as $sName => $sValue ) {
00849                 if ( isset( $sValue ) ) {
00850                     $sParams .= "<input type=\"hidden\" name=\"{$sName}\" value=\"".$oStr->htmlentities( $sValue )."\">\n";
00851                 }
00852             }
00853             $this->setViewConfigParam( 'navformparams', $sParams );
00854         }
00855         return $sParams;
00856     }
00857 
00863     public function getStockOnDefaultMessage()
00864     {
00865         return $this->getConfig()->getConfigParam( 'blStockOnDefaultMessage' );
00866     }
00867 
00873     public function getStockOffDefaultMessage()
00874     {
00875         return $this->getConfig()->getConfigParam( 'blStockOffDefaultMessage' );
00876     }
00877 
00883     public function getShopVersion()
00884     {
00885         return $this->getViewConfigParam( 'sShopVersion' );
00886     }
00887 
00893     public function getAjaxLink()
00894     {
00895         return $this->getViewConfigParam( 'ajaxlink' );
00896     }
00897 
00903     public function isMultiShop()
00904     {
00905         $oShop = $this->getConfig()->getActiveShop();
00906         return isset( $oShop->oxshops__oxismultishop ) ? ( (bool) $oShop->oxshops__oxismultishop->value ) : false;
00907     }
00908 
00914     public function getServiceUrl()
00915     {
00916         return $this->getViewConfigParam( 'sServiceUrl' );
00917     }
00918 
00925     public function getRemoteAccessToken()
00926     {
00927         $sRaToken = oxSession::getInstance()->getRemoteAccessToken();
00928 
00929         return $sRaToken;
00930     }
00931 
00932 
00939     public function getActionClassName()
00940     {
00941         return $this->getConfig()->getActiveView()->getActionClassName();
00942     }
00943 
00949     public function getFbAppId()
00950     {
00951         return $this->getConfig()->getConfigParam( 'sFbAppId' );
00952     }
00953 
00959     public function getShowBasketTimeout()
00960     {
00961         return $this->getConfig()->getConfigParam( 'blPsBasketReservationEnabled' )
00962             && ($this->getSession()->getBasketReservations()->getTimeLeft() > 0);
00963     }
00964 
00970     public function getBasketTimeLeft()
00971     {
00972         if (!isset($this->_dBasketTimeLeft)) {
00973             $this->_dBasketTimeLeft = $this->getSession()->getBasketReservations()->getTimeLeft();
00974         }
00975         return $this->_dBasketTimeLeft;
00976     }
00977 
00984     public function getShowFbConnect()
00985     {
00986         $myConfig = $this->getConfig();
00987 
00988         if ( $myConfig->getConfigParam( 'bl_showFbConnect' ) ) {
00989             if ( $myConfig->getConfigParam( "sFbAppId" ) && $myConfig->getConfigParam( "sFbSecretKey" ) ) {
00990                 return true;
00991             }
00992         }
00993 
00994         return false;
00995     }
00996 
01002     public function getTsDomain()
01003     {
01004         $sDomain = false;
01005         $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01006         if ( is_array( $aTsConfig ) ) {
01007             $sDomain = $aTsConfig["blTestMode"] ? $aTsConfig["sTsTestUrl"] : $aTsConfig["sTsUrl"];
01008         }
01009         return $sDomain;
01010     }
01011 
01017     public function getTsWidgetUrl()
01018     {
01019         $sUrl = false;
01020         if ( $sTsId = $this->getTsId() ) {
01021             $sTsUrl = $this->getTsDomain();
01022 
01023             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01024             $sTsWidgetUri = isset( $aTsConfig["sTsWidgetUri"] ) ? current( $aTsConfig["sTsWidgetUri"] ) : false;
01025 
01026             if ( $sTsUrl && $sTsWidgetUri ) {
01027                 //$sLocal = $this->getConfig()->getImageDir()."{$sTsId}.gif";
01028                 $sUrl = sprintf( "{$sTsUrl}/{$sTsWidgetUri}", $sTsId );
01029                 //if ( $sImgName = oxUtils::getInstance()->getRemoteCachePath( $sUrl, $sLocal ) ) {
01030                 //    $sUrl = $this->getImageUrl().basename( $sImgName );
01031                 //}
01032             }
01033         }
01034 
01035         return $sUrl;
01036     }
01037 
01043     public function getTsInfoUrl()
01044     {
01045         $sUrl = false;
01046         if ( $sTsId = $this->getTsId() ) {
01047             $sTsUrl = $this->getTsDomain();
01048 
01049             $sLangId = oxLang::getInstance()->getLanguageAbbr();
01050             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01051             $sTsInfoUri = ( isset( $aTsConfig["sTsInfoUri"] ) && isset( $aTsConfig["sTsInfoUri"][$sLangId] ) ) ? $aTsConfig["sTsInfoUri"][$sLangId] : false;
01052 
01053             if ( $sTsUrl && $sTsInfoUri ) {
01054                 $sUrl = sprintf( "{$sTsUrl}/{$sTsInfoUri}", $sTsId );
01055             }
01056         }
01057 
01058         return $sUrl;
01059     }
01060 
01066     public function getTsRatingUrl()
01067     {
01068         $sUrl = false;
01069         if ( $sTsId = $this->getTsId() ) {
01070             $sTsUrl = $this->getTsDomain();
01071 
01072             $sLangId = oxLang::getInstance()->getLanguageAbbr();
01073             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01074             $sTsRateUri = ( isset( $aTsConfig["sTsRatingUri"] ) && isset( $aTsConfig["sTsRatingUri"][$sLangId] ) ) ? $aTsConfig["sTsRatingUri"][$sLangId] : false;
01075 
01076             if ( $sTsUrl && $sTsRateUri ) {
01077                 $sUrl = sprintf( "{$sTsUrl}/{$sTsRateUri}", $sTsId );
01078             }
01079         }
01080 
01081         return $sUrl;
01082     }
01083 
01091     public function showTs( $sType )
01092     {
01093         $blShow = false;
01094         switch ( $sType ) {
01095             case "WIDGET":
01096                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsWidget" );
01097                 break;
01098             case "THANKYOU":
01099                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsThankyouReview" );
01100                 break;
01101             case "ORDEREMAIL":
01102                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderEmailReview" );
01103                 break;
01104             case "ORDERCONFEMAIL":
01105                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderSendEmailReview" );
01106                 break;
01107         }
01108         return $blShow;
01109     }
01110 
01116     public function getTsId()
01117     {
01118         $sTsId = false;
01119         $oConfig = $this->getConfig();
01120         $aLangIds = $oConfig->getConfigParam( "aTsLangIds" );
01121         $aActInfo = $oConfig->getConfigParam( "aTsActiveLangIds" );
01122 
01123         // mapping with language id
01124         $sLangId = oxLang::getInstance()->getLanguageAbbr();
01125         if ( isset( $aActInfo[$sLangId] ) && $aActInfo[$sLangId] &&
01126              isset( $aLangIds[$sLangId] ) && $aLangIds[$sLangId]
01127            ) {
01128             $sTsId = $aLangIds[$sLangId];
01129         }
01130 
01131         return $sTsId;
01132     }
01133 
01139     public function isTplBlocksDebugMode()
01140     {
01141         return (bool) $this->getConfig()->getConfigParam('blDebugTemplateBlocks');
01142     }
01143 
01149     public function getPasswordLength()
01150     {
01151         $iPasswordLength = 6;
01152 
01153         $oConfig = $this->getConfig();
01154 
01155         if ($oConfig->getConfigParam( "iPasswordLength" ) ) {
01156             $iPasswordLength = $oConfig->getConfigParam( "iPasswordLength" );
01157         }
01158 
01159         return $iPasswordLength;
01160     }
01161 
01167     public function getCountryList()
01168     {
01169         if ( $this->_oCountryList === null ) {
01170             // passing country list
01171             $this->_oCountryList = oxNew( 'oxcountrylist' );
01172             $this->_oCountryList->loadActiveCountries();
01173         }
01174         return $this->_oCountryList;
01175     }
01176 
01177 
01188     public function getModulePath($sModule, $sFile = '')
01189     {
01190         if (!$sFile || ($sFile[0] != '/')) {
01191             $sFile = '/'.$sFile;
01192         }
01193         $sFile = rtrim(getShopBasePath(), '/').'/modules/'.basename($sModule).$sFile;
01194         if (file_exists($sFile) || is_dir($sFile)) {
01195             return $sFile;
01196         }
01197         $oEx = new oxFileException("Requested file not found for module $sModule ($sFile)");
01198         $oEx->debugOut();
01199         throw $oEx;
01200     }
01201 
01212     public function getModuleUrl($sModule, $sFile = '')
01213     {
01214         if (!$sFile || ($sFile[0] != '/')) {
01215             $sFile = '/'.$sFile;
01216         }
01217         // check if file exists
01218         $this->getModulePath($sModule, $sFile);
01219         return rtrim($this->getConfig()->getCurrentShopUrl(), '/').'/modules/'.basename($sModule).$sFile;
01220     }
01221 
01229     public function getViewThemeParam( $sName )
01230     {
01231         $sValue = false;
01232 
01233         if ($this->getConfig()->isThemeOption( $sName ) ) {
01234             $sValue = $this->getConfig()->getConfigParam( $sName );
01235         }
01236 
01237         return $sValue;
01238     }
01239 
01240 
01246     public function showSelectLists()
01247     {
01248         return (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' );
01249     }
01250 
01256     public function showSelectListsInList()
01257     {
01258         return $this->showSelectLists() && (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectListsInAList' );
01259     }
01260 }