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 $sListType = $this->getActListType();
00110
00111
00112 return $this->getConfig()->getShopHomeURL()
00113 ."cl={$sClass}"
00114 . ( $sCatnid ? "&cnid={$sCatnid}" : '' )
00115 . ( $sArtnid ? "&anid={$sArtnid}" : '' )
00116 . ( $sSearchParam ? "&searchparam={$sSearchParam}" : '' )
00117 . ( $sSearchTag ? "&searchtag={$sSearchTag}" : '' )
00118 . ( $sListType ? "&listtype={$sListType}" : '' )
00119 . "&fnc=logout"
00120 . ( $sTplName ? "&tpl=".basename( $sTplName ) : '' )
00121 . "&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
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&page={$sClass}".( $sTplName ? "&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
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
00356 if ( $this->getConfig()->isSsl() ) {
00357 $sValue = $this->getConfig()->getSSLShopURL();
00358 } else {
00359 $sValue = $this->getConfig()->getShopURL();
00360 }
00361
00362 $this->setViewConfigParam( 'basedir', $sValue );
00363 }
00364 return $sValue;
00365 }
00366
00372 public function getCoreUtilsDir()
00373 {
00374 if ( ( $sValue = $this->getViewConfigParam( 'coreutilsdir' ) ) === null ) {
00375 $sValue = $this->getConfig()->getCoreUtilsURL();
00376 $this->setViewConfigParam( 'coreutilsdir', $sValue );
00377 }
00378 return $sValue;
00379 }
00380
00386 public function getSelfActionLink()
00387 {
00388 if ( ( $sValue = $this->getViewConfigParam( 'selfactionlink' ) ) === null ) {
00389 $sValue = $this->getConfig()->getShopCurrentUrl();
00390 $this->setViewConfigParam( 'selfactionlink', $sValue );
00391 }
00392 return $sValue;
00393 }
00394
00400 public function getCurrentHomeDir()
00401 {
00402 if ( ( $sValue = $this->getViewConfigParam( 'currenthomedir' ) ) === null ) {
00403 $sValue = $this->getConfig()->getCurrentShopUrl();
00404 $this->setViewConfigParam( 'currenthomedir', $sValue );
00405 }
00406 return $sValue;
00407 }
00408
00414 public function getBasketLink()
00415 {
00416 if ( ( $sValue = $this->getViewConfigParam( 'basketlink' ) ) === null ) {
00417 $sValue = $this->getConfig()->getShopHomeURL() . 'cl=basket';
00418 $this->setViewConfigParam( 'basketlink', $sValue );
00419 }
00420 return $sValue;
00421 }
00422
00428 public function getOrderLink()
00429 {
00430 if ( ( $sValue = $this->getViewConfigParam( 'orderlink' ) ) === null ) {
00431 $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=user';
00432 $this->setViewConfigParam( 'orderlink', $sValue );
00433 }
00434 return $sValue;
00435 }
00436
00442 public function getPaymentLink()
00443 {
00444 if ( ( $sValue = $this->getViewConfigParam( 'paymentlink' ) ) === null ) {
00445 $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=payment';
00446 $this->setViewConfigParam( 'paymentlink', $sValue );
00447 }
00448 return $sValue;
00449 }
00450
00456 public function getExeOrderLink()
00457 {
00458 if ( ( $sValue = $this->getViewConfigParam( 'exeorderlink' ) ) === null ) {
00459 $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order&fnc=execute';
00460 $this->setViewConfigParam( 'exeorderlink', $sValue );
00461 }
00462 return $sValue;
00463 }
00464
00470 public function getOrderConfirmLink()
00471 {
00472 if ( ( $sValue = $this->getViewConfigParam( 'orderconfirmlink' ) ) === null ) {
00473 $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order';
00474 $this->setViewConfigParam( 'orderconfirmlink', $sValue );
00475 }
00476 return $sValue;
00477 }
00478
00484 public function getResourceUrl()
00485 {
00486 if ( ( $sValue = $this->getViewConfigParam( 'basetpldir' ) ) === null ) {
00487 $sValue = $this->getConfig()->getResourceUrl( null, $this->isAdmin() );
00488 $this->setViewConfigParam( 'basetpldir', $sValue );
00489 }
00490 return $sValue;
00491 }
00492
00498 public function getTemplateDir()
00499 {
00500 if ( ( $sValue = $this->getViewConfigParam( 'templatedir' ) ) === null ) {
00501 $sValue = $this->getConfig()->getTemplateDir( $this->isAdmin() );
00502 $this->setViewConfigParam( 'templatedir', $sValue );
00503 }
00504 return $sValue;
00505 }
00506
00512 public function getUrlTemplateDir()
00513 {
00514 if ( ( $sValue = $this->getViewConfigParam( 'urltemplatedir' ) ) === null ) {
00515 $sValue = $this->getConfig()->getTemplateUrl( $this->isAdmin() );
00516 $this->setViewConfigParam( 'urltemplatedir', $sValue );
00517 }
00518 return $sValue;
00519 }
00520
00528 public function getImageUrl( $sFile = null )
00529 {
00530 if ($sFile) {
00531 $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), null, null, $sFile );
00532 } elseif ( ( $sValue = $this->getViewConfigParam( 'imagedir' ) ) === null ) {
00533 $sValue = $this->getConfig()->getImageUrl( $this->isAdmin() );
00534 $this->setViewConfigParam( 'imagedir', $sValue );
00535 }
00536 return $sValue;
00537 }
00538
00544 public function getNoSslImageDir()
00545 {
00546 if ( ( $sValue = $this->getViewConfigParam( 'nossl_imagedir' ) ) === null ) {
00547 $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), false );
00548 $this->setViewConfigParam( 'nossl_imagedir', $sValue );
00549 }
00550 return $sValue;
00551 }
00552
00559 public function getPictureDir()
00560 {
00561 if ( ( $sValue = $this->getViewConfigParam( 'picturedir' ) ) === null ) {
00562 $sValue = $this->getConfig()->getPictureUrl( null, $this->isAdmin() );
00563 $this->setViewConfigParam( 'picturedir', $sValue );
00564 }
00565 return $sValue;
00566 }
00567
00573 public function getAdminDir()
00574 {
00575 if ( ( $sValue = $this->getViewConfigParam( 'sAdminDir' ) ) === null ) {
00576 $sValue = $this->getConfig()->getConfigParam( 'sAdminDir' );
00577 $this->setViewConfigParam( 'sAdminDir', $sValue );
00578 }
00579 return $sValue;
00580 }
00581
00587 public function getActiveShopId()
00588 {
00589 if ( ( $sValue = $this->getViewConfigParam( 'shopid' ) ) === null ) {
00590 $sValue = $this->getConfig()->getShopId();
00591 $this->setViewConfigParam( 'shopid', $sValue );
00592 }
00593 return $sValue;
00594 }
00595
00601 public function isSsl()
00602 {
00603 if ( ( $sValue = $this->getViewConfigParam( 'isssl' ) ) === null ) {
00604 $sValue = $this->getConfig()->isSsl();
00605 $this->setViewConfigParam( 'isssl', $sValue );
00606 }
00607 return $sValue;
00608 }
00609
00610
00616 public function getRemoteAddress()
00617 {
00618 if ( ( $sValue = $this->getViewConfigParam( 'ip' ) ) === null ) {
00619 $sValue = oxUtilsServer::getInstance()->getRemoteAddress();
00620 $this->setViewConfigParam( 'ip', $sValue );
00621 }
00622 return $sValue;
00623 }
00624
00630 public function getPopupIdent()
00631 {
00632 if ( ( $sValue = $this->getViewConfigParam( 'popupident' ) ) === null ) {
00633 $sValue = md5( $this->getConfig()->getShopUrl() );
00634 $this->setViewConfigParam( 'popupident', $sValue );
00635 }
00636 return $sValue;
00637 }
00638
00644 public function getPopupIdentRand()
00645 {
00646 if ( ( $sValue = $this->getViewConfigParam( 'popupidentrand' ) ) === null ) {
00647 $sValue = md5( time() );
00648 $this->setViewConfigParam( 'popupidentrand', $sValue );
00649 }
00650 return $sValue;
00651 }
00652
00658 public function getArtPerPageForm()
00659 {
00660 if ( ( $sValue = $this->getViewConfigParam( 'artperpageform' ) ) === null ) {
00661 $sValue = $this->getConfig()->getShopCurrentUrl();
00662 $this->setViewConfigParam( 'artperpageform', $sValue );
00663 }
00664 return $sValue;
00665 }
00666
00672 public function isBuyableParent()
00673 {
00674 return $this->getConfig()->getConfigParam( 'blVariantParentBuyable' );
00675 }
00676
00682 public function showBirthdayFields()
00683 {
00684 return $this->getConfig()->getConfigParam( 'blShowBirthdayFields' );
00685 }
00686
00692 public function showFinalStep()
00693 {
00694 return $this->getConfig()->getConfigParam( 'blShowFinalStep' );
00695 }
00696
00702 public function getNrOfCatArticles()
00703 {
00704
00705 switch (oxSession::getVar( 'ldtype' )) {
00706 case 'grid':
00707 return $this->getConfig()->getConfigParam( 'aNrofCatArticlesInGrid' );
00708 break;
00709 case 'line':
00710 case 'infogrid':
00711 default:
00712 return $this->getConfig()->getConfigParam( 'aNrofCatArticles' );
00713 }
00714 }
00715
00721 public function getShowWishlist()
00722 {
00723 return $this->getConfig()->getConfigParam( 'bl_showWishlist' );
00724 }
00725
00731 public function getShowCompareList()
00732 {
00733 $myConfig = $this->getConfig();
00734 $blShowCompareList = true;
00735
00736 if ( !$myConfig->getConfigParam( 'bl_showCompareList' ) ||
00737 ( $myConfig->getConfigParam( 'blDisableNavBars' ) && $myConfig->getActiveView()->getIsOrderStep() ) ) {
00738 $blShowCompareList = false;
00739 }
00740
00741 return $blShowCompareList;
00742 }
00743
00749 public function getShowListmania()
00750 {
00751 return $this->getConfig()->getConfigParam( 'bl_showListmania' );
00752 }
00753
00759 public function getShowVouchers()
00760 {
00761 return $this->getConfig()->getConfigParam( 'bl_showVouchers' );
00762 }
00763
00769 public function getShowGiftWrapping()
00770 {
00771 return $this->getConfig()->getConfigParam( 'bl_showGiftWrapping' );
00772 }
00773
00779 public function isAutoSearchOnCat()
00780 {
00781 return $this->getConfig()->getConfigParam( 'blAutoSearchOnCat' );
00782 }
00783
00789 public function getActLanguageId()
00790 {
00791 if ( ( $sValue = $this->getViewConfigParam( 'lang' ) ) === null ) {
00792 $iLang = oxConfig::getParameter( 'lang' );
00793 $sValue = ( $iLang !== null ) ? $iLang : oxLang::getInstance()->getBaseLanguage();
00794 $this->setViewConfigParam( 'lang', $sValue );
00795 }
00796 return $sValue;
00797 }
00798
00804 public function getActiveClassName()
00805 {
00806 return $this->getConfig()->getActiveView()->getClassName();
00807 }
00808
00814 public function getArtPerPageCount()
00815 {
00816 return $this->getViewConfigParam( 'iartPerPage' );
00817 }
00818
00824 public function getNavUrlParams()
00825 {
00826 if ( ( $sParams = $this->getViewConfigParam( 'navurlparams' ) ) === null ) {
00827 $sParams = '';
00828 $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00829 foreach ( $aNavParams as $sName => $sValue ) {
00830 if ( isset( $sValue ) ) {
00831 if ( $sParams ) {
00832 $sParams .= '&';
00833 }
00834 $sParams .= "{$sName}=".rawurlencode( $sValue );
00835 }
00836 }
00837 if ( $sParams ) {
00838 $sParams = '&'.$sParams;
00839 }
00840 $this->setViewConfigParam( 'navurlparams', $sParams );
00841 }
00842
00843 return $sParams;
00844 }
00845
00851 public function getNavFormParams()
00852 {
00853
00854 if ( ( $sParams = $this->getViewConfigParam( 'navformparams' ) ) === null ) {
00855 $oStr = getStr();
00856 $sParams = '';
00857 $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00858 foreach ( $aNavParams as $sName => $sValue ) {
00859 if ( isset( $sValue ) ) {
00860 $sParams .= "<input type=\"hidden\" name=\"{$sName}\" value=\"".$oStr->htmlentities( $sValue )."\">\n";
00861 }
00862 }
00863 $this->setViewConfigParam( 'navformparams', $sParams );
00864 }
00865 return $sParams;
00866 }
00867
00873 public function getStockOnDefaultMessage()
00874 {
00875 return $this->getConfig()->getConfigParam( 'blStockOnDefaultMessage' );
00876 }
00877
00883 public function getStockOffDefaultMessage()
00884 {
00885 return $this->getConfig()->getConfigParam( 'blStockOffDefaultMessage' );
00886 }
00887
00893 public function getShopVersion()
00894 {
00895 return $this->getViewConfigParam( 'sShopVersion' );
00896 }
00897
00903 public function getAjaxLink()
00904 {
00905 return $this->getViewConfigParam( 'ajaxlink' );
00906 }
00907
00913 public function isMultiShop()
00914 {
00915 $oShop = $this->getConfig()->getActiveShop();
00916 return isset( $oShop->oxshops__oxismultishop ) ? ( (bool) $oShop->oxshops__oxismultishop->value ) : false;
00917 }
00918
00924 public function getServiceUrl()
00925 {
00926 return $this->getViewConfigParam( 'sServiceUrl' );
00927 }
00928
00935 public function getRemoteAccessToken()
00936 {
00937 $sRaToken = oxSession::getInstance()->getRemoteAccessToken();
00938
00939 return $sRaToken;
00940 }
00941
00942
00949 public function getActionClassName()
00950 {
00951 return $this->getConfig()->getActiveView()->getActionClassName();
00952 }
00953
00959 public function getFbAppId()
00960 {
00961 return $this->getConfig()->getConfigParam( 'sFbAppId' );
00962 }
00963
00969 public function getShowBasketTimeout()
00970 {
00971 return $this->getConfig()->getConfigParam( 'blPsBasketReservationEnabled' )
00972 && ($this->getSession()->getBasketReservations()->getTimeLeft() > 0);
00973 }
00974
00980 public function getBasketTimeLeft()
00981 {
00982 if (!isset($this->_dBasketTimeLeft)) {
00983 $this->_dBasketTimeLeft = $this->getSession()->getBasketReservations()->getTimeLeft();
00984 }
00985 return $this->_dBasketTimeLeft;
00986 }
00987
00994 public function getShowFbConnect()
00995 {
00996 $myConfig = $this->getConfig();
00997
00998 if ( $myConfig->getConfigParam( 'bl_showFbConnect' ) ) {
00999 if ( $myConfig->getConfigParam( "sFbAppId" ) && $myConfig->getConfigParam( "sFbSecretKey" ) ) {
01000 return true;
01001 }
01002 }
01003
01004 return false;
01005 }
01006
01012 public function getTsDomain()
01013 {
01014 $sDomain = false;
01015 $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01016 if ( is_array( $aTsConfig ) ) {
01017 $sDomain = $aTsConfig["blTestMode"] ? $aTsConfig["sTsTestUrl"] : $aTsConfig["sTsUrl"];
01018 }
01019 return $sDomain;
01020 }
01021
01027 public function getTsWidgetUrl()
01028 {
01029 $sUrl = false;
01030 if ( $sTsId = $this->getTsId() ) {
01031 $sTsUrl = $this->getTsDomain();
01032
01033 $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01034 $sTsWidgetUri = isset( $aTsConfig["sTsWidgetUri"] ) ? current( $aTsConfig["sTsWidgetUri"] ) : false;
01035
01036 if ( $sTsUrl && $sTsWidgetUri ) {
01037
01038 $sUrl = sprintf( "{$sTsUrl}/{$sTsWidgetUri}", $sTsId );
01039
01040
01041
01042 }
01043 }
01044
01045 return $sUrl;
01046 }
01047
01053 public function getTsInfoUrl()
01054 {
01055 $sUrl = false;
01056 if ( $sTsId = $this->getTsId() ) {
01057 $sTsUrl = $this->getTsDomain();
01058
01059 $sLangId = oxLang::getInstance()->getLanguageAbbr();
01060 $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01061 $sTsInfoUri = ( isset( $aTsConfig["sTsInfoUri"] ) && isset( $aTsConfig["sTsInfoUri"][$sLangId] ) ) ? $aTsConfig["sTsInfoUri"][$sLangId] : false;
01062
01063 if ( $sTsUrl && $sTsInfoUri ) {
01064 $sUrl = sprintf( "{$sTsUrl}/{$sTsInfoUri}", $sTsId );
01065 }
01066 }
01067
01068 return $sUrl;
01069 }
01070
01076 public function getTsRatingUrl()
01077 {
01078 $sUrl = false;
01079 if ( $sTsId = $this->getTsId() ) {
01080 $sTsUrl = $this->getTsDomain();
01081
01082 $sLangId = oxLang::getInstance()->getLanguageAbbr();
01083 $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01084 $sTsRateUri = ( isset( $aTsConfig["sTsRatingUri"] ) && isset( $aTsConfig["sTsRatingUri"][$sLangId] ) ) ? $aTsConfig["sTsRatingUri"][$sLangId] : false;
01085
01086 if ( $sTsUrl && $sTsRateUri ) {
01087 $sUrl = sprintf( "{$sTsUrl}/{$sTsRateUri}", $sTsId );
01088 }
01089 }
01090
01091 return $sUrl;
01092 }
01093
01101 public function showTs( $sType )
01102 {
01103 $blShow = false;
01104 switch ( $sType ) {
01105 case "WIDGET":
01106 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsWidget" );
01107 break;
01108 case "THANKYOU":
01109 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsThankyouReview" );
01110 break;
01111 case "ORDEREMAIL":
01112 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderEmailReview" );
01113 break;
01114 case "ORDERCONFEMAIL":
01115 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderSendEmailReview" );
01116 break;
01117 }
01118 return $blShow;
01119 }
01120
01126 public function getTsId()
01127 {
01128 $sTsId = false;
01129 $oConfig = $this->getConfig();
01130 $aLangIds = $oConfig->getConfigParam( "aTsLangIds" );
01131 $aActInfo = $oConfig->getConfigParam( "aTsActiveLangIds" );
01132
01133
01134 $sLangId = oxLang::getInstance()->getLanguageAbbr();
01135 if ( isset( $aActInfo[$sLangId] ) && $aActInfo[$sLangId] &&
01136 isset( $aLangIds[$sLangId] ) && $aLangIds[$sLangId]
01137 ) {
01138 $sTsId = $aLangIds[$sLangId];
01139 }
01140
01141 return $sTsId;
01142 }
01143
01149 public function isTplBlocksDebugMode()
01150 {
01151 return (bool) $this->getConfig()->getConfigParam('blDebugTemplateBlocks');
01152 }
01153
01159 public function getPasswordLength()
01160 {
01161 $iPasswordLength = 6;
01162
01163 $oConfig = $this->getConfig();
01164
01165 if ($oConfig->getConfigParam( "iPasswordLength" ) ) {
01166 $iPasswordLength = $oConfig->getConfigParam( "iPasswordLength" );
01167 }
01168
01169 return $iPasswordLength;
01170 }
01171
01177 public function getCountryList()
01178 {
01179 if ( $this->_oCountryList === null ) {
01180
01181 $this->_oCountryList = oxNew( 'oxcountrylist' );
01182 $this->_oCountryList->loadActiveCountries();
01183 }
01184 return $this->_oCountryList;
01185 }
01186
01187
01198 public function getModulePath($sModule, $sFile = '')
01199 {
01200 if (!$sFile || ($sFile[0] != '/')) {
01201 $sFile = '/'.$sFile;
01202 }
01203 $sFile = rtrim(getShopBasePath(), '/').'/modules/'.basename($sModule).$sFile;
01204 if (file_exists($sFile) || is_dir($sFile)) {
01205 return $sFile;
01206 }
01207 $oEx = new oxFileException("Requested file not found for module $sModule ($sFile)");
01208 $oEx->debugOut();
01209 throw $oEx;
01210 }
01211
01222 public function getModuleUrl($sModule, $sFile = '')
01223 {
01224 if (!$sFile || ($sFile[0] != '/')) {
01225 $sFile = '/'.$sFile;
01226 }
01227
01228 $this->getModulePath($sModule, $sFile);
01229 return rtrim($this->getConfig()->getCurrentShopUrl(), '/').'/modules/'.basename($sModule).$sFile;
01230 }
01231
01239 public function getViewThemeParam( $sName )
01240 {
01241 $sValue = false;
01242
01243 if ($this->getConfig()->isThemeOption( $sName ) ) {
01244 $sValue = $this->getConfig()->getConfigParam( $sName );
01245 }
01246
01247 return $sValue;
01248 }
01249
01250
01256 public function showSelectLists()
01257 {
01258 return (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' );
01259 }
01260
01266 public function showSelectListsInList()
01267 {
01268 return $this->showSelectLists() && (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectListsInAList' );
01269 }
01270 }