oxviewconfig.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class oxViewConfig extends oxSuperCfg
00009 {
00015     protected $_oShop = null;
00016 
00022     protected $_aViewData = null;
00023 
00029     protected $_aConfigParams = array();
00030 
00036     protected $_sHelpPageLink = null;
00037 
00043     protected $_oCountryList = null;
00044 
00050     public function getHomeLink()
00051     {
00052         if ( ( $sValue = $this->getViewConfigParam( 'homeLink' ) ) === null ) {
00053             $myConfig = $this->getConfig();
00054             $myUtils  = oxUtils::getInstance();
00055             $oLang    = oxLang::getInstance();
00056             $iLang = $oLang->getBaseLanguage();
00057 
00058             $sValue = null;
00059 
00060             $blAddStartCl = $myUtils->seoIsActive() && ( $iLang != $myConfig->getConfigParam( 'sDefaultLang' ) );
00061 
00062 
00063             if ( $blAddStartCl ) {
00064                 $sValue = oxSeoEncoder::getInstance()->getStaticUrl( $this->getSelfLink() . 'cl=start', $iLang );
00065                 $sValue = oxUtilsUrl::getInstance()->appendUrl(
00066                         $sValue,
00067                         oxUtilsUrl::getInstance()->getBaseAddUrlParams()
00068                     );
00069                 $sValue = getStr()->preg_replace('/(\?|&(amp;)?)$/', '', $sValue);
00070             }
00071 
00072             if ( !$sValue ) {
00073                 $sValue = getStr()->preg_replace('#index.php\??$#', '', $this->getSelfLink());
00074             }
00075 
00076             $this->setViewConfigParam( 'homeLink', $sValue );
00077         }
00078         return $sValue;
00079     }
00080 
00086     public function getActTplName()
00087     {
00088         $sTplName = oxConfig::getParameter( 'tpl' );
00089         // #M1176: Logout from CMS page
00090         if ( !$sTplName ) {
00091             $sTplName = $this->getViewConfigParam('tpl');
00092         }
00093         return $sTplName ? basename( $sTplName ) : null;
00094     }
00095 
00101     public function getLogoutLink()
00102     {
00103         $sClass         = $this->getActionClassName();
00104         $sCatnid        = $this->getActCatId();
00105         $sArtnid        = $this->getActArticleId();
00106         $sTplName       = $this->getActTplName();
00107         $sSearchParam   = $this->getActSearchParam();
00108         $sSearchTag     = $this->getActSearchTag();
00109         $sListType      = $this->getActListType();
00110 
00111 
00112         return $this->getConfig()->getShopHomeURL()
00113             ."cl={$sClass}"
00114             . ( $sCatnid ? "&amp;cnid={$sCatnid}" : '' )
00115             . ( $sArtnid ? "&amp;anid={$sArtnid}" : '' )
00116             . ( $sSearchParam ? "&amp;searchparam={$sSearchParam}" : '' )
00117             . ( $sSearchTag ? "&amp;searchtag={$sSearchTag}" : '' )
00118             . ( $sListType ? "&amp;listtype={$sListType}" : '' )
00119             . "&amp;fnc=logout"
00120             . ( $sTplName ? "&amp;tpl=".basename( $sTplName ) : '' )
00121             . "&amp;redirect=1";
00122     }
00123 
00129     public function getHelpPageLink()
00130     {
00131         if ( $this->_sHelpPageLink === null ) {
00132             $oConfig  = $this->getConfig();
00133             $sClass   = $this->getActiveClassName();
00134             $sLink    = false;
00135             $sAddQ    = "oxshopid = '".$oConfig->getShopId()."' and oxactive = 1 and";
00136             $sViewName = getViewName( 'oxcontents' );
00137 
00138             // checking if there is a custom content for help page
00139             $sQ  = "select oxid from {$sViewName} where {$sAddQ} oxloadid = 'oxhelp".strtolower( $sClass )."' union ";
00140             $sQ .= "select oxid from {$sViewName} where {$sAddQ} oxloadid = 'oxhelpdefault'";
00141 
00142             if ( $sContentId = oxDb::getDb()->getOne( $sQ ) ) {
00143                 $oContent = oxNew( "oxcontent" );
00144                 $oContent->load( $sContentId );
00145                 $sLink = $oContent->getLink();
00146             }
00147 
00148             $this->_sHelpPageLink = $sLink ? $sLink : $this->getHelpLink();
00149         }
00150         return $this->_sHelpPageLink;
00151     }
00152 
00158     public function getHelpLink()
00159     {
00160         $sTplName = $this->getActTplName();
00161         $sClass   = $this->getActiveClassName();
00162         return $this->getConfig()->getShopCurrentURL()."cl=help&amp;page={$sClass}".( $sTplName ? "&amp;tpl={$sTplName}" : '' );
00163     }
00164 
00170     public function getActCatId()
00171     {
00172         return oxConfig::getParameter( 'cnid' );
00173     }
00174 
00180     public function getActArticleId()
00181     {
00182         return oxConfig::getParameter( 'anid' );
00183     }
00184 
00190     public function getActSearchParam()
00191     {
00192         return oxConfig::getParameter( 'searchparam' );
00193     }
00194 
00200     public function getActSearchTag()
00201     {
00202         return oxConfig::getParameter( 'searchtag' );
00203     }
00204 
00210     public function getActListType()
00211     {
00212         return oxConfig::getParameter( 'listtype' );
00213     }
00214 
00220     public function getActManufacturerId()
00221     {
00222         return oxConfig::getParameter( 'mnid' );
00223     }
00224 
00236     public function setViewConfigParam( $sName, $sValue )
00237     {
00238         startProfile('oxviewconfig::setViewConfigParam');
00239 
00240         $this->_aConfigParams[$sName] = $sValue;
00241 
00242         stopProfile('oxviewconfig::setViewConfigParam');
00243     }
00244 
00252     public function getViewConfigParam( $sName )
00253     {
00254         startProfile('oxviewconfig::getViewConfigParam');
00255 
00256         if ( $this->_oShop && isset( $this->_oShop->$sName ) ) {
00257             $sValue = $this->_oShop->$sName;
00258         } elseif ( $this->_aViewData && isset( $this->_aViewData[ $sName ] ) ) {
00259             $sValue = $this->_aViewData[ $sName ];
00260         } else {
00261             $sValue = ( isset( $this->_aConfigParams[ $sName ] ) ? $this->_aConfigParams[ $sName ] : null );
00262         }
00263 
00264         stopProfile('oxviewconfig::getViewConfigParam');
00265 
00266         return $sValue;
00267     }
00268 
00278     public function setViewShop( $oShop, $aViewData )
00279     {
00280         $this->_oShop     = $oShop;
00281         $this->_aViewData = $aViewData;
00282     }
00283 
00289     public function getSessionId()
00290     {
00291         if ( ( $sValue = $this->getViewConfigParam( 'sessionid' ) ) === null ) {
00292             $sValue = $this->getSession()->getId();
00293             $this->setViewConfigParam( 'sessionid', $sValue );
00294         }
00295         return $sValue;
00296     }
00297 
00303     public function getHiddenSid()
00304     {
00305         if ( ( $sValue = $this->getViewConfigParam( 'hiddensid' ) ) === null ) {
00306             $sValue = $this->getSession()->hiddenSid();
00307 
00308             // appending language info to form
00309             if ( ( $sLang = oxLang::getInstance()->getFormLang() ) ) {
00310                 $sValue .= "\n{$sLang}";
00311             }
00312 
00313 
00314             $this->setViewConfigParam( 'hiddensid', $sValue );
00315         }
00316         return $sValue;
00317     }
00318 
00324     public function getSelfLink()
00325     {
00326         if ( ( $sValue = $this->getViewConfigParam( 'selflink' ) ) === null ) {
00327             $sValue = $this->getConfig()->getShopHomeURL();
00328             $this->setViewConfigParam( 'selflink', $sValue );
00329         }
00330         return $sValue;
00331     }
00332 
00338     public function getSslSelfLink()
00339     {
00340         if ( ( $sValue = $this->getViewConfigParam( 'sslselflink' ) ) === null ) {
00341             $sValue = $this->getConfig()->getShopSecureHomeURL();
00342             $this->setViewConfigParam( 'sslselflink', $sValue );
00343         }
00344         return $sValue;
00345     }
00346 
00352     public function getBaseDir()
00353     {
00354         if ( ( $sValue = $this->getViewConfigParam( 'basedir' ) ) === null ) {
00355             $sValue = $this->getConfig()->getShopURL();
00356             $this->setViewConfigParam( 'basedir', $sValue );
00357         }
00358         return $sValue;
00359     }
00360 
00366     public function getCoreUtilsDir()
00367     {
00368         if ( ( $sValue = $this->getViewConfigParam( 'coreutilsdir' ) ) === null ) {
00369             $sValue = $this->getConfig()->getCoreUtilsURL();
00370             $this->setViewConfigParam( 'coreutilsdir', $sValue );
00371         }
00372         return $sValue;
00373     }
00374 
00380     public function getSelfActionLink()
00381     {
00382         if ( ( $sValue = $this->getViewConfigParam( 'selfactionlink' ) ) === null ) {
00383             $sValue = $this->getConfig()->getShopCurrentUrl();
00384             $this->setViewConfigParam( 'selfactionlink', $sValue );
00385         }
00386         return $sValue;
00387     }
00388 
00394     public function getCurrentHomeDir()
00395     {
00396         if ( ( $sValue = $this->getViewConfigParam( 'currenthomedir' ) ) === null ) {
00397             $sValue = $this->getConfig()->getCurrentShopUrl();
00398             $this->setViewConfigParam( 'currenthomedir', $sValue );
00399         }
00400         return $sValue;
00401     }
00402 
00408     public function getBasketLink()
00409     {
00410         if ( ( $sValue = $this->getViewConfigParam( 'basketlink' ) ) === null ) {
00411             $sValue = $this->getConfig()->getShopHomeURL()   . 'cl=basket';
00412             $this->setViewConfigParam( 'basketlink', $sValue );
00413         }
00414         return $sValue;
00415     }
00416 
00422     public function getOrderLink()
00423     {
00424         if ( ( $sValue = $this->getViewConfigParam( 'orderlink' ) ) === null ) {
00425             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=user';
00426             $this->setViewConfigParam( 'orderlink', $sValue );
00427         }
00428         return $sValue;
00429     }
00430 
00436     public function getPaymentLink()
00437     {
00438         if ( ( $sValue = $this->getViewConfigParam( 'paymentlink' ) ) === null ) {
00439             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=payment';
00440             $this->setViewConfigParam( 'paymentlink', $sValue );
00441         }
00442         return $sValue;
00443     }
00444 
00450     public function getExeOrderLink()
00451     {
00452         if ( ( $sValue = $this->getViewConfigParam( 'exeorderlink' ) ) === null ) {
00453             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order&amp;fnc=execute';
00454             $this->setViewConfigParam( 'exeorderlink', $sValue );
00455         }
00456         return $sValue;
00457     }
00458 
00464     public function getOrderConfirmLink()
00465     {
00466         if ( ( $sValue = $this->getViewConfigParam( 'orderconfirmlink' ) ) === null ) {
00467             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order';
00468             $this->setViewConfigParam( 'orderconfirmlink', $sValue );
00469         }
00470         return $sValue;
00471     }
00472 
00478     public function getResourceUrl()
00479     {
00480         if ( ( $sValue = $this->getViewConfigParam( 'basetpldir' ) ) === null ) {
00481             $sValue = $this->getConfig()->getResourceUrl( null, $this->isAdmin() );
00482             $this->setViewConfigParam( 'basetpldir', $sValue );
00483         }
00484         return $sValue;
00485     }
00486 
00492     public function getTemplateDir()
00493     {
00494         if ( ( $sValue = $this->getViewConfigParam( 'templatedir' ) ) === null ) {
00495             $sValue = $this->getConfig()->getTemplateDir( $this->isAdmin() );
00496             $this->setViewConfigParam( 'templatedir', $sValue );
00497         }
00498         return $sValue;
00499     }
00500 
00506     public function getUrlTemplateDir()
00507     {
00508         if ( ( $sValue = $this->getViewConfigParam( 'urltemplatedir' ) ) === null ) {
00509             $sValue = $this->getConfig()->getTemplateUrl( $this->isAdmin() );
00510             $this->setViewConfigParam( 'urltemplatedir', $sValue );
00511         }
00512         return $sValue;
00513     }
00514 
00522     public function getImageUrl( $sFile = null )
00523     {
00524         if ($sFile) {
00525            $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), null, null, $sFile );
00526         } elseif ( ( $sValue = $this->getViewConfigParam( 'imagedir' ) ) === null ) {
00527             $sValue = $this->getConfig()->getImageUrl( $this->isAdmin() );
00528             $this->setViewConfigParam( 'imagedir', $sValue );
00529         }
00530         return $sValue;
00531     }
00532 
00538     public function getNoSslImageDir()
00539     {
00540         if ( ( $sValue = $this->getViewConfigParam( 'nossl_imagedir' ) ) === null ) {
00541             $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), false );
00542             $this->setViewConfigParam( 'nossl_imagedir', $sValue );
00543         }
00544         return $sValue;
00545     }
00546 
00553     public function getPictureDir()
00554     {
00555         if ( ( $sValue = $this->getViewConfigParam( 'picturedir' ) ) === null ) {
00556             $sValue = $this->getConfig()->getPictureUrl( null, $this->isAdmin() );
00557             $this->setViewConfigParam( 'picturedir', $sValue );
00558         }
00559         return $sValue;
00560     }
00561 
00567     public function getAdminDir()
00568     {
00569         if ( ( $sValue = $this->getViewConfigParam( 'sAdminDir' ) ) === null ) {
00570             $sValue = $this->getConfig()->getConfigParam( 'sAdminDir' );
00571             $this->setViewConfigParam( 'sAdminDir', $sValue );
00572         }
00573         return $sValue;
00574     }
00575 
00581     public function getActiveShopId()
00582     {
00583         if ( ( $sValue = $this->getViewConfigParam( 'shopid' ) ) === null ) {
00584             $sValue = $this->getConfig()->getShopId();
00585             $this->setViewConfigParam( 'shopid', $sValue );
00586         }
00587         return $sValue;
00588     }
00589 
00595     public function isSsl()
00596     {
00597         if ( ( $sValue = $this->getViewConfigParam( 'isssl' ) ) === null ) {
00598             $sValue = $this->getConfig()->isSsl();
00599             $this->setViewConfigParam( 'isssl', $sValue );
00600         }
00601         return $sValue;
00602     }
00603 
00604 
00610     public function getRemoteAddress()
00611     {
00612         if ( ( $sValue = $this->getViewConfigParam( 'ip' ) ) === null ) {
00613             $sValue = oxUtilsServer::getInstance()->getRemoteAddress();
00614             $this->setViewConfigParam( 'ip', $sValue );
00615         }
00616         return $sValue;
00617     }
00618 
00624     public function getPopupIdent()
00625     {
00626         if ( ( $sValue = $this->getViewConfigParam( 'popupident' ) ) === null ) {
00627             $sValue = md5( $this->getConfig()->getShopUrl() );
00628             $this->setViewConfigParam( 'popupident', $sValue );
00629         }
00630         return $sValue;
00631     }
00632 
00638     public function getPopupIdentRand()
00639     {
00640         if ( ( $sValue = $this->getViewConfigParam( 'popupidentrand' ) ) === null ) {
00641             $sValue = md5( time() );
00642             $this->setViewConfigParam( 'popupidentrand', $sValue );
00643         }
00644         return $sValue;
00645     }
00646 
00652     public function getArtPerPageForm()
00653     {
00654         if ( ( $sValue = $this->getViewConfigParam( 'artperpageform' ) ) === null ) {
00655             $sValue = $this->getConfig()->getShopCurrentUrl();
00656             $this->setViewConfigParam( 'artperpageform', $sValue );
00657         }
00658         return $sValue;
00659     }
00660 
00666     public function isBuyableParent()
00667     {
00668         return $this->getConfig()->getConfigParam( 'blVariantParentBuyable' );
00669     }
00670 
00676     public function showBirthdayFields()
00677     {
00678         return $this->getConfig()->getConfigParam( 'blShowBirthdayFields' );
00679     }
00680 
00686     public function showFinalStep()
00687     {
00688         return $this->getConfig()->getConfigParam( 'blShowFinalStep' );
00689     }
00690 
00696     public function getNrOfCatArticles()
00697     {
00698         // checking if all needed data is set
00699         switch (oxSession::getVar( 'ldtype' )) {
00700             case 'grid':
00701                 return $this->getConfig()->getConfigParam( 'aNrofCatArticlesInGrid' );
00702                 break;
00703             case 'line':
00704             case 'infogrid':
00705             default:
00706                 return $this->getConfig()->getConfigParam( 'aNrofCatArticles' );
00707         }
00708     }
00709 
00715     public function getShowWishlist()
00716     {
00717         return $this->getConfig()->getConfigParam( 'bl_showWishlist' );
00718     }
00719 
00725     public function getShowCompareList()
00726     {
00727         $myConfig = $this->getConfig();
00728         $blShowCompareList = true;
00729 
00730         if ( !$myConfig->getConfigParam( 'bl_showCompareList' ) ||
00731             ( $myConfig->getConfigParam( 'blDisableNavBars' ) && $myConfig->getActiveView()->getIsOrderStep() ) ) {
00732             $blShowCompareList = false;
00733         }
00734 
00735         return $blShowCompareList;
00736     }
00737 
00743     public function getShowListmania()
00744     {
00745         return $this->getConfig()->getConfigParam( 'bl_showListmania' );
00746     }
00747 
00753     public function getShowVouchers()
00754     {
00755         return $this->getConfig()->getConfigParam( 'bl_showVouchers' );
00756     }
00757 
00763     public function getShowGiftWrapping()
00764     {
00765         return $this->getConfig()->getConfigParam( 'bl_showGiftWrapping' );
00766     }
00767 
00773     public function isAutoSearchOnCat()
00774     {
00775         return $this->getConfig()->getConfigParam( 'blAutoSearchOnCat' );
00776     }
00777 
00783     public function getActLanguageId()
00784     {
00785         if ( ( $sValue = $this->getViewConfigParam( 'lang' ) ) === null ) {
00786             $iLang = oxConfig::getParameter( 'lang' );
00787             $sValue = ( $iLang !== null ) ? $iLang : oxLang::getInstance()->getBaseLanguage();
00788             $this->setViewConfigParam( 'lang', $sValue );
00789         }
00790         return $sValue;
00791     }
00792 
00798     public function getActiveClassName()
00799     {
00800         return $this->getConfig()->getActiveView()->getClassName();
00801     }
00802 
00808     public function getArtPerPageCount()
00809     {
00810         return $this->getViewConfigParam( 'iartPerPage' );
00811     }
00812 
00818     public function getNavUrlParams()
00819     {
00820         if ( ( $sParams = $this->getViewConfigParam( 'navurlparams' ) ) === null ) {
00821             $sParams = '';
00822             $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00823             foreach ( $aNavParams as $sName => $sValue ) {
00824                 if ( isset( $sValue ) ) {
00825                     if ( $sParams ) {
00826                         $sParams .= '&amp;';
00827                     }
00828                     $sParams .= "{$sName}=".rawurlencode( $sValue );
00829                 }
00830             }
00831             if ( $sParams ) {
00832                 $sParams = '&amp;'.$sParams;
00833             }
00834             $this->setViewConfigParam( 'navurlparams', $sParams );
00835         }
00836 
00837         return $sParams;
00838     }
00839 
00845     public function getNavFormParams()
00846     {
00847 
00848         if ( ( $sParams = $this->getViewConfigParam( 'navformparams' ) ) === null ) {
00849             $oStr = getStr();
00850             $sParams = '';
00851             $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00852             foreach ( $aNavParams as $sName => $sValue ) {
00853                 if ( isset( $sValue ) ) {
00854                     $sParams .= "<input type=\"hidden\" name=\"{$sName}\" value=\"".$oStr->htmlentities( $sValue )."\">\n";
00855                 }
00856             }
00857             $this->setViewConfigParam( 'navformparams', $sParams );
00858         }
00859         return $sParams;
00860     }
00861 
00867     public function getStockOnDefaultMessage()
00868     {
00869         return $this->getConfig()->getConfigParam( 'blStockOnDefaultMessage' );
00870     }
00871 
00877     public function getStockOffDefaultMessage()
00878     {
00879         return $this->getConfig()->getConfigParam( 'blStockOffDefaultMessage' );
00880     }
00881 
00887     public function getShopVersion()
00888     {
00889         return $this->getViewConfigParam( 'sShopVersion' );
00890     }
00891 
00897     public function getAjaxLink()
00898     {
00899         return $this->getViewConfigParam( 'ajaxlink' );
00900     }
00901 
00907     public function isMultiShop()
00908     {
00909         $oShop = $this->getConfig()->getActiveShop();
00910         return isset( $oShop->oxshops__oxismultishop ) ? ( (bool) $oShop->oxshops__oxismultishop->value ) : false;
00911     }
00912 
00918     public function getServiceUrl()
00919     {
00920         return $this->getViewConfigParam( 'sServiceUrl' );
00921     }
00922 
00929     public function getRemoteAccessToken()
00930     {
00931         $sRaToken = oxSession::getInstance()->getRemoteAccessToken();
00932 
00933         return $sRaToken;
00934     }
00935 
00936 
00943     public function getActionClassName()
00944     {
00945         return $this->getConfig()->getActiveView()->getActionClassName();
00946     }
00947 
00953     public function getFbAppId()
00954     {
00955         return $this->getConfig()->getConfigParam( 'sFbAppId' );
00956     }
00957 
00963     public function getShowBasketTimeout()
00964     {
00965         return $this->getConfig()->getConfigParam( 'blPsBasketReservationEnabled' )
00966             && ($this->getSession()->getBasketReservations()->getTimeLeft() > 0);
00967     }
00968 
00974     public function getBasketTimeLeft()
00975     {
00976         if (!isset($this->_dBasketTimeLeft)) {
00977             $this->_dBasketTimeLeft = $this->getSession()->getBasketReservations()->getTimeLeft();
00978         }
00979         return $this->_dBasketTimeLeft;
00980     }
00981 
00988     public function getShowFbConnect()
00989     {
00990         $myConfig = $this->getConfig();
00991 
00992         if ( $myConfig->getConfigParam( 'bl_showFbConnect' ) ) {
00993             if ( $myConfig->getConfigParam( "sFbAppId" ) && $myConfig->getConfigParam( "sFbSecretKey" ) ) {
00994                 return true;
00995             }
00996         }
00997 
00998         return false;
00999     }
01000 
01006     public function getTsDomain()
01007     {
01008         $sDomain = false;
01009         $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01010         if ( is_array( $aTsConfig ) ) {
01011             $sDomain = $aTsConfig["blTestMode"] ? $aTsConfig["sTsTestUrl"] : $aTsConfig["sTsUrl"];
01012         }
01013         return $sDomain;
01014     }
01015 
01021     public function getTsWidgetUrl()
01022     {
01023         $sUrl = false;
01024         if ( $sTsId = $this->getTsId() ) {
01025             $sTsUrl = $this->getTsDomain();
01026 
01027             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01028             $sTsWidgetUri = isset( $aTsConfig["sTsWidgetUri"] ) ? current( $aTsConfig["sTsWidgetUri"] ) : false;
01029 
01030             if ( $sTsUrl && $sTsWidgetUri ) {
01031                 //$sLocal = $this->getConfig()->getImageDir()."{$sTsId}.gif";
01032                 $sUrl = sprintf( "{$sTsUrl}/{$sTsWidgetUri}", $sTsId );
01033                 //if ( $sImgName = oxUtils::getInstance()->getRemoteCachePath( $sUrl, $sLocal ) ) {
01034                 //    $sUrl = $this->getImageUrl().basename( $sImgName );
01035                 //}
01036             }
01037         }
01038 
01039         return $sUrl;
01040     }
01041 
01047     public function getTsInfoUrl()
01048     {
01049         $sUrl = false;
01050         if ( $sTsId = $this->getTsId() ) {
01051             $sTsUrl = $this->getTsDomain();
01052 
01053             $sLangId = oxLang::getInstance()->getLanguageAbbr();
01054             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01055             $sTsInfoUri = ( isset( $aTsConfig["sTsInfoUri"] ) && isset( $aTsConfig["sTsInfoUri"][$sLangId] ) ) ? $aTsConfig["sTsInfoUri"][$sLangId] : false;
01056 
01057             if ( $sTsUrl && $sTsInfoUri ) {
01058                 $sUrl = sprintf( "{$sTsUrl}/{$sTsInfoUri}", $sTsId );
01059             }
01060         }
01061 
01062         return $sUrl;
01063     }
01064 
01070     public function getTsRatingUrl()
01071     {
01072         $sUrl = false;
01073         if ( $sTsId = $this->getTsId() ) {
01074             $sTsUrl = $this->getTsDomain();
01075 
01076             $sLangId = oxLang::getInstance()->getLanguageAbbr();
01077             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01078             $sTsRateUri = ( isset( $aTsConfig["sTsRatingUri"] ) && isset( $aTsConfig["sTsRatingUri"][$sLangId] ) ) ? $aTsConfig["sTsRatingUri"][$sLangId] : false;
01079 
01080             if ( $sTsUrl && $sTsRateUri ) {
01081                 $sUrl = sprintf( "{$sTsUrl}/{$sTsRateUri}", $sTsId );
01082             }
01083         }
01084 
01085         return $sUrl;
01086     }
01087 
01095     public function showTs( $sType )
01096     {
01097         $blShow = false;
01098         switch ( $sType ) {
01099             case "WIDGET":
01100                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsWidget" );
01101                 break;
01102             case "THANKYOU":
01103                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsThankyouReview" );
01104                 break;
01105             case "ORDEREMAIL":
01106                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderEmailReview" );
01107                 break;
01108             case "ORDERCONFEMAIL":
01109                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderSendEmailReview" );
01110                 break;
01111         }
01112         return $blShow;
01113     }
01114 
01120     public function getTsId()
01121     {
01122         $sTsId = false;
01123         $oConfig = $this->getConfig();
01124         $aLangIds = $oConfig->getConfigParam( "aTsLangIds" );
01125         $aActInfo = $oConfig->getConfigParam( "aTsActiveLangIds" );
01126 
01127         // mapping with language id
01128         $sLangId = oxLang::getInstance()->getLanguageAbbr();
01129         if ( isset( $aActInfo[$sLangId] ) && $aActInfo[$sLangId] &&
01130              isset( $aLangIds[$sLangId] ) && $aLangIds[$sLangId]
01131            ) {
01132             $sTsId = $aLangIds[$sLangId];
01133         }
01134 
01135         return $sTsId;
01136     }
01137 
01143     public function isTplBlocksDebugMode()
01144     {
01145         return (bool) $this->getConfig()->getConfigParam('blDebugTemplateBlocks');
01146     }
01147 
01153     public function getPasswordLength()
01154     {
01155         $iPasswordLength = 6;
01156 
01157         $oConfig = $this->getConfig();
01158 
01159         if ($oConfig->getConfigParam( "iPasswordLength" ) ) {
01160             $iPasswordLength = $oConfig->getConfigParam( "iPasswordLength" );
01161         }
01162 
01163         return $iPasswordLength;
01164     }
01165 
01171     public function getCountryList()
01172     {
01173         if ( $this->_oCountryList === null ) {
01174             // passing country list
01175             $this->_oCountryList = oxNew( 'oxcountrylist' );
01176             $this->_oCountryList->loadActiveCountries();
01177         }
01178         return $this->_oCountryList;
01179     }
01180 
01181 
01192     public function getModulePath($sModule, $sFile = '')
01193     {
01194         if (!$sFile || ($sFile[0] != '/')) {
01195             $sFile = '/'.$sFile;
01196         }
01197         $sFile = rtrim(getShopBasePath(), '/').'/modules/'.basename($sModule).$sFile;
01198         if (file_exists($sFile) || is_dir($sFile)) {
01199             return $sFile;
01200         }
01201         $oEx = new oxFileException("Requested file not found for module $sModule ($sFile)");
01202         $oEx->debugOut();
01203         throw $oEx;
01204     }
01205 
01216     public function getModuleUrl($sModule, $sFile = '')
01217     {
01218         if (!$sFile || ($sFile[0] != '/')) {
01219             $sFile = '/'.$sFile;
01220         }
01221         // check if file exists
01222         $this->getModulePath($sModule, $sFile);
01223         return rtrim($this->getConfig()->getCurrentShopUrl(), '/').'/modules/'.basename($sModule).$sFile;
01224     }
01225 
01233     public function getViewThemeParam( $sName )
01234     {
01235         $sValue = false;
01236 
01237         if ($this->getConfig()->isThemeOption( $sName ) ) {
01238             $sValue = $this->getConfig()->getConfigParam( $sName );
01239         }
01240 
01241         return $sValue;
01242     }
01243 
01244 
01250     public function showSelectLists()
01251     {
01252         return (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' );
01253     }
01254 
01260     public function showSelectListsInList()
01261     {
01262         return $this->showSelectLists() && (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectListsInAList' );
01263     }
01264 }