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