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     protected $_aTrustedShopRatings = null;
00051 
00057     protected $_sActiveTheme = null;
00058 
00063     protected $_sShopLogo = null;
00064 
00070     public function getHomeLink()
00071     {
00072         if ( ( $sValue = $this->getViewConfigParam( 'homeLink' ) ) === null ) {
00073             $myConfig = $this->getConfig();
00074             $myUtils  = oxRegistry::getUtils();
00075             $oLang    = oxRegistry::getLang();
00076             $iLang = $oLang->getBaseLanguage();
00077 
00078             $sValue = null;
00079 
00080             $blAddStartCl = $myUtils->seoIsActive() && ( $iLang != $myConfig->getConfigParam( 'sDefaultLang' ) );
00081 
00082 
00083             if ( $blAddStartCl ) {
00084                 $sValue = oxRegistry::get("oxSeoEncoder")->getStaticUrl( $this->getSelfLink() . 'cl=start', $iLang );
00085                 $sValue = oxRegistry::get("oxUtilsUrl")->appendUrl(
00086                         $sValue,
00087                         oxRegistry::get("oxUtilsUrl")->getBaseAddUrlParams()
00088                     );
00089                 $sValue = getStr()->preg_replace('/(\?|&(amp;)?)$/', '', $sValue);
00090             }
00091 
00092             if ( !$sValue ) {
00093                 $sValue = getStr()->preg_replace('#index.php\??$#', '', $this->getSelfLink());
00094             }
00095 
00096             $this->setViewConfigParam( 'homeLink', $sValue );
00097         }
00098         return $sValue;
00099     }
00100 
00106     public function getActContentLoadId()
00107     {
00108         $sTplName = oxRegistry::getConfig()->getRequestParameter( 'oxloadid' );
00109         // #M1176: Logout from CMS page
00110         if ( !$sTplName && $this->getConfig()->getTopActiveView() ) {
00111             $sTplName = $this->getConfig()->getTopActiveView()->getViewConfig()->getViewConfigParam('oxloadid');
00112         }
00113         return $sTplName ? basename( $sTplName ) : null;
00114     }
00115 
00121     public function getActTplName()
00122     {
00123         return oxRegistry::getConfig()->getRequestParameter( 'tpl' );
00124     }
00125 
00131     public function getActCurrency()
00132     {
00133         return $this->getConfig()->getShopCurrency();
00134     }
00135 
00141     public function getLogoutLink()
00142     {
00143         $sClass         = $this->getTopActionClassName();
00144         $sCatnid        = $this->getActCatId();
00145         $sMnfid         = $this->getActManufacturerId();
00146         $sArtnid        = $this->getActArticleId();
00147         $sTplName       = $this->getActTplName();
00148         $sContentLoadId = $this->getActContentLoadId();
00149         $sSearchParam   = $this->getActSearchParam();
00150         $sSearchTag     = $this->getActSearchTag();
00151         $sRecommId      = $this->getActRecommendationId();
00152         $sListType      = $this->getActListType();
00153 
00154         $oConfig = $this->getConfig();
00155         return ( $oConfig->isSsl()? $oConfig->getShopSecureHomeUrl() : $oConfig->getShopHomeUrl() )
00156             ."cl={$sClass}"
00157             . ( $sCatnid ? "&amp;cnid={$sCatnid}" : '' )
00158             . ( $sArtnid ? "&amp;anid={$sArtnid}" : '' )
00159             . ( $sMnfid ? "&amp;mnid={$sMnfid}" : '' )
00160             . ( $sSearchParam ? "&amp;searchparam={$sSearchParam}" : '' )
00161             . ( $sSearchTag ? "&amp;searchtag={$sSearchTag}" : '' )
00162             . ( $sRecommId ? "&amp;recommid={$sRecommId}" : '' )
00163             . ( $sListType ? "&amp;listtype={$sListType}" : '' )
00164             . "&amp;fnc=logout"
00165             . ( $sTplName ? "&amp;tpl=".basename( $sTplName ) : '' )
00166             . ( $sContentLoadId ? "&amp;oxloadid=" . $sContentLoadId : '' )
00167             . "&amp;redirect=1";
00168     }
00169 
00175     protected function _getHelpContentIdents()
00176     {
00177         $sClass   = $this->getActiveClassName();
00178         return array( 'oxhelp' . strtolower( $sClass ), 'oxhelpdefault' );
00179     }
00180 
00186     public function getHelpPageLink()
00187     {
00188         if ( $this->_sHelpPageLink === null ) {
00189             $sLink    = false;
00190 
00191             $aContentIdents = $this->_getHelpContentIdents();
00192             $oContent = oxNew( "oxContent" );
00193             foreach ( $aContentIdents as $sIdent ) {
00194                 if ( $oContent->loadByIdent( $sIdent ) ) {
00195                     $sLink = $oContent->getLink();
00196                     break;
00197                 }
00198             }
00199 
00200             $this->_sHelpPageLink = $sLink ? $sLink : $this->getHelpLink();
00201         }
00202         return $this->_sHelpPageLink;
00203     }
00204 
00210     public function getHelpLink()
00211     {
00212         $sTplName = $this->getActTplName();
00213         $sClass   = $this->getActiveClassName();
00214         return $this->getConfig()->getShopCurrentURL()."cl=help&amp;page={$sClass}".( $sTplName ? "&amp;tpl={$sTplName}" : '' );
00215     }
00216 
00222     public function getActCatId()
00223     {
00224         return oxRegistry::getConfig()->getRequestParameter( 'cnid' );
00225     }
00226 
00232     public function getActArticleId()
00233     {
00234         return oxRegistry::getConfig()->getRequestParameter( 'anid' );
00235     }
00236 
00242     public function getActSearchParam()
00243     {
00244         return oxRegistry::getConfig()->getRequestParameter( 'searchparam' );
00245     }
00246 
00252     public function getActSearchTag()
00253     {
00254         return oxRegistry::getConfig()->getRequestParameter( 'searchtag' );
00255     }
00256 
00262     public function getActRecommendationId()
00263     {
00264         return oxRegistry::getConfig()->getRequestParameter( 'recommid' );
00265     }
00266 
00272     public function getActListType()
00273     {
00274         return oxRegistry::getConfig()->getRequestParameter( 'listtype' );
00275     }
00276 
00282     public function getActManufacturerId()
00283     {
00284         return oxRegistry::getConfig()->getRequestParameter( 'mnid' );
00285     }
00286 
00292     public function getContentId()
00293     {
00294         return oxRegistry::getConfig()->getRequestParameter( 'oxcid' );
00295     }
00296 
00307     public function setViewConfigParam( $sName, $sValue )
00308     {
00309         startProfile('oxviewconfig::setViewConfigParam');
00310 
00311         $this->_aConfigParams[$sName] = $sValue;
00312 
00313         stopProfile('oxviewconfig::setViewConfigParam');
00314     }
00315 
00323     public function getViewConfigParam( $sName )
00324     {
00325         startProfile('oxviewconfig::getViewConfigParam');
00326 
00327         if ( $this->_oShop && isset( $this->_oShop->$sName ) ) {
00328             $sValue = $this->_oShop->$sName;
00329         } elseif ( $this->_aViewData && isset( $this->_aViewData[ $sName ] ) ) {
00330             $sValue = $this->_aViewData[ $sName ];
00331         } else {
00332             $sValue = ( isset( $this->_aConfigParams[ $sName ] ) ? $this->_aConfigParams[ $sName ] : null );
00333         }
00334 
00335         stopProfile('oxviewconfig::getViewConfigParam');
00336 
00337         return $sValue;
00338     }
00339 
00349     public function setViewShop( $oShop, $aViewData )
00350     {
00351         $this->_oShop     = $oShop;
00352         $this->_aViewData = $aViewData;
00353     }
00354 
00362     public function getSessionId()
00363     {
00364         if ( ( $sValue = $this->getViewConfigParam( 'sessionid' ) ) === null ) {
00365             $sValue = $this->getSession()->getId();
00366             $this->setViewConfigParam( 'sessionid', $sValue );
00367         }
00368         return $sValue;
00369     }
00370 
00376     public function getHiddenSid()
00377     {
00378         if ( ( $sValue = $this->getViewConfigParam( 'hiddensid' ) ) === null ) {
00379             $sValue = $this->getSession()->hiddenSid();
00380 
00381             // appending language info to form
00382             if ( ( $sLang = oxRegistry::getLang()->getFormLang() ) ) {
00383                 $sValue .= "\n{$sLang}";
00384             }
00385 
00386 
00387             $this->setViewConfigParam( 'hiddensid', $sValue );
00388         }
00389         return $sValue;
00390     }
00391 
00397     public function getSelfLink()
00398     {
00399         if ( ( $sValue = $this->getViewConfigParam( 'selflink' ) ) === null ) {
00400             $sValue = $this->getConfig()->getShopHomeURL();
00401             $this->setViewConfigParam( 'selflink', $sValue );
00402         }
00403         return $sValue;
00404     }
00405 
00411     public function getSslSelfLink()
00412     {
00413         if ( $this->isAdmin() ) {
00414             // using getSelfLink() method in admin mode (#2745)
00415             return $this->getSelfLink();
00416         }
00417 
00418         if ( ( $sValue = $this->getViewConfigParam( 'sslselflink' ) ) === null ) {
00419             $sValue = $this->getConfig()->getShopSecureHomeURL();
00420             $this->setViewConfigParam( 'sslselflink', $sValue );
00421         }
00422         return $sValue;
00423     }
00424 
00430     public function getBaseDir()
00431     {
00432         if ( ( $sValue = $this->getViewConfigParam( 'basedir' ) ) === null ) {
00433 
00434             if ( $this->getConfig()->isSsl() ) {
00435                 $sValue = $this->getConfig()->getSSLShopURL();
00436             } else {
00437                 $sValue = $this->getConfig()->getShopURL();
00438             }
00439 
00440             $this->setViewConfigParam( 'basedir', $sValue );
00441         }
00442         return $sValue;
00443     }
00444 
00450     public function getCoreUtilsDir()
00451     {
00452         if ( ( $sValue = $this->getViewConfigParam( 'coreutilsdir' ) ) === null ) {
00453             $sValue = $this->getConfig()->getCoreUtilsURL();
00454             $this->setViewConfigParam( 'coreutilsdir', $sValue );
00455         }
00456         return $sValue;
00457     }
00458 
00464     public function getSelfActionLink()
00465     {
00466         if ( ( $sValue = $this->getViewConfigParam( 'selfactionlink' ) ) === null ) {
00467             $sValue = $this->getConfig()->getShopCurrentUrl();
00468             $this->setViewConfigParam( 'selfactionlink', $sValue );
00469         }
00470         return $sValue;
00471     }
00472 
00478     public function getCurrentHomeDir()
00479     {
00480         if ( ( $sValue = $this->getViewConfigParam( 'currenthomedir' ) ) === null ) {
00481             $sValue = $this->getConfig()->getCurrentShopUrl();
00482             $this->setViewConfigParam( 'currenthomedir', $sValue );
00483         }
00484         return $sValue;
00485     }
00486 
00492     public function getBasketLink()
00493     {
00494         if ( ( $sValue = $this->getViewConfigParam( 'basketlink' ) ) === null ) {
00495             $sValue = $this->getConfig()->getShopHomeURL()   . 'cl=basket';
00496             $this->setViewConfigParam( 'basketlink', $sValue );
00497         }
00498         return $sValue;
00499     }
00500 
00506     public function getOrderLink()
00507     {
00508         if ( ( $sValue = $this->getViewConfigParam( 'orderlink' ) ) === null ) {
00509             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=user';
00510             $this->setViewConfigParam( 'orderlink', $sValue );
00511         }
00512         return $sValue;
00513     }
00514 
00520     public function getPaymentLink()
00521     {
00522         if ( ( $sValue = $this->getViewConfigParam( 'paymentlink' ) ) === null ) {
00523             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=payment';
00524             $this->setViewConfigParam( 'paymentlink', $sValue );
00525         }
00526         return $sValue;
00527     }
00528 
00534     public function getExeOrderLink()
00535     {
00536         if ( ( $sValue = $this->getViewConfigParam( 'exeorderlink' ) ) === null ) {
00537             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order&amp;fnc=execute';
00538             $this->setViewConfigParam( 'exeorderlink', $sValue );
00539         }
00540         return $sValue;
00541     }
00542 
00548     public function getOrderConfirmLink()
00549     {
00550         if ( ( $sValue = $this->getViewConfigParam( 'orderconfirmlink' ) ) === null ) {
00551             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order';
00552             $this->setViewConfigParam( 'orderconfirmlink', $sValue );
00553         }
00554         return $sValue;
00555     }
00556 
00564     public function getResourceUrl( $sFile = null )
00565     {
00566         if ( $sFile ) {
00567             $sValue = $this->getConfig()->getResourceUrl( $sFile, $this->isAdmin() );
00568         } elseif ( ( $sValue = $this->getViewConfigParam( 'basetpldir' ) ) === null ) {
00569             $sValue = $this->getConfig()->getResourceUrl( '', $this->isAdmin() );
00570             $this->setViewConfigParam( 'basetpldir', $sValue );
00571         }
00572         return $sValue;
00573     }
00574 
00580     public function getTemplateDir()
00581     {
00582         if ( ( $sValue = $this->getViewConfigParam( 'templatedir' ) ) === null ) {
00583             $sValue = $this->getConfig()->getTemplateDir( $this->isAdmin() );
00584             $this->setViewConfigParam( 'templatedir', $sValue );
00585         }
00586         return $sValue;
00587     }
00588 
00594     public function getUrlTemplateDir()
00595     {
00596         if ( ( $sValue = $this->getViewConfigParam( 'urltemplatedir' ) ) === null ) {
00597             $sValue = $this->getConfig()->getTemplateUrl( $this->isAdmin() );
00598             $this->setViewConfigParam( 'urltemplatedir', $sValue );
00599         }
00600         return $sValue;
00601     }
00602 
00611     public function getImageUrl( $sFile = null, $bSsl = null )
00612     {
00613         if ($sFile) {
00614            $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), $bSsl, null, $sFile );
00615         } elseif ( ( $sValue = $this->getViewConfigParam( 'imagedir' ) ) === null ) {
00616             $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), $bSsl );
00617             $this->setViewConfigParam( 'imagedir', $sValue );
00618         }
00619         return $sValue;
00620     }
00621 
00627     public function getNoSslImageDir()
00628     {
00629         if ( ( $sValue = $this->getViewConfigParam( 'nossl_imagedir' ) ) === null ) {
00630             $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), false );
00631             $this->setViewConfigParam( 'nossl_imagedir', $sValue );
00632         }
00633         return $sValue;
00634     }
00635 
00642     public function getPictureDir()
00643     {
00644         if ( ( $sValue = $this->getViewConfigParam( 'picturedir' ) ) === null ) {
00645             $sValue = $this->getConfig()->getPictureUrl( null, $this->isAdmin() );
00646             $this->setViewConfigParam( 'picturedir', $sValue );
00647         }
00648         return $sValue;
00649     }
00650 
00656     public function getAdminDir()
00657     {
00658         if ( ( $sValue = $this->getViewConfigParam( 'sAdminDir' ) ) === null ) {
00659             $sValue = $this->getConfig()->getConfigParam( 'sAdminDir' );
00660             $this->setViewConfigParam( 'sAdminDir', $sValue );
00661         }
00662         return $sValue;
00663     }
00664 
00670     public function getActiveShopId()
00671     {
00672         if ( ( $sValue = $this->getViewConfigParam( 'shopid' ) ) === null ) {
00673             $sValue = $this->getConfig()->getShopId();
00674             $this->setViewConfigParam( 'shopid', $sValue );
00675         }
00676         return $sValue;
00677     }
00678 
00684     public function isSsl()
00685     {
00686         if ( ( $sValue = $this->getViewConfigParam( 'isssl' ) ) === null ) {
00687             $sValue = $this->getConfig()->isSsl();
00688             $this->setViewConfigParam( 'isssl', $sValue );
00689         }
00690         return $sValue;
00691     }
00692 
00693 
00699     public function getRemoteAddress()
00700     {
00701         if ( ( $sValue = $this->getViewConfigParam( 'ip' ) ) === null ) {
00702             $sValue = oxRegistry::get("oxUtilsServer")->getRemoteAddress();
00703             $this->setViewConfigParam( 'ip', $sValue );
00704         }
00705         return $sValue;
00706     }
00707 
00713     public function getPopupIdent()
00714     {
00715         if ( ( $sValue = $this->getViewConfigParam( 'popupident' ) ) === null ) {
00716             $sValue = md5( $this->getConfig()->getShopUrl() );
00717             $this->setViewConfigParam( 'popupident', $sValue );
00718         }
00719         return $sValue;
00720     }
00721 
00727     public function getPopupIdentRand()
00728     {
00729         if ( ( $sValue = $this->getViewConfigParam( 'popupidentrand' ) ) === null ) {
00730             $sValue = md5( time() );
00731             $this->setViewConfigParam( 'popupidentrand', $sValue );
00732         }
00733         return $sValue;
00734     }
00735 
00741     public function getArtPerPageForm()
00742     {
00743         if ( ( $sValue = $this->getViewConfigParam( 'artperpageform' ) ) === null ) {
00744             $sValue = $this->getConfig()->getShopCurrentUrl();
00745             $this->setViewConfigParam( 'artperpageform', $sValue );
00746         }
00747         return $sValue;
00748     }
00749 
00755     public function isBuyableParent()
00756     {
00757         return $this->getConfig()->getConfigParam( 'blVariantParentBuyable' );
00758     }
00759 
00765     public function showBirthdayFields()
00766     {
00767         return $this->getConfig()->getConfigParam( 'blShowBirthdayFields' );
00768     }
00769 
00777     public function showFinalStep()
00778     {
00779         return true;
00780     }
00781 
00787     public function getNrOfCatArticles()
00788     {
00789         // checking if all needed data is set
00790         switch (oxRegistry::getSession()->getVariable( 'ldtype' )) {
00791             case 'grid':
00792                 return $this->getConfig()->getConfigParam( 'aNrofCatArticlesInGrid' );
00793                 break;
00794             case 'line':
00795             case 'infogrid':
00796             default:
00797                 return $this->getConfig()->getConfigParam( 'aNrofCatArticles' );
00798         }
00799     }
00800 
00806     public function getShowWishlist()
00807     {
00808         return $this->getConfig()->getConfigParam( 'bl_showWishlist' );
00809     }
00810 
00816     public function getShowCompareList()
00817     {
00818         $myConfig = $this->getConfig();
00819         $blShowCompareList = true;
00820 
00821         if ( !$myConfig->getConfigParam( 'bl_showCompareList' ) ||
00822             ( $myConfig->getConfigParam( 'blDisableNavBars' ) && $myConfig->getActiveView()->getIsOrderStep() ) ) {
00823             $blShowCompareList = false;
00824         }
00825 
00826         return $blShowCompareList;
00827     }
00828 
00834     public function getShowListmania()
00835     {
00836         return $this->getConfig()->getConfigParam( 'bl_showListmania' );
00837     }
00838 
00844     public function getShowVouchers()
00845     {
00846         return $this->getConfig()->getConfigParam( 'bl_showVouchers' );
00847     }
00848 
00854     public function getShowGiftWrapping()
00855     {
00856         return $this->getConfig()->getConfigParam( 'bl_showGiftWrapping' );
00857     }
00858 
00864     public function getActLanguageId()
00865     {
00866         if ( ( $sValue = $this->getViewConfigParam( 'lang' ) ) === null ) {
00867             $iLang = oxRegistry::getConfig()->getRequestParameter( 'lang' );
00868             $sValue = ( $iLang !== null ) ? $iLang : oxRegistry::getLang()->getBaseLanguage();
00869             $this->setViewConfigParam( 'lang', $sValue );
00870         }
00871         return $sValue;
00872     }
00873 
00879     public function getActLanguageAbbr()
00880     {
00881         return oxRegistry::getLang()->getLanguageAbbr( $this->getActLanguageId() );
00882     }
00883 
00889     public function getActiveClassName()
00890     {
00891         return $this->getConfig()->getActiveView()->getClassName();
00892     }
00893 
00900     public function getTopActiveClassName()
00901     {
00902         return $this->getConfig()->getTopActiveView()->getClassName();
00903     }
00904 
00910     public function getArtPerPageCount()
00911     {
00912         return $this->getViewConfigParam( 'iartPerPage' );
00913     }
00914 
00920     public function getNavUrlParams()
00921     {
00922         if ( ( $sParams = $this->getViewConfigParam( 'navurlparams' ) ) === null ) {
00923             $sParams = '';
00924             $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00925             foreach ( $aNavParams as $sName => $sValue ) {
00926                 if ( isset( $sValue ) ) {
00927                     if ( $sParams ) {
00928                         $sParams .= '&amp;';
00929                     }
00930                     $sParams .= "{$sName}=".rawurlencode( $sValue );
00931                 }
00932             }
00933             if ( $sParams ) {
00934                 $sParams = '&amp;'.$sParams;
00935             }
00936             $this->setViewConfigParam( 'navurlparams', $sParams );
00937         }
00938 
00939         return $sParams;
00940     }
00941 
00947     public function getNavFormParams()
00948     {
00949 
00950         if ( ( $sParams = $this->getViewConfigParam( 'navformparams' ) ) === null ) {
00951             $oStr = getStr();
00952             $sParams = '';
00953             $aNavParams = $this->getConfig()->getTopActiveView()->getNavigationParams();
00954             foreach ( $aNavParams as $sName => $sValue ) {
00955                 if ( isset( $sValue ) ) {
00956                     $sParams .= "<input type=\"hidden\" name=\"{$sName}\" value=\"".$oStr->htmlentities( $sValue )."\" />\n";
00957                 }
00958             }
00959             $this->setViewConfigParam( 'navformparams', $sParams );
00960         }
00961         return $sParams;
00962     }
00963 
00969     public function getStockOnDefaultMessage()
00970     {
00971         return $this->getConfig()->getConfigParam( 'blStockOnDefaultMessage' );
00972     }
00973 
00979     public function getStockOffDefaultMessage()
00980     {
00981         return $this->getConfig()->getConfigParam( 'blStockOffDefaultMessage' );
00982     }
00983 
00989     public function getShopVersion()
00990     {
00991         return $this->getViewConfigParam( 'sShopVersion' );
00992     }
00993 
00999     public function getAjaxLink()
01000     {
01001         return $this->getViewConfigParam( 'ajaxlink' );
01002     }
01003 
01009     public function isMultiShop()
01010     {
01011         $oShop = $this->getConfig()->getActiveShop();
01012         return isset( $oShop->oxshops__oxismultishop ) ? ( (bool) $oShop->oxshops__oxismultishop->value ) : false;
01013     }
01014 
01020     public function getServiceUrl()
01021     {
01022         return $this->getViewConfigParam( 'sServiceUrl' );
01023     }
01024 
01031     public function getRemoteAccessToken()
01032     {
01033         $sRaToken = oxRegistry::getSession()->getRemoteAccessToken();
01034 
01035         return $sRaToken;
01036     }
01037 
01044     public function getActionClassName()
01045     {
01046         return $this->getConfig()->getActiveView()->getActionClassName();
01047     }
01048 
01055     public function getTopActionClassName()
01056     {
01057         return $this->getConfig()->getTopActiveView()->getActionClassName();
01058     }
01059 
01065     public function getFbAppId()
01066     {
01067         return $this->getConfig()->getConfigParam( 'sFbAppId' );
01068     }
01069 
01075     public function getShowBasketTimeout()
01076     {
01077         return $this->getConfig()->getConfigParam( 'blPsBasketReservationEnabled' )
01078             && ($this->getSession()->getBasketReservations()->getTimeLeft() > 0);
01079     }
01080 
01086     public function getBasketTimeLeft()
01087     {
01088         if (!isset($this->_dBasketTimeLeft)) {
01089             $this->_dBasketTimeLeft = $this->getSession()->getBasketReservations()->getTimeLeft();
01090         }
01091         return $this->_dBasketTimeLeft;
01092     }
01093 
01100     public function getShowFbConnect()
01101     {
01102         $myConfig = $this->getConfig();
01103 
01104         if ( $myConfig->getConfigParam( 'bl_showFbConnect' ) ) {
01105             if ( $myConfig->getConfigParam( "sFbAppId" ) && $myConfig->getConfigParam( "sFbSecretKey" ) ) {
01106                 return true;
01107             }
01108         }
01109 
01110         return false;
01111     }
01112 
01118     public function getTsDomain()
01119     {
01120         $sDomain = false;
01121         $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01122         if ( is_array( $aTsConfig ) ) {
01123             $sDomain = $aTsConfig["blTestMode"] ? $aTsConfig["sTsTestUrl"] : $aTsConfig["sTsUrl"];
01124         }
01125         return $sDomain;
01126     }
01127 
01135     public function getTsWidgetUrl()
01136     {
01137         $sUrl = false;
01138         if ( $sTsId = $this->getTsId() ) {
01139             $sTsUrl = $this->getTsDomain();
01140 
01141             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01142             $sTsWidgetUri = isset( $aTsConfig["sTsWidgetUri"] ) ? current( $aTsConfig["sTsWidgetUri"] ) : false;
01143 
01144             if ( $sTsUrl && $sTsWidgetUri ) {
01145                 //$sLocal = $this->getConfig()->getImageDir()."{$sTsId}.gif";
01146                 $sUrl = sprintf( "{$sTsUrl}/{$sTsWidgetUri}", $sTsId );
01147                 //if ( $sImgName = oxRegistry::getUtils()->getRemoteCachePath( $sUrl, $sLocal ) ) {
01148                 //    $sUrl = $this->getImageUrl().basename( $sImgName );
01149                 //}
01150             }
01151         }
01152 
01153         return $sUrl;
01154     }
01155 
01163     public function getTsInfoUrl()
01164     {
01165         $sUrl = false;
01166         if ( $sTsId = $this->getTsId() ) {
01167             $sTsUrl = $this->getTsDomain();
01168 
01169             $sLangId = oxRegistry::getLang()->getLanguageAbbr();
01170             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01171             $sTsInfoUri = ( isset( $aTsConfig["sTsInfoUri"] ) && isset( $aTsConfig["sTsInfoUri"][$sLangId] ) ) ? $aTsConfig["sTsInfoUri"][$sLangId] : false;
01172 
01173             if ( $sTsUrl && $sTsInfoUri ) {
01174                 $sUrl = sprintf( "{$sTsUrl}/{$sTsInfoUri}", $sTsId );
01175             }
01176         }
01177 
01178         return $sUrl;
01179     }
01180 
01186     public function getTsRatings()
01187     {
01188         if ( $this->_aTrustedShopRatings === null ) {
01189             if ( $sTsId = $this->getTsId() ) {
01190                 $oTsRatings = oxNew( "oxTsRatings" );
01191                 $oTsRatings->setTsId( $sTsId );
01192                 $this->_aTrustedShopRatings = $oTsRatings->getRatings();
01193 
01194                 return $this->_aTrustedShopRatings;
01195             }
01196         }
01197         return $this->_aTrustedShopRatings;
01198     }
01199 
01205     public function getTsRatingUrl()
01206     {
01207         $sUrl = false;
01208         if ( $sTsId = $this->getTsId() ) {
01209             $sTsUrl = $this->getTsDomain();
01210 
01211             $sLangId = oxRegistry::getLang()->getLanguageAbbr();
01212             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01213             $sTsRateUri = ( isset( $aTsConfig["sTsRatingUri"] ) && isset( $aTsConfig["sTsRatingUri"][$sLangId] ) ) ? $aTsConfig["sTsRatingUri"][$sLangId] : false;
01214 
01215             if ( $sTsUrl && $sTsRateUri ) {
01216                 $sUrl = sprintf( "{$sTsUrl}/{$sTsRateUri}", $sTsId );
01217             }
01218         }
01219 
01220         return $sUrl;
01221     }
01222 
01230     public function showTs( $sType )
01231     {
01232         $blShow = false;
01233         switch ( $sType ) {
01234             case "WIDGET":
01235                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsWidget" );
01236                 break;
01237             case "THANKYOU":
01238                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsThankyouReview" );
01239                 break;
01240             case "ORDEREMAIL":
01241                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderEmailReview" );
01242                 break;
01243             case "ORDERCONFEMAIL":
01244                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderSendEmailReview" );
01245                 break;
01246         }
01247         return $blShow;
01248     }
01249 
01255     public function getTsId()
01256     {
01257         $sTsId = false;
01258         $oConfig = $this->getConfig();
01259         $aLangIds = $oConfig->getConfigParam( "aTsLangIds" );
01260         $aActInfo = $oConfig->getConfigParam( "aTsActiveLangIds" );
01261 
01262         // mapping with language id
01263         $sLangId = oxRegistry::getLang()->getLanguageAbbr();
01264         if ( isset( $aActInfo[$sLangId] ) && $aActInfo[$sLangId] &&
01265              isset( $aLangIds[$sLangId] ) && $aLangIds[$sLangId]
01266            ) {
01267             $sTsId = $aLangIds[$sLangId];
01268         }
01269 
01270         return $sTsId;
01271     }
01272 
01278     public function isTplBlocksDebugMode()
01279     {
01280         return (bool) $this->getConfig()->getConfigParam('blDebugTemplateBlocks');
01281     }
01282 
01288     public function getPasswordLength()
01289     {
01290         $iPasswordLength = 6;
01291 
01292         $oConfig = $this->getConfig();
01293 
01294         if ($oConfig->getConfigParam( "iPasswordLength" ) ) {
01295             $iPasswordLength = $oConfig->getConfigParam( "iPasswordLength" );
01296         }
01297 
01298         return $iPasswordLength;
01299     }
01300 
01306     public function getCountryList()
01307     {
01308         if ( $this->_oCountryList === null ) {
01309             // passing country list
01310             $this->_oCountryList = oxNew( 'oxcountrylist' );
01311             $this->_oCountryList->loadActiveCountries();
01312         }
01313         return $this->_oCountryList;
01314     }
01315 
01316 
01327     public function getModulePath($sModule, $sFile = '')
01328     {
01329         if (!$sFile || ($sFile[0] != '/')) {
01330             $sFile = '/'.$sFile;
01331         }
01332         $oModule = oxNew("oxmodule");
01333         $sModulePath = $oModule->getModulePath($sModule);
01334         $sFile = $this->getConfig()->getModulesDir().$sModulePath.$sFile;
01335         if (file_exists($sFile) || is_dir($sFile)) {
01336             return $sFile;
01337         } else {
01338             $oEx = oxNew( "oxFileException", "Requested file not found for module $sModule ($sFile)" );
01339             $oEx->debugOut();
01340             if (!$this->getConfig()->getConfigParam( 'iDebug' )) {
01341                 return '';
01342             }
01343             throw $oEx;
01344         }
01345     }
01346 
01357     public function getModuleUrl($sModule, $sFile = '')
01358     {
01359         $sUrl = str_replace(
01360                     rtrim($this->getConfig()->getConfigParam('sShopDir'), '/'),
01361                     rtrim($this->getConfig()->getCurrentShopUrl( false ), '/'),
01362                     $this->getModulePath($sModule, $sFile)
01363                            );
01364         return $sUrl;
01365     }
01366 
01374     public function getViewThemeParam( $sName )
01375     {
01376         $sValue = false;
01377 
01378         if ($this->getConfig()->isThemeOption( $sName ) ) {
01379             $sValue = $this->getConfig()->getConfigParam( $sName );
01380         }
01381 
01382         return $sValue;
01383     }
01384 
01385 
01391     public function showSelectLists()
01392     {
01393         return (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' );
01394     }
01395 
01401     public function showSelectListsInList()
01402     {
01403         return $this->showSelectLists() && (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectListsInAList' );
01404     }
01405 
01406 
01407 
01413     public function isAltImageServerConfigured()
01414     {
01415         $oConfig = $this->getConfig();
01416 
01417         return $oConfig->getConfigParam('sAltImageUrl') || $oConfig->getConfigParam('sSSLAltImageUrl') ||
01418                $oConfig->getConfigParam('sAltImageDir') || $oConfig->getConfigParam('sSSLAltImageDir');
01419     }
01420 
01428     public function isFunctionalityEnabled( $sParamName )
01429     {
01430         return (bool) $this->getConfig()->getConfigParam( $sParamName );
01431     }
01432 
01438     public function getActiveTheme()
01439     {
01440         if ( $this->_sActiveTheme === null ) {
01441             $oTheme = oxNew( 'oxTheme' );
01442             $this->_sActiveTheme = $oTheme->getActiveThemeId();
01443         }
01444         return $this->_sActiveTheme;
01445     }
01446 
01452     public function getShopLogo()
01453     {
01454         if ( is_null( $this->_sShopLogo ) ) {
01455 
01456             $sLogoImage = $this->getConfig()->getConfigParam( 'sShopLogo' );
01457             if ( empty( $sLogoImage ) )
01458             {
01459                 $sLogoImage = "logo.png";
01460             }
01461 
01462             $this->setShopLogo( $sLogoImage );
01463         }
01464 
01465         return $this->_sShopLogo;
01466     }
01467 
01475     public function setShopLogo( $sLogo )
01476     {
01477         $this->_sShopLogo = $sLogo;
01478     }
01479 }