00001 <?php
00002
00007 class oxView extends oxSuperCfg
00008 {
00014 protected $_oaComponents = array();
00015
00021 protected $_aViewData = array();
00022
00028 protected $_sClassLocation = null;
00029
00035 protected $_sThisAction = null;
00036
00042 protected $_oParent = null;
00043
00049 protected $_blIsOrderStep = false;
00050
00056 protected $_blIsComponent = false;
00057
00063 protected $_oActCategory = null;
00064
00070 protected $_oActVendor = null;
00071
00077 protected $_oActSearch = null;
00078
00084 protected $_sThisTemplate = null;
00085
00091 protected $_aComponentNames = array();
00092
00098 protected $_blIsCallForCache = false;
00099
00105 protected $_sViewId = null;
00106
00112 protected $_sListType = null;
00113
00119 protected $_sCategoryId = null;
00120
00126 protected $_sClass = null;
00127
00133 protected $_sFnc = null;
00134
00140 protected static $_blExecuted = false;
00141
00146 protected $_oClickCat = null;
00147
00152 protected $_sAdditionalParams = null;
00153
00158 protected $_blShowSorting = false;
00159
00164 protected $_blShowRightBasket = null;
00165
00170 protected $_blShowLeftBasket = null;
00171
00176 protected $_blShowTopBasket = null;
00177
00182 protected $_blLoadCurrency = null;
00183
00188 protected $_blLoadVendorTree = null;
00189
00194 protected $_blDontShowEmptyCats = null;
00195
00200 protected $_sTrustedShopId = null;
00201
00206 protected $_blLoadLanguage = null;
00207
00212 protected $_blShowTopCatNav = null;
00213
00218 protected $_iTopCatNavItmCnt = null;
00219
00224 protected $_sCharSet = null;
00225
00230 protected $_sVersion = null;
00231
00236 protected $_blDemoVersion = null;
00237
00242 protected $_blDemoShop = null;
00243
00248 protected $_aRssLinks = null;
00249
00254 protected $_blActiveSorting = null;
00255
00260 protected $_sListOrderBy = null;
00261
00266 protected $_sListOrderDir = null;
00267
00272 protected $_sMetaDescription = null;
00273
00278 protected $_sMetaKeywords = null;
00279
00284 protected $_oActCurrency = null;
00285
00290 protected $_iCompItemsCnt = null;
00291
00296 protected $_sWishlistName = null;
00297
00302 protected $_aMenueList = null;
00303
00310 protected $_iViewIndexState = 0;
00311
00316 protected $_iNewsStatus = null;
00317
00322 protected $_sShopLogo = null;
00323
00329 public function init()
00330 {
00331
00332 $this->_sThisAction = strtolower( get_class( $this ) );
00333
00334 if ( !$this->_blIsComponent ) {
00335
00336
00337 $blInit = true;
00338
00339
00340
00341 foreach ( $this->_aComponentNames as $sComponentName => $blNotCacheable ) {
00342
00343 if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00344
00345 $oComponent = oxNew( $sComponentName );
00346 $oComponent->setParent( $this );
00347 $oComponent->setThisAction( $sComponentName );
00348 $this->_oaComponents[$sComponentName] = $oComponent;
00349 }
00350
00351
00352 if ( $blInit ) {
00353 $this->_oaComponents[$sComponentName]->init();
00354
00355
00356 if ( !method_exists( $this, $this->getFncName() ) ) {
00357 $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00358 }
00359 }
00360 }
00361
00362
00363 $this->addGlobalParams();
00364
00365
00366 if ( $this->showSorting() ) {
00367 $this->prepareSortColumns();
00368 }
00369 $this->_aViewData['showsorting'] = $this->isSortingActive();
00370 $this->_aViewData["allsortcolumns"] = $this->getSortColumns();
00371 $this->_aViewData['listorderby'] = $this->getListOrderBy();
00372 $this->_aViewData['listorder'] = $this->getListOrderDirection();
00373 }
00374 }
00375
00381 public function showSorting()
00382 {
00383 return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00384 }
00385
00392 public function getViewId()
00393 {
00394 if ( $this->_sViewId ) {
00395 return $this->_sViewId;
00396 }
00397
00398
00399 $iLang = oxLang::getInstance()->getBaseLanguage();
00400
00401 $iCur = (int) oxConfig::getParameter( 'currency' );
00402
00403
00404 $this->_sViewId = "ox|$iLang|$iCur";
00405
00406 return $this->_sViewId;
00407 }
00408
00409
00416 public function getViewResetId()
00417 {
00418 if ( $this->_sViewResetID ) {
00419 return $this->_sViewResetID;
00420 }
00421
00422 $sCategoryID = $this->_oClickCat?$this->_oClickCat->getId():'-';
00423 $this->_sViewResetID = "ox|cid={$sCategoryID}|cl=".$this->getClassName();
00424 return $this->_sViewResetID;
00425 }
00426
00427
00436 public function render()
00437 {
00438 $this->_aViewData['meta_description'] = $this->getMetaDescription();
00439 $this->_aViewData['meta_keywords'] = $this->getMetaKeywords();
00440
00441
00442 if ( !$this->_blIsComponent ) {
00443 foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
00444 $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
00445 }
00446
00447
00448 $this->_setNavigationParams();
00449 }
00450
00451 return $this->_sThisTemplate;
00452 }
00453
00467 public function addGlobalParams( $oShop = null)
00468 {
00469 $mySession = $this->getSession();
00470 $myConfig = $this->getConfig();
00471
00472
00473
00474 $this->_aViewData['isnewsletter'] = true;
00475 $this->_aViewData['isvarianten'] = true;
00476 $this->_aViewData['isreview'] = true;
00477 $this->_aViewData['isaddsales'] = true;
00478 $this->_aViewData['isvoucher'] = true;
00479 $this->_aViewData['isdtaus'] = true;
00480 $this->_aViewData['ispricealarm'] = true;
00481 $this->_aViewData['iswishlist'] = true;
00482 $this->_aViewData['isipayment'] = true;
00483 $this->_aViewData['istrusted'] = true;
00484 $this->_aViewData['isfiltering'] = true;
00485 $this->_aViewData['isgooglestats'] = true;
00486 $this->_aViewData['iswishlist'] = true;
00487 $this->_aViewData['isstaffelpreis'] = true;
00488
00489
00490 $this->_iNewsStatus = 1;
00491
00492 $this->_aViewData['charset'] = $this->getCharSet();
00493 $this->_aViewData['version'] = $this->getShopVersion();
00494 $this->_aViewData['edition'] = $this->getShopEdition();
00495 $this->_aViewData['fulledition'] = $this->getShopFullEdition();
00496 $this->_aViewData['isdemoversion'] = $this->isDemoVersion();
00497
00498 $this->_aViewData['isfiltering'] = true;
00499
00500
00501 $this->_aViewData['bl_perfShowLeftBasket'] = $this->showLeftBasket();
00502 $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
00503 $this->_aViewData['bl_perfShowTopBasket'] = $this->showTopBasket();
00504
00505
00506 $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
00507
00508
00509 $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
00510
00511
00512 $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
00513
00514 $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
00515
00516
00517 $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
00518 $this->_aViewData['urlsign'] = '&';
00519 $this->_aViewData['wishid'] = oxConfig::getParameter( 'wishid' );
00520 $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
00521
00522 $this->_aViewData['sListType'] = $this->getListType();
00523
00524
00525 $this->_setAdditionalParams();
00526 $this->_aViewData["additionalparams"] = $this->getAdditionalParams();
00527
00528 $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
00529
00530
00531 $this->_aViewData['showtopcatnavigation'] = $this->showTopCatNavigation();
00532 $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
00533
00534 $this->_setNrOfArtPerPage();
00535
00536
00537 $oViewConf = $this->getViewConfig();
00538 if ( $oShop ) {
00539 $oViewConf->setViewShop( $oShop, $this->_aViewData );
00540 }
00541
00542
00543 $this->_aViewData['oView'] = $this;
00544 $this->_aViewData['oViewConf'] = $this->getViewConfig();
00545
00546
00547 $this->_aViewData['shop'] = $this->getViewConfig();
00548
00549 return $oViewConf;
00550 }
00551
00560 public function addRssFeed($sTitle, $sUrl, $key = null)
00561 {
00562 if (!is_array($this->_aRssLinks)) {
00563 $this->_aRssLinks = array();
00564 }
00565 if ($key === null) {
00566 $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
00567 } else {
00568 $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
00569 }
00570
00571 $this->_aViewData['rsslinks'] = $this->getRssLinks();
00572 }
00573
00582 public function addTplParam( $sPara, $sValue )
00583 {
00584 $this->_aViewData[$sPara] = $sValue;
00585 }
00586
00601 public function prepareSortColumns()
00602 {
00603 $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
00604 if ( count( $aSortColumns ) > 0 ) {
00605
00606 $this->_blActiveSorting = true;
00607 $this->_aSortColumns = $aSortColumns;
00608
00609 $sCnid = oxConfig::getParameter( 'cnid' );
00610
00611 $sSortBy = oxConfig::getParameter( 'listorderby' );
00612 $sSortDir = oxConfig::getParameter( 'listorder' );
00613
00614 if ( !$sSortBy && $aSorting = $this->getSorting( $sCnid ) ) {
00615 $sSortBy = $aSorting['sortby'];
00616 $sSortDir = $aSorting['sortdir'];
00617 }
00618
00619 if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
00620 $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
00621
00622 $this->_sListOrderBy = $sSortBy;
00623 $this->_sListOrderDir = $sSortDir;
00624
00625
00626 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
00627 }
00628 }
00629 }
00630
00640 protected function _setAdditionalParams()
00641 {
00642
00643 $this->_sAdditionalParams = 'cl='.$this->getConfig()->getActiveView()->getClassName();
00644
00645
00646 $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
00647 if ( isset( $sSearchParamForLink ) ) {
00648 $this->_sAdditionalParams .= "&searchparam={$sSearchParamForLink}";
00649 }
00650
00651 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
00652 $this->_sAdditionalParams .= '&searchcnid='.rawurlencode( rawurldecode( $sVar ) );
00653 }
00654 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
00655 $this->_sAdditionalParams .= '&searchvendor='.rawurlencode( rawurldecode( $sVar ) );
00656 }
00657 if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
00658 $this->_sAdditionalParams .= '&cnid='.rawurlencode( rawurldecode( $sVar ) );
00659 }
00660 }
00661
00667 public function getViewConfig()
00668 {
00669 if ( $this->_oViewConf === null ) {
00670 $this->_oViewConf = oxNew( 'oxViewConfig' );
00671 }
00672
00673 return $this->_oViewConf;
00674 }
00675
00681 protected function _setNrOfArtPerPage()
00682 {
00683 $myConfig = $this->getConfig();
00684 $aViewData = array();
00685
00686
00687 $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
00688 $iNrofCatArticles = ( $iNrofCatArticles) ? $iNrofCatArticles : 10;
00689
00690
00691 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
00692 if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
00693 $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
00694 } else {
00695 $iNrofCatArticles = $aNrofCatArticles[0];
00696 }
00697
00698 $oViewConf = $this->getViewConfig();
00699
00700 if ( ( $iUserArtPerPage = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
00701
00702 $iNrofArticles = ( $iUserArtPerPage > 100 ) ? 10 : abs( $iUserArtPerPage );
00703
00704 $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
00705 $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
00706 oxSession::setVar( '_artperpage', $iNrofCatArticles );
00707 } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
00708
00709 $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
00710 $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
00711 $iNrofCatArticles = $iSessArtPerPage;
00712 } else {
00713 $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
00714 }
00715
00716
00717 $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
00718
00719 $this->_aViewData = array_merge( $this->_aViewData, $aViewData );
00720 }
00721
00727 protected function _getSeoObjectId()
00728 {
00729 }
00730
00740 public function setMetaDescription ( $aInput, $iLength = 1024, $blDescTag = false )
00741 {
00742 if ( oxUtils::getInstance()->seoIsActive() && ( $sOxid = $this->_getSeoObjectId() ) ) {
00743
00744
00745 if ( ( $sDescription = oxSeoEncoder::getInstance()->getMetaData( $sOxid , 'oxdescription' ) ) ) {
00746 return $this->_sMetaDescription = $sDescription;
00747 }
00748
00749 }
00750
00751 return $this->_sMetaDescription = $this->_prepareMetaDescription( $aInput, $iLength, $blDescTag );
00752 }
00753
00766 protected function _prepareMetaDescription( $aInput, $iLength = 1024, $blDescTag = false )
00767 {
00768
00769
00770
00771
00772
00773 $sString = $aInput;
00774 if ( is_array( $aInput ) ) {
00775 $sString = implode( ' ', $aInput );
00776 }
00777
00778 if ( $iLength != -1 ) {
00779 $iELength = ( $iLength * 2 );
00780 $sString = substr( $sString, 0, $iELength );
00781 }
00782
00783
00784 $sString = html_entity_decode( $sString );
00785
00786 $sString = strip_tags( $sString );
00787
00788
00789 $aRemoveChars = array( "\"", "'", ".", ":", "!", "?", "\n", "\r", "\t", "\x95", "\xA0", ";" );
00790 $sString = str_replace( $aRemoveChars, ' ', $sString );
00791
00792
00793 if ( !$blDescTag ) {
00794 $sString = $this->_removeDuplicatedWords( $sString );
00795 }
00796
00797
00798 $sString = str_replace( ' ,', ',', $sString );
00799 $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
00800 $sString = preg_replace( $aPattern, ',', $sString );;
00801 $sString = oxUtilsString::getInstance()->minimizeTruncateString( $sString, $iLength );
00802
00803 return $sString;
00804 }
00805
00813 public function setMetaKeywords( $aInput )
00814 {
00815 if ( oxUtils::getInstance()->seoIsActive() && ( $sOxid = $this->_getSeoObjectId() ) ) {
00816
00817 if ( ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, 'oxkeywords' ) ) ) {
00818 return $this->_sMetaKeywords = $sKeywords;
00819 }
00820 }
00821
00822 return $this->_sMetaKeywords = $this->_prepareMetaKeyword( $aInput );
00823 }
00824
00833 protected function _prepareMetaKeyword( $aInput )
00834 {
00835 $sString = $this->_prepareMetaDescription( $aInput, -1, true );
00836 $sString = $this->_removeDuplicatedWords( $sString );
00837
00838 $aSkipTags = $this->getConfig()->getConfigParam( 'aSkipTags' );
00839 if ( is_array( $aSkipTags ) && $sString ) {
00840 foreach ( $aSkipTags as $sSkip ) {
00841 $aPattern = array( '/\W'.$sSkip.'\W/i', '/^'.$sSkip.'\W/i', '/\"'.$sSkip.'$/i' );
00842 $sString = preg_replace( $aPattern, '', $sString);
00843 }
00844 }
00845 return $sString;
00846 }
00847
00855 protected function _removeDuplicatedWords( $aInput )
00856 {
00857 if ( is_array( $aInput ) ) {
00858 $aStrings = $aInput;
00859 } else {
00860
00861 $aStrings = preg_split( "/[\s,]+/", $aInput );
00862 }
00863
00864 foreach ( $aStrings as $iANum => $sAString ) {
00865 foreach ( $aStrings as $iBNum => $sBString ) {
00866
00867 if ( $sAString && $iANum != $iBNum && !strcasecmp( $sAString, $sBString ) ) {
00868 unset( $aStrings[$iANum] );
00869 }
00870 }
00871 }
00872
00873 return implode( ', ', $aStrings );
00874 }
00875
00881 protected function _setNavigationParams()
00882 {
00883 $aParams = $this->_getNavigationParams();
00884
00885 $aNavString['url'] = '';
00886 $aNavString['form'] = '';
00887
00888 foreach ( $aParams as $sKey => $sValue ) {
00889 if ( $sValue ) {
00890
00891 $aNavString['url'] .= '&'.$sKey.'='.rawurlencode( $sValue );
00892
00893
00894 if ( $sKey == 'searchparam' )
00895 $sValue = oxConfig::getParameter( 'searchparam' );
00896
00897 $aNavString['form'] .= "<input type=\"hidden\" name=\"$sKey\" value=\"$sValue\">\n";
00898 }
00899 }
00900
00901 $oViewConf = $this->getViewConfig();
00902 $oViewConf->setViewConfigParam( 'navurlparams', $aNavString['url'] );
00903 $oViewConf->setViewConfigParam( 'navformparams', $aNavString['form'] );
00904 }
00905
00911 protected function _getNavigationParams()
00912 {
00913 $aParams['cnid'] = $this->getCategoryId();
00914 $aParams['listtype'] = $this->getListType();
00915
00916 $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
00917 $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
00918 $aParams['searchparam'] = oxConfig::getParameter( 'searchparam', true );
00919 $aParams['searchcnid'] = oxConfig::getParameter( 'searchcnid' );
00920 $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
00921 $aParams['searchtag'] = oxConfig::getParameter( 'searchtag', 1 );
00922
00923 return $aParams;
00924 }
00925
00931 public function getListType()
00932 {
00933 if ( $this->_sListType == null && ( $sListType = oxConfig::getParameter( 'listtype' ) ) ) {
00934 $this->_sListType = $sListType;
00935 }
00936 return $this->_sListType;
00937 }
00938
00946 public function setListType( $sType )
00947 {
00948 $this->_sListType = $sType;
00949 }
00950
00956 public function getCategoryId()
00957 {
00958 if ( $this->_sCategoryId == null && ( $sCatId = oxConfig::getParameter( 'cnid' ) ) ) {
00959 $this->_sCategoryId = $sCatId;
00960 }
00961
00962 return $this->_sCategoryId;
00963 }
00964
00972 public function setCategoryId( $sCategoryId )
00973 {
00974 $this->_sCategoryId = $sCategoryId;
00975 }
00976
00982 public function getTemplateName()
00983 {
00984 return $this->_sThisTemplate;
00985 }
00986
00994 public function setClassName( $sClassName )
00995 {
00996 $this->_sClass = $sClassName;
00997 }
00998
01004 public function getClassName()
01005 {
01006 return $this->_sClass;
01007 }
01008
01016 public function setFncName( $sFncName )
01017 {
01018 $this->_sFnc = $sFncName;
01019 }
01020
01026 public function getFncName()
01027 {
01028 return $this->_sFnc;
01029 }
01030
01038 public function setComponents( $aComponents = null )
01039 {
01040 $this->_oaComponents = $aComponents;
01041 }
01042
01048 public function getComponents()
01049 {
01050 return $this->_oaComponents;
01051 }
01052
01060 public function setViewData( $aViewData = null )
01061 {
01062 $this->_aViewData = $aViewData;
01063 }
01064
01070 public function getViewData()
01071 {
01072 return $this->_aViewData;
01073 }
01074
01082 public function getViewDataElement( $sParamId = null )
01083 {
01084 if ( $sParamId && isset( $this->_aViewData[$sParamId] ) ) {
01085 return $this->_aViewData[$sParamId];
01086 }
01087 }
01088
01096 public function setClassLocation( $sClassLocation = null )
01097 {
01098 $this->_sClassLocation = $sClassLocation;
01099 }
01105 public function getClassLocation()
01106 {
01107 return $this->_sClassLocation;
01108 }
01109
01117 public function setThisAction( $sThisAction = null )
01118 {
01119 $this->_sThisAction = $sThisAction;
01120 }
01121
01127 public function getThisAction()
01128 {
01129 return $this->_sThisAction;
01130 }
01131
01139 public function setParent( $oParent = null )
01140 {
01141 $this->_oParent = $oParent;
01142 }
01143
01149 public function getParent()
01150 {
01151 return $this->_oParent;
01152 }
01153
01161 public function setIsOrderStep( $blIsOrderStep = null )
01162 {
01163 $this->_blIsOrderStep = $blIsOrderStep;
01164 }
01165
01171 public function getIsOrderStep()
01172 {
01173 return $this->_blIsOrderStep;
01174 }
01175
01183 public function setIsComponent( $blIsComponent = null )
01184 {
01185 $this->_blIsComponent = $blIsComponent;
01186 }
01187
01193 public function getIsComponent()
01194 {
01195 return $this->_blIsComponent;
01196 }
01197
01207 public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01208 {
01209 $aSorting = oxSession::getVar( 'aSorting' );
01210 $aSorting[$sCnid]['sortby'] = $sSortBy;
01211 $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01212
01213 oxSession::setVar( 'aSorting', $aSorting );
01214 }
01215
01223 public function getSorting( $sCnid )
01224 {
01225 $aSorting = oxSession::getVar( 'aSorting' );
01226 if ( isset( $aSorting[$sCnid] ) ) {
01227 return $aSorting[$sCnid];
01228 }
01229 }
01230
01238 public function getSortingSql( $sCnid )
01239 {
01240 $aSorting = $this->getSorting( $sCnid );
01241 if ( is_array( $aSorting ) ) {
01242 return implode( " ", $aSorting );
01243 }
01244 }
01245
01253 public function setIsCallForCache( $blIsCallForCache = null )
01254 {
01255 $this->_blIsCallForCache = $blIsCallForCache;
01256 }
01257
01263 public function getIsCallForCache()
01264 {
01265 return $this->_blIsCallForCache;
01266 }
01267
01277 public function executeFunction( $sFunction )
01278 {
01279 $sNewAction = null;
01280
01281
01282 if ( $sFunction && !self::$_blExecuted ) {
01283 if ( method_exists( $this, $sFunction ) ) {
01284
01285
01286 $sNewAction = $this->$sFunction();
01287 self::$_blExecuted = true;
01288 }
01289
01290
01291 if ( !$this->_blIsComponent && !self::$_blExecuted ) {
01292 $oEx = oxNew( 'oxSystemComponentException' );
01293 $oEx->setMessage( 'EXCEPTION_SYSTEMCOMPONENT_FUNCTIONNOTFOUND' );
01294 $oEx->setComponent( $sFunction );
01295 throw $oEx;
01296 }
01297 }
01298
01299 $this->_executeNewAction( $sNewAction );
01300 }
01301
01312 protected function _executeNewAction( $sNewAction )
01313 {
01314 if ( $sNewAction ) {
01315 $myConfig = $this->getConfig();
01316
01317
01318 $aParams = explode( '?', $sNewAction );
01319
01320
01321 $sPageParams = isset( $aParams[1] )?$aParams[1]:null;
01322
01323
01324 $aParams = explode( '/', $aParams[0] );
01325 $sClassName = $aParams[0];
01326
01327
01328 $aParams = explode( '@', $aParams[0] );
01329 $sCmpName = ( count( $aParams ) > 1 )?$aParams[0]:null;
01330 $sClassName = ( $sCmpName !== null )?$aParams[1]:$sClassName;
01331
01332
01333 $sHeader = ( $sClassName )?"cl=$sClassName&":'';
01334 $sHeader .= ( $sPageParams )?"$sPageParams&":'';
01335 $sHeader .= $this->getSession()->sid();
01336
01337
01338 $sURL = $myConfig->isSsl()?$myConfig->getSslShopUrl():$myConfig->getShopUrl();
01339
01340
01341 if ( $this->isAdmin() ) {
01342 $sURL .= $myConfig->getConfigParam( 'sAdminDir' ) . '/';
01343 }
01344
01345 $sURL = "{$sURL}index.php?{$sHeader}";
01346
01347
01348 oxUtils::getInstance()->redirect( $sURL, (bool) oxConfig::getParameter( 'redirected' ) );
01349 }
01350 }
01351
01357 public function getAdditionalParams()
01358 {
01359 return $this->_sAdditionalParams;
01360 }
01361
01368 public function noIndex()
01369 {
01370 if ( oxConfig::getParameter( 'cur' ) ) {
01371 return $this->_iViewIndexState = 1;
01372 }
01373
01374 switch ( oxConfig::getParameter( 'fnc' ) ) {
01375 case 'tocomparelist':
01376 case 'tobasket':
01377 return $this->_iViewIndexState = 1;
01378 default: break;
01379 }
01380 return $this->_iViewIndexState;
01381 }
01382
01388 public function getTitleSuffix()
01389 {
01390 return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01391 }
01392
01399 public function getTitlePrefix()
01400 {
01401 return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01402 }
01403
01410 protected function getSubject()
01411 {
01412 return null;
01413 }
01414
01420 public function getDynUrlParams()
01421 {
01422 $sRet = '';
01423 $sListType = $this->getListType();
01424
01425 switch ($sListType) {
01426 default:
01427 break;
01428 case 'search':
01429 $sRet .= "&listtype={$sListType}";
01430 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01431 $sRet .= "&searchparam={$sSearchParamForLink}";
01432 }
01433
01434 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01435 $sRet .= '&searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01436 }
01437 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01438 $sRet .= '&searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01439 }
01440 break;
01441 }
01442
01443 return $sRet;
01444 }
01445
01453 public function getLink($iLang = null)
01454 {
01455 if ( !isset( $iLang ) ) {
01456 $iLang = oxLang::getInstance()->getBaseLanguage();
01457 }
01458
01459 $oDisplayObj = null;
01460 if ( oxUtils::getInstance()->seoIsActive() ) {
01461 $blTrySeo = true;
01462 $oDisplayObj = $this->getSubject();
01463 }
01464
01465 if ( $oDisplayObj ) {
01466 return $oDisplayObj->getLink( $iLang );
01467 } else {
01468 $myConfig = $this->getConfig();
01469
01470 if ( $blTrySeo ) {
01471 $oEncoder = oxSeoEncoder::getInstance();
01472 if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL() . $this->_getSeoRequestParams(), $iLang ) ) ) {
01473 return $sSeoUrl;
01474 }
01475 }
01476
01477 $sForceLangChange = '';
01478 if ( oxLang::getInstance()->getBaseLanguage() != $iLang ) {
01479 $sForceLangChange = "&lang={$iLang}";
01480 }
01481
01482
01483 return $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams() . $sForceLangChange;
01484 }
01485 }
01486
01493 public function getSimilarRecommLists()
01494 {
01495 return null;
01496 }
01497
01505 protected function _getRequestParams( $blAddPageNr = true )
01506 {
01507
01508 $sClass = $this->getClassName();
01509 $sFnc = $this->getFncName();
01510
01511
01512 $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01513 if ( in_array( $sFnc, $aFnc ) ) {
01514 $sFnc = '';
01515 }
01516
01517
01518 $sURL = "cl={$sClass}";
01519 if ( $sFnc ) {
01520 $sURL .= "&fnc={$sFnc}";
01521 }
01522 if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01523 $sURL .= "&cnid={$sVal}";
01524 }
01525 if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01526 $sURL .= "&anid={$sVal}";
01527 }
01528
01529 if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01530 $sURL .= "&page={$sVal}";
01531 }
01532
01533 if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01534 $sURL .= "&tpl={$sVal}";
01535 }
01536
01537 $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01538
01539
01540 if ( $blAddPageNr && $iPgNr > 0 ) {
01541 $sURL .= "&pgNr={$iPgNr}";
01542 }
01543
01544
01545 if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01546 $sURL .= "&searchparam={$sVal}";
01547 }
01548
01549 if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01550 $sURL .= "&searchcnid={$sVal}";
01551 }
01552
01553 if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01554 $sURL .= "&searchvendor={$sVal}";
01555 }
01556
01557 if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01558 $sUrl .= "&searchrecomm={$sVal}";
01559 }
01560
01561 if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01562 $sUrl .= "&searchtag={$sVal}";
01563 }
01564
01565 if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01566 $sURL .= "&recommid={$sVal}";
01567 }
01568
01569 return $sURL;
01570 }
01571
01577 protected function _getSeoRequestParams()
01578 {
01579
01580 $sClass = $this->getClassName();
01581 $sFnc = $this->getFncName();
01582
01583
01584 $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01585 if ( in_array( $sFnc, $aFnc ) ) {
01586 $sFnc = '';
01587 }
01588
01589
01590 $sURL = "cl={$sClass}";
01591 if ( $sFnc ) {
01592 $sURL .= "&fnc={$sFnc}";
01593 }
01594 if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01595 $sURL .= "&page={$sVal}";
01596 }
01597
01598 if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01599 $sURL .= "&tpl={$sVal}";
01600 }
01601
01602 $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01603 if ( $iPgNr > 0 ) {
01604 $sURL .= "&pgNr={$iPgNr}";
01605 }
01606
01607 return $sURL;
01608 }
01609
01615 public function showRightBasket()
01616 {
01617 if ( $this->_blShowRightBasket === null ) {
01618 if ( $blShowRightBasket = $this->getConfig()->getConfigParam( 'bl_perfShowRightBasket' ) ) {
01619 $this->_blShowRightBasket = $blShowRightBasket;
01620 }
01621 }
01622 return $this->_blShowRightBasket;
01623 }
01624
01632 public function setShowRightBasket( $blShowBasket )
01633 {
01634 $this->_blShowRightBasket = $blShowBasket;
01635 }
01636
01642 public function showLeftBasket()
01643 {
01644 if ( $this->_blShowLeftBasket === null ) {
01645 if ( $blShowLeftBasket = $this->getConfig()->getConfigParam( 'bl_perfShowLeftBasket' ) ) {
01646 $this->_blShowLeftBasket = $blShowLeftBasket;
01647 }
01648 }
01649 return $this->_blShowLeftBasket;
01650 }
01651
01659 public function setShowLeftBasket( $blShowBasket )
01660 {
01661 $this->_blShowLeftBasket = $blShowBasket;
01662 }
01663
01669 public function showTopBasket()
01670 {
01671 if ( $this->_blShowTopBasket === null ) {
01672 if ( $blShowTopBasket = $this->getConfig()->getConfigParam( 'bl_perfShowTopBasket' ) ) {
01673 $this->_blShowTopBasket = $blShowTopBasket;
01674 }
01675 }
01676 return $this->_blShowTopBasket;
01677 }
01678
01686 public function setShowTopBasket( $blShowBasket )
01687 {
01688 $this->_blShowTopBasket = $blShowBasket;
01689 }
01690
01696 public function showSearch()
01697 {
01698 $myConfig = $this->getConfig();
01699 if ( $myConfig->getConfigParam( 'blDisableNavBars' ) && $myConfig->getActiveView()->getIsOrderStep() ) {
01700 return 0;
01701 }
01702 return 1;
01703 }
01704
01710 public function loadCurrency()
01711 {
01712 if ( $this->_blLoadCurrency == null ) {
01713 $this->_blLoadCurrency = false;
01714 if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
01715 $this->_blLoadCurrency = $blLoadCurrency;
01716 }
01717 }
01718 return $this->_blLoadCurrency;
01719 }
01720
01726 public function loadVendorTree()
01727 {
01728 if ( $this->_blLoadVendorTree == null ) {
01729 $this->_blLoadVendorTree = false;
01730 if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
01731 $this->_blLoadVendorTree = $blLoadVendorTree;
01732 }
01733 }
01734 return $this->_blLoadVendorTree;
01735 }
01736
01742 public function dontShowEmptyCategories()
01743 {
01744 if ( $this->_blDontShowEmptyCats == null ) {
01745 $this->_blDontShowEmptyCats = false;
01746 if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
01747 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
01748 }
01749 }
01750 return $this->_blDontShowEmptyCats;
01751 }
01752
01758 public function getTrustedShopId()
01759 {
01760 if ( $this->_sTrustedShopId == null && ( $aTrustedShopIds = $this->getConfig()->getConfigParam( 'iShopID_TrustedShops' ) ) ) {
01761 $iLangId = (int) oxLang::getInstance()->getBaseLanguage();
01762
01763 if ( !is_array( $aTrustedShopIds ) && $iLangId == 0 ) {
01764 $this->_sTrustedShopId = $aTrustedShopIds;
01765 }
01766 if ( is_array( $aTrustedShopIds ) ) {
01767 $this->_sTrustedShopId = $aTrustedShopIds[$iLangId];
01768 }
01769 }
01770 return $this->_sTrustedShopId;
01771 }
01772
01778 public function isLanguageLoaded()
01779 {
01780 if ( $this->_blLoadLanguage == null ) {
01781 $this->_blLoadLanguage = false;
01782 if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01783 $this->_blLoadLanguage = $blLoadLanguage;
01784 }
01785 }
01786 return $this->_blLoadLanguage;
01787 }
01788
01794 public function showTopCatNavigation()
01795 {
01796 if ( $this->_blShowTopCatNav == null ) {
01797 $this->_blShowTopCatNav = false;
01798 if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
01799 $this->_blShowTopCatNav = $blShowTopCatNav;
01800 }
01801 }
01802 return $this->_blShowTopCatNav;
01803 }
01804
01810 public function getTopNavigationCatCnt()
01811 {
01812 if ( $this->_iTopCatNavItmCnt == null ) {
01813 $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
01814 $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
01815 }
01816 return $this->_iTopCatNavItmCnt;
01817 }
01818
01824 public function getCharSet()
01825 {
01826 if ( $this->_sCharSet == null ) {
01827 $this->_sCharSet = oxLang::getInstance()->translateString( 'charset' );
01828 }
01829 return $this->_sCharSet;
01830 }
01831
01837 public function getShopVersion()
01838 {
01839 if ( $this->_sVersion == null ) {
01840 $this->_sVersion = $this->getConfig()->getActiveShop()->oxshops__oxversion->value;
01841 }
01842 return $this->_sVersion;
01843 }
01844
01850 public function getShopEdition()
01851 {
01852 return $this->getConfig()->getActiveShop()->oxshops__oxedition->value;
01853 }
01854
01860 public function getShopFullEdition()
01861 {
01862 $sEdition = $this->getShopEdition();
01863 $sFullEdition = "Community Edition";
01864 if ($sEdition == "PE")
01865 $sFullEdition = "Professional Edition";
01866
01867 if ($sEdition == "EE")
01868 $sFullEdition = "Enterprise Edition";
01869
01870 return $sFullEdition;
01871 }
01872
01873
01879 public function isDemoVersion()
01880 {
01881 if ( $this->_blDemoVersion == null ) {
01882 $this->_blDemoVersion = $this->getConfig()->detectVersion() == 1;
01883 }
01884 return $this->_blDemoVersion;
01885 }
01886
01892 public function isDemoShop()
01893 {
01894 if ( $this->_blDemoShop == null ) {
01895 $this->_blDemoShop = $this->getConfig()->isDemoShop();
01896 }
01897 return $this->_blDemoShop;
01898 }
01899
01905 public function getRssLinks()
01906 {
01907 return $this->_aRssLinks;
01908 }
01909
01915 public function isSortingActive()
01916 {
01917 return $this->_blActiveSorting;
01918 }
01919
01925 public function getSortColumns()
01926 {
01927 return $this->_aSortColumns;
01928 }
01929
01935 public function getListOrderBy()
01936 {
01937 return $this->_sListOrderBy;
01938 }
01939
01945 public function getListOrderDirection()
01946 {
01947 return $this->_sListOrderDir;
01948 }
01949
01955 public function getMetaDescription()
01956 {
01957 return $this->_sMetaDescription;
01958 }
01959
01965 public function getMetaKeywords()
01966 {
01967 return $this->_sMetaKeywords;
01968 }
01969
01975 public function getActCurrency()
01976 {
01977 return $this->_oActCurrency;
01978 }
01979
01987 public function setActCurrency( $oCur )
01988 {
01989 $this->_oActCurrency = $oCur;
01990 }
01991
01997 public function getCompareItemsCnt()
01998 {
01999 return $this->_iCompItemsCnt;
02000 }
02001
02009 public function setCompareItemsCnt( $iCount )
02010 {
02011 $this->_iCompItemsCnt = $iCount;
02012 }
02013
02019 public function getWishlistName()
02020 {
02021 return $this->_sWishlistName;
02022 }
02023
02031 public function setWishlistName( $sName )
02032 {
02033 $this->_sWishlistName = $sName;
02034 }
02035
02041 public function getMenueList()
02042 {
02043 return $this->_aMenueList;
02044 }
02045
02053 public function setMenueList( $aMenue )
02054 {
02055 $this->_aMenueList = $aMenue;
02056 }
02057
02063 public function getEditTags()
02064 {
02065 }
02066
02072 public function getRecommSearch()
02073 {
02074 return null;
02075 }
02076
02082 public function getReviewUserId()
02083 {
02084 }
02085
02091 public function getPaymentList()
02092 {
02093 }
02094
02100 public function getActiveRecommList()
02101 {
02102 }
02103
02109 public function getAccessoires()
02110 {
02111 }
02112
02118 public function getCrossSelling()
02119 {
02120 }
02121
02127 public function getSimilarProducts()
02128 {
02129 }
02130
02136 public function getAlsoBoughtThiesProducts()
02137 {
02138 }
02139
02145 public function getArticleId()
02146 {
02147 }
02148
02156 public function setActiveCategory( $oCategory )
02157 {
02158 $this->_oActCategory = $oCategory;
02159 }
02160
02168 public function getActiveCategory()
02169 {
02170 return $this->_oActCategory;
02171 }
02172
02178 public function isMoreTagsVisible()
02179 {
02180 return false;
02181 }
02182
02188 public function getTitle()
02189 {
02190 }
02191
02197 public function showNewsletter()
02198 {
02199 if ( $this->_iNewsStatus === null) {
02200 return 1;
02201 }
02202 return $this->_iNewsStatus;
02203 }
02204
02212 public function setShowNewsletter( $blShow )
02213 {
02214 $this->_iNewsStatus = $blShow;
02215 }
02216
02222 public function getShopLogo()
02223 {
02224 return $this->_sShopLogo;
02225 }
02226
02234 public function setShopLogo( $sLogo )
02235 {
02236 $this->_sShopLogo = $sLogo;
02237 }
02238
02239 }