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