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