oxubase.php

Go to the documentation of this file.
00001 <?php
00002 
00006 require_once getShopBasePath() . 'views/oxview.php' ;
00007 
00008 // view indexing state for search engines:
00009 define( 'VIEW_INDEXSTATE_INDEX', 0 );           //  index without limitations
00010 define( 'VIEW_INDEXSTATE_NOINDEXNOFOLLOW', 1 ); //  no index / no follow
00011 define( 'VIEW_INDEXSTATE_NOINDEXFOLLOW', 2 );   //  no index / follow
00012 
00018 class oxUBase extends oxView
00019 {
00024     protected $_blFbWidgetsOn = null;
00025 
00030     protected $_sRemoveMetaChars = '.\+*?[^]$(){}=!<>|:&';
00031 
00037     protected $_oaComponents = array();
00038 
00044     protected $_blIsOrderStep = false;
00045 
00051     protected $_sListType = null;
00052 
00058     protected $_aListDisplayTypes = array( 'grid', 'line', 'infogrid' );
00059 
00065     protected $_sListDisplayType = null;
00066 
00072     protected $_oActCategory = null;
00073 
00079     protected $_oActManufacturer = null;
00080 
00086     protected $_oActVendor = null;
00087 
00092     protected $_oActiveRecommList = null;
00093 
00099     protected $_oActSearch = null;
00100 
00105     protected $_blShowSorting = false;
00106 
00111     protected $_blShowRightBasket = null;
00112 
00117     protected $_blShowTopBasket = null;
00118 
00123     protected $_blShowLeftBasket = null;
00124 
00129     protected $_blLoadCurrency = null;
00130 
00135     protected $_blLoadVendorTree = null;
00136 
00141     protected $_blLoadManufacturerTree = null;
00142 
00147     protected $_blDontShowEmptyCats = null;
00148 
00153     protected $_blLoadLanguage = null;
00154 
00159     protected $_blShowTopCatNav = null;
00160 
00165     protected $_iTopCatNavItmCnt = null;
00166 
00171     protected $_aRssLinks = null;
00172 
00177     protected $_sListOrderBy = null;
00178 
00183     protected $_sListOrderDir = null;
00184 
00189     protected $_sMetaDescription = null;
00190 
00195     protected $_sMetaKeywords = null;
00196 
00202     protected $_sMetaDescriptionIdent = null;
00203 
00209     protected $_sMetaKeywordsIdent = null;
00210 
00215     protected $_sAdditionalParams = null;
00216 
00221     protected $_oActCurrency = null;
00222 
00227     protected $_blEnabledPrivateSales = null;
00228 
00235     protected $_blCommonAdded = false;
00236 
00243     protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00244 
00251     protected $_blForceNoIndex = false;
00252 
00257     protected $_sWishlistName = null;
00258 
00263     protected $_iCompItemsCnt = null;
00264 
00270     protected $_sContentId = null;
00271 
00277     protected $_oContent = null;
00278 
00284     protected $_sViewResetID = null;
00285 
00290     protected $_blActiveSorting = null;
00291 
00296     protected $_aMenueList = null;
00297 
00303     protected $_aComponentNames = array(
00304                                     'oxcmp_user'       => 1, // 0 means dont init if cached
00305                                     'oxcmp_lang'       => 0,
00306                                     'oxcmp_cur'        => 1,
00307                                     'oxcmp_shop'       => 1,
00308                                     'oxcmp_categories' => 0,
00309                                     'oxcmp_utils'      => 1,
00310                                     'oxcmp_news'       => 0,
00311                                     'oxcmp_basket'     => 1
00312                                   );
00313 
00319     protected $_aUserComponentNames = array();
00320 
00326     protected $_oProduct = null;
00327 
00332     protected $_iActPage = null;
00333 
00338     protected $_aArticleList = null;
00339 
00344     protected $_oVendorTree  = null;
00345 
00350     protected $_oManufacturerTree  = null;
00351 
00356     protected $_oCategoryTree  = null;
00357 
00362     protected $_aTop5ArticleList  = null;
00363 
00368     protected $_aBargainArticleList  = null;
00369 
00374     protected $_blLowOrderPrice = null;
00375 
00380     protected $_sMinOrderPrice  = null;
00381 
00386     protected $_iNewsRealStatus  = null;
00387 
00393     protected $_aBlockRedirectParams = array( 'fnc', 'stoken', 'force_sid', 'force_admin_sid' );
00394 
00399     protected $_aVendorlist = null;
00400 
00405     protected $_oRootVendor = null;
00406 
00411     protected $_sVendorId = null;
00412 
00417     protected $_aManufacturerlist = null;
00418 
00423     protected $_oRootManufacturer = null;
00424 
00429     protected $_sManufacturerId = null;
00430 
00435     protected $_aSearchCatTree = null;
00436 
00441     protected $_oCatMore = null;
00442 
00447     protected $_blNewsSubscribed = null;
00448 
00453     protected $_oDelAddress = null;
00454 
00459     protected $_sCatTreePath = null;
00460 
00465     protected $_aContents = array();
00466 
00471     protected $_blTop5Action = true;
00472 
00477     protected $_blBargainAction = false;
00478 
00484     protected $_aMustFillFields = null;
00485 
00490     protected $_blShowTagCloud = true;
00491 
00496     protected $_blRootCatChanged = false;
00497 
00502     protected $_aInvoiceAddress = null;
00503 
00508     protected $_aDeliveryAddress = null;
00509 
00514     protected $_sActiveUsername = null;
00515 
00521     protected static $_aCollectedComponentNames = null;
00522 
00528     protected function _getComponentNames()
00529     {
00530         if ( self::$_aCollectedComponentNames === null ) {
00531             self::$_aCollectedComponentNames = array_merge( $this->_aComponentNames, $this->_aUserComponentNames );
00532 
00533             // #1721: custom component handling. At the moment it is not possible to override this variable in oxubase,
00534             // so we added this array to config.inc.php file
00535             if ( ( $aUserCmps = $this->getConfig()->getConfigParam( 'aUserComponentNames' ) ) ) {
00536                 self::$_aCollectedComponentNames = array_merge( self::$_aCollectedComponentNames, $aUserCmps );
00537             }
00538 
00539             if ( oxConfig::getParameter( '_force_no_basket_cmp' ) ) {
00540                 unset( self::$_aCollectedComponentNames['oxcmp_basket'] );
00541             }
00542         }
00543 
00544         // resetting array pointer
00545         reset( self::$_aCollectedComponentNames );
00546         return self::$_aCollectedComponentNames;
00547     }
00548 
00557     protected function _processRequest()
00558     {
00559         $myUtils = oxUtils::getInstance();
00560 
00561         // non admin, request is not empty and was not processed by seo engine
00562         if ( !isSearchEngineUrl() && $myUtils->seoIsActive() && ( $sStdUrl = getRequestUrl( '', true ) ) ) {
00563 
00564             // fetching standard url and looking for it in seo table
00565             if ( $this->_canRedirect() && ( $sRedirectUrl = oxSeoEncoder::getInstance()->fetchSeoUrl( $sStdUrl ) ) ) {
00566                 $myUtils->redirect( $this->getConfig()->getCurrentShopUrl() . $sRedirectUrl, false );
00567             } elseif (VIEW_INDEXSTATE_INDEX == $this->noIndex()) {
00568                 // forcing to set noindex/follow meta
00569                 $this->_forceNoIndex();
00570 
00571                 if (!$this->getConfig()->isProductiveMode() || $this->getConfig()->getConfigParam('blSeoLogging')) {
00572                     $sShopId = $this->getConfig()->getShopId();
00573                     $sLangId = oxLang::getInstance()->getBaseLanguage();
00574                     $sIdent  = md5( strtolower( $sStdUrl ) . $sShopId . $sLangId );
00575 
00576                     // logging "not found" url
00577                     $oDb = oxDb::getDb();
00578                     $oDb->execute( "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
00579                                     values ( " . $oDb->quote( $sStdUrl ) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) " );
00580                 }
00581             }
00582         }
00583     }
00584 
00591     public function init()
00592     {
00593         $this->_processRequest();
00594 
00595         // storing current view
00596         $blInit = true;
00597 
00598 
00599         // init all components if there are any
00600         foreach ( $this->_getComponentNames() as $sComponentName => $blNotCacheable ) {
00601             // do not override initiated components
00602             if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00603                 // component objects MUST be created to support user called functions
00604                 $oComponent = oxNew( $sComponentName );
00605                 $oComponent->setParent( $this );
00606                 $oComponent->setThisAction( $sComponentName );
00607                 $this->_oaComponents[$sComponentName] = $oComponent;
00608             }
00609 
00610             // do we really need to initiate them ?
00611             if ( $blInit ) {
00612                 $this->_oaComponents[$sComponentName]->init();
00613 
00614                 // executing only is view does not have action method
00615                 if ( !method_exists( $this, $this->getFncName() ) ) {
00616                     $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00617                 }
00618             }
00619         }
00620 
00621         parent::init();
00622 
00623         // enable sorting ?
00624         if ( $this->showSorting() ) {
00625             $this->prepareSortColumns();
00626         }
00627     }
00628 
00635     public function getViewId()
00636     {
00637         if ( $this->_sViewId ) {
00638             return $this->_sViewId;
00639         }
00640 
00641         $myConfig = $this->getConfig();
00642         $iLang = oxLang::getInstance()->getBaseLanguage();
00643         $iCur  = (int) $myConfig->getShopCurrency();
00644 
00645 
00646             $this->_sViewId =  "ox|$iLang|$iCur";
00647 
00648         $this->_sViewId .= "|".( (int) $this->_blForceNoIndex ).'|'.((int)$this->isRootCatChanged());
00649 
00650         // #0002866: external global viewID addition
00651         if (function_exists('customGetViewId')) {
00652             $oExtViewId = customGetViewId();
00653 
00654             if ($oExtViewId !== null) {
00655                 $this->_sViewId .= '|'.md5(serialize($oExtViewId));
00656             }
00657         }
00658 
00659         return $this->_sViewId;
00660     }
00661 
00662 
00668     public function showSorting()
00669     {
00670         return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00671     }
00672 
00680     public function setComponents( $aComponents = null )
00681     {
00682         $this->_oaComponents = $aComponents;
00683     }
00684 
00690     public function getComponents()
00691     {
00692         return $this->_oaComponents;
00693     }
00694 
00702     public function setIsOrderStep( $blIsOrderStep = null )
00703     {
00704         $this->_blIsOrderStep = $blIsOrderStep;
00705     }
00706 
00712     public function getIsOrderStep()
00713     {
00714         return $this->_blIsOrderStep;
00715     }
00716 
00717 
00725     public function setActiveCategory( $oCategory )
00726     {
00727         $this->_oActCategory = $oCategory;
00728     }
00729 
00735     public function getActiveCategory()
00736     {
00737         return $this->_oActCategory;
00738     }
00739 
00745     public function getListType()
00746     {
00747         if ( $this->_sListType == null ) {
00748             if ( $sListType = oxConfig::getParameter( 'listtype' ) ) {
00749                 $this->_sListType = $sListType;
00750             } elseif ( $sListType = $this->getConfig()->getGlobalParameter( 'listtype' ) ) {
00751                 $this->_sListType = $sListType;
00752             }
00753         }
00754         return $this->_sListType;
00755     }
00756 
00762     public function getListDisplayType()
00763     {
00764         if ( $this->_sListDisplayType == null ) {
00765             $this->_sListDisplayType = oxConfig::getParameter( 'ldtype' );
00766 
00767             if ( !$this->_sListDisplayType ) {
00768                 $this->_sListDisplayType = oxSession::getVar( 'ldtype' );
00769             }
00770 
00771             if ( !$this->_sListDisplayType ) {
00772                 $this->_sListDisplayType = $this->getConfig()->getConfigParam( 'sDefaultListDisplayType' );
00773             }
00774 
00775             $this->_sListDisplayType = in_array( ( string ) $this->_sListDisplayType, $this->_aListDisplayTypes ) ? $this->_sListDisplayType : 'infogrid';
00776 
00777             // writing to session
00778             if ( oxConfig::getParameter( 'ldtype' ) ) {
00779                 oxSession::setVar( 'ldtype', $this->_sListDisplayType );
00780             }
00781         }
00782         return $this->_sListDisplayType;
00783     }
00784 
00792     public function setListType( $sType )
00793     {
00794         $this->_sListType = $sType;
00795         $this->getConfig()->setGlobalParameter( 'listtype', $sType );
00796     }
00797 
00803     public function showRightBasket()
00804     {
00805         if ( $this->_blShowRightBasket === null ) {
00806             if ( $blShowRightBasket = $this->getConfig()->getConfigParam( 'bl_perfShowRightBasket' ) ) {
00807                 $this->_blShowRightBasket = $blShowRightBasket;
00808             }
00809         }
00810         return $this->_blShowRightBasket;
00811     }
00812 
00820     public function setShowRightBasket( $blShowBasket )
00821     {
00822         $this->_blShowRightBasket = $blShowBasket;
00823     }
00824 
00830     public function showLeftBasket()
00831     {
00832         if ( $this->_blShowLeftBasket === null ) {
00833             if ( $blShowLeftBasket = $this->getConfig()->getConfigParam( 'bl_perfShowLeftBasket' ) ) {
00834                 $this->_blShowLeftBasket = $blShowLeftBasket;
00835             }
00836         }
00837         return $this->_blShowLeftBasket;
00838     }
00839 
00847     public function setShowLeftBasket( $blShowBasket )
00848     {
00849         $this->_blShowLeftBasket = $blShowBasket;
00850     }
00851 
00857     public function showTopBasket()
00858     {
00859         if ( $this->_blShowTopBasket === null ) {
00860             if ( $blShowTopBasket = $this->getConfig()->getConfigParam( 'bl_perfShowTopBasket' ) ) {
00861                 $this->_blShowTopBasket = $blShowTopBasket;
00862             }
00863         }
00864         return $this->_blShowTopBasket;
00865     }
00866 
00874     public function setShowTopBasket( $blShowBasket )
00875     {
00876         $this->_blShowTopBasket = $blShowBasket;
00877     }
00878 
00884     public function loadCurrency()
00885     {
00886         if ( $this->_blLoadCurrency == null ) {
00887             $this->_blLoadCurrency = false;
00888             if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00889                 $this->_blLoadCurrency = $blLoadCurrency;
00890             }
00891         }
00892         return $this->_blLoadCurrency;
00893     }
00894 
00902     public function loadVendorTree()
00903     {
00904         if ( $this->_blLoadVendorTree == null ) {
00905             $this->_blLoadVendorTree = false;
00906             if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
00907                 $this->_blLoadVendorTree = $blLoadVendorTree;
00908             }
00909         }
00910         return $this->_blLoadVendorTree;
00911     }
00912 
00918     public function loadManufacturerTree()
00919     {
00920         if ( $this->_blLoadManufacturerTree == null ) {
00921             $this->_blLoadManufacturerTree = false;
00922             if ( $blLoadManufacturerTree = $this->getConfig()->getConfigParam( 'bl_perfLoadManufacturerTree' ) ) {
00923                 $this->_blLoadManufacturerTree = $blLoadManufacturerTree;
00924             }
00925         }
00926         return $this->_blLoadManufacturerTree;
00927     }
00928 
00934     public function dontShowEmptyCategories()
00935     {
00936         if ( $this->_blDontShowEmptyCats == null ) {
00937             $this->_blDontShowEmptyCats = false;
00938             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00939                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00940             }
00941         }
00942         return $this->_blDontShowEmptyCats;
00943     }
00944 
00950     public function showCategoryArticlesCount()
00951     {
00952         return $this->getConfig()->getConfigParam( 'bl_perfShowActionCatArticleCnt' );
00953     }
00954 
00960     public function isLanguageLoaded()
00961     {
00962         if ( $this->_blLoadLanguage == null ) {
00963             $this->_blLoadLanguage = false;
00964             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00965                 $this->_blLoadLanguage = $blLoadLanguage;
00966             }
00967         }
00968         return $this->_blLoadLanguage;
00969     }
00970 
00976     public function showTopCatNavigation()
00977     {
00978         if ( $this->_blShowTopCatNav == null ) {
00979             $this->_blShowTopCatNav = false;
00980             if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
00981                 $this->_blShowTopCatNav = $blShowTopCatNav;
00982             }
00983         }
00984         return $this->_blShowTopCatNav;
00985     }
00986 
00992     public function getTopNavigationCatCnt()
00993     {
00994         if ( $this->_iTopCatNavItmCnt == null ) {
00995             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00996             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00997         }
00998         return $this->_iTopCatNavItmCnt;
00999     }
01000 
01010     public function addRssFeed($sTitle, $sUrl, $key = null)
01011     {
01012         if (!is_array($this->_aRssLinks)) {
01013             $this->_aRssLinks = array();
01014         }
01015         if ($key === null) {
01016             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
01017         } else {
01018             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
01019         }
01020     }
01021 
01027     public function getSortOrderByParameterName()
01028     {
01029         return 'listorderby';
01030     }
01031 
01037     public function getSortOrderParameterName()
01038     {
01039         return 'listorder';
01040     }
01041 
01052     public function prepareSortColumns()
01053     {
01054         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
01055         if ( count( $aSortColumns ) > 0 ) {
01056 
01057             $this->_blActiveSorting = true;
01058             $this->_aSortColumns = $aSortColumns;
01059 
01060             $sCnid = oxConfig::getParameter( 'cnid' );
01061 
01062 
01063             $sSortBy  = oxConfig::getParameter( $this->getSortOrderByParameterName() );
01064             $sSortDir = oxConfig::getParameter( $this->getSortOrderParameterName() );
01065 
01066             if ( !$sSortBy && $aSorting = $this->getSorting( $sCnid ) ) {
01067                 $sSortBy  = $aSorting['sortby'];
01068                 $sSortDir = $aSorting['sortdir'];
01069             }
01070 
01071             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
01072                  $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
01073 
01074                 $this->_sListOrderBy  = $sSortBy;
01075                 $this->_sListOrderDir = $sSortDir;
01076 
01077                 // caching sorting config
01078                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
01079             }
01080         }
01081     }
01082 
01088     public function getListOrderBy()
01089     {
01090         //if column is with table name split it
01091         $aColums = explode('.', $this->_sListOrderBy);
01092 
01093         if ( is_array($aColums) && count($aColums) > 1 ) {
01094            return $aColums[1];
01095         }
01096 
01097         return $this->_sListOrderBy;
01098     }
01099 
01105     public function getListOrderDirection()
01106     {
01107         return $this->_sListOrderDir;
01108     }
01109 
01117     public function setMetaDescription ( $sDescription )
01118     {
01119         return $this->_sMetaDescription = $sDescription;
01120     }
01121 
01129     public function setMetaKeywords( $sKeywords )
01130     {
01131         return $this->_sMetaKeywords = $sKeywords;
01132     }
01133 
01141     protected function _getMetaFromSeo( $sDataType )
01142     {
01143         $sOxid  = $this->_getSeoObjectId();
01144         $iLang  = oxLang::getInstance()->getBaseLanguage();
01145         $sShop  = $this->getConfig()->getShopId();
01146 
01147         if ( $sOxid && oxUtils::getInstance()->seoIsActive() &&
01148              ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, $sDataType, $sShop, $iLang) ) ) {
01149             return $sKeywords;
01150         }
01151     }
01152 
01160     protected function _getMetaFromContent( $sMetaIdent )
01161     {
01162         if ( $sMetaIdent ) {
01163             $oContent = oxNew( 'oxcontent' );
01164             if ( $oContent->loadByIdent( $sMetaIdent ) &&
01165                  $oContent->oxcontents__oxactive->value ) {
01166                 return strip_tags( $oContent->oxcontents__oxcontent->value );
01167             }
01168         }
01169     }
01170 
01176     public function getMetaKeywords()
01177     {
01178         if ( $this->_sMetaKeywords === null ) {
01179             $this->_sMetaKeywords = false;
01180 
01181             // set special meta keywords ?
01182             if ( ( $sKeywords = $this->_getMetaFromSeo( 'oxkeywords' ) ) ) {
01183                 $this->_sMetaKeywords = $sKeywords;
01184             } elseif ( ( $sKeywords = $this->_getMetaFromContent( $this->_sMetaKeywordsIdent ) ) ) {
01185                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( $sKeywords, false );
01186             } else {
01187                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( false, true );
01188             }
01189         }
01190 
01191         return $this->_sMetaKeywords;
01192     }
01193 
01199     public function getMetaDescription()
01200     {
01201         if ( $this->_sMetaDescription === null ) {
01202             $this->_sMetaDescription = false;
01203 
01204             // set special meta description ?
01205             if ( ( $sDescription = $this->_getMetaFromSeo( 'oxdescription' ) ) ) {
01206                 $this->_sMetaDescription = $sDescription;
01207             } elseif ( ( $sDescription = $this->_getMetaFromContent( $this->_sMetaDescriptionIdent ) ) ) {
01208                 $this->_sMetaDescription = $this->_prepareMetaDescription( $sDescription );
01209             } else {
01210                 $this->_sMetaDescription = $this->_prepareMetaDescription( false );
01211             }
01212         }
01213 
01214         return $this->_sMetaDescription;
01215     }
01216 
01222     public function getActCurrency()
01223     {
01224         return $this->_oActCurrency;
01225     }
01226 
01234     public function setActCurrency( $oCur )
01235     {
01236         $this->_oActCurrency = $oCur;
01237     }
01238 
01244     public function getCompareItemsCnt()
01245     {
01246         return (int)$this->_iCompItemsCnt;
01247     }
01248 
01256     public function setCompareItemsCnt( $iCount )
01257     {
01258         $this->_iCompItemsCnt = $iCount;
01259     }
01260 
01266     public function getWishlistName()
01267     {
01268         return $this->_sWishlistName;
01269     }
01270 
01278     public function setWishlistName( $sName )
01279     {
01280         $this->_sWishlistName = $sName;
01281     }
01282 
01288     protected function _forceNoIndex()
01289     {
01290         $this->_blForceNoIndex = true;
01291     }
01292 
01299     public function noIndex()
01300     {
01301         if ( $this->_blForceNoIndex ) {
01302             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01303         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01304             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01305         } else {
01306             switch ( oxConfig::getParameter( 'fnc' ) ) {
01307                 case 'tocomparelist':
01308                 case 'tobasket':
01309                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01310                     break;
01311             }
01312         }
01313         return $this->_iViewIndexState;
01314     }
01315 
01322     public function getContentId()
01323     {
01324         if ( $this->_sContentId === null) {
01325             $oContent = oxNew( 'oxcontent' );
01326             $oContent->loadByIdent( 'oximpressum' );
01327             $this->_sContentId = $oContent->getId();
01328         }
01329 
01330         return $this->_sContentId;
01331     }
01332 
01339     public function getContent()
01340     {
01341         if ( $this->_oContent === null) {
01342             $oContent = oxNew( 'oxcontent' );
01343             if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01344                 $this->_oContent = $oContent;
01345             }
01346         }
01347 
01348         return $this->_oContent;
01349     }
01350 
01356     public function isSortingActive()
01357     {
01358         return $this->_blActiveSorting;
01359     }
01360 
01366     public function getMenueList()
01367     {
01368         return $this->_aMenueList;
01369     }
01370 
01378     public function setMenueList( $aMenue )
01379     {
01380         $this->_aMenueList = $aMenue;
01381     }
01382 
01383 
01389     protected function _setNrOfArtPerPage()
01390     {
01391         $myConfig  = $this->getConfig();
01392 
01393         //setting default values to avoid possible errors showing article list
01394         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01395 
01396         $iNrofCatArticles = ( $iNrofCatArticles ) ? $iNrofCatArticles : 10;
01397 
01398         // checking if all needed data is set
01399         switch ( $this->getListDisplayType() ) {
01400             case 'grid':
01401                 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticlesInGrid' );
01402                 break;
01403             case 'line':
01404             case 'infogrid':
01405             default:
01406                 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01407         }
01408 
01409         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01410             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01411         } else {
01412             $iNrofCatArticles = $aNrofCatArticles[0];
01413         }
01414 
01415         $oViewConf = $this->getViewConfig();
01416         //value from user input
01417         if ( ( $iNrofArticles = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01418             // M45 Possibility to push any "Show articles per page" number parameter
01419             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01420             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01421             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01422         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01423             // M45 Possibility to push any "Show articles per page" number parameter
01424             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01425             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01426             $iNrofCatArticles = $iSessArtPerPage;
01427         } else {
01428             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01429         }
01430 
01431         //setting number of articles per page to config value
01432         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01433     }
01434 
01440     protected function _getSeoObjectId()
01441     {
01442     }
01443 
01453     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01454     {
01455         if ( $sMeta ) {
01456 
01457             $oStr = getStr();
01458             if ( $iLength != -1 ) {
01459                 /* *
01460                  * performance - we dont need a huge amount of initial text.
01461                  * assume that effective text may be double longer than $iLength
01462                  * and simple turncate it
01463                  */
01464                 $iELength = ( $iLength * 2 );
01465                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01466             }
01467 
01468             // decoding html entities
01469             $sMeta = $oStr->html_entity_decode( $sMeta );
01470             // stripping HTML tags
01471             $sMeta = strip_tags( $sMeta );
01472 
01473             // removing some special chars
01474             $sMeta = $oStr->cleanStr( $sMeta );
01475 
01476             // removing duplicate words
01477             if ( $blRemoveDuplicatedWords ) {
01478                 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01479             }
01480 
01481             // some special cases
01482             $sMeta = str_replace( ' ,', ',', $sMeta );
01483             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01484             $sMeta = $oStr->preg_replace( $aPattern, ',', $sMeta );
01485             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01486 
01487             return trim( $sMeta );
01488         }
01489     }
01490 
01499     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01500     {
01501 
01502         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01503 
01504         if ( $blRemoveDuplicatedWords ) {
01505             $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01506         }
01507 
01508         // removing in admin defined strings
01509 
01510         /*if ( is_array( $aSkipTags ) && $sString ) {
01511             $oStr = getStr();
01512             foreach ( $aSkipTags as $sSkip ) {
01513                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01514                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01515                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01516                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01517             }
01518         }*/
01519 
01520         return trim( $sString );
01521     }
01522 
01531     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01532     {
01533         $oStr = getStr();
01534         if ( is_array( $aInput ) ) {
01535             $aInput = implode( " ", $aInput );
01536         }
01537 
01538         // removing some usually met characters..
01539         $aInput = $oStr->preg_replace( "/[".preg_quote( $this->_sRemoveMetaChars, "/" )."]/", " ", $aInput );
01540 
01541         // splitting by word
01542         $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01543 
01544         if ( $sCount = count( $aSkipTags ) ) {
01545             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01546                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01547             }
01548         }
01549         $sCount = count($aStrings);
01550         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01551             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01552             // removing in admin defined strings
01553             if ( !$aStrings[$iNum] || in_array( $aStrings[$iNum], $aSkipTags ) ) {
01554                 unset( $aStrings[$iNum] );
01555             }
01556         }
01557 
01558         // duplicates
01559         return implode( ', ', array_unique( $aStrings ) );
01560     }
01561 
01569     public function getNavigationParams()
01570     {
01571         $aParams['cnid'] = $this->getCategoryId();
01572         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01573 
01574         $aParams['listtype'] = $this->getListType();
01575         $aParams['ldtype'] = $this->getListDisplayType();
01576 
01577         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01578 
01579         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01580         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01581         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01582 
01583         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01584         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01585         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01586 
01587         return $aParams;
01588     }
01589 
01599     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01600     {
01601 
01602         $aSorting = oxSession::getVar( 'aSorting' );
01603         $aSorting[$sCnid]['sortby']  = $sSortBy;
01604         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01605 
01606         oxSession::setVar( 'aSorting', $aSorting );
01607     }
01608 
01616     public function getSorting( $sCnid )
01617     {
01618         $aSorting = oxSession::getVar( 'aSorting' );
01619 
01620         if ( isset( $aSorting[$sCnid] ) ) {
01621             return $aSorting[$sCnid];
01622         }
01623     }
01624 
01632     public function getSortingSql( $sCnid )
01633     {
01634         $aSorting = $this->getSorting( $sCnid );
01635         if ( is_array( $aSorting ) ) {
01636             return implode( " ", $aSorting );
01637         }
01638     }
01639 
01645     public function getTitleSuffix()
01646     {
01647         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01648     }
01649 
01655     public function getTitlePageSuffix()
01656     {
01657     }
01658 
01665     public function getTitlePrefix()
01666     {
01667         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01668     }
01669 
01670 
01671 
01680     protected function _getSubject( $iLang )
01681     {
01682         return null;
01683     }
01684 
01690     public function getDynUrlParams()
01691     {
01692         $sRet = '';
01693         $sListType = $this->getListType();
01694 
01695         switch ($sListType) {
01696             default:
01697                 break;
01698             case 'search':
01699                 $sRet .= "&amp;listtype={$sListType}";
01700                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01701                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01702                 }
01703 
01704                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01705                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01706                 }
01707                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01708                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01709                 }
01710                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01711                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01712                 }
01713                 break;
01714             case 'tag':
01715                 $sRet .= "&amp;listtype={$sListType}";
01716                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01717                     $sRet .= "&amp;searchtag={$sParam}";
01718                 }
01719                 break;
01720         }
01721 
01722         return $sRet;
01723     }
01724 
01732     public function getLink( $iLang = null )
01733     {
01734         if ( !isset( $iLang ) ) {
01735             $iLang = oxLang::getInstance()->getBaseLanguage();
01736         }
01737 
01738         $oDisplayObj = null;
01739         $blTrySeo = false;
01740         if ( oxUtils::getInstance()->seoIsActive() ) {
01741             $blTrySeo = true;
01742             $oDisplayObj = $this->_getSubject( $iLang );
01743         }
01744         $iActPageNr = $this->getActPage();
01745 
01746         if ( $oDisplayObj ) {
01747             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01748         }
01749 
01750         $myConfig = $this->getConfig();
01751 
01752         if ( $blTrySeo ) {
01753             $oEncoder = oxSeoEncoder::getInstance();
01754             if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01755                 return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01756             }
01757         }
01758 
01759         $sUrl = oxUtilsUrl::getInstance()->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams(), true, null, $iLang);
01760 
01761         // fallback to old non seo url
01762         return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01763     }
01764 
01770     public function getCanonicalUrl()
01771     {
01772     }
01773 
01780     public function getSimilarRecommLists()
01781     {
01782     }
01783 
01790     public function getSearchParamForHtml()
01791     {
01792     }
01793 
01801     protected function _getRequestParams( $blAddPageNr  = true )
01802     {
01803         $sClass = $this->getClassName();
01804         $sFnc   = $this->getFncName();
01805 
01806         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher', 'moveleft', 'moveright' );
01807         if ( in_array( $sFnc, $aFnc ) ) {
01808             $sFnc = '';
01809         }
01810 
01811         // #680
01812         $sURL = "cl={$sClass}";
01813         if ( $sFnc ) {
01814             $sURL .= "&amp;fnc={$sFnc}";
01815         }
01816         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01817             $sURL .= "&amp;cnid={$sVal}";
01818         }
01819         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01820             $sURL .= "&amp;mnid={$sVal}";
01821         }
01822         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01823             $sURL .= "&amp;anid={$sVal}";
01824         }
01825 
01826         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01827             $sURL .= "&amp;page={$sVal}";
01828         }
01829 
01830         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01831             $sURL .= "&amp;tpl={$sVal}";
01832         }
01833 
01834         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01835         // don't include page number for navigation
01836         // it will be done in oxubase::generatePageNavigation
01837         if ( $blAddPageNr && $iPgNr > 0 ) {
01838             $sURL .= "&amp;pgNr={$iPgNr}";
01839         }
01840 
01841         // #1184M - specialchar search
01842         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01843             $sURL .= "&amp;searchparam={$sVal}";
01844         }
01845 
01846         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01847             $sURL .= "&amp;searchcnid={$sVal}";
01848         }
01849 
01850         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01851             $sURL .= "&amp;searchvendor={$sVal}";
01852         }
01853 
01854         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01855             $sURL .= "&amp;searchmanufacturer={$sVal}";
01856         }
01857 
01858         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01859             $sURL .= "&amp;searchrecomm={$sVal}";
01860         }
01861 
01862         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01863             $sURL .= "&amp;searchtag={$sVal}";
01864         }
01865 
01866         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01867             $sURL .= "&amp;recommid={$sVal}";
01868         }
01869 
01870         return $sURL;
01871     }
01872 
01878     protected function _getSeoRequestParams()
01879     {
01880         $sClass = $this->getClassName();
01881         $sFnc   = $this->getFncName();
01882 
01883         // #921 S
01884         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01885         if ( in_array( $sFnc, $aFnc ) ) {
01886             $sFnc = '';
01887         }
01888 
01889         // #680
01890         $sURL = "cl={$sClass}";
01891         if ( $sFnc ) {
01892             $sURL .= "&amp;fnc={$sFnc}";
01893         }
01894         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01895             $sURL .= "&amp;page={$sVal}";
01896         }
01897 
01898         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01899             $sURL .= "&amp;tpl={$sVal}";
01900         }
01901 
01902         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01903         if ( $iPgNr > 0 ) {
01904             $sURL .= "&amp;pgNr={$iPgNr}";
01905         }
01906 
01907         return $sURL;
01908     }
01909 
01915     public function showSearch()
01916     {
01917         $blShow = true;
01918         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01919             $blShow = false;
01920         }
01921         return (int) $blShow;
01922     }
01923 
01929     public function getRssLinks()
01930     {
01931         return $this->_aRssLinks;
01932     }
01933 
01939     public function getSortColumns()
01940     {
01941         return $this->_aSortColumns;
01942     }
01943 
01949     public function getEditTags()
01950     {
01951     }
01952 
01958     public function getRecommSearch()
01959     {
01960     }
01961 
01967     public function getPaymentList()
01968     {
01969     }
01970 
01976     public function getActiveRecommList()
01977     {
01978         if ( $this->_oActiveRecommList === null ) {
01979             $this->_oActiveRecommList = false;
01980             if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01981                 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01982                 $this->_oActiveRecommList->load( $sOxid );
01983             }
01984         }
01985         return $this->_oActiveRecommList;
01986     }
01987 
01993     public function getAccessoires()
01994     {
01995     }
01996 
02002     public function getCrossSelling()
02003     {
02004     }
02005 
02011     public function getSimilarProducts()
02012     {
02013     }
02014 
02020     public function getAlsoBoughtTheseProducts()
02021     {
02022     }
02023 
02029     public function getArticleId()
02030     {
02031     }
02032 
02038     public function isMoreTagsVisible()
02039     {
02040         return false;
02041     }
02042 
02048     public function getTitle()
02049     {
02050     }
02051 
02057     public function getActiveLangAbbr()
02058     {
02059         // Performance
02060         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
02061             return;
02062         }
02063 
02064         if ( !isset($this->_sActiveLangAbbr ) ) {
02065             $aLanguages = oxLang::getInstance()->getLanguageArray();
02066             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
02067                 if ( $oVal->selected ) {
02068                     $this->_sActiveLangAbbr = $oVal->abbr;
02069                     break;
02070                 }
02071             }
02072         }
02073 
02074         return $this->_sActiveLangAbbr;
02075     }
02076 
02084     public function addGlobalParams( $oShop = null)
02085     {
02086         $oViewConf = parent::addGlobalParams( $oShop );
02087 
02088         $this->_setNrOfArtPerPage();
02089 
02090         return $oViewConf;
02091     }
02092 
02098     public function getAdditionalParams()
02099     {
02100         if ( $this->_sAdditionalParams === null ) {
02101             // #1018A
02102             $this->_sAdditionalParams  = parent::getAdditionalParams();
02103             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02104 
02105             // #1834M - specialchar search
02106             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02107             if ( isset( $sSearchParamForLink ) ) {
02108                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
02109             }
02110             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02111                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
02112             }
02113             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02114                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02115             }
02116             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02117                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02118             }
02119             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02120                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02121             }
02122             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02123                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02124             }
02125             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02126                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02127             }
02128         }
02129 
02130         return $this->_sAdditionalParams;
02131     }
02132 
02138     public function generatePageNavigationUrl()
02139     {
02140         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02141     }
02142 
02152     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02153     {
02154         if ( $iPage ) {
02155             if ( ( strpos( $sUrl, 'pgNr=' ) ) ) {
02156                 $sUrl = preg_replace('/pgNr=[0-9]*/', 'pgNr='.$iPage, $sUrl);
02157             } else {
02158                 $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02159             }
02160         } else {
02161            $sUrl = preg_replace('/pgNr=[0-9]*/', '', $sUrl);
02162            $sUrl = preg_replace('/\&amp\;\&amp\;/', '&amp;', $sUrl);
02163            $sUrl = preg_replace('/\?\&amp\;/', '?', $sUrl);
02164            $sUrl = preg_replace('/\&amp\;$/', '', $sUrl);
02165         }
02166         return $sUrl;
02167     }
02168 
02174     public function getPageNavigation()
02175     {
02176 
02177     }
02178 
02184     public function getPageNavigationLimitedTop()
02185     {
02186 
02187         $this->_oPageNavigation = $this->generatePageNavigation( 7 );
02188 
02189         return $this->_oPageNavigation;
02190     }
02191 
02197     public function getPageNavigationLimitedBottom()
02198     {
02199 
02200         $this->_oPageNavigation = $this->generatePageNavigation( 11 );
02201 
02202         return $this->_oPageNavigation;
02203     }
02204 
02205 
02213     public function generatePageNavigation( $iPositionCount = 0 )
02214     {
02215         startProfile('generatePageNavigation');
02216 
02217         $pageNavigation = new stdClass();
02218 
02219         $pageNavigation->NrOfPages = $this->_iCntPages;
02220         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02221         $iActPage = $this->getActPage();
02222         $pageNavigation->actPage   = $iActPage + 1;
02223         $sUrl = $this->generatePageNavigationUrl();
02224 
02225         if ( $iPositionCount == 0 || ($iPositionCount >= $pageNavigation->NrOfPages) ) {
02226              $iStartNo = 2;
02227              $iFinishNo = $pageNavigation->NrOfPages;
02228              $bStart = false;
02229              $bFinish =false;
02230         } else {
02231             $iTmpVal = $iPositionCount - 3;
02232             $iTmpVal2 = floor( ( $iPositionCount - 4 ) / 2 );
02233 
02234             // actual page is at the start
02235             if ( $pageNavigation->actPage <= $iTmpVal ) {
02236                 $iStartNo = 2;
02237                 $iFinishNo = $iTmpVal + 1;
02238                 $bStart = false;
02239                 $bFinish = true;
02240             // actual page is at the end
02241             } elseif ( $pageNavigation->actPage >= $pageNavigation->NrOfPages - $iTmpVal ) {
02242                 $iStartNo = $pageNavigation->NrOfPages - $iTmpVal;
02243                 $iFinishNo = $pageNavigation->NrOfPages - 1;
02244                 $bStart = true;
02245                 $bFinish = false;
02246             // actual page is in the midle
02247             } else {
02248                 $iStartNo = $pageNavigation->actPage - $iTmpVal2;
02249                 $iFinishNo = $pageNavigation->actPage + $iTmpVal2;
02250                 $bStart = true;
02251                 $bFinish = true;
02252             }
02253         }
02254 
02255         if ( $iActPage > 0) {
02256             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02257         }
02258 
02259         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02260             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02261         }
02262 
02263         if ( $pageNavigation->NrOfPages > 1 ) {
02264 
02265             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02266 
02267                 if ( $i == 1 || $i == $pageNavigation->NrOfPages || ( $i >= $iStartNo && $i <= $iFinishNo ) ) {
02268                     $page = new Oxstdclass();
02269                     $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02270                     $page->selected = ( $i == $pageNavigation->actPage ) ? 1 : 0;
02271                     $pageNavigation->changePage[$i] = $page;
02272                 }
02273             }
02274 
02275             // first/last one
02276             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02277             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02278         }
02279 
02280         stopProfile('generatePageNavigation');
02281 
02282         return $pageNavigation;
02283     }
02284 
02290     public function getArticleCount()
02291     {
02292         return $this->_iAllArtCnt;
02293     }
02294 
02301     public function render()
02302     {
02303         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02304             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02305         }
02306 
02307         parent::render();
02308 
02309         if ( $this->getIsOrderStep() ) {
02310 
02311             // disabling navigation during order ...
02312             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02313                 $this->_iNewsRealStatus = 1;
02314                 $this->setShowNewsletter( 0 );
02315                 $this->setShowRightBasket( 0 );
02316                 $this->setShowLeftBasket( 0 );
02317                 $this->setShowTopBasket( 0 );
02318             }
02319         }
02320         return $this->_sThisTemplate;
02321     }
02322 
02328     public function getViewProduct()
02329     {
02330         return $this->getProduct();
02331     }
02332 
02340     public function setViewProduct( $oProduct )
02341     {
02342         $this->_oProduct = $oProduct;
02343     }
02344 
02350     public function getViewProductList()
02351     {
02352         return $this->_aArticleList;
02353     }
02354 
02360     public function getActPage()
02361     {
02362         if ( $this->_iActPage === null ) {
02363             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02364             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02365         }
02366         return $this->_iActPage;
02367     }
02368 
02376     public function getActTag()
02377     {
02378         if ( $this->_oActTag === null ) {
02379             $this->_oActTag = new Oxstdclass();
02380             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02381             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02382 
02383             $sLink = false;
02384             if ( oxUtils::getInstance()->seoIsActive() ) {
02385                 $sLink = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02386             }
02387 
02388             $this->_oActTag->link = $sLink ? $sLink : $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02389         }
02390         return $this->_oActTag;
02391     }
02392 
02400     public function getActVendor()
02401     {
02402         // if active vendor is not set yet - trying to load it from request params
02403         // this may be usefull when category component was unable to load active vendor
02404         // and we still need some object to mount navigation info
02405         if ( $this->_oActVendor === null ) {
02406             $this->_oActVendor = false;
02407             $sVendorId = oxConfig::getParameter( 'cnid' );
02408             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02409             $oVendor = oxNew( 'oxvendor' );
02410             if ( $oVendor->load( $sVendorId ) ) {
02411                 $this->_oActVendor = $oVendor;
02412             }
02413         }
02414 
02415         return $this->_oActVendor;
02416     }
02417 
02425     public function getActManufacturer()
02426     {
02427         // if active Manufacturer is not set yet - trying to load it from request params
02428         // this may be usefull when category component was unable to load active Manufacturer
02429         // and we still need some object to mount navigation info
02430         if ( $this->_oActManufacturer === null ) {
02431 
02432             $this->_oActManufacturer = false;
02433             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02434             $oManufacturer = oxNew( 'oxmanufacturer' );
02435             if ( $oManufacturer->load( $sManufacturerId ) ) {
02436                 $this->_oActManufacturer = $oManufacturer;
02437             }
02438         }
02439 
02440         return $this->_oActManufacturer;
02441     }
02442 
02450     public function setActVendor( $oVendor )
02451     {
02452         $this->_oActVendor = $oVendor;
02453     }
02454 
02462     public function setActManufacturer( $oManufacturer )
02463     {
02464         $this->_oActManufacturer = $oManufacturer;
02465     }
02466 
02472     public function getActSearch()
02473     {
02474         if ( $this->_oActSearch === null ) {
02475             $this->_oActSearch = new oxStdClass();
02476             $sUrl = $this->getConfig()->getShopHomeURL();
02477             $this->_oActSearch->link = "{$sUrl}cl=search";
02478         }
02479         return $this->_oActSearch;
02480     }
02481 
02487     public function getCategoryTree()
02488     {
02489         return $this->_oCategoryTree;
02490     }
02491 
02499     public function setCategoryTree( $oCatTree )
02500     {
02501         $this->_oCategoryTree = $oCatTree;
02502     }
02503 
02509     public function getVendorTree()
02510     {
02511         return $this->_oVendorTree;
02512     }
02513 
02521     public function setVendorTree( $oVendorTree )
02522     {
02523         $this->_oVendorTree = $oVendorTree;
02524     }
02525 
02531     public function getManufacturerTree()
02532     {
02533         return $this->_oManufacturerTree;
02534     }
02535 
02543     public function setManufacturerTree( $oManufacturerTree )
02544     {
02545         $this->_oManufacturerTree = $oManufacturerTree;
02546     }
02547 
02553     public function getAddUrlParams()
02554     {
02555     }
02556 
02563     public function getTop5ArticleList()
02564     {
02565         if ( $this->_blTop5Action ) {
02566             if ( $this->_aTop5ArticleList === null ) {
02567                 $this->_aTop5ArticleList = false;
02568                 $myConfig = $this->getConfig();
02569                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02570                     // top 5 articles
02571                     $oArtList = oxNew( 'oxarticlelist' );
02572                     $oArtList->loadTop5Articles();
02573                     if ( $oArtList->count() ) {
02574                         $this->_aTop5ArticleList = $oArtList;
02575                     }
02576                 }
02577             }
02578         }
02579         return $this->_aTop5ArticleList;
02580     }
02581 
02588     public function getBargainArticleList()
02589     {
02590         if ( $this->_blBargainAction ) {
02591             if ( $this->_aBargainArticleList === null ) {
02592                 $this->_aBargainArticleList = array();
02593                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02594                     $oArtList = oxNew( 'oxarticlelist' );
02595                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02596                     if ( $oArtList->count() ) {
02597                         $this->_aBargainArticleList = $oArtList;
02598                     }
02599                 }
02600             }
02601         }
02602         return $this->_aBargainArticleList;
02603     }
02604 
02611     public function isLowOrderPrice()
02612     {
02613         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02614             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02615         }
02616 
02617         return $this->_blLowOrderPrice;
02618     }
02619 
02625     public function getMinOrderPrice()
02626     {
02627         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02628             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02629             $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice );
02630         }
02631         return $this->_sMinOrderPrice;
02632     }
02633 
02639     public function getNewsRealStatus()
02640     {
02641         return $this->_iNewsRealStatus;
02642     }
02643 
02649     protected function _canRedirect()
02650     {
02651         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02652             if ( oxConfig::getParameter( $sParam ) !== null ) {
02653                 return false;
02654             }
02655         }
02656 
02657         return true;
02658     }
02659 
02665     public function getProduct()
02666     {
02667     }
02668 
02674     public function getVendorlist()
02675     {
02676         return $this->_aVendorlist;
02677     }
02678 
02686     public function setVendorlist( $aList )
02687     {
02688         $this->_aVendorlist = $aList;
02689     }
02690 
02696     public function getManufacturerlist()
02697     {
02698         return $this->_aManufacturerlist;
02699     }
02700 
02708     public function setManufacturerlist( $aList )
02709     {
02710         $this->_aManufacturerlist = $aList;
02711     }
02712 
02720     public function setRootVendor( $oVendor )
02721     {
02722         $this->_oRootVendor = $oVendor;
02723     }
02724 
02730     public function getRootVendor()
02731     {
02732         return $this->_oRootVendor;
02733     }
02734 
02742     public function setRootManufacturer( $oManufacturer )
02743     {
02744         $this->_oRootManufacturer = $oManufacturer;
02745     }
02746 
02752     public function getRootManufacturer()
02753     {
02754         return $this->_oRootManufacturer;
02755     }
02756 
02762     public function getVendorId()
02763     {
02764         if ( $this->_sVendorId === null ) {
02765             $this->_sVendorId = false;
02766             if ( ( $oVendor = $this->getActVendor() ) ) {
02767                 $this->_sVendorId = $oVendor->getId();
02768             }
02769         }
02770         return $this->_sVendorId;
02771     }
02772 
02778     public function getManufacturerId()
02779     {
02780         if ( $this->_sManufacturerId === null ) {
02781             $this->_sManufacturerId = false;
02782             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02783                 $this->_sManufacturerId = $oManufacturer->getId();
02784             }
02785         }
02786         return $this->_sManufacturerId;
02787     }
02788 
02794     public function getSearchCatTree()
02795     {
02796         return $this->_aSearchCatTree;
02797     }
02798 
02806     public function setSearchCatTree( $aTree )
02807     {
02808         $this->_aSearchCatTree = $aTree;
02809     }
02810 
02816     public function getCatMoreUrl()
02817     {
02818         return $this->getConfig()->getShopHomeURL().'cnid=oxmore';
02819     }
02820 
02826     public function getCatMore()
02827     {
02828         return $this->_oCatMore;
02829     }
02830 
02838     public function setCatMore( $oCat )
02839     {
02840         $this->_oCatMore = $oCat;
02841     }
02842 
02848     public function getCatTreePath()
02849     {
02850         return $this->_sCatTreePath;
02851     }
02852 
02860     public function getContentByIdent( $sIdent )
02861     {
02862         if ( !isset( $this->_aContents[$sIdent] ) ) {
02863             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02864             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02865         }
02866         return $this->_aContents[$sIdent];
02867     }
02868 
02874     public function getContentCategory()
02875     {
02876         return false;
02877     }
02878 
02884     public function getMustFillFields()
02885     {
02886         if ( $this->_aMustFillFields === null ) {
02887             $this->_aMustFillFields = false;
02888 
02889             // passing must-be-filled-fields info
02890             $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02891             if ( is_array( $aMustFillFields ) ) {
02892                 $this->_aMustFillFields = array_flip( $aMustFillFields );
02893             }
02894         }
02895         return $this->_aMustFillFields;
02896     }
02897 
02905     public function isFieldRequired( $sField )
02906     {
02907         if ( $aMustFillFields = $this->getMustFillFields() ) {
02908             if ( isset( $aMustFillFields[$sField] ) ) {
02909                 return true;
02910             }
02911         }
02912 
02913         return false;
02914     }
02915 
02921     public function getFormId()
02922     {
02923         if ( $this->_sFormId === null ) {
02924             $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02925             oxSession::setVar( 'sessionuformid', $this->_sFormId );
02926         }
02927 
02928         return $this->_sFormId;
02929     }
02930 
02936     public function canAcceptFormData()
02937     {
02938         if ( $this->_blCanAcceptFormData === null ) {
02939             $this->_blCanAcceptFormData = false;
02940 
02941             $sFormId = oxConfig::getParameter( "uformid" );
02942             $sSessionFormId = oxSession::getVar( "sessionuformid" );
02943 
02944             // testing if form and session ids matches
02945             if ( $sFormId && $sFormId === $sSessionFormId ) {
02946                 $this->_blCanAcceptFormData = true;
02947             }
02948 
02949             // regenerating form data
02950             $this->getFormId();
02951         }
02952         return $this->_blCanAcceptFormData;
02953     }
02954 
02960     public function getPromoFinishedList()
02961     {
02962         if (isset($this->_oPromoFinishedList)) {
02963             return $this->_oPromoFinishedList;
02964         }
02965         $this->_oPromoFinishedList = oxNew( 'oxActionList' );
02966         $this->_oPromoFinishedList->loadFinishedByCount(2);
02967         return $this->_oPromoFinishedList;
02968     }
02969 
02975     public function getPromoCurrentList()
02976     {
02977         if (isset($this->_oPromoCurrentList)) {
02978             return $this->_oPromoCurrentList;
02979         }
02980         $this->_oPromoCurrentList = oxNew( 'oxActionList' );
02981         $this->_oPromoCurrentList->loadCurrent();
02982         return $this->_oPromoCurrentList;
02983     }
02984 
02990     public function getPromoFutureList()
02991     {
02992         if (isset($this->_oPromoFutureList)) {
02993             return $this->_oPromoFutureList;
02994         }
02995         $this->_oPromoFutureList = oxNew( 'oxActionList' );
02996         $this->_oPromoFutureList->loadFutureByCount(2);
02997         return $this->_oPromoFutureList;
02998     }
02999 
03005     public function getShowPromotionList()
03006     {
03007         if (isset($this->_blShowPromotions)) {
03008             return $this->_blShowPromotions;
03009         }
03010         $this->_blShowPromotions = false;
03011         if (oxNew('oxActionList')->areAnyActivePromotions()) {
03012             $this->_blShowPromotions = ( count( $this->getPromoFinishedList() ) + count( $this->getPromoCurrentList() ) + count( $this->getPromoFutureList() ) ) > 0;
03013         }
03014         return $this->_blShowPromotions;
03015     }
03016 
03022     public function isEnabledPrivateSales()
03023     {
03024         if ( $this->_blEnabledPrivateSales === null ) {
03025             $this->_blEnabledPrivateSales = (bool) $this->getConfig()->getConfigParam( 'blPsLoginEnabled' );
03026             if ( $this->_blEnabledPrivateSales && ( $blCanPreview = oxUtils::getInstance()->canPreview() ) !== null ) {
03027                 $this->_blEnabledPrivateSales = !$blCanPreview;
03028             }
03029         }
03030         return $this->_blEnabledPrivateSales;
03031     }
03032 
03038     public function getTagCloudManager()
03039     {
03040         if ( $this->_blShowTagCloud ) {
03041             return oxNew( "oxTagCloud" );
03042         } else {
03043             return false;
03044         }
03045     }
03046 
03052     public function getFieldValidationErrors()
03053     {
03054         return oxInputValidator::getInstance()->getFieldValidationErrors();
03055     }
03056 
03062     public function getBreadCrumb()
03063     {
03064         return null;
03065     }
03066 
03074     public function setRootCatChanged( $blRootCatChanged )
03075     {
03076         $this->_blRootCatChanged = $blRootCatChanged;
03077     }
03078 
03084     public function isRootCatChanged()
03085     {
03086         return $this->_blRootCatChanged;
03087     }
03088 
03094     public function getInvoiceAddress()
03095     {
03096         if ( $this->_aInvoiceAddress == null ) {
03097             $aAddress = oxConfig::getParameter( 'invadr');
03098             if ( $aAddress ) {
03099                 $this->_aInvoiceAddress = $aAddress;
03100             }
03101         }
03102         return $this->_aInvoiceAddress;
03103     }
03104 
03110     public function getDeliveryAddress()
03111     {
03112         if ( $this->_aDeliveryAddress == null ) {
03113             $aAddress = oxConfig::getParameter( 'deladr');
03114             if ( $aAddress ) {
03115                 $this->_aDeliveryAddress = $aAddress;
03116             }
03117         }
03118         return $this->_aDeliveryAddress;
03119     }
03120 
03128     public function setInvoiceAddress( $aAddress )
03129     {
03130         $this->_aInvoiceAddress = $aAddress;
03131     }
03132 
03138     public function getActiveUsername()
03139     {
03140         if ( $this->_sActiveUsername == null ) {
03141             $this->_sActiveUsername = false;
03142             $sUsername = oxConfig::getParameter( 'lgn_usr' );
03143             if ( $sUsername ) {
03144                 $this->_sActiveUsername = $sUsername;
03145             } elseif ( $oUser = $this->getUser() ) {
03146                 $this->_sActiveUsername = $oUser->oxuser__oxusername->value;
03147             }
03148         }
03149         return $this->_sActiveUsername;
03150     }
03151 
03157     public function getWishlistUserId()
03158     {
03159         return oxConfig::getParameter( 'wishid' );
03160     }
03161 
03167     public function getSearchCatId()
03168     {
03169     }
03170 
03176     public function getSearchVendor()
03177     {
03178     }
03179 
03185     public function getSearchManufacturer()
03186     {
03187     }
03188 
03194     public function getLastProducts()
03195     {
03196 
03197     }
03198 
03204     public function getNewBasketItemMsgType()
03205     {
03206         return (int) $this->getConfig()->getConfigParam( "iNewBasketItemMessage" );
03207     }
03208 
03214     public function showTags()
03215     {
03216         return (bool) $this->getConfig()->getConfigParam( "blShowTags" );
03217     }
03218 
03226     public function isActive( $sName )
03227     {
03228         return $this->getConfig()->getConfigParam( "bl".$sName."Enabled" );
03229     }
03230 
03236     public function isFbWidgetWisible()
03237     {
03238         if ( $this->_blFbWidgetsOn === null ) {
03239             $oUtils = oxUtilsServer::getInstance();
03240 
03241             // reading ..
03242             $this->_blFbWidgetsOn = (bool) $oUtils->getOxCookie( "fbwidgetson" );
03243 
03244             // .. and setting back
03245             $oUtils->setOxCookie( "fbwidgetson", $this->_blFbWidgetsOn ? 1 : 0 );
03246         }
03247         return $this->_blFbWidgetsOn;
03248     }
03249 
03255     public function showRememberMe()
03256     {
03257         return (bool)$this->getConfig()->getConfigParam('blShowRememberMe');
03258     }
03259 }