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             $oDb = oxDb::getDb();
00139             // checking if there is a custom content for help page
00140             $sQ  = "select oxid from {$sViewName} where {$sAddQ} oxloadid = ".$oDb->quote( 'oxhelp'.strtolower( $sClass ) )." union ";
00141             $sQ .= "select oxid from {$sViewName} where {$sAddQ} oxloadid = 'oxhelpdefault'";
00142 
00143             if ( $sContentId = $oDb->getOne( $sQ ) ) {
00144                 $oContent = oxNew( "oxcontent" );
00145                 $oContent->load( $sContentId );
00146                 $sLink = $oContent->getLink();
00147             }
00148 
00149             $this->_sHelpPageLink = $sLink ? $sLink : $this->getHelpLink();
00150         }
00151         return $this->_sHelpPageLink;
00152     }
00153 
00159     public function getHelpLink()
00160     {
00161         $sTplName = $this->getActTplName();
00162         $sClass   = $this->getActiveClassName();
00163         return $this->getConfig()->getShopCurrentURL()."cl=help&amp;page={$sClass}".( $sTplName ? "&amp;tpl={$sTplName}" : '' );
00164     }
00165 
00171     public function getActCatId()
00172     {
00173         return oxConfig::getParameter( 'cnid' );
00174     }
00175 
00181     public function getActArticleId()
00182     {
00183         return oxConfig::getParameter( 'anid' );
00184     }
00185 
00191     public function getActSearchParam()
00192     {
00193         return oxConfig::getParameter( 'searchparam' );
00194     }
00195 
00201     public function getActSearchTag()
00202     {
00203         return oxConfig::getParameter( 'searchtag' );
00204     }
00205 
00211     public function getActListType()
00212     {
00213         return oxConfig::getParameter( 'listtype' );
00214     }
00215 
00221     public function getActManufacturerId()
00222     {
00223         return oxConfig::getParameter( 'mnid' );
00224     }
00225 
00237     public function setViewConfigParam( $sName, $sValue )
00238     {
00239         startProfile('oxviewconfig::setViewConfigParam');
00240 
00241         $this->_aConfigParams[$sName] = $sValue;
00242 
00243         stopProfile('oxviewconfig::setViewConfigParam');
00244     }
00245 
00253     public function getViewConfigParam( $sName )
00254     {
00255         startProfile('oxviewconfig::getViewConfigParam');
00256 
00257         if ( $this->_oShop && isset( $this->_oShop->$sName ) ) {
00258             $sValue = $this->_oShop->$sName;
00259         } elseif ( $this->_aViewData && isset( $this->_aViewData[ $sName ] ) ) {
00260             $sValue = $this->_aViewData[ $sName ];
00261         } else {
00262             $sValue = ( isset( $this->_aConfigParams[ $sName ] ) ? $this->_aConfigParams[ $sName ] : null );
00263         }
00264 
00265         stopProfile('oxviewconfig::getViewConfigParam');
00266 
00267         return $sValue;
00268     }
00269 
00279     public function setViewShop( $oShop, $aViewData )
00280     {
00281         $this->_oShop     = $oShop;
00282         $this->_aViewData = $aViewData;
00283     }
00284 
00290     public function getSessionId()
00291     {
00292         if ( ( $sValue = $this->getViewConfigParam( 'sessionid' ) ) === null ) {
00293             $sValue = $this->getSession()->getId();
00294             $this->setViewConfigParam( 'sessionid', $sValue );
00295         }
00296         return $sValue;
00297     }
00298 
00304     public function getHiddenSid()
00305     {
00306         if ( ( $sValue = $this->getViewConfigParam( 'hiddensid' ) ) === null ) {
00307             $sValue = $this->getSession()->hiddenSid();
00308 
00309             // appending language info to form
00310             if ( ( $sLang = oxLang::getInstance()->getFormLang() ) ) {
00311                 $sValue .= "\n{$sLang}";
00312             }
00313 
00314 
00315             $this->setViewConfigParam( 'hiddensid', $sValue );
00316         }
00317         return $sValue;
00318     }
00319 
00325     public function getSelfLink()
00326     {
00327         if ( ( $sValue = $this->getViewConfigParam( 'selflink' ) ) === null ) {
00328             $sValue = $this->getConfig()->getShopHomeURL();
00329             $this->setViewConfigParam( 'selflink', $sValue );
00330         }
00331         return $sValue;
00332     }
00333 
00339     public function getSslSelfLink()
00340     {
00341         if ( $this->isAdmin() ) {
00342             // using getSelfLink() method in admin mode (#2745)
00343             return $this->getSelfLink();
00344         }
00345 
00346         if ( ( $sValue = $this->getViewConfigParam( 'sslselflink' ) ) === null ) {
00347             $sValue = $this->getConfig()->getShopSecureHomeURL();
00348             $this->setViewConfigParam( 'sslselflink', $sValue );
00349         }
00350         return $sValue;
00351     }
00352 
00358     public function getBaseDir()
00359     {
00360         if ( ( $sValue = $this->getViewConfigParam( 'basedir' ) ) === null ) {
00361 
00362             if ( $this->getConfig()->isSsl() ) {
00363                 $sValue = $this->getConfig()->getSSLShopURL();
00364             } else {
00365                 $sValue = $this->getConfig()->getShopURL();
00366             }
00367 
00368             $this->setViewConfigParam( 'basedir', $sValue );
00369         }
00370         return $sValue;
00371     }
00372 
00378     public function getCoreUtilsDir()
00379     {
00380         if ( ( $sValue = $this->getViewConfigParam( 'coreutilsdir' ) ) === null ) {
00381             $sValue = $this->getConfig()->getCoreUtilsURL();
00382             $this->setViewConfigParam( 'coreutilsdir', $sValue );
00383         }
00384         return $sValue;
00385     }
00386 
00392     public function getSelfActionLink()
00393     {
00394         if ( ( $sValue = $this->getViewConfigParam( 'selfactionlink' ) ) === null ) {
00395             $sValue = $this->getConfig()->getShopCurrentUrl();
00396             $this->setViewConfigParam( 'selfactionlink', $sValue );
00397         }
00398         return $sValue;
00399     }
00400 
00406     public function getCurrentHomeDir()
00407     {
00408         if ( ( $sValue = $this->getViewConfigParam( 'currenthomedir' ) ) === null ) {
00409             $sValue = $this->getConfig()->getCurrentShopUrl();
00410             $this->setViewConfigParam( 'currenthomedir', $sValue );
00411         }
00412         return $sValue;
00413     }
00414 
00420     public function getBasketLink()
00421     {
00422         if ( ( $sValue = $this->getViewConfigParam( 'basketlink' ) ) === null ) {
00423             $sValue = $this->getConfig()->getShopHomeURL()   . 'cl=basket';
00424             $this->setViewConfigParam( 'basketlink', $sValue );
00425         }
00426         return $sValue;
00427     }
00428 
00434     public function getOrderLink()
00435     {
00436         if ( ( $sValue = $this->getViewConfigParam( 'orderlink' ) ) === null ) {
00437             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=user';
00438             $this->setViewConfigParam( 'orderlink', $sValue );
00439         }
00440         return $sValue;
00441     }
00442 
00448     public function getPaymentLink()
00449     {
00450         if ( ( $sValue = $this->getViewConfigParam( 'paymentlink' ) ) === null ) {
00451             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=payment';
00452             $this->setViewConfigParam( 'paymentlink', $sValue );
00453         }
00454         return $sValue;
00455     }
00456 
00462     public function getExeOrderLink()
00463     {
00464         if ( ( $sValue = $this->getViewConfigParam( 'exeorderlink' ) ) === null ) {
00465             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order&amp;fnc=execute';
00466             $this->setViewConfigParam( 'exeorderlink', $sValue );
00467         }
00468         return $sValue;
00469     }
00470 
00476     public function getOrderConfirmLink()
00477     {
00478         if ( ( $sValue = $this->getViewConfigParam( 'orderconfirmlink' ) ) === null ) {
00479             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order';
00480             $this->setViewConfigParam( 'orderconfirmlink', $sValue );
00481         }
00482         return $sValue;
00483     }
00484 
00492     public function getResourceUrl( $sFile = null )
00493     {
00494         if ( ( $sValue = $this->getViewConfigParam( 'basetpldir' ) ) === null ) {
00495             $sValue = $this->getConfig()->getResourceUrl( $sFile, $this->isAdmin() );
00496             $this->setViewConfigParam( 'basetpldir', $sValue );
00497         }
00498         return $sValue;
00499     }
00500 
00506     public function getTemplateDir()
00507     {
00508         if ( ( $sValue = $this->getViewConfigParam( 'templatedir' ) ) === null ) {
00509             $sValue = $this->getConfig()->getTemplateDir( $this->isAdmin() );
00510             $this->setViewConfigParam( 'templatedir', $sValue );
00511         }
00512         return $sValue;
00513     }
00514 
00520     public function getUrlTemplateDir()
00521     {
00522         if ( ( $sValue = $this->getViewConfigParam( 'urltemplatedir' ) ) === null ) {
00523             $sValue = $this->getConfig()->getTemplateUrl( $this->isAdmin() );
00524             $this->setViewConfigParam( 'urltemplatedir', $sValue );
00525         }
00526         return $sValue;
00527     }
00528 
00537     public function getImageUrl( $sFile = null, $bSsl = null )
00538     {
00539         if ($sFile) {
00540            $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), $bSsl, null, $sFile );
00541         } elseif ( ( $sValue = $this->getViewConfigParam( 'imagedir' ) ) === null ) {
00542             $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), $bSsl );
00543             $this->setViewConfigParam( 'imagedir', $sValue );
00544         }
00545         return $sValue;
00546     }
00547 
00553     public function getNoSslImageDir()
00554     {
00555         if ( ( $sValue = $this->getViewConfigParam( 'nossl_imagedir' ) ) === null ) {
00556             $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), false );
00557             $this->setViewConfigParam( 'nossl_imagedir', $sValue );
00558         }
00559         return $sValue;
00560     }
00561 
00568     public function getPictureDir()
00569     {
00570         if ( ( $sValue = $this->getViewConfigParam( 'picturedir' ) ) === null ) {
00571             $sValue = $this->getConfig()->getPictureUrl( null, $this->isAdmin() );
00572             $this->setViewConfigParam( 'picturedir', $sValue );
00573         }
00574         return $sValue;
00575     }
00576 
00582     public function getAdminDir()
00583     {
00584         if ( ( $sValue = $this->getViewConfigParam( 'sAdminDir' ) ) === null ) {
00585             $sValue = $this->getConfig()->getConfigParam( 'sAdminDir' );
00586             $this->setViewConfigParam( 'sAdminDir', $sValue );
00587         }
00588         return $sValue;
00589     }
00590 
00596     public function getActiveShopId()
00597     {
00598         if ( ( $sValue = $this->getViewConfigParam( 'shopid' ) ) === null ) {
00599             $sValue = $this->getConfig()->getShopId();
00600             $this->setViewConfigParam( 'shopid', $sValue );
00601         }
00602         return $sValue;
00603     }
00604 
00610     public function isSsl()
00611     {
00612         if ( ( $sValue = $this->getViewConfigParam( 'isssl' ) ) === null ) {
00613             $sValue = $this->getConfig()->isSsl();
00614             $this->setViewConfigParam( 'isssl', $sValue );
00615         }
00616         return $sValue;
00617     }
00618 
00619 
00625     public function getRemoteAddress()
00626     {
00627         if ( ( $sValue = $this->getViewConfigParam( 'ip' ) ) === null ) {
00628             $sValue = oxUtilsServer::getInstance()->getRemoteAddress();
00629             $this->setViewConfigParam( 'ip', $sValue );
00630         }
00631         return $sValue;
00632     }
00633 
00639     public function getPopupIdent()
00640     {
00641         if ( ( $sValue = $this->getViewConfigParam( 'popupident' ) ) === null ) {
00642             $sValue = md5( $this->getConfig()->getShopUrl() );
00643             $this->setViewConfigParam( 'popupident', $sValue );
00644         }
00645         return $sValue;
00646     }
00647 
00653     public function getPopupIdentRand()
00654     {
00655         if ( ( $sValue = $this->getViewConfigParam( 'popupidentrand' ) ) === null ) {
00656             $sValue = md5( time() );
00657             $this->setViewConfigParam( 'popupidentrand', $sValue );
00658         }
00659         return $sValue;
00660     }
00661 
00667     public function getArtPerPageForm()
00668     {
00669         if ( ( $sValue = $this->getViewConfigParam( 'artperpageform' ) ) === null ) {
00670             $sValue = $this->getConfig()->getShopCurrentUrl();
00671             $this->setViewConfigParam( 'artperpageform', $sValue );
00672         }
00673         return $sValue;
00674     }
00675 
00681     public function isBuyableParent()
00682     {
00683         return $this->getConfig()->getConfigParam( 'blVariantParentBuyable' );
00684     }
00685 
00691     public function showBirthdayFields()
00692     {
00693         return $this->getConfig()->getConfigParam( 'blShowBirthdayFields' );
00694     }
00695 
00701     public function showFinalStep()
00702     {
00703         return $this->getConfig()->getConfigParam( 'blShowFinalStep' );
00704     }
00705 
00711     public function getNrOfCatArticles()
00712     {
00713         // checking if all needed data is set
00714         switch (oxSession::getVar( 'ldtype' )) {
00715             case 'grid':
00716                 return $this->getConfig()->getConfigParam( 'aNrofCatArticlesInGrid' );
00717                 break;
00718             case 'line':
00719             case 'infogrid':
00720             default:
00721                 return $this->getConfig()->getConfigParam( 'aNrofCatArticles' );
00722         }
00723     }
00724 
00730     public function getShowWishlist()
00731     {
00732         return $this->getConfig()->getConfigParam( 'bl_showWishlist' );
00733     }
00734 
00740     public function getShowCompareList()
00741     {
00742         $myConfig = $this->getConfig();
00743         $blShowCompareList = true;
00744 
00745         if ( !$myConfig->getConfigParam( 'bl_showCompareList' ) ||
00746             ( $myConfig->getConfigParam( 'blDisableNavBars' ) && $myConfig->getActiveView()->getIsOrderStep() ) ) {
00747             $blShowCompareList = false;
00748         }
00749 
00750         return $blShowCompareList;
00751     }
00752 
00758     public function getShowListmania()
00759     {
00760         return $this->getConfig()->getConfigParam( 'bl_showListmania' );
00761     }
00762 
00768     public function getShowVouchers()
00769     {
00770         return $this->getConfig()->getConfigParam( 'bl_showVouchers' );
00771     }
00772 
00778     public function getShowGiftWrapping()
00779     {
00780         return $this->getConfig()->getConfigParam( 'bl_showGiftWrapping' );
00781     }
00782 
00788     public function isAutoSearchOnCat()
00789     {
00790         return $this->getConfig()->getConfigParam( 'blAutoSearchOnCat' );
00791     }
00792 
00798     public function getActLanguageId()
00799     {
00800         if ( ( $sValue = $this->getViewConfigParam( 'lang' ) ) === null ) {
00801             $iLang = oxConfig::getParameter( 'lang' );
00802             $sValue = ( $iLang !== null ) ? $iLang : oxLang::getInstance()->getBaseLanguage();
00803             $this->setViewConfigParam( 'lang', $sValue );
00804         }
00805         return $sValue;
00806     }
00807 
00813     public function getActLanguageAbbr()
00814     {
00815         return oxLang::getInstance()->getLanguageAbbr( $this->getActLanguageId() );
00816     }
00817 
00823     public function getActiveClassName()
00824     {
00825         return $this->getConfig()->getActiveView()->getClassName();
00826     }
00827 
00833     public function getArtPerPageCount()
00834     {
00835         return $this->getViewConfigParam( 'iartPerPage' );
00836     }
00837 
00843     public function getNavUrlParams()
00844     {
00845         if ( ( $sParams = $this->getViewConfigParam( 'navurlparams' ) ) === null ) {
00846             $sParams = '';
00847             $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00848             foreach ( $aNavParams as $sName => $sValue ) {
00849                 if ( isset( $sValue ) ) {
00850                     if ( $sParams ) {
00851                         $sParams .= '&amp;';
00852                     }
00853                     $sParams .= "{$sName}=".rawurlencode( $sValue );
00854                 }
00855             }
00856             if ( $sParams ) {
00857                 $sParams = '&amp;'.$sParams;
00858             }
00859             $this->setViewConfigParam( 'navurlparams', $sParams );
00860         }
00861 
00862         return $sParams;
00863     }
00864 
00870     public function getNavFormParams()
00871     {
00872 
00873         if ( ( $sParams = $this->getViewConfigParam( 'navformparams' ) ) === null ) {
00874             $oStr = getStr();
00875             $sParams = '';
00876             $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00877             foreach ( $aNavParams as $sName => $sValue ) {
00878                 if ( isset( $sValue ) ) {
00879                     $sParams .= "<input type=\"hidden\" name=\"{$sName}\" value=\"".$oStr->htmlentities( $sValue )."\">\n";
00880                 }
00881             }
00882             $this->setViewConfigParam( 'navformparams', $sParams );
00883         }
00884         return $sParams;
00885     }
00886 
00892     public function getStockOnDefaultMessage()
00893     {
00894         return $this->getConfig()->getConfigParam( 'blStockOnDefaultMessage' );
00895     }
00896 
00902     public function getStockOffDefaultMessage()
00903     {
00904         return $this->getConfig()->getConfigParam( 'blStockOffDefaultMessage' );
00905     }
00906 
00912     public function getShopVersion()
00913     {
00914         return $this->getViewConfigParam( 'sShopVersion' );
00915     }
00916 
00922     public function getAjaxLink()
00923     {
00924         return $this->getViewConfigParam( 'ajaxlink' );
00925     }
00926 
00932     public function isMultiShop()
00933     {
00934         $oShop = $this->getConfig()->getActiveShop();
00935         return isset( $oShop->oxshops__oxismultishop ) ? ( (bool) $oShop->oxshops__oxismultishop->value ) : false;
00936     }
00937 
00943     public function getServiceUrl()
00944     {
00945         return $this->getViewConfigParam( 'sServiceUrl' );
00946     }
00947 
00954     public function getRemoteAccessToken()
00955     {
00956         $sRaToken = oxSession::getInstance()->getRemoteAccessToken();
00957 
00958         return $sRaToken;
00959     }
00960 
00961 
00968     public function getActionClassName()
00969     {
00970         return $this->getConfig()->getActiveView()->getActionClassName();
00971     }
00972 
00978     public function getFbAppId()
00979     {
00980         return $this->getConfig()->getConfigParam( 'sFbAppId' );
00981     }
00982 
00988     public function getShowBasketTimeout()
00989     {
00990         return $this->getConfig()->getConfigParam( 'blPsBasketReservationEnabled' )
00991             && ($this->getSession()->getBasketReservations()->getTimeLeft() > 0);
00992     }
00993 
00999     public function getBasketTimeLeft()
01000     {
01001         if (!isset($this->_dBasketTimeLeft)) {
01002             $this->_dBasketTimeLeft = $this->getSession()->getBasketReservations()->getTimeLeft();
01003         }
01004         return $this->_dBasketTimeLeft;
01005     }
01006 
01013     public function getShowFbConnect()
01014     {
01015         $myConfig = $this->getConfig();
01016 
01017         if ( $myConfig->getConfigParam( 'bl_showFbConnect' ) ) {
01018             if ( $myConfig->getConfigParam( "sFbAppId" ) && $myConfig->getConfigParam( "sFbSecretKey" ) ) {
01019                 return true;
01020             }
01021         }
01022 
01023         return false;
01024     }
01025 
01031     public function getTsDomain()
01032     {
01033         $sDomain = false;
01034         $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01035         if ( is_array( $aTsConfig ) ) {
01036             $sDomain = $aTsConfig["blTestMode"] ? $aTsConfig["sTsTestUrl"] : $aTsConfig["sTsUrl"];
01037         }
01038         return $sDomain;
01039     }
01040 
01046     public function getTsWidgetUrl()
01047     {
01048         $sUrl = false;
01049         if ( $sTsId = $this->getTsId() ) {
01050             $sTsUrl = $this->getTsDomain();
01051 
01052             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01053             $sTsWidgetUri = isset( $aTsConfig["sTsWidgetUri"] ) ? current( $aTsConfig["sTsWidgetUri"] ) : false;
01054 
01055             if ( $sTsUrl && $sTsWidgetUri ) {
01056                 //$sLocal = $this->getConfig()->getImageDir()."{$sTsId}.gif";
01057                 $sUrl = sprintf( "{$sTsUrl}/{$sTsWidgetUri}", $sTsId );
01058                 //if ( $sImgName = oxUtils::getInstance()->getRemoteCachePath( $sUrl, $sLocal ) ) {
01059                 //    $sUrl = $this->getImageUrl().basename( $sImgName );
01060                 //}
01061             }
01062         }
01063 
01064         return $sUrl;
01065     }
01066 
01072     public function getTsInfoUrl()
01073     {
01074         $sUrl = false;
01075         if ( $sTsId = $this->getTsId() ) {
01076             $sTsUrl = $this->getTsDomain();
01077 
01078             $sLangId = oxLang::getInstance()->getLanguageAbbr();
01079             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01080             $sTsInfoUri = ( isset( $aTsConfig["sTsInfoUri"] ) && isset( $aTsConfig["sTsInfoUri"][$sLangId] ) ) ? $aTsConfig["sTsInfoUri"][$sLangId] : false;
01081 
01082             if ( $sTsUrl && $sTsInfoUri ) {
01083                 $sUrl = sprintf( "{$sTsUrl}/{$sTsInfoUri}", $sTsId );
01084             }
01085         }
01086 
01087         return $sUrl;
01088     }
01089 
01095     public function getTsRatingUrl()
01096     {
01097         $sUrl = false;
01098         if ( $sTsId = $this->getTsId() ) {
01099             $sTsUrl = $this->getTsDomain();
01100 
01101             $sLangId = oxLang::getInstance()->getLanguageAbbr();
01102             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01103             $sTsRateUri = ( isset( $aTsConfig["sTsRatingUri"] ) && isset( $aTsConfig["sTsRatingUri"][$sLangId] ) ) ? $aTsConfig["sTsRatingUri"][$sLangId] : false;
01104 
01105             if ( $sTsUrl && $sTsRateUri ) {
01106                 $sUrl = sprintf( "{$sTsUrl}/{$sTsRateUri}", $sTsId );
01107             }
01108         }
01109 
01110         return $sUrl;
01111     }
01112 
01120     public function showTs( $sType )
01121     {
01122         $blShow = false;
01123         switch ( $sType ) {
01124             case "WIDGET":
01125                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsWidget" );
01126                 break;
01127             case "THANKYOU":
01128                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsThankyouReview" );
01129                 break;
01130             case "ORDEREMAIL":
01131                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderEmailReview" );
01132                 break;
01133             case "ORDERCONFEMAIL":
01134                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderSendEmailReview" );
01135                 break;
01136         }
01137         return $blShow;
01138     }
01139 
01145     public function getTsId()
01146     {
01147         $sTsId = false;
01148         $oConfig = $this->getConfig();
01149         $aLangIds = $oConfig->getConfigParam( "aTsLangIds" );
01150         $aActInfo = $oConfig->getConfigParam( "aTsActiveLangIds" );
01151 
01152         // mapping with language id
01153         $sLangId = oxLang::getInstance()->getLanguageAbbr();
01154         if ( isset( $aActInfo[$sLangId] ) && $aActInfo[$sLangId] &&
01155              isset( $aLangIds[$sLangId] ) && $aLangIds[$sLangId]
01156            ) {
01157             $sTsId = $aLangIds[$sLangId];
01158         }
01159 
01160         return $sTsId;
01161     }
01162 
01168     public function isTplBlocksDebugMode()
01169     {
01170         return (bool) $this->getConfig()->getConfigParam('blDebugTemplateBlocks');
01171     }
01172 
01178     public function getPasswordLength()
01179     {
01180         $iPasswordLength = 6;
01181 
01182         $oConfig = $this->getConfig();
01183 
01184         if ($oConfig->getConfigParam( "iPasswordLength" ) ) {
01185             $iPasswordLength = $oConfig->getConfigParam( "iPasswordLength" );
01186         }
01187 
01188         return $iPasswordLength;
01189     }
01190 
01196     public function getCountryList()
01197     {
01198         if ( $this->_oCountryList === null ) {
01199             // passing country list
01200             $this->_oCountryList = oxNew( 'oxcountrylist' );
01201             $this->_oCountryList->loadActiveCountries();
01202         }
01203         return $this->_oCountryList;
01204     }
01205 
01206 
01217     public function getModulePath($sModule, $sFile = '')
01218     {
01219         if (!$sFile || ($sFile[0] != '/')) {
01220             $sFile = '/'.$sFile;
01221         }
01222         $oModule = oxNew("oxmodule");
01223         $sModulePath = $oModule->getModulePath($sModule);
01224         $sFile = $this->getConfig()->getModulesDir().$sModulePath.$sFile;
01225         if (file_exists($sFile) || is_dir($sFile)) {
01226             return $sFile;
01227         } else {
01228             $oEx = oxNew( "oxFileException", "Requested file not found for module $sModule ($sFile)" );
01229             $oEx->debugOut();
01230             if (!$this->getConfig()->getConfigParam( 'iDebug' )) {
01231                 return '';
01232             }
01233             throw $oEx;
01234         }
01235     }
01236 
01247     public function getModuleUrl($sModule, $sFile = '')
01248     {
01249         $sUrl = str_replace(
01250                     rtrim($this->getConfig()->getConfigParam('sShopDir'), '/'),
01251                     rtrim($this->getConfig()->getCurrentShopUrl( false ), '/'),
01252                     $this->getModulePath($sModule, $sFile)
01253                            );
01254         return $sUrl;
01255     }
01256 
01264     public function getViewThemeParam( $sName )
01265     {
01266         $sValue = false;
01267 
01268         if ($this->getConfig()->isThemeOption( $sName ) ) {
01269             $sValue = $this->getConfig()->getConfigParam( $sName );
01270         }
01271 
01272         return $sValue;
01273     }
01274 
01275 
01281     public function showSelectLists()
01282     {
01283         return (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' );
01284     }
01285 
01291     public function showSelectListsInList()
01292     {
01293         return $this->showSelectLists() && (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectListsInAList' );
01294     }
01295 
01296 
01297 
01303     public function isAltImageServerConfigured()
01304     {
01305         $oConfig = $this->getConfig();
01306 
01307         return $oConfig->getConfigParam('sAltImageUrl') || $oConfig->getConfigParam('sSSLAltImageUrl') ||
01308                $oConfig->getConfigParam('sAltImageDir') || $oConfig->getConfigParam('sSSLAltImageDir');
01309     }
01310 
01311 }