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         $aSortDir = array( 'desc', 'asc' );
01056         if ( count( $aSortColumns ) > 0 ) {
01057 
01058             $this->_blActiveSorting = true;
01059             $this->_aSortColumns = $aSortColumns;
01060 
01061             $sCnid = oxConfig::getParameter( 'cnid' );
01062 
01063 
01064             $sSortBy  = oxConfig::getParameter( $this->getSortOrderByParameterName() );
01065             $sSortDir = oxConfig::getParameter( $this->getSortOrderParameterName() );
01066 
01067             $oStr = getStr();
01068             if ( (!$sSortBy || !in_array( $oStr->strtolower($sSortBy), $aSortColumns) || !in_array( $oStr->strtolower($sSortDir), $aSortDir) ) && $aSorting = $this->getSorting( $sCnid ) ) {
01069                 $sSortBy  = $aSorting['sortby'];
01070                 $sSortDir = $aSorting['sortdir'];
01071             }
01072 
01073             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
01074                  $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
01075 
01076                 $this->_sListOrderBy  = $sSortBy;
01077                 $this->_sListOrderDir = $sSortDir;
01078 
01079                 // caching sorting config
01080                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
01081             }
01082         }
01083     }
01084 
01090     public function getListOrderBy()
01091     {
01092         //if column is with table name split it
01093         $aColums = explode('.', $this->_sListOrderBy);
01094 
01095         if ( is_array($aColums) && count($aColums) > 1 ) {
01096            return $aColums[1];
01097         }
01098 
01099         return $this->_sListOrderBy;
01100     }
01101 
01107     public function getListOrderDirection()
01108     {
01109         return $this->_sListOrderDir;
01110     }
01111 
01119     public function setMetaDescription ( $sDescription )
01120     {
01121         return $this->_sMetaDescription = $sDescription;
01122     }
01123 
01131     public function setMetaKeywords( $sKeywords )
01132     {
01133         return $this->_sMetaKeywords = $sKeywords;
01134     }
01135 
01143     protected function _getMetaFromSeo( $sDataType )
01144     {
01145         $sOxid  = $this->_getSeoObjectId();
01146         $iLang  = oxLang::getInstance()->getBaseLanguage();
01147         $sShop  = $this->getConfig()->getShopId();
01148 
01149         if ( $sOxid && oxUtils::getInstance()->seoIsActive() &&
01150              ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, $sDataType, $sShop, $iLang) ) ) {
01151             return $sKeywords;
01152         }
01153     }
01154 
01162     protected function _getMetaFromContent( $sMetaIdent )
01163     {
01164         if ( $sMetaIdent ) {
01165             $oContent = oxNew( 'oxcontent' );
01166             if ( $oContent->loadByIdent( $sMetaIdent ) &&
01167                  $oContent->oxcontents__oxactive->value ) {
01168                 return strip_tags( $oContent->oxcontents__oxcontent->value );
01169             }
01170         }
01171     }
01172 
01178     public function getMetaKeywords()
01179     {
01180         if ( $this->_sMetaKeywords === null ) {
01181             $this->_sMetaKeywords = false;
01182 
01183             // set special meta keywords ?
01184             if ( ( $sKeywords = $this->_getMetaFromSeo( 'oxkeywords' ) ) ) {
01185                 $this->_sMetaKeywords = $sKeywords;
01186             } elseif ( ( $sKeywords = $this->_getMetaFromContent( $this->_sMetaKeywordsIdent ) ) ) {
01187                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( $sKeywords, false );
01188             } else {
01189                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( false, true );
01190             }
01191         }
01192 
01193         return $this->_sMetaKeywords;
01194     }
01195 
01201     public function getMetaDescription()
01202     {
01203         if ( $this->_sMetaDescription === null ) {
01204             $this->_sMetaDescription = false;
01205 
01206             // set special meta description ?
01207             if ( ( $sDescription = $this->_getMetaFromSeo( 'oxdescription' ) ) ) {
01208                 $this->_sMetaDescription = $sDescription;
01209             } elseif ( ( $sDescription = $this->_getMetaFromContent( $this->_sMetaDescriptionIdent ) ) ) {
01210                 $this->_sMetaDescription = $this->_prepareMetaDescription( $sDescription );
01211             } else {
01212                 $this->_sMetaDescription = $this->_prepareMetaDescription( false );
01213             }
01214         }
01215 
01216         return $this->_sMetaDescription;
01217     }
01218 
01224     public function getActCurrency()
01225     {
01226         return $this->_oActCurrency;
01227     }
01228 
01236     public function setActCurrency( $oCur )
01237     {
01238         $this->_oActCurrency = $oCur;
01239     }
01240 
01246     public function getCompareItemsCnt()
01247     {
01248         return (int)$this->_iCompItemsCnt;
01249     }
01250 
01258     public function setCompareItemsCnt( $iCount )
01259     {
01260         $this->_iCompItemsCnt = $iCount;
01261     }
01262 
01268     public function getWishlistName()
01269     {
01270         return $this->_sWishlistName;
01271     }
01272 
01280     public function setWishlistName( $sName )
01281     {
01282         $this->_sWishlistName = $sName;
01283     }
01284 
01290     protected function _forceNoIndex()
01291     {
01292         $this->_blForceNoIndex = true;
01293     }
01294 
01301     public function noIndex()
01302     {
01303         if ( $this->_blForceNoIndex ) {
01304             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01305         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01306             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01307         } else {
01308             switch ( oxConfig::getParameter( 'fnc' ) ) {
01309                 case 'tocomparelist':
01310                 case 'tobasket':
01311                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01312                     break;
01313             }
01314         }
01315         return $this->_iViewIndexState;
01316     }
01317 
01324     public function getContentId()
01325     {
01326         if ( $this->_sContentId === null) {
01327             $oContent = oxNew( 'oxcontent' );
01328             $oContent->loadByIdent( 'oximpressum' );
01329             $this->_sContentId = $oContent->getId();
01330         }
01331 
01332         return $this->_sContentId;
01333     }
01334 
01341     public function getContent()
01342     {
01343         if ( $this->_oContent === null) {
01344             $oContent = oxNew( 'oxcontent' );
01345             if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01346                 $this->_oContent = $oContent;
01347             }
01348         }
01349 
01350         return $this->_oContent;
01351     }
01352 
01358     public function isSortingActive()
01359     {
01360         return $this->_blActiveSorting;
01361     }
01362 
01368     public function getMenueList()
01369     {
01370         return $this->_aMenueList;
01371     }
01372 
01380     public function setMenueList( $aMenue )
01381     {
01382         $this->_aMenueList = $aMenue;
01383     }
01384 
01385 
01391     protected function _setNrOfArtPerPage()
01392     {
01393         $myConfig  = $this->getConfig();
01394 
01395         //setting default values to avoid possible errors showing article list
01396         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01397 
01398         $iNrofCatArticles = ( $iNrofCatArticles ) ? $iNrofCatArticles : 10;
01399 
01400         // checking if all needed data is set
01401         switch ( $this->getListDisplayType() ) {
01402             case 'grid':
01403                 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticlesInGrid' );
01404                 break;
01405             case 'line':
01406             case 'infogrid':
01407             default:
01408                 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01409         }
01410 
01411         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01412             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01413         } else {
01414             $iNrofCatArticles = $aNrofCatArticles[0];
01415         }
01416 
01417         $oViewConf = $this->getViewConfig();
01418         //value from user input
01419         if ( ( $iNrofArticles = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01420             // M45 Possibility to push any "Show articles per page" number parameter
01421             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01422             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01423             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01424         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01425             // M45 Possibility to push any "Show articles per page" number parameter
01426             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01427             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01428             $iNrofCatArticles = $iSessArtPerPage;
01429         } else {
01430             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01431         }
01432 
01433         //setting number of articles per page to config value
01434         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01435     }
01436 
01442     protected function _getSeoObjectId()
01443     {
01444     }
01445 
01455     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01456     {
01457         if ( $sMeta ) {
01458 
01459             $oStr = getStr();
01460             if ( $iLength != -1 ) {
01461                 /* *
01462                  * performance - we dont need a huge amount of initial text.
01463                  * assume that effective text may be double longer than $iLength
01464                  * and simple turncate it
01465                  */
01466                 $iELength = ( $iLength * 2 );
01467                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01468             }
01469 
01470             // decoding html entities
01471             $sMeta = $oStr->html_entity_decode( $sMeta );
01472             // stripping HTML tags
01473             $sMeta = strip_tags( $sMeta );
01474 
01475             // removing some special chars
01476             $sMeta = $oStr->cleanStr( $sMeta );
01477 
01478             // removing duplicate words
01479             if ( $blRemoveDuplicatedWords ) {
01480                 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01481             }
01482 
01483             // some special cases
01484             $sMeta = str_replace( ' ,', ',', $sMeta );
01485             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01486             $sMeta = $oStr->preg_replace( $aPattern, ',', $sMeta );
01487             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01488             $sMeta = $oStr->htmlspecialchars( $sMeta );
01489 
01490             return trim( $sMeta );
01491         }
01492     }
01493 
01502     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01503     {
01504 
01505         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01506 
01507         if ( $blRemoveDuplicatedWords ) {
01508             $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01509         }
01510 
01511         // removing in admin defined strings
01512 
01513         /*if ( is_array( $aSkipTags ) && $sString ) {
01514             $oStr = getStr();
01515             foreach ( $aSkipTags as $sSkip ) {
01516                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01517                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01518                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01519                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01520             }
01521         }*/
01522 
01523         return trim( $sString );
01524     }
01525 
01534     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01535     {
01536         $oStr = getStr();
01537         if ( is_array( $aInput ) ) {
01538             $aInput = implode( " ", $aInput );
01539         }
01540 
01541         // removing some usually met characters..
01542         $aInput = $oStr->preg_replace( "/[".preg_quote( $this->_sRemoveMetaChars, "/" )."]/", " ", $aInput );
01543 
01544         // splitting by word
01545         $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01546 
01547         if ( $sCount = count( $aSkipTags ) ) {
01548             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01549                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01550             }
01551         }
01552         $sCount = count($aStrings);
01553         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01554             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01555             // removing in admin defined strings
01556             if ( !$aStrings[$iNum] || in_array( $aStrings[$iNum], $aSkipTags ) ) {
01557                 unset( $aStrings[$iNum] );
01558             }
01559         }
01560 
01561         // duplicates
01562         return implode( ', ', array_unique( $aStrings ) );
01563     }
01564 
01572     public function getNavigationParams()
01573     {
01574         $aParams['cnid'] = $this->getCategoryId();
01575         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01576 
01577         $aParams['listtype'] = $this->getListType();
01578         $aParams['ldtype'] = $this->getListDisplayType();
01579 
01580         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01581 
01582         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01583         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01584         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01585 
01586         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01587         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01588         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01589 
01590         return $aParams;
01591     }
01592 
01602     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01603     {
01604 
01605         $aSorting = oxSession::getVar( 'aSorting' );
01606         $aSorting[$sCnid]['sortby']  = $sSortBy;
01607         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01608 
01609         oxSession::setVar( 'aSorting', $aSorting );
01610     }
01611 
01619     public function getSorting( $sCnid )
01620     {
01621         $aSorting = oxSession::getVar( 'aSorting' );
01622 
01623         if ( isset( $aSorting[$sCnid] ) ) {
01624             return $aSorting[$sCnid];
01625         }
01626     }
01627 
01635     public function getSortingSql( $sCnid )
01636     {
01637         $aSorting = $this->getSorting( $sCnid );
01638         if ( is_array( $aSorting ) ) {
01639             return implode( " ", $aSorting );
01640         }
01641     }
01642 
01648     public function getTitleSuffix()
01649     {
01650         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01651     }
01652 
01658     public function getTitlePageSuffix()
01659     {
01660     }
01661 
01668     public function getTitlePrefix()
01669     {
01670         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01671     }
01672 
01673 
01674 
01683     protected function _getSubject( $iLang )
01684     {
01685         return null;
01686     }
01687 
01693     public function getDynUrlParams()
01694     {
01695         $sRet = '';
01696         $sListType = $this->getListType();
01697 
01698         switch ($sListType) {
01699             default:
01700                 break;
01701             case 'search':
01702                 $sRet .= "&amp;listtype={$sListType}";
01703                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01704                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01705                 }
01706 
01707                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid', true ) ) ) {
01708                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01709                 }
01710                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor', true ) ) ) {
01711                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01712                 }
01713                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer', true ) ) ) {
01714                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01715                 }
01716                 break;
01717             case 'tag':
01718                 $sRet .= "&amp;listtype={$sListType}";
01719                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', true ) ) ) {
01720                     $sRet .= "&amp;searchtag={$sParam}";
01721                 }
01722                 break;
01723         }
01724 
01725         return $sRet;
01726     }
01727 
01735     public function getLink( $iLang = null )
01736     {
01737         if ( !isset( $iLang ) ) {
01738             $iLang = oxLang::getInstance()->getBaseLanguage();
01739         }
01740 
01741         $oDisplayObj = null;
01742         $blTrySeo = false;
01743         if ( oxUtils::getInstance()->seoIsActive() ) {
01744             $blTrySeo = true;
01745             $oDisplayObj = $this->_getSubject( $iLang );
01746         }
01747         $iActPageNr = $this->getActPage();
01748 
01749         if ( $oDisplayObj ) {
01750             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01751         }
01752 
01753         $myConfig = $this->getConfig();
01754 
01755         if ( $blTrySeo ) {
01756             $oEncoder = oxSeoEncoder::getInstance();
01757             if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01758                 return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01759             }
01760         }
01761 
01762         $sUrl = oxUtilsUrl::getInstance()->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams(), true, null, $iLang);
01763 
01764         // fallback to old non seo url
01765         return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01766     }
01767 
01773     public function getCanonicalUrl()
01774     {
01775     }
01776 
01783     public function getSimilarRecommLists()
01784     {
01785     }
01786 
01793     public function getSearchParamForHtml()
01794     {
01795     }
01796 
01804     protected function _getRequestParams( $blAddPageNr  = true )
01805     {
01806         $sClass = $this->getClassName();
01807         $sFnc   = $this->getFncName();
01808 
01809         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher', 'moveleft', 'moveright' );
01810         if ( in_array( $sFnc, $aFnc ) ) {
01811             $sFnc = '';
01812         }
01813 
01814         // #680
01815         $sURL = "cl={$sClass}";
01816         if ( $sFnc ) {
01817             $sURL .= "&amp;fnc={$sFnc}";
01818         }
01819         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01820             $sURL .= "&amp;cnid={$sVal}";
01821         }
01822         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01823             $sURL .= "&amp;mnid={$sVal}";
01824         }
01825         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01826             $sURL .= "&amp;anid={$sVal}";
01827         }
01828 
01829         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01830             $sURL .= "&amp;page={$sVal}";
01831         }
01832 
01833         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01834             $sURL .= "&amp;tpl={$sVal}";
01835         }
01836 
01837         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01838         // don't include page number for navigation
01839         // it will be done in oxubase::generatePageNavigation
01840         if ( $blAddPageNr && $iPgNr > 0 ) {
01841             $sURL .= "&amp;pgNr={$iPgNr}";
01842         }
01843 
01844         // #1184M - specialchar search
01845         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01846             $sURL .= "&amp;searchparam={$sVal}";
01847         }
01848 
01849         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01850             $sURL .= "&amp;searchcnid={$sVal}";
01851         }
01852 
01853         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01854             $sURL .= "&amp;searchvendor={$sVal}";
01855         }
01856 
01857         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01858             $sURL .= "&amp;searchmanufacturer={$sVal}";
01859         }
01860 
01861         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01862             $sURL .= "&amp;searchrecomm={$sVal}";
01863         }
01864 
01865         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01866             $sURL .= "&amp;searchtag={$sVal}";
01867         }
01868 
01869         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01870             $sURL .= "&amp;recommid={$sVal}";
01871         }
01872 
01873         return $sURL;
01874     }
01875 
01881     protected function _getSeoRequestParams()
01882     {
01883         $sClass = $this->getClassName();
01884         $sFnc   = $this->getFncName();
01885 
01886         // #921 S
01887         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01888         if ( in_array( $sFnc, $aFnc ) ) {
01889             $sFnc = '';
01890         }
01891 
01892         // #680
01893         $sURL = "cl={$sClass}";
01894         if ( $sFnc ) {
01895             $sURL .= "&amp;fnc={$sFnc}";
01896         }
01897         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01898             $sURL .= "&amp;page={$sVal}";
01899         }
01900 
01901         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01902             $sURL .= "&amp;tpl={$sVal}";
01903         }
01904 
01905         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01906         if ( $iPgNr > 0 ) {
01907             $sURL .= "&amp;pgNr={$iPgNr}";
01908         }
01909 
01910         return $sURL;
01911     }
01912 
01918     public function showSearch()
01919     {
01920         $blShow = true;
01921         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01922             $blShow = false;
01923         }
01924         return (int) $blShow;
01925     }
01926 
01932     public function getRssLinks()
01933     {
01934         return $this->_aRssLinks;
01935     }
01936 
01942     public function getSortColumns()
01943     {
01944         return $this->_aSortColumns;
01945     }
01946 
01952     public function getEditTags()
01953     {
01954     }
01955 
01961     public function getRecommSearch()
01962     {
01963     }
01964 
01970     public function getPaymentList()
01971     {
01972     }
01973 
01979     public function getActiveRecommList()
01980     {
01981         if ( $this->_oActiveRecommList === null ) {
01982             $this->_oActiveRecommList = false;
01983             if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01984                 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01985                 $this->_oActiveRecommList->load( $sOxid );
01986             }
01987         }
01988         return $this->_oActiveRecommList;
01989     }
01990 
01996     public function getAccessoires()
01997     {
01998     }
01999 
02005     public function getCrossSelling()
02006     {
02007     }
02008 
02014     public function getSimilarProducts()
02015     {
02016     }
02017 
02023     public function getAlsoBoughtTheseProducts()
02024     {
02025     }
02026 
02032     public function getArticleId()
02033     {
02034     }
02035 
02041     public function isMoreTagsVisible()
02042     {
02043         return false;
02044     }
02045 
02051     public function getTitle()
02052     {
02053     }
02054 
02060     public function getActiveLangAbbr()
02061     {
02062         // Performance
02063         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
02064             return;
02065         }
02066 
02067         if ( !isset($this->_sActiveLangAbbr ) ) {
02068             $aLanguages = oxLang::getInstance()->getLanguageArray();
02069             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
02070                 if ( $oVal->selected ) {
02071                     $this->_sActiveLangAbbr = $oVal->abbr;
02072                     break;
02073                 }
02074             }
02075         }
02076 
02077         return $this->_sActiveLangAbbr;
02078     }
02079 
02087     public function addGlobalParams( $oShop = null)
02088     {
02089         $oViewConf = parent::addGlobalParams( $oShop );
02090 
02091         $this->_setNrOfArtPerPage();
02092 
02093         return $oViewConf;
02094     }
02095 
02101     public function getAdditionalParams()
02102     {
02103         if ( $this->_sAdditionalParams === null ) {
02104             // #1018A
02105             $this->_sAdditionalParams  = parent::getAdditionalParams();
02106             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02107 
02108             // #1834M - specialchar search
02109             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02110             if ( isset( $sSearchParamForLink ) ) {
02111                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
02112             }
02113             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02114                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
02115             }
02116             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02117                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02118             }
02119             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02120                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02121             }
02122             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02123                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02124             }
02125             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02126                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02127             }
02128             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02129                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02130             }
02131         }
02132 
02133         return $this->_sAdditionalParams;
02134     }
02135 
02141     public function generatePageNavigationUrl()
02142     {
02143         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02144     }
02145 
02155     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02156     {
02157         if ( $iPage ) {
02158             if ( ( strpos( $sUrl, 'pgNr=' ) ) ) {
02159                 $sUrl = preg_replace('/pgNr=[0-9]*/', 'pgNr='.$iPage, $sUrl);
02160             } else {
02161                 $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02162             }
02163         } else {
02164            $sUrl = preg_replace('/pgNr=[0-9]*/', '', $sUrl);
02165            $sUrl = preg_replace('/\&amp\;\&amp\;/', '&amp;', $sUrl);
02166            $sUrl = preg_replace('/\?\&amp\;/', '?', $sUrl);
02167            $sUrl = preg_replace('/\&amp\;$/', '', $sUrl);
02168         }
02169         return $sUrl;
02170     }
02171 
02177     public function getPageNavigation()
02178     {
02179 
02180     }
02181 
02187     public function getPageNavigationLimitedTop()
02188     {
02189 
02190         $this->_oPageNavigation = $this->generatePageNavigation( 7 );
02191 
02192         return $this->_oPageNavigation;
02193     }
02194 
02200     public function getPageNavigationLimitedBottom()
02201     {
02202 
02203         $this->_oPageNavigation = $this->generatePageNavigation( 11 );
02204 
02205         return $this->_oPageNavigation;
02206     }
02207 
02208 
02216     public function generatePageNavigation( $iPositionCount = 0 )
02217     {
02218         startProfile('generatePageNavigation');
02219 
02220         $pageNavigation = new stdClass();
02221 
02222         $pageNavigation->NrOfPages = $this->_iCntPages;
02223         $iActPage = $this->getActPage();
02224         $pageNavigation->actPage   = $iActPage + 1;
02225         $sUrl = $this->generatePageNavigationUrl();
02226 
02227         if ( $iPositionCount == 0 || ($iPositionCount >= $pageNavigation->NrOfPages) ) {
02228              $iStartNo = 2;
02229              $iFinishNo = $pageNavigation->NrOfPages;
02230              $bStart = false;
02231              $bFinish =false;
02232         } else {
02233             $iTmpVal = $iPositionCount - 3;
02234             $iTmpVal2 = floor( ( $iPositionCount - 4 ) / 2 );
02235 
02236             // actual page is at the start
02237             if ( $pageNavigation->actPage <= $iTmpVal ) {
02238                 $iStartNo = 2;
02239                 $iFinishNo = $iTmpVal + 1;
02240                 $bStart = false;
02241                 $bFinish = true;
02242             // actual page is at the end
02243             } elseif ( $pageNavigation->actPage >= $pageNavigation->NrOfPages - $iTmpVal ) {
02244                 $iStartNo = $pageNavigation->NrOfPages - $iTmpVal;
02245                 $iFinishNo = $pageNavigation->NrOfPages - 1;
02246                 $bStart = true;
02247                 $bFinish = false;
02248             // actual page is in the midle
02249             } else {
02250                 $iStartNo = $pageNavigation->actPage - $iTmpVal2;
02251                 $iFinishNo = $pageNavigation->actPage + $iTmpVal2;
02252                 $bStart = true;
02253                 $bFinish = true;
02254             }
02255         }
02256 
02257         if ( $iActPage > 0) {
02258             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02259         }
02260 
02261         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02262             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02263         }
02264 
02265         if ( $pageNavigation->NrOfPages > 1 ) {
02266 
02267             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02268 
02269                 if ( $i == 1 || $i == $pageNavigation->NrOfPages || ( $i >= $iStartNo && $i <= $iFinishNo ) ) {
02270                     $page = new Oxstdclass();
02271                     $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02272                     $page->selected = ( $i == $pageNavigation->actPage ) ? 1 : 0;
02273                     $pageNavigation->changePage[$i] = $page;
02274                 }
02275             }
02276 
02277             // first/last one
02278             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02279             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02280         }
02281 
02282         stopProfile('generatePageNavigation');
02283 
02284         return $pageNavigation;
02285     }
02286 
02293     public function getArticleCount()
02294     {
02295         return $this->_iAllArtCnt;
02296     }
02297 
02304     public function render()
02305     {
02306         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02307             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02308         }
02309 
02310         parent::render();
02311 
02312         if ( $this->getIsOrderStep() ) {
02313 
02314             // disabling navigation during order ...
02315             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02316                 $this->_iNewsRealStatus = 1;
02317                 $this->setShowNewsletter( 0 );
02318                 $this->setShowRightBasket( 0 );
02319                 $this->setShowLeftBasket( 0 );
02320                 $this->setShowTopBasket( 0 );
02321             }
02322         }
02323         return $this->_sThisTemplate;
02324     }
02325 
02331     public function getViewProduct()
02332     {
02333         return $this->getProduct();
02334     }
02335 
02343     public function setViewProduct( $oProduct )
02344     {
02345         $this->_oProduct = $oProduct;
02346     }
02347 
02353     public function getViewProductList()
02354     {
02355         return $this->_aArticleList;
02356     }
02357 
02363     public function getActPage()
02364     {
02365         if ( $this->_iActPage === null ) {
02366             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02367             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02368         }
02369         return $this->_iActPage;
02370     }
02371 
02379     public function getActTag()
02380     {
02381         if ( $this->_oActTag === null ) {
02382             $this->_oActTag = new Oxstdclass();
02383             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02384             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02385 
02386             $sLink = false;
02387             if ( oxUtils::getInstance()->seoIsActive() ) {
02388                 $sLink = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02389             }
02390 
02391             $this->_oActTag->link = $sLink ? $sLink : $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02392         }
02393         return $this->_oActTag;
02394     }
02395 
02403     public function getActVendor()
02404     {
02405         // if active vendor is not set yet - trying to load it from request params
02406         // this may be usefull when category component was unable to load active vendor
02407         // and we still need some object to mount navigation info
02408         if ( $this->_oActVendor === null ) {
02409             $this->_oActVendor = false;
02410             $sVendorId = oxConfig::getParameter( 'cnid' );
02411             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02412             $oVendor = oxNew( 'oxvendor' );
02413             if ( $oVendor->load( $sVendorId ) ) {
02414                 $this->_oActVendor = $oVendor;
02415             }
02416         }
02417 
02418         return $this->_oActVendor;
02419     }
02420 
02428     public function getActManufacturer()
02429     {
02430         // if active Manufacturer is not set yet - trying to load it from request params
02431         // this may be usefull when category component was unable to load active Manufacturer
02432         // and we still need some object to mount navigation info
02433         if ( $this->_oActManufacturer === null ) {
02434 
02435             $this->_oActManufacturer = false;
02436             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02437             $oManufacturer = oxNew( 'oxmanufacturer' );
02438             if ( $oManufacturer->load( $sManufacturerId ) ) {
02439                 $this->_oActManufacturer = $oManufacturer;
02440             }
02441         }
02442 
02443         return $this->_oActManufacturer;
02444     }
02445 
02453     public function setActVendor( $oVendor )
02454     {
02455         $this->_oActVendor = $oVendor;
02456     }
02457 
02465     public function setActManufacturer( $oManufacturer )
02466     {
02467         $this->_oActManufacturer = $oManufacturer;
02468     }
02469 
02475     public function getActSearch()
02476     {
02477         if ( $this->_oActSearch === null ) {
02478             $this->_oActSearch = new oxStdClass();
02479             $sUrl = $this->getConfig()->getShopHomeURL();
02480             $this->_oActSearch->link = "{$sUrl}cl=search";
02481         }
02482         return $this->_oActSearch;
02483     }
02484 
02490     public function getCategoryTree()
02491     {
02492         return $this->_oCategoryTree;
02493     }
02494 
02502     public function setCategoryTree( $oCatTree )
02503     {
02504         $this->_oCategoryTree = $oCatTree;
02505     }
02506 
02512     public function getVendorTree()
02513     {
02514         return $this->_oVendorTree;
02515     }
02516 
02524     public function setVendorTree( $oVendorTree )
02525     {
02526         $this->_oVendorTree = $oVendorTree;
02527     }
02528 
02534     public function getManufacturerTree()
02535     {
02536         return $this->_oManufacturerTree;
02537     }
02538 
02546     public function setManufacturerTree( $oManufacturerTree )
02547     {
02548         $this->_oManufacturerTree = $oManufacturerTree;
02549     }
02550 
02556     public function getAddUrlParams()
02557     {
02558     }
02559 
02566     public function getTop5ArticleList()
02567     {
02568         if ( $this->_blTop5Action ) {
02569             if ( $this->_aTop5ArticleList === null ) {
02570                 $this->_aTop5ArticleList = false;
02571                 $myConfig = $this->getConfig();
02572                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02573                     // top 5 articles
02574                     $oArtList = oxNew( 'oxarticlelist' );
02575                     $oArtList->loadTop5Articles();
02576                     if ( $oArtList->count() ) {
02577                         $this->_aTop5ArticleList = $oArtList;
02578                     }
02579                 }
02580             }
02581         }
02582         return $this->_aTop5ArticleList;
02583     }
02584 
02591     public function getBargainArticleList()
02592     {
02593         if ( $this->_blBargainAction ) {
02594             if ( $this->_aBargainArticleList === null ) {
02595                 $this->_aBargainArticleList = array();
02596                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02597                     $oArtList = oxNew( 'oxarticlelist' );
02598                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02599                     if ( $oArtList->count() ) {
02600                         $this->_aBargainArticleList = $oArtList;
02601                     }
02602                 }
02603             }
02604         }
02605         return $this->_aBargainArticleList;
02606     }
02607 
02614     public function isLowOrderPrice()
02615     {
02616         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02617             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02618         }
02619 
02620         return $this->_blLowOrderPrice;
02621     }
02622 
02628     public function getMinOrderPrice()
02629     {
02630         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02631             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02632             $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice );
02633         }
02634         return $this->_sMinOrderPrice;
02635     }
02636 
02642     public function getNewsRealStatus()
02643     {
02644         return $this->_iNewsRealStatus;
02645     }
02646 
02652     protected function _canRedirect()
02653     {
02654         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02655             if ( oxConfig::getParameter( $sParam ) !== null ) {
02656                 return false;
02657             }
02658         }
02659 
02660         return true;
02661     }
02662 
02668     public function getProduct()
02669     {
02670     }
02671 
02677     public function getVendorlist()
02678     {
02679         return $this->_aVendorlist;
02680     }
02681 
02689     public function setVendorlist( $aList )
02690     {
02691         $this->_aVendorlist = $aList;
02692     }
02693 
02699     public function getManufacturerlist()
02700     {
02701         return $this->_aManufacturerlist;
02702     }
02703 
02711     public function setManufacturerlist( $aList )
02712     {
02713         $this->_aManufacturerlist = $aList;
02714     }
02715 
02723     public function setRootVendor( $oVendor )
02724     {
02725         $this->_oRootVendor = $oVendor;
02726     }
02727 
02733     public function getRootVendor()
02734     {
02735         return $this->_oRootVendor;
02736     }
02737 
02745     public function setRootManufacturer( $oManufacturer )
02746     {
02747         $this->_oRootManufacturer = $oManufacturer;
02748     }
02749 
02755     public function getRootManufacturer()
02756     {
02757         return $this->_oRootManufacturer;
02758     }
02759 
02765     public function getVendorId()
02766     {
02767         if ( $this->_sVendorId === null ) {
02768             $this->_sVendorId = false;
02769             if ( ( $oVendor = $this->getActVendor() ) ) {
02770                 $this->_sVendorId = $oVendor->getId();
02771             }
02772         }
02773         return $this->_sVendorId;
02774     }
02775 
02781     public function getManufacturerId()
02782     {
02783         if ( $this->_sManufacturerId === null ) {
02784             $this->_sManufacturerId = false;
02785             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02786                 $this->_sManufacturerId = $oManufacturer->getId();
02787             }
02788         }
02789         return $this->_sManufacturerId;
02790     }
02791 
02797     public function getSearchCatTree()
02798     {
02799         return $this->_aSearchCatTree;
02800     }
02801 
02809     public function setSearchCatTree( $aTree )
02810     {
02811         $this->_aSearchCatTree = $aTree;
02812     }
02813 
02819     public function getCatMoreUrl()
02820     {
02821         return $this->getConfig()->getShopHomeURL().'cnid=oxmore';
02822     }
02823 
02829     public function getCatMore()
02830     {
02831         return $this->_oCatMore;
02832     }
02833 
02841     public function setCatMore( $oCat )
02842     {
02843         $this->_oCatMore = $oCat;
02844     }
02845 
02851     public function getCatTreePath()
02852     {
02853         return $this->_sCatTreePath;
02854     }
02855 
02863     public function getContentByIdent( $sIdent )
02864     {
02865         if ( !isset( $this->_aContents[$sIdent] ) ) {
02866             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02867             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02868         }
02869         return $this->_aContents[$sIdent];
02870     }
02871 
02877     public function getContentCategory()
02878     {
02879         return false;
02880     }
02881 
02887     public function getMustFillFields()
02888     {
02889         if ( $this->_aMustFillFields === null ) {
02890             $this->_aMustFillFields = false;
02891 
02892             // passing must-be-filled-fields info
02893             $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02894             if ( is_array( $aMustFillFields ) ) {
02895                 $this->_aMustFillFields = array_flip( $aMustFillFields );
02896             }
02897         }
02898         return $this->_aMustFillFields;
02899     }
02900 
02908     public function isFieldRequired( $sField )
02909     {
02910         if ( $aMustFillFields = $this->getMustFillFields() ) {
02911             if ( isset( $aMustFillFields[$sField] ) ) {
02912                 return true;
02913             }
02914         }
02915 
02916         return false;
02917     }
02918 
02924     public function getFormId()
02925     {
02926         if ( $this->_sFormId === null ) {
02927             $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02928             oxSession::setVar( 'sessionuformid', $this->_sFormId );
02929         }
02930 
02931         return $this->_sFormId;
02932     }
02933 
02939     public function canAcceptFormData()
02940     {
02941         if ( $this->_blCanAcceptFormData === null ) {
02942             $this->_blCanAcceptFormData = false;
02943 
02944             $sFormId = oxConfig::getParameter( "uformid" );
02945             $sSessionFormId = oxSession::getVar( "sessionuformid" );
02946 
02947             // testing if form and session ids matches
02948             if ( $sFormId && $sFormId === $sSessionFormId ) {
02949                 $this->_blCanAcceptFormData = true;
02950             }
02951 
02952             // regenerating form data
02953             $this->getFormId();
02954         }
02955         return $this->_blCanAcceptFormData;
02956     }
02957 
02963     public function getPromoFinishedList()
02964     {
02965         if (isset($this->_oPromoFinishedList)) {
02966             return $this->_oPromoFinishedList;
02967         }
02968         $this->_oPromoFinishedList = oxNew( 'oxActionList' );
02969         $this->_oPromoFinishedList->loadFinishedByCount(2);
02970         return $this->_oPromoFinishedList;
02971     }
02972 
02978     public function getPromoCurrentList()
02979     {
02980         if (isset($this->_oPromoCurrentList)) {
02981             return $this->_oPromoCurrentList;
02982         }
02983         $this->_oPromoCurrentList = oxNew( 'oxActionList' );
02984         $this->_oPromoCurrentList->loadCurrent();
02985         return $this->_oPromoCurrentList;
02986     }
02987 
02993     public function getPromoFutureList()
02994     {
02995         if (isset($this->_oPromoFutureList)) {
02996             return $this->_oPromoFutureList;
02997         }
02998         $this->_oPromoFutureList = oxNew( 'oxActionList' );
02999         $this->_oPromoFutureList->loadFutureByCount(2);
03000         return $this->_oPromoFutureList;
03001     }
03002 
03008     public function getShowPromotionList()
03009     {
03010         if (isset($this->_blShowPromotions)) {
03011             return $this->_blShowPromotions;
03012         }
03013         $this->_blShowPromotions = false;
03014         if (oxNew('oxActionList')->areAnyActivePromotions()) {
03015             $this->_blShowPromotions = ( count( $this->getPromoFinishedList() ) + count( $this->getPromoCurrentList() ) + count( $this->getPromoFutureList() ) ) > 0;
03016         }
03017         return $this->_blShowPromotions;
03018     }
03019 
03025     public function isEnabledPrivateSales()
03026     {
03027         if ( $this->_blEnabledPrivateSales === null ) {
03028             $this->_blEnabledPrivateSales = (bool) $this->getConfig()->getConfigParam( 'blPsLoginEnabled' );
03029             if ( $this->_blEnabledPrivateSales && ( $blCanPreview = oxUtils::getInstance()->canPreview() ) !== null ) {
03030                 $this->_blEnabledPrivateSales = !$blCanPreview;
03031             }
03032         }
03033         return $this->_blEnabledPrivateSales;
03034     }
03035 
03041     public function getTagCloudManager()
03042     {
03043         if ( $this->_blShowTagCloud ) {
03044             return oxNew( "oxTagCloud" );
03045         } else {
03046             return false;
03047         }
03048     }
03049 
03055     public function getFieldValidationErrors()
03056     {
03057         return oxInputValidator::getInstance()->getFieldValidationErrors();
03058     }
03059 
03065     public function getBreadCrumb()
03066     {
03067         return null;
03068     }
03069 
03077     public function setRootCatChanged( $blRootCatChanged )
03078     {
03079         $this->_blRootCatChanged = $blRootCatChanged;
03080     }
03081 
03087     public function isRootCatChanged()
03088     {
03089         return $this->_blRootCatChanged;
03090     }
03091 
03097     public function getInvoiceAddress()
03098     {
03099         if ( $this->_aInvoiceAddress == null ) {
03100             $aAddress = oxConfig::getParameter( 'invadr');
03101             if ( $aAddress ) {
03102                 $this->_aInvoiceAddress = $aAddress;
03103             }
03104         }
03105         return $this->_aInvoiceAddress;
03106     }
03107 
03113     public function getDeliveryAddress()
03114     {
03115         if ( $this->_aDeliveryAddress == null ) {
03116             $aAddress = oxConfig::getParameter( 'deladr');
03117             //do not show deladr if address was reloaded
03118             if ( $aAddress && !oxConfig::getParameter( 'reloadaddress' )) {
03119                 $this->_aDeliveryAddress = $aAddress;
03120             }
03121         }
03122         return $this->_aDeliveryAddress;
03123     }
03124 
03132     public function setInvoiceAddress( $aAddress )
03133     {
03134         $this->_aInvoiceAddress = $aAddress;
03135     }
03136 
03142     public function getActiveUsername()
03143     {
03144         if ( $this->_sActiveUsername == null ) {
03145             $this->_sActiveUsername = false;
03146             $sUsername = oxConfig::getParameter( 'lgn_usr' );
03147             if ( $sUsername ) {
03148                 $this->_sActiveUsername = $sUsername;
03149             } elseif ( $oUser = $this->getUser() ) {
03150                 $this->_sActiveUsername = $oUser->oxuser__oxusername->value;
03151             }
03152         }
03153         return $this->_sActiveUsername;
03154     }
03155 
03161     public function getWishlistUserId()
03162     {
03163         return oxConfig::getParameter( 'wishid' );
03164     }
03165 
03171     public function getSearchCatId()
03172     {
03173     }
03174 
03180     public function getSearchVendor()
03181     {
03182     }
03183 
03189     public function getSearchManufacturer()
03190     {
03191     }
03192 
03198     public function getLastProducts()
03199     {
03200 
03201     }
03202 
03208     public function getNewBasketItemMsgType()
03209     {
03210         return (int) $this->getConfig()->getConfigParam( "iNewBasketItemMessage" );
03211     }
03212 
03218     public function showTags()
03219     {
03220         return (bool) $this->getConfig()->getConfigParam( "blShowTags" );
03221     }
03222 
03230     public function isActive( $sName )
03231     {
03232         return $this->getConfig()->getConfigParam( "bl".$sName."Enabled" );
03233     }
03234 
03240     public function isFbWidgetVisible()
03241     {
03242         if ( $this->_blFbWidgetsOn === null ) {
03243             $oUtils = oxUtilsServer::getInstance();
03244 
03245             // reading ..
03246             $this->_blFbWidgetsOn = (bool) $oUtils->getOxCookie( "fbwidgetson" );
03247         }
03248         return $this->_blFbWidgetsOn;
03249     }
03250 
03256     public function isEnabledDownloadableFiles()
03257     {
03258         return (bool) $this->getConfig()->getConfigParam( "blEnableDownloads" );
03259     }
03260 
03266     public function showRememberMe()
03267     {
03268         return (bool) $this->getConfig()->getConfigParam('blShowRememberMe');
03269     }
03270 
03277     public function isVatIncluded()
03278     {
03279         $blResult = true;
03280         $oUser = $this->getUser();
03281         $oVatSelector = oxNew( 'oxVatSelector' );
03282         $oConfig = $this->getConfig();
03283 
03284         if ( $oConfig->getConfigParam( 'blEnterNetPrice' ) && $oConfig->getConfigParam( 'bl_perfCalcVatOnlyForBasketOrder' ) ) {
03285             $blResult = false;
03286         } elseif ( $oUser && !$oVatSelector->getUserVat( $oUser ) ) {
03287             $blResult = false;
03288         }
03289 
03290         return $blResult;
03291     }
03292 
03298     public function isPriceCalculated()
03299     {
03300         return (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadPrice' );
03301     }
03302 
03303 }