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 
00900     public function loadVendorTree()
00901     {
00902         if ( $this->_blLoadVendorTree == null ) {
00903             $this->_blLoadVendorTree = false;
00904             if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
00905                 $this->_blLoadVendorTree = $blLoadVendorTree;
00906             }
00907         }
00908         return $this->_blLoadVendorTree;
00909     }
00910 
00916     public function loadManufacturerTree()
00917     {
00918         if ( $this->_blLoadManufacturerTree == null ) {
00919             $this->_blLoadManufacturerTree = false;
00920             if ( $blLoadManufacturerTree = $this->getConfig()->getConfigParam( 'bl_perfLoadManufacturerTree' ) ) {
00921                 $this->_blLoadManufacturerTree = $blLoadManufacturerTree;
00922             }
00923         }
00924         return $this->_blLoadManufacturerTree;
00925     }
00926 
00932     public function dontShowEmptyCategories()
00933     {
00934         if ( $this->_blDontShowEmptyCats == null ) {
00935             $this->_blDontShowEmptyCats = false;
00936             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00937                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00938             }
00939         }
00940         return $this->_blDontShowEmptyCats;
00941     }
00942 
00948     public function showCategoryArticlesCount()
00949     {
00950         return $this->getConfig()->getConfigParam( 'bl_perfShowActionCatArticleCnt' );
00951     }
00952 
00958     public function isLanguageLoaded()
00959     {
00960         if ( $this->_blLoadLanguage == null ) {
00961             $this->_blLoadLanguage = false;
00962             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00963                 $this->_blLoadLanguage = $blLoadLanguage;
00964             }
00965         }
00966         return $this->_blLoadLanguage;
00967     }
00968 
00974     public function showTopCatNavigation()
00975     {
00976         if ( $this->_blShowTopCatNav == null ) {
00977             $this->_blShowTopCatNav = false;
00978             if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
00979                 $this->_blShowTopCatNav = $blShowTopCatNav;
00980             }
00981         }
00982         return $this->_blShowTopCatNav;
00983     }
00984 
00990     public function getTopNavigationCatCnt()
00991     {
00992         if ( $this->_iTopCatNavItmCnt == null ) {
00993             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00994             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00995         }
00996         return $this->_iTopCatNavItmCnt;
00997     }
00998 
01008     public function addRssFeed($sTitle, $sUrl, $key = null)
01009     {
01010         if (!is_array($this->_aRssLinks)) {
01011             $this->_aRssLinks = array();
01012         }
01013         if ($key === null) {
01014             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
01015         } else {
01016             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
01017         }
01018     }
01019 
01025     public function getSortOrderByParameterName()
01026     {
01027         return 'listorderby';
01028     }
01029 
01035     public function getSortOrderParameterName()
01036     {
01037         return 'listorder';
01038     }
01039 
01050     public function prepareSortColumns()
01051     {
01052         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
01053         if ( count( $aSortColumns ) > 0 ) {
01054 
01055             $this->_blActiveSorting = true;
01056             $this->_aSortColumns = $aSortColumns;
01057 
01058             $sCnid = oxConfig::getParameter( 'cnid' );
01059 
01060 
01061             $sSortBy  = oxConfig::getParameter( $this->getSortOrderByParameterName() );
01062             $sSortDir = oxConfig::getParameter( $this->getSortOrderParameterName() );
01063 
01064             if ( !$sSortBy && $aSorting = $this->getSorting( $sCnid ) ) {
01065                 $sSortBy  = $aSorting['sortby'];
01066                 $sSortDir = $aSorting['sortdir'];
01067             }
01068 
01069             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
01070                  $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
01071 
01072                 $this->_sListOrderBy  = $sSortBy;
01073                 $this->_sListOrderDir = $sSortDir;
01074 
01075                 // caching sorting config
01076                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
01077             }
01078         }
01079     }
01080 
01086     public function getListOrderBy()
01087     {
01088         //if column is with table name split it
01089         $aColums = explode('.', $this->_sListOrderBy);
01090 
01091         if ( is_array($aColums) && count($aColums) > 1 ) {
01092            return $aColums[1];
01093         }
01094 
01095         return $this->_sListOrderBy;
01096     }
01097 
01103     public function getListOrderDirection()
01104     {
01105         return $this->_sListOrderDir;
01106     }
01107 
01115     public function setMetaDescription ( $sDescription )
01116     {
01117         return $this->_sMetaDescription = $sDescription;
01118     }
01119 
01127     public function setMetaKeywords( $sKeywords )
01128     {
01129         return $this->_sMetaKeywords = $sKeywords;
01130     }
01131 
01139     protected function _getMetaFromSeo( $sDataType )
01140     {
01141         $sOxid  = $this->_getSeoObjectId();
01142         $iLang  = oxLang::getInstance()->getBaseLanguage();
01143         $sShop  = $this->getConfig()->getShopId();
01144 
01145         if ( $sOxid && oxUtils::getInstance()->seoIsActive() &&
01146              ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, $sDataType, $sShop, $iLang) ) ) {
01147             return $sKeywords;
01148         }
01149     }
01150 
01158     protected function _getMetaFromContent( $sMetaIdent )
01159     {
01160         if ( $sMetaIdent ) {
01161             $oContent = oxNew( 'oxcontent' );
01162             if ( $oContent->loadByIdent( $sMetaIdent ) &&
01163                  $oContent->oxcontents__oxactive->value ) {
01164                 return strip_tags( $oContent->oxcontents__oxcontent->value );
01165             }
01166         }
01167     }
01168 
01174     public function getMetaKeywords()
01175     {
01176         if ( $this->_sMetaKeywords === null ) {
01177             $this->_sMetaKeywords = false;
01178 
01179             // set special meta keywords ?
01180             if ( ( $sKeywords = $this->_getMetaFromSeo( 'oxkeywords' ) ) ) {
01181                 $this->_sMetaKeywords = $sKeywords;
01182             } elseif ( ( $sKeywords = $this->_getMetaFromContent( $this->_sMetaKeywordsIdent ) ) ) {
01183                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( $sKeywords, false );
01184             } else {
01185                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( false, true );
01186             }
01187         }
01188 
01189         return $this->_sMetaKeywords;
01190     }
01191 
01197     public function getMetaDescription()
01198     {
01199         if ( $this->_sMetaDescription === null ) {
01200             $this->_sMetaDescription = false;
01201 
01202             // set special meta description ?
01203             if ( ( $sDescription = $this->_getMetaFromSeo( 'oxdescription' ) ) ) {
01204                 $this->_sMetaDescription = $sDescription;
01205             } elseif ( ( $sDescription = $this->_getMetaFromContent( $this->_sMetaDescriptionIdent ) ) ) {
01206                 $this->_sMetaDescription = $this->_prepareMetaDescription( $sDescription );
01207             } else {
01208                 $this->_sMetaDescription = $this->_prepareMetaDescription( false );
01209             }
01210         }
01211 
01212         return $this->_sMetaDescription;
01213     }
01214 
01220     public function getActCurrency()
01221     {
01222         return $this->_oActCurrency;
01223     }
01224 
01232     public function setActCurrency( $oCur )
01233     {
01234         $this->_oActCurrency = $oCur;
01235     }
01236 
01242     public function getCompareItemsCnt()
01243     {
01244         return (int)$this->_iCompItemsCnt;
01245     }
01246 
01254     public function setCompareItemsCnt( $iCount )
01255     {
01256         $this->_iCompItemsCnt = $iCount;
01257     }
01258 
01264     public function getWishlistName()
01265     {
01266         return $this->_sWishlistName;
01267     }
01268 
01276     public function setWishlistName( $sName )
01277     {
01278         $this->_sWishlistName = $sName;
01279     }
01280 
01286     protected function _forceNoIndex()
01287     {
01288         $this->_blForceNoIndex = true;
01289     }
01290 
01297     public function noIndex()
01298     {
01299         if ( $this->_blForceNoIndex ) {
01300             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01301         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01302             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01303         } else {
01304             switch ( oxConfig::getParameter( 'fnc' ) ) {
01305                 case 'tocomparelist':
01306                 case 'tobasket':
01307                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01308                     break;
01309             }
01310         }
01311         return $this->_iViewIndexState;
01312     }
01313 
01320     public function getContentId()
01321     {
01322         if ( $this->_sContentId === null) {
01323             $oContent = oxNew( 'oxcontent' );
01324             $oContent->loadByIdent( 'oximpressum' );
01325             $this->_sContentId = $oContent->getId();
01326         }
01327 
01328         return $this->_sContentId;
01329     }
01330 
01337     public function getContent()
01338     {
01339         if ( $this->_oContent === null) {
01340             $oContent = oxNew( 'oxcontent' );
01341             if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01342                 $this->_oContent = $oContent;
01343             }
01344         }
01345 
01346         return $this->_oContent;
01347     }
01348 
01354     public function isSortingActive()
01355     {
01356         return $this->_blActiveSorting;
01357     }
01358 
01364     public function getMenueList()
01365     {
01366         return $this->_aMenueList;
01367     }
01368 
01376     public function setMenueList( $aMenue )
01377     {
01378         $this->_aMenueList = $aMenue;
01379     }
01380 
01381 
01387     protected function _setNrOfArtPerPage()
01388     {
01389         $myConfig  = $this->getConfig();
01390 
01391         //setting default values to avoid possible errors showing article list
01392         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01393 
01394         $iNrofCatArticles = ( $iNrofCatArticles ) ? $iNrofCatArticles : 10;
01395 
01396         // checking if all needed data is set
01397         switch ( $this->getListDisplayType() ) {
01398             case 'grid':
01399                 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticlesInGrid' );
01400                 break;
01401             case 'line':
01402             case 'infogrid':
01403             default:
01404                 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01405         }
01406 
01407         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01408             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01409         } else {
01410             $iNrofCatArticles = $aNrofCatArticles[0];
01411         }
01412 
01413         $oViewConf = $this->getViewConfig();
01414         //value from user input
01415         if ( ( $iNrofArticles = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01416             // M45 Possibility to push any "Show articles per page" number parameter
01417             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01418             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01419             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01420         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01421             // M45 Possibility to push any "Show articles per page" number parameter
01422             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01423             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01424             $iNrofCatArticles = $iSessArtPerPage;
01425         } else {
01426             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01427         }
01428 
01429         //setting number of articles per page to config value
01430         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01431     }
01432 
01438     protected function _getSeoObjectId()
01439     {
01440     }
01441 
01451     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01452     {
01453         if ( $sMeta ) {
01454 
01455             $oStr = getStr();
01456             if ( $iLength != -1 ) {
01457                 /* *
01458                  * performance - we dont need a huge amount of initial text.
01459                  * assume that effective text may be double longer than $iLength
01460                  * and simple turncate it
01461                  */
01462                 $iELength = ( $iLength * 2 );
01463                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01464             }
01465 
01466             // decoding html entities
01467             $sMeta = $oStr->html_entity_decode( $sMeta );
01468             // stripping HTML tags
01469             $sMeta = strip_tags( $sMeta );
01470 
01471             // removing some special chars
01472             $sMeta = $oStr->cleanStr( $sMeta );
01473 
01474             // removing duplicate words
01475             if ( $blRemoveDuplicatedWords ) {
01476                 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01477             }
01478 
01479             // some special cases
01480             $sMeta = str_replace( ' ,', ',', $sMeta );
01481             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01482             $sMeta = $oStr->preg_replace( $aPattern, ',', $sMeta );
01483             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01484 
01485             return trim( $sMeta );
01486         }
01487     }
01488 
01497     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01498     {
01499 
01500         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01501 
01502         if ( $blRemoveDuplicatedWords ) {
01503             $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01504         }
01505 
01506         // removing in admin defined strings
01507 
01508         /*if ( is_array( $aSkipTags ) && $sString ) {
01509             $oStr = getStr();
01510             foreach ( $aSkipTags as $sSkip ) {
01511                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01512                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01513                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01514                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01515             }
01516         }*/
01517 
01518         return trim( $sString );
01519     }
01520 
01529     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01530     {
01531         $oStr = getStr();
01532         if ( is_array( $aInput ) ) {
01533             $aInput = implode( " ", $aInput );
01534         }
01535 
01536         // removing some usually met characters..
01537         $aInput = $oStr->preg_replace( "/[".preg_quote( $this->_sRemoveMetaChars, "/" )."]/", " ", $aInput );
01538 
01539         // splitting by word
01540         $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01541 
01542         if ( $sCount = count( $aSkipTags ) ) {
01543             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01544                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01545             }
01546         }
01547         $sCount = count($aStrings);
01548         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01549             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01550             // removing in admin defined strings
01551             if ( !$aStrings[$iNum] || in_array( $aStrings[$iNum], $aSkipTags ) ) {
01552                 unset( $aStrings[$iNum] );
01553             }
01554         }
01555 
01556         // duplicates
01557         return implode( ', ', array_unique( $aStrings ) );
01558     }
01559 
01567     public function getNavigationParams()
01568     {
01569         $aParams['cnid'] = $this->getCategoryId();
01570         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01571 
01572         $aParams['listtype'] = $this->getListType();
01573         $aParams['ldtype'] = $this->getListDisplayType();
01574 
01575         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01576 
01577         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01578         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01579         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01580 
01581         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01582         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01583         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01584 
01585         return $aParams;
01586     }
01587 
01597     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01598     {
01599 
01600         $aSorting = oxSession::getVar( 'aSorting' );
01601         $aSorting[$sCnid]['sortby']  = $sSortBy;
01602         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01603 
01604         oxSession::setVar( 'aSorting', $aSorting );
01605     }
01606 
01614     public function getSorting( $sCnid )
01615     {
01616         $aSorting = oxSession::getVar( 'aSorting' );
01617 
01618         if ( isset( $aSorting[$sCnid] ) ) {
01619             return $aSorting[$sCnid];
01620         }
01621     }
01622 
01630     public function getSortingSql( $sCnid )
01631     {
01632         $aSorting = $this->getSorting( $sCnid );
01633         if ( is_array( $aSorting ) ) {
01634             return implode( " ", $aSorting );
01635         }
01636     }
01637 
01643     public function getTitleSuffix()
01644     {
01645         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01646     }
01647 
01653     public function getTitlePageSuffix()
01654     {
01655     }
01656 
01663     public function getTitlePrefix()
01664     {
01665         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01666     }
01667 
01668 
01669 
01678     protected function _getSubject( $iLang )
01679     {
01680         return null;
01681     }
01682 
01688     public function getDynUrlParams()
01689     {
01690         $sRet = '';
01691         $sListType = $this->getListType();
01692 
01693         switch ($sListType) {
01694             default:
01695                 break;
01696             case 'search':
01697                 $sRet .= "&amp;listtype={$sListType}";
01698                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01699                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01700                 }
01701 
01702                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01703                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01704                 }
01705                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01706                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01707                 }
01708                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01709                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01710                 }
01711                 break;
01712             case 'tag':
01713                 $sRet .= "&amp;listtype={$sListType}";
01714                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01715                     $sRet .= "&amp;searchtag={$sParam}";
01716                 }
01717                 break;
01718         }
01719 
01720         return $sRet;
01721     }
01722 
01730     public function getLink( $iLang = null )
01731     {
01732         if ( !isset( $iLang ) ) {
01733             $iLang = oxLang::getInstance()->getBaseLanguage();
01734         }
01735 
01736         $oDisplayObj = null;
01737         $blTrySeo = false;
01738         if ( oxUtils::getInstance()->seoIsActive() ) {
01739             $blTrySeo = true;
01740             $oDisplayObj = $this->_getSubject( $iLang );
01741         }
01742         $iActPageNr = $this->getActPage();
01743 
01744         if ( $oDisplayObj ) {
01745             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01746         }
01747 
01748         $myConfig = $this->getConfig();
01749 
01750         if ( $blTrySeo ) {
01751             $oEncoder = oxSeoEncoder::getInstance();
01752             if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01753                 return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01754             }
01755         }
01756 
01757         $sUrl = oxUtilsUrl::getInstance()->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams(), true, null, $iLang);
01758 
01759         // fallback to old non seo url
01760         return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01761     }
01762 
01768     public function getCanonicalUrl()
01769     {
01770     }
01771 
01778     public function getSimilarRecommLists()
01779     {
01780     }
01781 
01788     public function getSearchParamForHtml()
01789     {
01790     }
01791 
01799     protected function _getRequestParams( $blAddPageNr  = true )
01800     {
01801         $sClass = $this->getClassName();
01802         $sFnc   = $this->getFncName();
01803 
01804         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher', 'moveleft', 'moveright' );
01805         if ( in_array( $sFnc, $aFnc ) ) {
01806             $sFnc = '';
01807         }
01808 
01809         // #680
01810         $sURL = "cl={$sClass}";
01811         if ( $sFnc ) {
01812             $sURL .= "&amp;fnc={$sFnc}";
01813         }
01814         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01815             $sURL .= "&amp;cnid={$sVal}";
01816         }
01817         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01818             $sURL .= "&amp;mnid={$sVal}";
01819         }
01820         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01821             $sURL .= "&amp;anid={$sVal}";
01822         }
01823 
01824         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01825             $sURL .= "&amp;page={$sVal}";
01826         }
01827 
01828         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01829             $sURL .= "&amp;tpl={$sVal}";
01830         }
01831 
01832         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01833         // don't include page number for navigation
01834         // it will be done in oxubase::generatePageNavigation
01835         if ( $blAddPageNr && $iPgNr > 0 ) {
01836             $sURL .= "&amp;pgNr={$iPgNr}";
01837         }
01838 
01839         // #1184M - specialchar search
01840         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01841             $sURL .= "&amp;searchparam={$sVal}";
01842         }
01843 
01844         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01845             $sURL .= "&amp;searchcnid={$sVal}";
01846         }
01847 
01848         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01849             $sURL .= "&amp;searchvendor={$sVal}";
01850         }
01851 
01852         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01853             $sURL .= "&amp;searchmanufacturer={$sVal}";
01854         }
01855 
01856         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01857             $sURL .= "&amp;searchrecomm={$sVal}";
01858         }
01859 
01860         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01861             $sURL .= "&amp;searchtag={$sVal}";
01862         }
01863 
01864         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01865             $sURL .= "&amp;recommid={$sVal}";
01866         }
01867 
01868         return $sURL;
01869     }
01870 
01876     protected function _getSeoRequestParams()
01877     {
01878         $sClass = $this->getClassName();
01879         $sFnc   = $this->getFncName();
01880 
01881         // #921 S
01882         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01883         if ( in_array( $sFnc, $aFnc ) ) {
01884             $sFnc = '';
01885         }
01886 
01887         // #680
01888         $sURL = "cl={$sClass}";
01889         if ( $sFnc ) {
01890             $sURL .= "&amp;fnc={$sFnc}";
01891         }
01892         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01893             $sURL .= "&amp;page={$sVal}";
01894         }
01895 
01896         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01897             $sURL .= "&amp;tpl={$sVal}";
01898         }
01899 
01900         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01901         if ( $iPgNr > 0 ) {
01902             $sURL .= "&amp;pgNr={$iPgNr}";
01903         }
01904 
01905         return $sURL;
01906     }
01907 
01913     public function showSearch()
01914     {
01915         $blShow = true;
01916         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01917             $blShow = false;
01918         }
01919         return (int) $blShow;
01920     }
01921 
01927     public function getRssLinks()
01928     {
01929         return $this->_aRssLinks;
01930     }
01931 
01937     public function getSortColumns()
01938     {
01939         return $this->_aSortColumns;
01940     }
01941 
01947     public function getEditTags()
01948     {
01949     }
01950 
01956     public function getRecommSearch()
01957     {
01958     }
01959 
01965     public function getPaymentList()
01966     {
01967     }
01968 
01974     public function getActiveRecommList()
01975     {
01976         if ( $this->_oActiveRecommList === null ) {
01977             $this->_oActiveRecommList = false;
01978             if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01979                 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01980                 $this->_oActiveRecommList->load( $sOxid );
01981             }
01982         }
01983         return $this->_oActiveRecommList;
01984     }
01985 
01991     public function getAccessoires()
01992     {
01993     }
01994 
02000     public function getCrossSelling()
02001     {
02002     }
02003 
02009     public function getSimilarProducts()
02010     {
02011     }
02012 
02018     public function getAlsoBoughtTheseProducts()
02019     {
02020     }
02021 
02027     public function getArticleId()
02028     {
02029     }
02030 
02036     public function isMoreTagsVisible()
02037     {
02038         return false;
02039     }
02040 
02046     public function getTitle()
02047     {
02048     }
02049 
02055     public function getActiveLangAbbr()
02056     {
02057         // Performance
02058         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
02059             return;
02060         }
02061 
02062         if ( !isset($this->_sActiveLangAbbr ) ) {
02063             $aLanguages = oxLang::getInstance()->getLanguageArray();
02064             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
02065                 if ( $oVal->selected ) {
02066                     $this->_sActiveLangAbbr = $oVal->abbr;
02067                     break;
02068                 }
02069             }
02070         }
02071 
02072         return $this->_sActiveLangAbbr;
02073     }
02074 
02082     public function addGlobalParams( $oShop = null)
02083     {
02084         $oViewConf = parent::addGlobalParams( $oShop );
02085 
02086         $this->_setNrOfArtPerPage();
02087 
02088         return $oViewConf;
02089     }
02090 
02096     public function getAdditionalParams()
02097     {
02098         if ( $this->_sAdditionalParams === null ) {
02099             // #1018A
02100             $this->_sAdditionalParams  = parent::getAdditionalParams();
02101             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02102 
02103             // #1834M - specialchar search
02104             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02105             if ( isset( $sSearchParamForLink ) ) {
02106                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
02107             }
02108             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02109                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
02110             }
02111             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02112                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02113             }
02114             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02115                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02116             }
02117             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02118                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02119             }
02120             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02121                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02122             }
02123             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02124                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02125             }
02126         }
02127 
02128         return $this->_sAdditionalParams;
02129     }
02130 
02136     public function generatePageNavigationUrl()
02137     {
02138         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02139     }
02140 
02150     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02151     {
02152         if ( $iPage ) {
02153             if ( ( strpos( $sUrl, 'pgNr=' ) ) ) {
02154                 $sUrl = preg_replace('/pgNr=[0-9]*/', 'pgNr='.$iPage, $sUrl);
02155             } else {
02156                 $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02157             }
02158         } else {
02159            $sUrl = preg_replace('/pgNr=[0-9]*/', '', $sUrl);
02160            $sUrl = preg_replace('/\&amp\;\&amp\;/', '&amp;', $sUrl);
02161            $sUrl = preg_replace('/\?\&amp\;/', '?', $sUrl);
02162            $sUrl = preg_replace('/\&amp\;$/', '', $sUrl);
02163         }
02164         return $sUrl;
02165     }
02166 
02172     public function getPageNavigation()
02173     {
02174 
02175     }
02176 
02182     public function getPageNavigationLimitedTop()
02183     {
02184 
02185         $this->_oPageNavigation = $this->generatePageNavigation( 7 );
02186 
02187         return $this->_oPageNavigation;
02188     }
02189 
02195     public function getPageNavigationLimitedBottom()
02196     {
02197 
02198         $this->_oPageNavigation = $this->generatePageNavigation( 11 );
02199 
02200         return $this->_oPageNavigation;
02201     }
02202 
02203 
02211     public function generatePageNavigation( $iPositionCount = 0 )
02212     {
02213         startProfile('generatePageNavigation');
02214 
02215         $pageNavigation = new stdClass();
02216 
02217         $pageNavigation->NrOfPages = $this->_iCntPages;
02218         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02219         $iActPage = $this->getActPage();
02220         $pageNavigation->actPage   = $iActPage + 1;
02221         $sUrl = $this->generatePageNavigationUrl();
02222 
02223         if ( $iPositionCount == 0 || ($iPositionCount >= $pageNavigation->NrOfPages) ) {
02224              $iStartNo = 2;
02225              $iFinishNo = $pageNavigation->NrOfPages;
02226              $bStart = false;
02227              $bFinish =false;
02228         } else {
02229             $iTmpVal = $iPositionCount - 3;
02230             $iTmpVal2 = floor( ( $iPositionCount - 4 ) / 2 );
02231 
02232             // actual page is at the start
02233             if ( $pageNavigation->actPage <= $iTmpVal ) {
02234                 $iStartNo = 2;
02235                 $iFinishNo = $iTmpVal + 1;
02236                 $bStart = false;
02237                 $bFinish = true;
02238             // actual page is at the end
02239             } elseif ( $pageNavigation->actPage >= $pageNavigation->NrOfPages - $iTmpVal ) {
02240                 $iStartNo = $pageNavigation->NrOfPages - $iTmpVal;
02241                 $iFinishNo = $pageNavigation->NrOfPages - 1;
02242                 $bStart = true;
02243                 $bFinish = false;
02244             // actual page is in the midle
02245             } else {
02246                 $iStartNo = $pageNavigation->actPage - $iTmpVal2;
02247                 $iFinishNo = $pageNavigation->actPage + $iTmpVal2;
02248                 $bStart = true;
02249                 $bFinish = true;
02250             }
02251         }
02252 
02253         if ( $iActPage > 0) {
02254             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02255         }
02256 
02257         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02258             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02259         }
02260 
02261         if ( $pageNavigation->NrOfPages > 1 ) {
02262 
02263             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02264 
02265                 if ( $i == 1 || $i == $pageNavigation->NrOfPages || ( $i >= $iStartNo && $i <= $iFinishNo ) ) {
02266                     $page = new Oxstdclass();
02267                     $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02268                     $page->selected = ( $i == $pageNavigation->actPage ) ? 1 : 0;
02269                     $pageNavigation->changePage[$i] = $page;
02270                 }
02271             }
02272 
02273             // first/last one
02274             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02275             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02276         }
02277 
02278         stopProfile('generatePageNavigation');
02279 
02280         return $pageNavigation;
02281     }
02282 
02288     public function getArticleCount()
02289     {
02290         return $this->_iAllArtCnt;
02291     }
02292 
02299     public function render()
02300     {
02301         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02302             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02303         }
02304 
02305         parent::render();
02306 
02307         if ( $this->getIsOrderStep() ) {
02308 
02309             // disabling navigation during order ...
02310             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02311                 $this->_iNewsRealStatus = 1;
02312                 $this->setShowNewsletter( 0 );
02313                 $this->setShowRightBasket( 0 );
02314                 $this->setShowLeftBasket( 0 );
02315                 $this->setShowTopBasket( 0 );
02316             }
02317         }
02318         return $this->_sThisTemplate;
02319     }
02320 
02326     public function getViewProduct()
02327     {
02328         return $this->getProduct();
02329     }
02330 
02338     public function setViewProduct( $oProduct )
02339     {
02340         $this->_oProduct = $oProduct;
02341     }
02342 
02348     public function getViewProductList()
02349     {
02350         return $this->_aArticleList;
02351     }
02352 
02358     public function getActPage()
02359     {
02360         if ( $this->_iActPage === null ) {
02361             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02362             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02363         }
02364         return $this->_iActPage;
02365     }
02366 
02374     public function getActTag()
02375     {
02376         if ( $this->_oActTag === null ) {
02377             $this->_oActTag = new Oxstdclass();
02378             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02379             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02380 
02381             $sLink = false;
02382             if ( oxUtils::getInstance()->seoIsActive() ) {
02383                 $sLink = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02384             }
02385 
02386             $this->_oActTag->link = $sLink ? $sLink : $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02387         }
02388         return $this->_oActTag;
02389     }
02390 
02398     public function getActVendor()
02399     {
02400         // if active vendor is not set yet - trying to load it from request params
02401         // this may be usefull when category component was unable to load active vendor
02402         // and we still need some object to mount navigation info
02403         if ( $this->_oActVendor === null ) {
02404             $this->_oActVendor = false;
02405             $sVendorId = oxConfig::getParameter( 'cnid' );
02406             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02407             $oVendor = oxNew( 'oxvendor' );
02408             if ( $oVendor->load( $sVendorId ) ) {
02409                 $this->_oActVendor = $oVendor;
02410             }
02411         }
02412 
02413         return $this->_oActVendor;
02414     }
02415 
02423     public function getActManufacturer()
02424     {
02425         // if active Manufacturer is not set yet - trying to load it from request params
02426         // this may be usefull when category component was unable to load active Manufacturer
02427         // and we still need some object to mount navigation info
02428         if ( $this->_oActManufacturer === null ) {
02429 
02430             $this->_oActManufacturer = false;
02431             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02432             $oManufacturer = oxNew( 'oxmanufacturer' );
02433             if ( $oManufacturer->load( $sManufacturerId ) ) {
02434                 $this->_oActManufacturer = $oManufacturer;
02435             }
02436         }
02437 
02438         return $this->_oActManufacturer;
02439     }
02440 
02448     public function setActVendor( $oVendor )
02449     {
02450         $this->_oActVendor = $oVendor;
02451     }
02452 
02460     public function setActManufacturer( $oManufacturer )
02461     {
02462         $this->_oActManufacturer = $oManufacturer;
02463     }
02464 
02470     public function getActSearch()
02471     {
02472         if ( $this->_oActSearch === null ) {
02473             $this->_oActSearch = new oxStdClass();
02474             $sUrl = $this->getConfig()->getShopHomeURL();
02475             $this->_oActSearch->link = "{$sUrl}cl=search";
02476         }
02477         return $this->_oActSearch;
02478     }
02479 
02485     public function getCategoryTree()
02486     {
02487         return $this->_oCategoryTree;
02488     }
02489 
02497     public function setCategoryTree( $oCatTree )
02498     {
02499         $this->_oCategoryTree = $oCatTree;
02500     }
02501 
02507     public function getVendorTree()
02508     {
02509         return $this->_oVendorTree;
02510     }
02511 
02519     public function setVendorTree( $oVendorTree )
02520     {
02521         $this->_oVendorTree = $oVendorTree;
02522     }
02523 
02529     public function getManufacturerTree()
02530     {
02531         return $this->_oManufacturerTree;
02532     }
02533 
02541     public function setManufacturerTree( $oManufacturerTree )
02542     {
02543         $this->_oManufacturerTree = $oManufacturerTree;
02544     }
02545 
02551     public function getAddUrlParams()
02552     {
02553     }
02554 
02561     public function getTop5ArticleList()
02562     {
02563         if ( $this->_blTop5Action ) {
02564             if ( $this->_aTop5ArticleList === null ) {
02565                 $this->_aTop5ArticleList = false;
02566                 $myConfig = $this->getConfig();
02567                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02568                     // top 5 articles
02569                     $oArtList = oxNew( 'oxarticlelist' );
02570                     $oArtList->loadTop5Articles();
02571                     if ( $oArtList->count() ) {
02572                         $this->_aTop5ArticleList = $oArtList;
02573                     }
02574                 }
02575             }
02576         }
02577         return $this->_aTop5ArticleList;
02578     }
02579 
02586     public function getBargainArticleList()
02587     {
02588         if ( $this->_blBargainAction ) {
02589             if ( $this->_aBargainArticleList === null ) {
02590                 $this->_aBargainArticleList = array();
02591                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02592                     $oArtList = oxNew( 'oxarticlelist' );
02593                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02594                     if ( $oArtList->count() ) {
02595                         $this->_aBargainArticleList = $oArtList;
02596                     }
02597                 }
02598             }
02599         }
02600         return $this->_aBargainArticleList;
02601     }
02602 
02609     public function isLowOrderPrice()
02610     {
02611         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02612             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02613         }
02614 
02615         return $this->_blLowOrderPrice;
02616     }
02617 
02623     public function getMinOrderPrice()
02624     {
02625         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02626             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02627             $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice );
02628         }
02629         return $this->_sMinOrderPrice;
02630     }
02631 
02637     public function getNewsRealStatus()
02638     {
02639         return $this->_iNewsRealStatus;
02640     }
02641 
02647     protected function _canRedirect()
02648     {
02649         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02650             if ( oxConfig::getParameter( $sParam ) !== null ) {
02651                 return false;
02652             }
02653         }
02654 
02655         return true;
02656     }
02657 
02663     public function getProduct()
02664     {
02665     }
02666 
02672     public function getVendorlist()
02673     {
02674         return $this->_aVendorlist;
02675     }
02676 
02684     public function setVendorlist( $aList )
02685     {
02686         $this->_aVendorlist = $aList;
02687     }
02688 
02694     public function getManufacturerlist()
02695     {
02696         return $this->_aManufacturerlist;
02697     }
02698 
02706     public function setManufacturerlist( $aList )
02707     {
02708         $this->_aManufacturerlist = $aList;
02709     }
02710 
02718     public function setRootVendor( $oVendor )
02719     {
02720         $this->_oRootVendor = $oVendor;
02721     }
02722 
02728     public function getRootVendor()
02729     {
02730         return $this->_oRootVendor;
02731     }
02732 
02740     public function setRootManufacturer( $oManufacturer )
02741     {
02742         $this->_oRootManufacturer = $oManufacturer;
02743     }
02744 
02750     public function getRootManufacturer()
02751     {
02752         return $this->_oRootManufacturer;
02753     }
02754 
02760     public function getVendorId()
02761     {
02762         if ( $this->_sVendorId === null ) {
02763             $this->_sVendorId = false;
02764             if ( ( $oVendor = $this->getActVendor() ) ) {
02765                 $this->_sVendorId = $oVendor->getId();
02766             }
02767         }
02768         return $this->_sVendorId;
02769     }
02770 
02776     public function getManufacturerId()
02777     {
02778         if ( $this->_sManufacturerId === null ) {
02779             $this->_sManufacturerId = false;
02780             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02781                 $this->_sManufacturerId = $oManufacturer->getId();
02782             }
02783         }
02784         return $this->_sManufacturerId;
02785     }
02786 
02792     public function getSearchCatTree()
02793     {
02794         return $this->_aSearchCatTree;
02795     }
02796 
02804     public function setSearchCatTree( $aTree )
02805     {
02806         $this->_aSearchCatTree = $aTree;
02807     }
02808 
02814     public function getCatMoreUrl()
02815     {
02816         return $this->getConfig()->getShopHomeURL().'cnid=oxmore';
02817     }
02818 
02824     public function getCatMore()
02825     {
02826         return $this->_oCatMore;
02827     }
02828 
02836     public function setCatMore( $oCat )
02837     {
02838         $this->_oCatMore = $oCat;
02839     }
02840 
02846     public function getCatTreePath()
02847     {
02848         return $this->_sCatTreePath;
02849     }
02850 
02858     public function getContentByIdent( $sIdent )
02859     {
02860         if ( !isset( $this->_aContents[$sIdent] ) ) {
02861             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02862             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02863         }
02864         return $this->_aContents[$sIdent];
02865     }
02866 
02872     public function getContentCategory()
02873     {
02874         return false;
02875     }
02876 
02882     public function getMustFillFields()
02883     {
02884         if ( $this->_aMustFillFields === null ) {
02885             $this->_aMustFillFields = false;
02886 
02887             // passing must-be-filled-fields info
02888             $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02889             if ( is_array( $aMustFillFields ) ) {
02890                 $this->_aMustFillFields = array_flip( $aMustFillFields );
02891             }
02892         }
02893         return $this->_aMustFillFields;
02894     }
02895 
02903     public function isFieldRequired( $sField )
02904     {
02905         if ( $aMustFillFields = $this->getMustFillFields() ) {
02906             if ( isset( $aMustFillFields[$sField] ) ) {
02907                 return true;
02908             }
02909         }
02910 
02911         return false;
02912     }
02913 
02919     public function getFormId()
02920     {
02921         if ( $this->_sFormId === null ) {
02922             $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02923             oxSession::setVar( 'sessionuformid', $this->_sFormId );
02924         }
02925 
02926         return $this->_sFormId;
02927     }
02928 
02934     public function canAcceptFormData()
02935     {
02936         if ( $this->_blCanAcceptFormData === null ) {
02937             $this->_blCanAcceptFormData = false;
02938 
02939             $sFormId = oxConfig::getParameter( "uformid" );
02940             $sSessionFormId = oxSession::getVar( "sessionuformid" );
02941 
02942             // testing if form and session ids matches
02943             if ( $sFormId && $sFormId === $sSessionFormId ) {
02944                 $this->_blCanAcceptFormData = true;
02945             }
02946 
02947             // regenerating form data
02948             $this->getFormId();
02949         }
02950         return $this->_blCanAcceptFormData;
02951     }
02952 
02958     public function getPromoFinishedList()
02959     {
02960         if (isset($this->_oPromoFinishedList)) {
02961             return $this->_oPromoFinishedList;
02962         }
02963         $this->_oPromoFinishedList = oxNew( 'oxActionList' );
02964         $this->_oPromoFinishedList->loadFinishedByCount(2);
02965         return $this->_oPromoFinishedList;
02966     }
02967 
02973     public function getPromoCurrentList()
02974     {
02975         if (isset($this->_oPromoCurrentList)) {
02976             return $this->_oPromoCurrentList;
02977         }
02978         $this->_oPromoCurrentList = oxNew( 'oxActionList' );
02979         $this->_oPromoCurrentList->loadCurrent();
02980         return $this->_oPromoCurrentList;
02981     }
02982 
02988     public function getPromoFutureList()
02989     {
02990         if (isset($this->_oPromoFutureList)) {
02991             return $this->_oPromoFutureList;
02992         }
02993         $this->_oPromoFutureList = oxNew( 'oxActionList' );
02994         $this->_oPromoFutureList->loadFutureByCount(2);
02995         return $this->_oPromoFutureList;
02996     }
02997 
03003     public function getShowPromotionList()
03004     {
03005         if (isset($this->_blShowPromotions)) {
03006             return $this->_blShowPromotions;
03007         }
03008         $this->_blShowPromotions = false;
03009         if (oxNew('oxActionList')->areAnyActivePromotions()) {
03010             $this->_blShowPromotions = ( count( $this->getPromoFinishedList() ) + count( $this->getPromoCurrentList() ) + count( $this->getPromoFutureList() ) ) > 0;
03011         }
03012         return $this->_blShowPromotions;
03013     }
03014 
03020     public function isEnabledPrivateSales()
03021     {
03022         if ( $this->_blEnabledPrivateSales === null ) {
03023             $this->_blEnabledPrivateSales = (bool) $this->getConfig()->getConfigParam( 'blPsLoginEnabled' );
03024             if ( $this->_blEnabledPrivateSales && ( $blCanPreview = oxUtils::getInstance()->canPreview() ) !== null ) {
03025                 $this->_blEnabledPrivateSales = !$blCanPreview;
03026             }
03027         }
03028         return $this->_blEnabledPrivateSales;
03029     }
03030 
03036     public function getTagCloudManager()
03037     {
03038         if ( $this->_blShowTagCloud ) {
03039             return oxNew( "oxTagCloud" );
03040         } else {
03041             return false;
03042         }
03043     }
03044 
03050     public function getFieldValidationErrors()
03051     {
03052         return oxInputValidator::getInstance()->getFieldValidationErrors();
03053     }
03054 
03060     public function getBreadCrumb()
03061     {
03062         return null;
03063     }
03064 
03072     public function setRootCatChanged( $blRootCatChanged )
03073     {
03074         $this->_blRootCatChanged = $blRootCatChanged;
03075     }
03076 
03082     public function isRootCatChanged()
03083     {
03084         return $this->_blRootCatChanged;
03085     }
03086 
03092     public function getInvoiceAddress()
03093     {
03094         if ( $this->_aInvoiceAddress == null ) {
03095             $aAddress = oxConfig::getParameter( 'invadr');
03096             if ( $aAddress ) {
03097                 $this->_aInvoiceAddress = $aAddress;
03098             }
03099         }
03100         return $this->_aInvoiceAddress;
03101     }
03102 
03108     public function getDeliveryAddress()
03109     {
03110         if ( $this->_aDeliveryAddress == null ) {
03111             $aAddress = oxConfig::getParameter( 'deladr');
03112             if ( $aAddress ) {
03113                 $this->_aDeliveryAddress = $aAddress;
03114             }
03115         }
03116         return $this->_aDeliveryAddress;
03117     }
03118 
03126     public function setInvoiceAddress( $aAddress )
03127     {
03128         $this->_aInvoiceAddress = $aAddress;
03129     }
03130 
03136     public function getActiveUsername()
03137     {
03138         if ( $this->_sActiveUsername == null ) {
03139             $this->_sActiveUsername = false;
03140             $sUsername = oxConfig::getParameter( 'lgn_usr' );
03141             if ( $sUsername ) {
03142                 $this->_sActiveUsername = $sUsername;
03143             } elseif ( $oUser = $this->getUser() ) {
03144                 $this->_sActiveUsername = $oUser->oxuser__oxusername->value;
03145             }
03146         }
03147         return $this->_sActiveUsername;
03148     }
03149 
03155     public function getWishlistUserId()
03156     {
03157         return oxConfig::getParameter( 'wishid' );
03158     }
03159 
03165     public function getSearchCatId()
03166     {
03167     }
03168 
03174     public function getSearchVendor()
03175     {
03176     }
03177 
03183     public function getSearchManufacturer()
03184     {
03185     }
03186 
03192     public function getLastProducts()
03193     {
03194 
03195     }
03196 
03202     public function getNewBasketItemMsgType()
03203     {
03204         return (int) $this->getConfig()->getConfigParam( "iNewBasketItemMessage" );
03205     }
03206 
03212     public function showTags()
03213     {
03214         return (bool) $this->getConfig()->getConfigParam( "blShowTags" );
03215     }
03216 
03224     public function isActive( $sName )
03225     {
03226         return $this->getConfig()->getConfigParam( "bl".$sName."Enabled" );
03227     }
03228 
03234     public function isFbWidgetWisible()
03235     {
03236         if ( $this->_blFbWidgetsOn === null ) {
03237             $oUtils = oxUtilsServer::getInstance();
03238 
03239             // reading ..
03240             $this->_blFbWidgetsOn = (bool) $oUtils->getOxCookie( "fbwidgetson" );
03241 
03242             // .. and setting back
03243             $oUtils->setOxCookie( "fbwidgetson", $this->_blFbWidgetsOn ? 1 : 0 );
03244         }
03245         return $this->_blFbWidgetsOn;
03246     }
03247 
03253     public function showRememberMe()
03254     {
03255         return (bool)$this->getConfig()->getConfigParam('blShowRememberMe');
03256     }
03257 }