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
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 $sRecommId = $this->getActRecommendationId();
00110 $sListType = $this->getActListType();
00111
00112
00113
00114 return $this->getConfig()->getShopHomeURL()
00115 ."cl={$sClass}"
00116 . ( $sCatnid ? "&cnid={$sCatnid}" : '' )
00117 . ( $sArtnid ? "&anid={$sArtnid}" : '' )
00118 . ( $sSearchParam ? "&searchparam={$sSearchParam}" : '' )
00119 . ( $sSearchTag ? "&searchtag={$sSearchTag}" : '' )
00120 . ( $sRecommId ? "&recommid={$sRecommId}" : '' )
00121 . ( $sListType ? "&listtype={$sListType}" : '' )
00122 . "&fnc=logout"
00123 . ( $sTplName ? "&tpl=".basename( $sTplName ) : '' )
00124 . "&redirect=1";
00125 }
00126
00132 public function getHelpPageLink()
00133 {
00134 if ( $this->_sHelpPageLink === null ) {
00135 $oConfig = $this->getConfig();
00136 $sClass = $this->getActiveClassName();
00137 $sLink = false;
00138 $sAddQ = "oxshopid = '".$oConfig->getShopId()."' and oxactive = 1 and";
00139 $sViewName = getViewName( 'oxcontents' );
00140
00141 $oDb = oxDb::getDb();
00142
00143 $sQ = "select oxid from {$sViewName} where {$sAddQ} oxloadid = ".$oDb->quote( 'oxhelp'.strtolower( $sClass ) )." union ";
00144 $sQ .= "select oxid from {$sViewName} where {$sAddQ} oxloadid = 'oxhelpdefault'";
00145
00146 if ( $sContentId = $oDb->getOne( $sQ ) ) {
00147 $oContent = oxNew( "oxcontent" );
00148 $oContent->load( $sContentId );
00149 $sLink = $oContent->getLink();
00150 }
00151
00152 $this->_sHelpPageLink = $sLink ? $sLink : $this->getHelpLink();
00153 }
00154 return $this->_sHelpPageLink;
00155 }
00156
00162 public function getHelpLink()
00163 {
00164 $sTplName = $this->getActTplName();
00165 $sClass = $this->getActiveClassName();
00166 return $this->getConfig()->getShopCurrentURL()."cl=help&page={$sClass}".( $sTplName ? "&tpl={$sTplName}" : '' );
00167 }
00168
00174 public function getActCatId()
00175 {
00176 return oxConfig::getParameter( 'cnid' );
00177 }
00178
00184 public function getActArticleId()
00185 {
00186 return oxConfig::getParameter( 'anid' );
00187 }
00188
00194 public function getActSearchParam()
00195 {
00196 return oxConfig::getParameter( 'searchparam' );
00197 }
00198
00204 public function getActSearchTag()
00205 {
00206 return oxConfig::getParameter( 'searchtag' );
00207 }
00208
00214 public function getActRecommendationId()
00215 {
00216 return oxConfig::getParameter( 'recommid' );
00217 }
00218
00224 public function getActListType()
00225 {
00226 return oxConfig::getParameter( 'listtype' );
00227 }
00228
00234 public function getActManufacturerId()
00235 {
00236 return oxConfig::getParameter( 'mnid' );
00237 }
00238
00250 public function setViewConfigParam( $sName, $sValue )
00251 {
00252 startProfile('oxviewconfig::setViewConfigParam');
00253
00254 $this->_aConfigParams[$sName] = $sValue;
00255
00256 stopProfile('oxviewconfig::setViewConfigParam');
00257 }
00258
00266 public function getViewConfigParam( $sName )
00267 {
00268 startProfile('oxviewconfig::getViewConfigParam');
00269
00270 if ( $this->_oShop && isset( $this->_oShop->$sName ) ) {
00271 $sValue = $this->_oShop->$sName;
00272 } elseif ( $this->_aViewData && isset( $this->_aViewData[ $sName ] ) ) {
00273 $sValue = $this->_aViewData[ $sName ];
00274 } else {
00275 $sValue = ( isset( $this->_aConfigParams[ $sName ] ) ? $this->_aConfigParams[ $sName ] : null );
00276 }
00277
00278 stopProfile('oxviewconfig::getViewConfigParam');
00279
00280 return $sValue;
00281 }
00282
00292 public function setViewShop( $oShop, $aViewData )
00293 {
00294 $this->_oShop = $oShop;
00295 $this->_aViewData = $aViewData;
00296 }
00297
00303 public function getSessionId()
00304 {
00305 if ( ( $sValue = $this->getViewConfigParam( 'sessionid' ) ) === null ) {
00306 $sValue = $this->getSession()->getId();
00307 $this->setViewConfigParam( 'sessionid', $sValue );
00308 }
00309 return $sValue;
00310 }
00311
00317 public function getHiddenSid()
00318 {
00319 if ( ( $sValue = $this->getViewConfigParam( 'hiddensid' ) ) === null ) {
00320 $sValue = $this->getSession()->hiddenSid();
00321
00322
00323 if ( ( $sLang = oxLang::getInstance()->getFormLang() ) ) {
00324 $sValue .= "\n{$sLang}";
00325 }
00326
00327
00328 $this->setViewConfigParam( 'hiddensid', $sValue );
00329 }
00330 return $sValue;
00331 }
00332
00338 public function getSelfLink()
00339 {
00340 if ( ( $sValue = $this->getViewConfigParam( 'selflink' ) ) === null ) {
00341 $sValue = $this->getConfig()->getShopHomeURL();
00342 $this->setViewConfigParam( 'selflink', $sValue );
00343 }
00344 return $sValue;
00345 }
00346
00352 public function getSslSelfLink()
00353 {
00354 if ( $this->isAdmin() ) {
00355
00356 return $this->getSelfLink();
00357 }
00358
00359 if ( ( $sValue = $this->getViewConfigParam( 'sslselflink' ) ) === null ) {
00360 $sValue = $this->getConfig()->getShopSecureHomeURL();
00361 $this->setViewConfigParam( 'sslselflink', $sValue );
00362 }
00363 return $sValue;
00364 }
00365
00371 public function getBaseDir()
00372 {
00373 if ( ( $sValue = $this->getViewConfigParam( 'basedir' ) ) === null ) {
00374
00375 if ( $this->getConfig()->isSsl() ) {
00376 $sValue = $this->getConfig()->getSSLShopURL();
00377 } else {
00378 $sValue = $this->getConfig()->getShopURL();
00379 }
00380
00381 $this->setViewConfigParam( 'basedir', $sValue );
00382 }
00383 return $sValue;
00384 }
00385
00391 public function getCoreUtilsDir()
00392 {
00393 if ( ( $sValue = $this->getViewConfigParam( 'coreutilsdir' ) ) === null ) {
00394 $sValue = $this->getConfig()->getCoreUtilsURL();
00395 $this->setViewConfigParam( 'coreutilsdir', $sValue );
00396 }
00397 return $sValue;
00398 }
00399
00405 public function getSelfActionLink()
00406 {
00407 if ( ( $sValue = $this->getViewConfigParam( 'selfactionlink' ) ) === null ) {
00408 $sValue = $this->getConfig()->getShopCurrentUrl();
00409 $this->setViewConfigParam( 'selfactionlink', $sValue );
00410 }
00411 return $sValue;
00412 }
00413
00419 public function getCurrentHomeDir()
00420 {
00421 if ( ( $sValue = $this->getViewConfigParam( 'currenthomedir' ) ) === null ) {
00422 $sValue = $this->getConfig()->getCurrentShopUrl();
00423 $this->setViewConfigParam( 'currenthomedir', $sValue );
00424 }
00425 return $sValue;
00426 }
00427
00433 public function getBasketLink()
00434 {
00435 if ( ( $sValue = $this->getViewConfigParam( 'basketlink' ) ) === null ) {
00436 $sValue = $this->getConfig()->getShopHomeURL() . 'cl=basket';
00437 $this->setViewConfigParam( 'basketlink', $sValue );
00438 }
00439 return $sValue;
00440 }
00441
00447 public function getOrderLink()
00448 {
00449 if ( ( $sValue = $this->getViewConfigParam( 'orderlink' ) ) === null ) {
00450 $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=user';
00451 $this->setViewConfigParam( 'orderlink', $sValue );
00452 }
00453 return $sValue;
00454 }
00455
00461 public function getPaymentLink()
00462 {
00463 if ( ( $sValue = $this->getViewConfigParam( 'paymentlink' ) ) === null ) {
00464 $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=payment';
00465 $this->setViewConfigParam( 'paymentlink', $sValue );
00466 }
00467 return $sValue;
00468 }
00469
00475 public function getExeOrderLink()
00476 {
00477 if ( ( $sValue = $this->getViewConfigParam( 'exeorderlink' ) ) === null ) {
00478 $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order&fnc=execute';
00479 $this->setViewConfigParam( 'exeorderlink', $sValue );
00480 }
00481 return $sValue;
00482 }
00483
00489 public function getOrderConfirmLink()
00490 {
00491 if ( ( $sValue = $this->getViewConfigParam( 'orderconfirmlink' ) ) === null ) {
00492 $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order';
00493 $this->setViewConfigParam( 'orderconfirmlink', $sValue );
00494 }
00495 return $sValue;
00496 }
00497
00505 public function getResourceUrl( $sFile = null )
00506 {
00507 if ( ( $sValue = $this->getViewConfigParam( 'basetpldir' ) ) === null ) {
00508 $sValue = $this->getConfig()->getResourceUrl( $sFile, $this->isAdmin() );
00509 $this->setViewConfigParam( 'basetpldir', $sValue );
00510 }
00511 return $sValue;
00512 }
00513
00519 public function getTemplateDir()
00520 {
00521 if ( ( $sValue = $this->getViewConfigParam( 'templatedir' ) ) === null ) {
00522 $sValue = $this->getConfig()->getTemplateDir( $this->isAdmin() );
00523 $this->setViewConfigParam( 'templatedir', $sValue );
00524 }
00525 return $sValue;
00526 }
00527
00533 public function getUrlTemplateDir()
00534 {
00535 if ( ( $sValue = $this->getViewConfigParam( 'urltemplatedir' ) ) === null ) {
00536 $sValue = $this->getConfig()->getTemplateUrl( $this->isAdmin() );
00537 $this->setViewConfigParam( 'urltemplatedir', $sValue );
00538 }
00539 return $sValue;
00540 }
00541
00550 public function getImageUrl( $sFile = null, $bSsl = null )
00551 {
00552 if ($sFile) {
00553 $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), $bSsl, null, $sFile );
00554 } elseif ( ( $sValue = $this->getViewConfigParam( 'imagedir' ) ) === null ) {
00555 $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), $bSsl );
00556 $this->setViewConfigParam( 'imagedir', $sValue );
00557 }
00558 return $sValue;
00559 }
00560
00566 public function getNoSslImageDir()
00567 {
00568 if ( ( $sValue = $this->getViewConfigParam( 'nossl_imagedir' ) ) === null ) {
00569 $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), false );
00570 $this->setViewConfigParam( 'nossl_imagedir', $sValue );
00571 }
00572 return $sValue;
00573 }
00574
00581 public function getPictureDir()
00582 {
00583 if ( ( $sValue = $this->getViewConfigParam( 'picturedir' ) ) === null ) {
00584 $sValue = $this->getConfig()->getPictureUrl( null, $this->isAdmin() );
00585 $this->setViewConfigParam( 'picturedir', $sValue );
00586 }
00587 return $sValue;
00588 }
00589
00595 public function getAdminDir()
00596 {
00597 if ( ( $sValue = $this->getViewConfigParam( 'sAdminDir' ) ) === null ) {
00598 $sValue = $this->getConfig()->getConfigParam( 'sAdminDir' );
00599 $this->setViewConfigParam( 'sAdminDir', $sValue );
00600 }
00601 return $sValue;
00602 }
00603
00609 public function getActiveShopId()
00610 {
00611 if ( ( $sValue = $this->getViewConfigParam( 'shopid' ) ) === null ) {
00612 $sValue = $this->getConfig()->getShopId();
00613 $this->setViewConfigParam( 'shopid', $sValue );
00614 }
00615 return $sValue;
00616 }
00617
00623 public function isSsl()
00624 {
00625 if ( ( $sValue = $this->getViewConfigParam( 'isssl' ) ) === null ) {
00626 $sValue = $this->getConfig()->isSsl();
00627 $this->setViewConfigParam( 'isssl', $sValue );
00628 }
00629 return $sValue;
00630 }
00631
00632
00638 public function getRemoteAddress()
00639 {
00640 if ( ( $sValue = $this->getViewConfigParam( 'ip' ) ) === null ) {
00641 $sValue = oxUtilsServer::getInstance()->getRemoteAddress();
00642 $this->setViewConfigParam( 'ip', $sValue );
00643 }
00644 return $sValue;
00645 }
00646
00652 public function getPopupIdent()
00653 {
00654 if ( ( $sValue = $this->getViewConfigParam( 'popupident' ) ) === null ) {
00655 $sValue = md5( $this->getConfig()->getShopUrl() );
00656 $this->setViewConfigParam( 'popupident', $sValue );
00657 }
00658 return $sValue;
00659 }
00660
00666 public function getPopupIdentRand()
00667 {
00668 if ( ( $sValue = $this->getViewConfigParam( 'popupidentrand' ) ) === null ) {
00669 $sValue = md5( time() );
00670 $this->setViewConfigParam( 'popupidentrand', $sValue );
00671 }
00672 return $sValue;
00673 }
00674
00680 public function getArtPerPageForm()
00681 {
00682 if ( ( $sValue = $this->getViewConfigParam( 'artperpageform' ) ) === null ) {
00683 $sValue = $this->getConfig()->getShopCurrentUrl();
00684 $this->setViewConfigParam( 'artperpageform', $sValue );
00685 }
00686 return $sValue;
00687 }
00688
00694 public function isBuyableParent()
00695 {
00696 return $this->getConfig()->getConfigParam( 'blVariantParentBuyable' );
00697 }
00698
00704 public function showBirthdayFields()
00705 {
00706 return $this->getConfig()->getConfigParam( 'blShowBirthdayFields' );
00707 }
00708
00714 public function showFinalStep()
00715 {
00716 return $this->getConfig()->getConfigParam( 'blShowFinalStep' );
00717 }
00718
00724 public function getNrOfCatArticles()
00725 {
00726
00727 switch (oxSession::getVar( 'ldtype' )) {
00728 case 'grid':
00729 return $this->getConfig()->getConfigParam( 'aNrofCatArticlesInGrid' );
00730 break;
00731 case 'line':
00732 case 'infogrid':
00733 default:
00734 return $this->getConfig()->getConfigParam( 'aNrofCatArticles' );
00735 }
00736 }
00737
00743 public function getShowWishlist()
00744 {
00745 return $this->getConfig()->getConfigParam( 'bl_showWishlist' );
00746 }
00747
00753 public function getShowCompareList()
00754 {
00755 $myConfig = $this->getConfig();
00756 $blShowCompareList = true;
00757
00758 if ( !$myConfig->getConfigParam( 'bl_showCompareList' ) ||
00759 ( $myConfig->getConfigParam( 'blDisableNavBars' ) && $myConfig->getActiveView()->getIsOrderStep() ) ) {
00760 $blShowCompareList = false;
00761 }
00762
00763 return $blShowCompareList;
00764 }
00765
00771 public function getShowListmania()
00772 {
00773 return $this->getConfig()->getConfigParam( 'bl_showListmania' );
00774 }
00775
00781 public function getShowVouchers()
00782 {
00783 return $this->getConfig()->getConfigParam( 'bl_showVouchers' );
00784 }
00785
00791 public function getShowGiftWrapping()
00792 {
00793 return $this->getConfig()->getConfigParam( 'bl_showGiftWrapping' );
00794 }
00795
00801 public function isAutoSearchOnCat()
00802 {
00803 return $this->getConfig()->getConfigParam( 'blAutoSearchOnCat' );
00804 }
00805
00811 public function getActLanguageId()
00812 {
00813 if ( ( $sValue = $this->getViewConfigParam( 'lang' ) ) === null ) {
00814 $iLang = oxConfig::getParameter( 'lang' );
00815 $sValue = ( $iLang !== null ) ? $iLang : oxLang::getInstance()->getBaseLanguage();
00816 $this->setViewConfigParam( 'lang', $sValue );
00817 }
00818 return $sValue;
00819 }
00820
00826 public function getActLanguageAbbr()
00827 {
00828 return oxLang::getInstance()->getLanguageAbbr( $this->getActLanguageId() );
00829 }
00830
00836 public function getActiveClassName()
00837 {
00838 return $this->getConfig()->getActiveView()->getClassName();
00839 }
00840
00846 public function getArtPerPageCount()
00847 {
00848 return $this->getViewConfigParam( 'iartPerPage' );
00849 }
00850
00856 public function getNavUrlParams()
00857 {
00858 if ( ( $sParams = $this->getViewConfigParam( 'navurlparams' ) ) === null ) {
00859 $sParams = '';
00860 $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00861 foreach ( $aNavParams as $sName => $sValue ) {
00862 if ( isset( $sValue ) ) {
00863 if ( $sParams ) {
00864 $sParams .= '&';
00865 }
00866 $sParams .= "{$sName}=".rawurlencode( $sValue );
00867 }
00868 }
00869 if ( $sParams ) {
00870 $sParams = '&'.$sParams;
00871 }
00872 $this->setViewConfigParam( 'navurlparams', $sParams );
00873 }
00874
00875 return $sParams;
00876 }
00877
00883 public function getNavFormParams()
00884 {
00885
00886 if ( ( $sParams = $this->getViewConfigParam( 'navformparams' ) ) === null ) {
00887 $oStr = getStr();
00888 $sParams = '';
00889 $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00890 foreach ( $aNavParams as $sName => $sValue ) {
00891 if ( isset( $sValue ) ) {
00892 $sParams .= "<input type=\"hidden\" name=\"{$sName}\" value=\"".$oStr->htmlentities( $sValue )."\">\n";
00893 }
00894 }
00895 $this->setViewConfigParam( 'navformparams', $sParams );
00896 }
00897 return $sParams;
00898 }
00899
00905 public function getStockOnDefaultMessage()
00906 {
00907 return $this->getConfig()->getConfigParam( 'blStockOnDefaultMessage' );
00908 }
00909
00915 public function getStockOffDefaultMessage()
00916 {
00917 return $this->getConfig()->getConfigParam( 'blStockOffDefaultMessage' );
00918 }
00919
00925 public function getShopVersion()
00926 {
00927 return $this->getViewConfigParam( 'sShopVersion' );
00928 }
00929
00935 public function getAjaxLink()
00936 {
00937 return $this->getViewConfigParam( 'ajaxlink' );
00938 }
00939
00945 public function isMultiShop()
00946 {
00947 $oShop = $this->getConfig()->getActiveShop();
00948 return isset( $oShop->oxshops__oxismultishop ) ? ( (bool) $oShop->oxshops__oxismultishop->value ) : false;
00949 }
00950
00956 public function getServiceUrl()
00957 {
00958 return $this->getViewConfigParam( 'sServiceUrl' );
00959 }
00960
00967 public function getRemoteAccessToken()
00968 {
00969 $sRaToken = oxSession::getInstance()->getRemoteAccessToken();
00970
00971 return $sRaToken;
00972 }
00973
00974
00981 public function getActionClassName()
00982 {
00983 return $this->getConfig()->getActiveView()->getActionClassName();
00984 }
00985
00991 public function getFbAppId()
00992 {
00993 return $this->getConfig()->getConfigParam( 'sFbAppId' );
00994 }
00995
01001 public function getShowBasketTimeout()
01002 {
01003 return $this->getConfig()->getConfigParam( 'blPsBasketReservationEnabled' )
01004 && ($this->getSession()->getBasketReservations()->getTimeLeft() > 0);
01005 }
01006
01012 public function getBasketTimeLeft()
01013 {
01014 if (!isset($this->_dBasketTimeLeft)) {
01015 $this->_dBasketTimeLeft = $this->getSession()->getBasketReservations()->getTimeLeft();
01016 }
01017 return $this->_dBasketTimeLeft;
01018 }
01019
01026 public function getShowFbConnect()
01027 {
01028 $myConfig = $this->getConfig();
01029
01030 if ( $myConfig->getConfigParam( 'bl_showFbConnect' ) ) {
01031 if ( $myConfig->getConfigParam( "sFbAppId" ) && $myConfig->getConfigParam( "sFbSecretKey" ) ) {
01032 return true;
01033 }
01034 }
01035
01036 return false;
01037 }
01038
01044 public function getTsDomain()
01045 {
01046 $sDomain = false;
01047 $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01048 if ( is_array( $aTsConfig ) ) {
01049 $sDomain = $aTsConfig["blTestMode"] ? $aTsConfig["sTsTestUrl"] : $aTsConfig["sTsUrl"];
01050 }
01051 return $sDomain;
01052 }
01053
01059 public function getTsWidgetUrl()
01060 {
01061 $sUrl = false;
01062 if ( $sTsId = $this->getTsId() ) {
01063 $sTsUrl = $this->getTsDomain();
01064
01065 $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01066 $sTsWidgetUri = isset( $aTsConfig["sTsWidgetUri"] ) ? current( $aTsConfig["sTsWidgetUri"] ) : false;
01067
01068 if ( $sTsUrl && $sTsWidgetUri ) {
01069
01070 $sUrl = sprintf( "{$sTsUrl}/{$sTsWidgetUri}", $sTsId );
01071
01072
01073
01074 }
01075 }
01076
01077 return $sUrl;
01078 }
01079
01085 public function getTsInfoUrl()
01086 {
01087 $sUrl = false;
01088 if ( $sTsId = $this->getTsId() ) {
01089 $sTsUrl = $this->getTsDomain();
01090
01091 $sLangId = oxLang::getInstance()->getLanguageAbbr();
01092 $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01093 $sTsInfoUri = ( isset( $aTsConfig["sTsInfoUri"] ) && isset( $aTsConfig["sTsInfoUri"][$sLangId] ) ) ? $aTsConfig["sTsInfoUri"][$sLangId] : false;
01094
01095 if ( $sTsUrl && $sTsInfoUri ) {
01096 $sUrl = sprintf( "{$sTsUrl}/{$sTsInfoUri}", $sTsId );
01097 }
01098 }
01099
01100 return $sUrl;
01101 }
01102
01108 public function getTsRatingUrl()
01109 {
01110 $sUrl = false;
01111 if ( $sTsId = $this->getTsId() ) {
01112 $sTsUrl = $this->getTsDomain();
01113
01114 $sLangId = oxLang::getInstance()->getLanguageAbbr();
01115 $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01116 $sTsRateUri = ( isset( $aTsConfig["sTsRatingUri"] ) && isset( $aTsConfig["sTsRatingUri"][$sLangId] ) ) ? $aTsConfig["sTsRatingUri"][$sLangId] : false;
01117
01118 if ( $sTsUrl && $sTsRateUri ) {
01119 $sUrl = sprintf( "{$sTsUrl}/{$sTsRateUri}", $sTsId );
01120 }
01121 }
01122
01123 return $sUrl;
01124 }
01125
01133 public function showTs( $sType )
01134 {
01135 $blShow = false;
01136 switch ( $sType ) {
01137 case "WIDGET":
01138 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsWidget" );
01139 break;
01140 case "THANKYOU":
01141 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsThankyouReview" );
01142 break;
01143 case "ORDEREMAIL":
01144 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderEmailReview" );
01145 break;
01146 case "ORDERCONFEMAIL":
01147 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderSendEmailReview" );
01148 break;
01149 }
01150 return $blShow;
01151 }
01152
01158 public function getTsId()
01159 {
01160 $sTsId = false;
01161 $oConfig = $this->getConfig();
01162 $aLangIds = $oConfig->getConfigParam( "aTsLangIds" );
01163 $aActInfo = $oConfig->getConfigParam( "aTsActiveLangIds" );
01164
01165
01166 $sLangId = oxLang::getInstance()->getLanguageAbbr();
01167 if ( isset( $aActInfo[$sLangId] ) && $aActInfo[$sLangId] &&
01168 isset( $aLangIds[$sLangId] ) && $aLangIds[$sLangId]
01169 ) {
01170 $sTsId = $aLangIds[$sLangId];
01171 }
01172
01173 return $sTsId;
01174 }
01175
01181 public function isTplBlocksDebugMode()
01182 {
01183 return (bool) $this->getConfig()->getConfigParam('blDebugTemplateBlocks');
01184 }
01185
01191 public function getPasswordLength()
01192 {
01193 $iPasswordLength = 6;
01194
01195 $oConfig = $this->getConfig();
01196
01197 if ($oConfig->getConfigParam( "iPasswordLength" ) ) {
01198 $iPasswordLength = $oConfig->getConfigParam( "iPasswordLength" );
01199 }
01200
01201 return $iPasswordLength;
01202 }
01203
01209 public function getCountryList()
01210 {
01211 if ( $this->_oCountryList === null ) {
01212
01213 $this->_oCountryList = oxNew( 'oxcountrylist' );
01214 $this->_oCountryList->loadActiveCountries();
01215 }
01216 return $this->_oCountryList;
01217 }
01218
01219
01230 public function getModulePath($sModule, $sFile = '')
01231 {
01232 if (!$sFile || ($sFile[0] != '/')) {
01233 $sFile = '/'.$sFile;
01234 }
01235 $oModule = oxNew("oxmodule");
01236 $sModulePath = $oModule->getModulePath($sModule);
01237 $sFile = $this->getConfig()->getModulesDir().$sModulePath.$sFile;
01238 if (file_exists($sFile) || is_dir($sFile)) {
01239 return $sFile;
01240 } else {
01241 $oEx = oxNew( "oxFileException", "Requested file not found for module $sModule ($sFile)" );
01242 $oEx->debugOut();
01243 if (!$this->getConfig()->getConfigParam( 'iDebug' )) {
01244 return '';
01245 }
01246 throw $oEx;
01247 }
01248 }
01249
01260 public function getModuleUrl($sModule, $sFile = '')
01261 {
01262 $sUrl = str_replace(
01263 rtrim($this->getConfig()->getConfigParam('sShopDir'), '/'),
01264 rtrim($this->getConfig()->getCurrentShopUrl( false ), '/'),
01265 $this->getModulePath($sModule, $sFile)
01266 );
01267 return $sUrl;
01268 }
01269
01277 public function getViewThemeParam( $sName )
01278 {
01279 $sValue = false;
01280
01281 if ($this->getConfig()->isThemeOption( $sName ) ) {
01282 $sValue = $this->getConfig()->getConfigParam( $sName );
01283 }
01284
01285 return $sValue;
01286 }
01287
01288
01294 public function showSelectLists()
01295 {
01296 return (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' );
01297 }
01298
01304 public function showSelectListsInList()
01305 {
01306 return $this->showSelectLists() && (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectListsInAList' );
01307 }
01308
01309
01310
01316 public function isAltImageServerConfigured()
01317 {
01318 $oConfig = $this->getConfig();
01319
01320 return $oConfig->getConfigParam('sAltImageUrl') || $oConfig->getConfigParam('sSSLAltImageUrl') ||
01321 $oConfig->getConfigParam('sAltImageDir') || $oConfig->getConfigParam('sSSLAltImageDir');
01322 }
01323
01324 }