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 
00033     public function isActive( $sName )
00034     {
00035         return $this->getConfig()->getConfigParam( "bl".$sName."Enabled" );
00036     }
00037 
00043     public function isFbWidgetWisible()
00044     {
00045         if ( $this->_blFbWidgetsOn === null ) {
00046             $oUtils = oxUtilsServer::getInstance();
00047 
00048             // reading ..
00049             $this->_blFbWidgetsOn = (bool) $oUtils->getOxCookie( "fbwidgetson" );
00050 
00051             // .. and setting back
00052             $oUtils->setOxCookie( "fbwidgetson", $this->_blFbWidgetsOn ? 1 : 0 );
00053         }
00054         return $this->_blFbWidgetsOn;
00055     }
00056 
00062     protected $_oaComponents = array();
00063 
00069     protected $_blIsOrderStep = false;
00070 
00076     protected $_sListType = null;
00077 
00083     protected $_aListDisplayTypes = array( 'grid', 'line', 'infogrid' );
00084 
00090     protected $_sListDisplayType = null;
00091 
00097     protected $_oActCategory = null;
00098 
00104     protected $_oActManufacturer = null;
00105 
00111     protected $_oActVendor = null;
00112 
00117     protected $_oActiveRecommList = null;
00118 
00124     protected $_oActSearch = null;
00125 
00130     protected $_blShowSorting = false;
00131 
00136     protected $_blShowRightBasket = null;
00137 
00142     protected $_blShowTopBasket = null;
00143 
00148     protected $_blShowLeftBasket = null;
00149 
00154     protected $_blLoadCurrency = null;
00155 
00160     protected $_blLoadVendorTree = null;
00161 
00166     protected $_blLoadManufacturerTree = null;
00167 
00172     protected $_blDontShowEmptyCats = null;
00173 
00178     protected $_blLoadLanguage = null;
00179 
00184     protected $_blShowTopCatNav = null;
00185 
00190     protected $_iTopCatNavItmCnt = null;
00191 
00196     protected $_aRssLinks = null;
00197 
00202     protected $_sListOrderBy = null;
00203 
00208     protected $_sListOrderDir = null;
00209 
00214     protected $_sMetaDescription = null;
00215 
00220     protected $_sMetaKeywords = null;
00221 
00227     protected $_sMetaDescriptionIdent = null;
00228 
00234     protected $_sMetaKeywordsIdent = null;
00235 
00240     protected $_sAdditionalParams = null;
00241 
00246     protected $_oActCurrency = null;
00247 
00252     protected $_blEnabledPrivateSales = null;
00253 
00260     protected $_blCommonAdded = false;
00261 
00268     protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00269 
00276     protected $_blForceNoIndex = false;
00277 
00282     protected $_sWishlistName = null;
00283 
00288     protected $_iCompItemsCnt = null;
00289 
00295     protected $_sContentId = null;
00296 
00302     protected $_oContent = null;
00303 
00309     protected $_sViewResetID = null;
00310 
00315     protected $_blActiveSorting = null;
00316 
00321     protected $_aMenueList = null;
00322 
00328     protected $_aComponentNames = array(
00329                                     'oxcmp_user'       => 1, // 0 means dont init if cached
00330                                     'oxcmp_lang'       => 0,
00331                                     'oxcmp_cur'        => 1,
00332                                     'oxcmp_shop'       => 1,
00333                                     'oxcmp_categories' => 0,
00334                                     'oxcmp_utils'      => 1,
00335                                     'oxcmp_news'       => 0,
00336                                     'oxcmp_basket'     => 1
00337                                   );
00338 
00344     protected $_aUserComponentNames = array();
00345 
00351     protected $_oProduct = null;
00352 
00357     protected $_iActPage = null;
00358 
00363     protected $_aArticleList = null;
00364 
00369     protected $_oVendorTree  = null;
00370 
00375     protected $_oManufacturerTree  = null;
00376 
00381     protected $_oCategoryTree  = null;
00382 
00387     protected $_aTop5ArticleList  = null;
00388 
00393     protected $_aBargainArticleList  = null;
00394 
00399     protected $_blLowOrderPrice = null;
00400 
00405     protected $_sMinOrderPrice  = null;
00406 
00411     protected $_iNewsRealStatus  = null;
00412 
00418     protected $_aBlockRedirectParams = array( 'fnc', 'stoken', 'force_sid', 'force_admin_sid' );
00419 
00424     protected $_aVendorlist = null;
00425 
00430     protected $_oRootVendor = null;
00431 
00436     protected $_sVendorId = null;
00437 
00442     protected $_aManufacturerlist = null;
00443 
00448     protected $_oRootManufacturer = null;
00449 
00454     protected $_sManufacturerId = null;
00455 
00460     protected $_aSearchCatTree = null;
00461 
00466     protected $_oCatMore = null;
00467 
00472     protected $_blNewsSubscribed = null;
00473 
00478     protected $_oDelAddress = null;
00479 
00484     protected $_sCatTreePath = null;
00485 
00490     protected $_aContents = array();
00491 
00496     protected $_blTop5Action = true;
00497 
00502     protected $_blBargainAction = false;
00503 
00509     protected $_aMustFillFields = null;
00510 
00515     protected $_blShowTagCloud = true;
00516 
00521     protected $_blRootCatChanged = false;
00522 
00527     protected $_aInvoiceAddress = null;
00528 
00533     protected $_aDeliveryAddress = null;
00534 
00539     protected $_sActiveUsername = null;
00540 
00546     protected static $_aCollectedComponentNames = null;
00547 
00553     protected function _getComponentNames()
00554     {
00555         if ( self::$_aCollectedComponentNames === null ) {
00556             self::$_aCollectedComponentNames = array_merge( $this->_aComponentNames, $this->_aUserComponentNames );
00557 
00558             // #1721: custom component handling. At the moment it is not possible to override this variable in oxubase,
00559             // so we added this array to config.inc.php file
00560             if ( ( $aUserCmps = $this->getConfig()->getConfigParam( 'aUserComponentNames' ) ) ) {
00561                 self::$_aCollectedComponentNames = array_merge( self::$_aCollectedComponentNames, $aUserCmps );
00562             }
00563 
00564             if ( oxConfig::getParameter( '_force_no_basket_cmp' ) ) {
00565                 unset( self::$_aCollectedComponentNames['oxcmp_basket'] );
00566             }
00567         }
00568 
00569         // resetting array pointer
00570         reset( self::$_aCollectedComponentNames );
00571         return self::$_aCollectedComponentNames;
00572     }
00573 
00582     protected function _processRequest()
00583     {
00584         $myUtils = oxUtils::getInstance();
00585 
00586         // non admin, request is not empty and was not processed by seo engine
00587         if ( !isSearchEngineUrl() && $myUtils->seoIsActive() && ( $sStdUrl = getRequestUrl( '', true ) ) ) {
00588 
00589             // fetching standard url and looking for it in seo table
00590             if ( $this->_canRedirect() && ( $sRedirectUrl = oxSeoEncoder::getInstance()->fetchSeoUrl( $sStdUrl ) ) ) {
00591                 $myUtils->redirect( $this->getConfig()->getCurrentShopUrl() . $sRedirectUrl, false );
00592             } elseif (VIEW_INDEXSTATE_INDEX == $this->noIndex()) {
00593                 // forcing to set noindex/follow meta
00594                 $this->_forceNoIndex();
00595 
00596                 if (!$this->getConfig()->isProductiveMode() || $this->getConfig()->getConfigParam('blSeoLogging')) {
00597                     $sShopId = $this->getConfig()->getShopId();
00598                     $sLangId = oxLang::getInstance()->getBaseLanguage();
00599                     $sIdent  = md5( strtolower( $sStdUrl ) . $sShopId . $sLangId );
00600 
00601                     // logging "not found" url
00602                     $oDb = oxDb::getDb();
00603                     $oDb->execute( "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
00604                                     values ( " . $oDb->quote( $sStdUrl ) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) " );
00605                 }
00606             }
00607         }
00608     }
00609 
00616     public function init()
00617     {
00618         $this->_processRequest();
00619 
00620         // storing current view
00621         $blInit = true;
00622 
00623 
00624         // init all components if there are any
00625         foreach ( $this->_getComponentNames() as $sComponentName => $blNotCacheable ) {
00626             // do not override initiated components
00627             if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00628                 // component objects MUST be created to support user called functions
00629                 $oComponent = oxNew( $sComponentName );
00630                 $oComponent->setParent( $this );
00631                 $oComponent->setThisAction( $sComponentName );
00632                 $this->_oaComponents[$sComponentName] = $oComponent;
00633             }
00634 
00635             // do we really need to initiate them ?
00636             if ( $blInit ) {
00637                 $this->_oaComponents[$sComponentName]->init();
00638 
00639                 // executing only is view does not have action method
00640                 if ( !method_exists( $this, $this->getFncName() ) ) {
00641                     $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00642                 }
00643             }
00644         }
00645 
00646         parent::init();
00647 
00648         // enable sorting ?
00649         if ( $this->showSorting() ) {
00650             $this->prepareSortColumns();
00651         }
00652     }
00653 
00660     public function getViewId()
00661     {
00662         if ( $this->_sViewId ) {
00663             return $this->_sViewId;
00664         }
00665 
00666         $myConfig = $this->getConfig();
00667         $iLang = oxLang::getInstance()->getBaseLanguage();
00668         $iCur  = (int) $myConfig->getShopCurrency();
00669 
00670 
00671             $this->_sViewId =  "ox|$iLang|$iCur";
00672 
00673         $this->_sViewId .= "|".( (int) $this->_blForceNoIndex ).'|'.((int)$this->isRootCatChanged());
00674 
00675         return $this->_sViewId;
00676     }
00677 
00678 
00684     public function showSorting()
00685     {
00686         return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00687     }
00688 
00696     public function setComponents( $aComponents = null )
00697     {
00698         $this->_oaComponents = $aComponents;
00699     }
00700 
00706     public function getComponents()
00707     {
00708         return $this->_oaComponents;
00709     }
00710 
00718     public function setIsOrderStep( $blIsOrderStep = null )
00719     {
00720         $this->_blIsOrderStep = $blIsOrderStep;
00721     }
00722 
00728     public function getIsOrderStep()
00729     {
00730         return $this->_blIsOrderStep;
00731     }
00732 
00733 
00741     public function setActiveCategory( $oCategory )
00742     {
00743         $this->_oActCategory = $oCategory;
00744     }
00745 
00751     public function getActiveCategory()
00752     {
00753         return $this->_oActCategory;
00754     }
00755 
00761     public function getListType()
00762     {
00763         if ( $this->_sListType == null ) {
00764             if ( $sListType = oxConfig::getParameter( 'listtype' ) ) {
00765                 $this->_sListType = $sListType;
00766             } elseif ( $sListType = $this->getConfig()->getGlobalParameter( 'listtype' ) ) {
00767                 $this->_sListType = $sListType;
00768             }
00769         }
00770         return $this->_sListType;
00771     }
00772 
00778     public function getListDisplayType()
00779     {
00780         if ( $this->_sListDisplayType == null ) {
00781             $this->_sListDisplayType = oxConfig::getParameter( 'ldtype' );
00782 
00783             if ( !$this->_sListDisplayType ) {
00784                 $this->_sListDisplayType = oxSession::getVar( 'ldtype' );
00785             }
00786 
00787             if ( !$this->_sListDisplayType ) {
00788                 $this->_sListDisplayType = $this->getConfig()->getConfigParam( 'sDefaultListDisplayType' );
00789             }
00790 
00791             $this->_sListDisplayType = in_array( ( string ) $this->_sListDisplayType, $this->_aListDisplayTypes ) ? $this->_sListDisplayType : 'infogrid';
00792 
00793             // writing to session
00794             if ( oxConfig::getParameter( 'ldtype' ) ) {
00795                 oxSession::setVar( 'ldtype', $this->_sListDisplayType );
00796             }
00797         }
00798         return $this->_sListDisplayType;
00799     }
00800 
00808     public function setListType( $sType )
00809     {
00810         $this->_sListType = $sType;
00811         $this->getConfig()->setGlobalParameter( 'listtype', $sType );
00812     }
00813 
00819     public function showRightBasket()
00820     {
00821         if ( $this->_blShowRightBasket === null ) {
00822             if ( $blShowRightBasket = $this->getConfig()->getConfigParam( 'bl_perfShowRightBasket' ) ) {
00823                 $this->_blShowRightBasket = $blShowRightBasket;
00824             }
00825         }
00826         return $this->_blShowRightBasket;
00827     }
00828 
00836     public function setShowRightBasket( $blShowBasket )
00837     {
00838         $this->_blShowRightBasket = $blShowBasket;
00839     }
00840 
00846     public function showLeftBasket()
00847     {
00848         if ( $this->_blShowLeftBasket === null ) {
00849             if ( $blShowLeftBasket = $this->getConfig()->getConfigParam( 'bl_perfShowLeftBasket' ) ) {
00850                 $this->_blShowLeftBasket = $blShowLeftBasket;
00851             }
00852         }
00853         return $this->_blShowLeftBasket;
00854     }
00855 
00863     public function setShowLeftBasket( $blShowBasket )
00864     {
00865         $this->_blShowLeftBasket = $blShowBasket;
00866     }
00867 
00873     public function showTopBasket()
00874     {
00875         if ( $this->_blShowTopBasket === null ) {
00876             if ( $blShowTopBasket = $this->getConfig()->getConfigParam( 'bl_perfShowTopBasket' ) ) {
00877                 $this->_blShowTopBasket = $blShowTopBasket;
00878             }
00879         }
00880         return $this->_blShowTopBasket;
00881     }
00882 
00890     public function setShowTopBasket( $blShowBasket )
00891     {
00892         $this->_blShowTopBasket = $blShowBasket;
00893     }
00894 
00900     public function loadCurrency()
00901     {
00902         if ( $this->_blLoadCurrency == null ) {
00903             $this->_blLoadCurrency = false;
00904             if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00905                 $this->_blLoadCurrency = $blLoadCurrency;
00906             }
00907         }
00908         return $this->_blLoadCurrency;
00909     }
00910 
00916     public function loadVendorTree()
00917     {
00918         if ( $this->_blLoadVendorTree == null ) {
00919             $this->_blLoadVendorTree = false;
00920             if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
00921                 $this->_blLoadVendorTree = $blLoadVendorTree;
00922             }
00923         }
00924         return $this->_blLoadVendorTree;
00925     }
00926 
00932     public function loadManufacturerTree()
00933     {
00934         if ( $this->_blLoadManufacturerTree == null ) {
00935             $this->_blLoadManufacturerTree = false;
00936             if ( $blLoadManufacturerTree = $this->getConfig()->getConfigParam( 'bl_perfLoadManufacturerTree' ) ) {
00937                 $this->_blLoadManufacturerTree = $blLoadManufacturerTree;
00938             }
00939         }
00940         return $this->_blLoadManufacturerTree;
00941     }
00942 
00948     public function dontShowEmptyCategories()
00949     {
00950         if ( $this->_blDontShowEmptyCats == null ) {
00951             $this->_blDontShowEmptyCats = false;
00952             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00953                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00954             }
00955         }
00956         return $this->_blDontShowEmptyCats;
00957     }
00958 
00964     public function showCategoryArticlesCount()
00965     {
00966         return $this->getConfig()->getConfigParam( 'bl_perfShowActionCatArticleCnt' );
00967     }
00968 
00974     public function isLanguageLoaded()
00975     {
00976         if ( $this->_blLoadLanguage == null ) {
00977             $this->_blLoadLanguage = false;
00978             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00979                 $this->_blLoadLanguage = $blLoadLanguage;
00980             }
00981         }
00982         return $this->_blLoadLanguage;
00983     }
00984 
00990     public function showTopCatNavigation()
00991     {
00992         if ( $this->_blShowTopCatNav == null ) {
00993             $this->_blShowTopCatNav = false;
00994             if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
00995                 $this->_blShowTopCatNav = $blShowTopCatNav;
00996             }
00997         }
00998         return $this->_blShowTopCatNav;
00999     }
01000 
01006     public function getTopNavigationCatCnt()
01007     {
01008         if ( $this->_iTopCatNavItmCnt == null ) {
01009             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
01010             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
01011         }
01012         return $this->_iTopCatNavItmCnt;
01013     }
01014 
01024     public function addRssFeed($sTitle, $sUrl, $key = null)
01025     {
01026         if (!is_array($this->_aRssLinks)) {
01027             $this->_aRssLinks = array();
01028         }
01029         if ($key === null) {
01030             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
01031         } else {
01032             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
01033         }
01034     }
01035 
01041     public function getSortOrderByParameterName()
01042     {
01043         return 'listorderby';
01044     }
01045 
01051     public function getSortOrderParameterName()
01052     {
01053         return 'listorder';
01054     }
01055 
01066     public function prepareSortColumns()
01067     {
01068         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
01069         if ( count( $aSortColumns ) > 0 ) {
01070 
01071             $this->_blActiveSorting = true;
01072             $this->_aSortColumns = $aSortColumns;
01073 
01074             $sCnid = oxConfig::getParameter( 'cnid' );
01075 
01076 
01077             $sSortBy  = oxConfig::getParameter( $this->getSortOrderByParameterName() );
01078             $sSortDir = oxConfig::getParameter( $this->getSortOrderParameterName() );
01079 
01080             if ( !$sSortBy && $aSorting = $this->getSorting( $sCnid ) ) {
01081                 $sSortBy  = $aSorting['sortby'];
01082                 $sSortDir = $aSorting['sortdir'];
01083             }
01084 
01085             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
01086                  $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
01087 
01088                 $this->_sListOrderBy  = $sSortBy;
01089                 $this->_sListOrderDir = $sSortDir;
01090 
01091                 // caching sorting config
01092                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
01093             }
01094         }
01095     }
01096 
01102     public function getListOrderBy()
01103     {
01104         //if column is with table name split it
01105         $aColums = explode('.', $this->_sListOrderBy);
01106 
01107         if ( is_array($aColums) && count($aColums) > 1 ) {
01108            return $aColums[1];
01109         }
01110 
01111         return $this->_sListOrderBy;
01112     }
01113 
01119     public function getListOrderDirection()
01120     {
01121         return $this->_sListOrderDir;
01122     }
01123 
01131     public function setMetaDescription ( $sDescription )
01132     {
01133         return $this->_sMetaDescription = $sDescription;
01134     }
01135 
01143     public function setMetaKeywords( $sKeywords )
01144     {
01145         return $this->_sMetaKeywords = $sKeywords;
01146     }
01147 
01155     protected function _getMetaFromSeo( $sDataType )
01156     {
01157         $sOxid  = $this->_getSeoObjectId();
01158         $iLang  = oxLang::getInstance()->getBaseLanguage();
01159         $sShop  = $this->getConfig()->getShopId();
01160 
01161         if ( $sOxid && oxUtils::getInstance()->seoIsActive() &&
01162              ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, $sDataType, $sShop, $iLang) ) ) {
01163             return $sKeywords;
01164         }
01165     }
01166 
01174     protected function _getMetaFromContent( $sMetaIdent )
01175     {
01176         if ( $sMetaIdent ) {
01177             $oContent = oxNew( 'oxcontent' );
01178             if ( $oContent->loadByIdent( $sMetaIdent ) &&
01179                  $oContent->oxcontents__oxactive->value ) {
01180                 return strip_tags( $oContent->oxcontents__oxcontent->value );
01181             }
01182         }
01183     }
01184 
01190     public function getMetaKeywords()
01191     {
01192         if ( $this->_sMetaKeywords === null ) {
01193             $this->_sMetaKeywords = false;
01194 
01195             // set special meta keywords ?
01196             if ( ( $sKeywords = $this->_getMetaFromSeo( 'oxkeywords' ) ) ) {
01197                 $this->_sMetaKeywords = $sKeywords;
01198             } elseif ( ( $sKeywords = $this->_getMetaFromContent( $this->_sMetaKeywordsIdent ) ) ) {
01199                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( $sKeywords, false );
01200             } else {
01201                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( false, true );
01202             }
01203         }
01204 
01205         return $this->_sMetaKeywords;
01206     }
01207 
01213     public function getMetaDescription()
01214     {
01215         if ( $this->_sMetaDescription === null ) {
01216             $this->_sMetaDescription = false;
01217 
01218             // set special meta description ?
01219             if ( ( $sDescription = $this->_getMetaFromSeo( 'oxdescription' ) ) ) {
01220                 $this->_sMetaDescription = $sDescription;
01221             } elseif ( ( $sDescription = $this->_getMetaFromContent( $this->_sMetaDescriptionIdent ) ) ) {
01222                 $this->_sMetaDescription = $this->_prepareMetaDescription( $sDescription );
01223             } else {
01224                 $this->_sMetaDescription = $this->_prepareMetaDescription( false );
01225             }
01226         }
01227 
01228         return $this->_sMetaDescription;
01229     }
01230 
01236     public function getActCurrency()
01237     {
01238         return $this->_oActCurrency;
01239     }
01240 
01248     public function setActCurrency( $oCur )
01249     {
01250         $this->_oActCurrency = $oCur;
01251     }
01252 
01258     public function getCompareItemsCnt()
01259     {
01260         return (int)$this->_iCompItemsCnt;
01261     }
01262 
01270     public function setCompareItemsCnt( $iCount )
01271     {
01272         $this->_iCompItemsCnt = $iCount;
01273     }
01274 
01280     public function getWishlistName()
01281     {
01282         return $this->_sWishlistName;
01283     }
01284 
01292     public function setWishlistName( $sName )
01293     {
01294         $this->_sWishlistName = $sName;
01295     }
01296 
01302     protected function _forceNoIndex()
01303     {
01304         $this->_blForceNoIndex = true;
01305     }
01306 
01313     public function noIndex()
01314     {
01315         if ( $this->_blForceNoIndex ) {
01316             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01317         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01318             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01319         } else {
01320             switch ( oxConfig::getParameter( 'fnc' ) ) {
01321                 case 'tocomparelist':
01322                 case 'tobasket':
01323                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01324                     break;
01325             }
01326         }
01327         return $this->_iViewIndexState;
01328     }
01329 
01336     public function getContentId()
01337     {
01338         if ( $this->_sContentId === null) {
01339             $oContent = oxNew( 'oxcontent' );
01340             $oContent->loadByIdent( 'oximpressum' );
01341             $this->_sContentId = $oContent->getId();
01342         }
01343 
01344         return $this->_sContentId;
01345     }
01346 
01353     public function getContent()
01354     {
01355         if ( $this->_oContent === null) {
01356             $oContent = oxNew( 'oxcontent' );
01357             if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01358                 $this->_oContent = $oContent;
01359             }
01360         }
01361 
01362         return $this->_oContent;
01363     }
01364 
01370     public function isSortingActive()
01371     {
01372         return $this->_blActiveSorting;
01373     }
01374 
01380     public function getMenueList()
01381     {
01382         return $this->_aMenueList;
01383     }
01384 
01392     public function setMenueList( $aMenue )
01393     {
01394         $this->_aMenueList = $aMenue;
01395     }
01396 
01397 
01403     protected function _setNrOfArtPerPage()
01404     {
01405         $myConfig  = $this->getConfig();
01406 
01407         //setting default values to avoid possible errors showing article list
01408         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01409 
01410         $iNrofCatArticles = ( $iNrofCatArticles ) ? $iNrofCatArticles : 10;
01411 
01412         // checking if all needed data is set
01413         switch ( $this->getListDisplayType() ) {
01414             case 'grid':
01415                 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticlesInGrid' );
01416                 break;
01417             case 'line':
01418             case 'infogrid':
01419             default:
01420                 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01421         }
01422 
01423         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01424             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01425         } else {
01426             $iNrofCatArticles = $aNrofCatArticles[0];
01427         }
01428 
01429         $oViewConf = $this->getViewConfig();
01430         //value from user input
01431         if ( ( $iNrofArticles = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01432             // M45 Possibility to push any "Show articles per page" number parameter
01433             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01434             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01435             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01436         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01437             // M45 Possibility to push any "Show articles per page" number parameter
01438             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01439             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01440             $iNrofCatArticles = $iSessArtPerPage;
01441         } else {
01442             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01443         }
01444 
01445         //setting number of articles per page to config value
01446         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01447     }
01448 
01454     protected function _getSeoObjectId()
01455     {
01456     }
01457 
01467     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01468     {
01469         if ( $sMeta ) {
01470 
01471             $oStr = getStr();
01472             if ( $iLength != -1 ) {
01473                 /* *
01474                  * performance - we dont need a huge amount of initial text.
01475                  * assume that effective text may be double longer than $iLength
01476                  * and simple turncate it
01477                  */
01478                 $iELength = ( $iLength * 2 );
01479                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01480             }
01481 
01482             // decoding html entities
01483             $sMeta = $oStr->html_entity_decode( $sMeta );
01484             // stripping HTML tags
01485             $sMeta = strip_tags( $sMeta );
01486 
01487             // removing some special chars
01488             $sMeta = $oStr->cleanStr( $sMeta );
01489 
01490             // removing duplicate words
01491             if ( $blRemoveDuplicatedWords ) {
01492                 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01493             }
01494 
01495             // some special cases
01496             $sMeta = str_replace( ' ,', ',', $sMeta );
01497             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01498             $sMeta = $oStr->preg_replace( $aPattern, ',', $sMeta );
01499             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01500 
01501             return trim( $sMeta );
01502         }
01503     }
01504 
01513     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01514     {
01515 
01516         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01517 
01518         if ( $blRemoveDuplicatedWords ) {
01519             $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01520         }
01521 
01522         // removing in admin defined strings
01523 
01524         /*if ( is_array( $aSkipTags ) && $sString ) {
01525             $oStr = getStr();
01526             foreach ( $aSkipTags as $sSkip ) {
01527                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01528                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01529                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01530                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01531             }
01532         }*/
01533 
01534         return trim( $sString );
01535     }
01536 
01545     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01546     {
01547         $oStr = getStr();
01548         if ( is_array( $aInput ) ) {
01549             $aStrings = $aInput;
01550         } else {
01551             //is String
01552             $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01553         }
01554 
01555         if ( $sCount = count( $aSkipTags ) ) {
01556             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01557                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01558             }
01559         }
01560         $sCount = count($aStrings);
01561         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01562             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01563             // removing in admin defined strings
01564             if ( in_array( $aStrings[$iNum], $aSkipTags ) ) {
01565                 unset( $aStrings[$iNum] );
01566             }
01567         }
01568 
01569         // duplicates
01570         $aStrings = array_unique($aStrings);
01571 
01572         return implode( ', ', $aStrings );
01573     }
01574 
01582     public function getNavigationParams()
01583     {
01584         $aParams['cnid'] = $this->getCategoryId();
01585         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01586 
01587         $aParams['listtype'] = $this->getListType();
01588         $aParams['ldtype'] = $this->getListDisplayType();
01589 
01590         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01591 
01592         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01593         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01594         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01595 
01596         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01597         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01598         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01599 
01600         return $aParams;
01601     }
01602 
01612     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01613     {
01614 
01615         $aSorting = oxSession::getVar( 'aSorting' );
01616         $aSorting[$sCnid]['sortby']  = $sSortBy;
01617         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01618 
01619         oxSession::setVar( 'aSorting', $aSorting );
01620     }
01621 
01629     public function getSorting( $sCnid )
01630     {
01631         $aSorting = oxSession::getVar( 'aSorting' );
01632 
01633         if ( isset( $aSorting[$sCnid] ) ) {
01634             return $aSorting[$sCnid];
01635         }
01636     }
01637 
01645     public function getSortingSql( $sCnid )
01646     {
01647         $aSorting = $this->getSorting( $sCnid );
01648         if ( is_array( $aSorting ) ) {
01649             return implode( " ", $aSorting );
01650         }
01651     }
01652 
01658     public function getTitleSuffix()
01659     {
01660         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01661     }
01662 
01668     public function getTitlePageSuffix()
01669     {
01670     }
01671 
01678     public function getTitlePrefix()
01679     {
01680         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01681     }
01682 
01683 
01684 
01693     protected function _getSubject( $iLang )
01694     {
01695         return null;
01696     }
01697 
01703     public function getDynUrlParams()
01704     {
01705         $sRet = '';
01706         $sListType = $this->getListType();
01707 
01708         switch ($sListType) {
01709             default:
01710                 break;
01711             case 'search':
01712                 $sRet .= "&amp;listtype={$sListType}";
01713                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01714                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01715                 }
01716 
01717                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01718                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01719                 }
01720                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01721                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01722                 }
01723                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01724                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01725                 }
01726                 break;
01727             case 'tag':
01728                 $sRet .= "&amp;listtype={$sListType}";
01729                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01730                     $sRet .= "&amp;searchtag={$sParam}";
01731                 }
01732                 break;
01733         }
01734 
01735         return $sRet;
01736     }
01737 
01745     public function getLink( $iLang = null )
01746     {
01747         if ( !isset( $iLang ) ) {
01748             $iLang = oxLang::getInstance()->getBaseLanguage();
01749         }
01750 
01751         $oDisplayObj = null;
01752         $blTrySeo = false;
01753         if ( oxUtils::getInstance()->seoIsActive() ) {
01754             $blTrySeo = true;
01755             $oDisplayObj = $this->_getSubject( $iLang );
01756         }
01757         $iActPageNr = $this->getActPage();
01758 
01759         if ( $oDisplayObj ) {
01760             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01761         }
01762 
01763         $myConfig = $this->getConfig();
01764 
01765         if ( $blTrySeo ) {
01766             $oEncoder = oxSeoEncoder::getInstance();
01767             if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01768                 return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01769             }
01770         }
01771 
01772         $sUrl = oxUtilsUrl::getInstance()->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams(), true, null, $iLang);
01773 
01774         // fallback to old non seo url
01775         return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01776     }
01777 
01783     public function getCanonicalUrl()
01784     {
01785     }
01786 
01793     public function getSimilarRecommLists()
01794     {
01795     }
01796 
01803     public function getSearchParamForHtml()
01804     {
01805     }
01806 
01814     protected function _getRequestParams( $blAddPageNr  = true )
01815     {
01816         $sClass = $this->getClassName();
01817         $sFnc   = $this->getFncName();
01818 
01819         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher', 'moveleft', 'moveright' );
01820         if ( in_array( $sFnc, $aFnc ) ) {
01821             $sFnc = '';
01822         }
01823 
01824         // #680
01825         $sURL = "cl={$sClass}";
01826         if ( $sFnc ) {
01827             $sURL .= "&amp;fnc={$sFnc}";
01828         }
01829         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01830             $sURL .= "&amp;cnid={$sVal}";
01831         }
01832         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01833             $sURL .= "&amp;mnid={$sVal}";
01834         }
01835         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01836             $sURL .= "&amp;anid={$sVal}";
01837         }
01838 
01839         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01840             $sURL .= "&amp;page={$sVal}";
01841         }
01842 
01843         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01844             $sURL .= "&amp;tpl={$sVal}";
01845         }
01846 
01847         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01848         // don't include page number for navigation
01849         // it will be done in oxubase::generatePageNavigation
01850         if ( $blAddPageNr && $iPgNr > 0 ) {
01851             $sURL .= "&amp;pgNr={$iPgNr}";
01852         }
01853 
01854         // #1184M - specialchar search
01855         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01856             $sURL .= "&amp;searchparam={$sVal}";
01857         }
01858 
01859         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01860             $sURL .= "&amp;searchcnid={$sVal}";
01861         }
01862 
01863         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01864             $sURL .= "&amp;searchvendor={$sVal}";
01865         }
01866 
01867         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01868             $sURL .= "&amp;searchmanufacturer={$sVal}";
01869         }
01870 
01871         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01872             $sURL .= "&amp;searchrecomm={$sVal}";
01873         }
01874 
01875         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01876             $sURL .= "&amp;searchtag={$sVal}";
01877         }
01878 
01879         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01880             $sURL .= "&amp;recommid={$sVal}";
01881         }
01882 
01883         return $sURL;
01884     }
01885 
01891     protected function _getSeoRequestParams()
01892     {
01893         $sClass = $this->getClassName();
01894         $sFnc   = $this->getFncName();
01895 
01896         // #921 S
01897         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01898         if ( in_array( $sFnc, $aFnc ) ) {
01899             $sFnc = '';
01900         }
01901 
01902         // #680
01903         $sURL = "cl={$sClass}";
01904         if ( $sFnc ) {
01905             $sURL .= "&amp;fnc={$sFnc}";
01906         }
01907         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01908             $sURL .= "&amp;page={$sVal}";
01909         }
01910 
01911         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01912             $sURL .= "&amp;tpl={$sVal}";
01913         }
01914 
01915         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01916         if ( $iPgNr > 0 ) {
01917             $sURL .= "&amp;pgNr={$iPgNr}";
01918         }
01919 
01920         return $sURL;
01921     }
01922 
01928     public function showSearch()
01929     {
01930         $blShow = true;
01931         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01932             $blShow = false;
01933         }
01934         return (int) $blShow;
01935     }
01936 
01942     public function getRssLinks()
01943     {
01944         return $this->_aRssLinks;
01945     }
01946 
01952     public function getSortColumns()
01953     {
01954         return $this->_aSortColumns;
01955     }
01956 
01962     public function getEditTags()
01963     {
01964     }
01965 
01971     public function getRecommSearch()
01972     {
01973     }
01974 
01980     public function getPaymentList()
01981     {
01982     }
01983 
01989     public function getActiveRecommList()
01990     {
01991         if ( $this->_oActiveRecommList === null ) {
01992             $this->_oActiveRecommList = false;
01993             if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01994                 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01995                 $this->_oActiveRecommList->load( $sOxid );
01996             }
01997         }
01998         return $this->_oActiveRecommList;
01999     }
02000 
02006     public function getAccessoires()
02007     {
02008     }
02009 
02015     public function getCrossSelling()
02016     {
02017     }
02018 
02024     public function getSimilarProducts()
02025     {
02026     }
02027 
02033     public function getAlsoBoughtTheseProducts()
02034     {
02035     }
02036 
02042     public function getArticleId()
02043     {
02044     }
02045 
02051     public function isMoreTagsVisible()
02052     {
02053         return false;
02054     }
02055 
02061     public function getTitle()
02062     {
02063     }
02064 
02070     public function getActiveLangAbbr()
02071     {
02072         // Performance
02073         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
02074             return;
02075         }
02076 
02077         if ( !isset($this->_sActiveLangAbbr ) ) {
02078             $aLanguages = oxLang::getInstance()->getLanguageArray();
02079             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
02080                 if ( $oVal->selected ) {
02081                     $this->_sActiveLangAbbr = $oVal->abbr;
02082                     break;
02083                 }
02084             }
02085         }
02086 
02087         return $this->_sActiveLangAbbr;
02088     }
02089 
02097     public function addGlobalParams( $oShop = null)
02098     {
02099         $oViewConf = parent::addGlobalParams( $oShop );
02100 
02101         $this->_setNrOfArtPerPage();
02102 
02103         return $oViewConf;
02104     }
02105 
02111     public function getAdditionalParams()
02112     {
02113         if ( $this->_sAdditionalParams === null ) {
02114             // #1018A
02115             $this->_sAdditionalParams  = parent::getAdditionalParams();
02116             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02117 
02118             // #1834M - specialchar search
02119             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02120             if ( isset( $sSearchParamForLink ) ) {
02121                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
02122             }
02123             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02124                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
02125             }
02126             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02127                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02128             }
02129             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02130                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02131             }
02132             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02133                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02134             }
02135             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02136                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02137             }
02138             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02139                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02140             }
02141         }
02142 
02143         return $this->_sAdditionalParams;
02144     }
02145 
02151     public function generatePageNavigationUrl()
02152     {
02153         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02154     }
02155 
02165     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02166     {
02167         if ( $iPage ) {
02168             if ( ( strpos( $sUrl, 'pgNr=' ) ) ) {
02169                 $sUrl = preg_replace('/pgNr=[0-9]*/', 'pgNr='.$iPage, $sUrl);
02170             } else {
02171                 $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02172             }
02173         } else {
02174            $sUrl = preg_replace('/pgNr=[0-9]*/', '', $sUrl);
02175            $sUrl = preg_replace('/\&amp\;\&amp\;/', '&amp;', $sUrl);
02176            $sUrl = preg_replace('/\?\&amp\;/', '?', $sUrl);
02177            $sUrl = preg_replace('/\&amp\;$/', '', $sUrl);
02178         }
02179         return $sUrl;
02180     }
02181 
02187     public function getPageNavigation()
02188     {
02189 
02190     }
02191 
02197     public function getPageNavigationLimitedTop()
02198     {
02199 
02200         $this->_oPageNavigation = $this->generatePageNavigation( 7 );
02201 
02202         return $this->_oPageNavigation;
02203     }
02204 
02210     public function getPageNavigationLimitedBottom()
02211     {
02212 
02213         $this->_oPageNavigation = $this->generatePageNavigation( 11 );
02214 
02215         return $this->_oPageNavigation;
02216     }
02217 
02218 
02226     public function generatePageNavigation( $iPositionCount = 0 )
02227     {
02228         startProfile('generatePageNavigation');
02229 
02230         $pageNavigation = new stdClass();
02231 
02232         $pageNavigation->NrOfPages = $this->_iCntPages;
02233         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02234         $iActPage = $this->getActPage();
02235         $pageNavigation->actPage   = $iActPage + 1;
02236         $sUrl = $this->generatePageNavigationUrl();
02237 
02238         if ( $iPositionCount == 0 || ($iPositionCount >= $pageNavigation->NrOfPages) ) {
02239              $iStartNo = 2;
02240              $iFinishNo = $pageNavigation->NrOfPages;
02241              $bStart = false;
02242              $bFinish =false;
02243         } else {
02244             $iTmpVal = $iPositionCount - 3;
02245             $iTmpVal2 = floor( ( $iPositionCount - 4 ) / 2 );
02246 
02247             // actual page is at the start
02248             if ( $pageNavigation->actPage <= $iTmpVal ) {
02249                 $iStartNo = 2;
02250                 $iFinishNo = $iTmpVal + 1;
02251                 $bStart = false;
02252                 $bFinish = true;
02253             // actual page is at the end
02254             } elseif ( $pageNavigation->actPage >= $pageNavigation->NrOfPages - $iTmpVal ) {
02255                 $iStartNo = $pageNavigation->NrOfPages - $iTmpVal;
02256                 $iFinishNo = $pageNavigation->NrOfPages - 1;
02257                 $bStart = true;
02258                 $bFinish = false;
02259             // actual page is in the midle
02260             } else {
02261                 $iStartNo = $pageNavigation->actPage - $iTmpVal2;
02262                 $iFinishNo = $pageNavigation->actPage + $iTmpVal2;
02263                 $bStart = true;
02264                 $bFinish = true;
02265             }
02266         }
02267 
02268         if ( $iActPage > 0) {
02269             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02270         }
02271 
02272         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02273             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02274         }
02275 
02276         if ( $pageNavigation->NrOfPages > 1 ) {
02277 
02278             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02279 
02280                 if ( $i == 1 || $i == $pageNavigation->NrOfPages || ( $i >= $iStartNo && $i <= $iFinishNo ) ) {
02281                     $page = new Oxstdclass();
02282                     $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02283                     $page->selected = ( $i == $pageNavigation->actPage ) ? 1 : 0;
02284                     $pageNavigation->changePage[$i] = $page;
02285                 }
02286             }
02287 
02288             // first/last one
02289             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02290             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02291         }
02292 
02293         stopProfile('generatePageNavigation');
02294 
02295         return $pageNavigation;
02296     }
02297 
02303     public function getArticleCount()
02304     {
02305         return $this->_iAllArtCnt;
02306     }
02307 
02314     public function render()
02315     {
02316         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02317             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02318         }
02319 
02320         parent::render();
02321 
02322         if ( $this->getIsOrderStep() ) {
02323 
02324             // disabling navigation during order ...
02325             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02326                 $this->_iNewsRealStatus = 1;
02327                 $this->setShowNewsletter( 0 );
02328                 $this->setShowRightBasket( 0 );
02329                 $this->setShowLeftBasket( 0 );
02330                 $this->setShowTopBasket( 0 );
02331             }
02332         }
02333         return $this->_sThisTemplate;
02334     }
02335 
02341     public function getViewProduct()
02342     {
02343         return $this->getProduct();
02344     }
02345 
02353     public function setViewProduct( $oProduct )
02354     {
02355         $this->_oProduct = $oProduct;
02356     }
02357 
02363     public function getViewProductList()
02364     {
02365         return $this->_aArticleList;
02366     }
02367 
02373     public function getActPage()
02374     {
02375         if ( $this->_iActPage === null ) {
02376             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02377             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02378         }
02379         return $this->_iActPage;
02380     }
02381 
02389     public function getActTag()
02390     {
02391         if ( $this->_oActTag === null ) {
02392             $this->_oActTag = new Oxstdclass();
02393             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02394             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02395 
02396             $sLink = false;
02397             if ( oxUtils::getInstance()->seoIsActive() ) {
02398                 $sLink = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02399             }
02400 
02401             $this->_oActTag->link = $sLink ? $sLink : $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02402         }
02403         return $this->_oActTag;
02404     }
02405 
02413     public function getActVendor()
02414     {
02415         // if active vendor is not set yet - trying to load it from request params
02416         // this may be usefull when category component was unable to load active vendor
02417         // and we still need some object to mount navigation info
02418         if ( $this->_oActVendor === null ) {
02419             $this->_oActVendor = false;
02420             $sVendorId = oxConfig::getParameter( 'cnid' );
02421             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02422             $oVendor = oxNew( 'oxvendor' );
02423             if ( $oVendor->load( $sVendorId ) ) {
02424                 $this->_oActVendor = $oVendor;
02425             }
02426         }
02427 
02428         return $this->_oActVendor;
02429     }
02430 
02438     public function getActManufacturer()
02439     {
02440         // if active Manufacturer is not set yet - trying to load it from request params
02441         // this may be usefull when category component was unable to load active Manufacturer
02442         // and we still need some object to mount navigation info
02443         if ( $this->_oActManufacturer === null ) {
02444 
02445             $this->_oActManufacturer = false;
02446             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02447             $oManufacturer = oxNew( 'oxmanufacturer' );
02448             if ( $oManufacturer->load( $sManufacturerId ) ) {
02449                 $this->_oActManufacturer = $oManufacturer;
02450             }
02451         }
02452 
02453         return $this->_oActManufacturer;
02454     }
02455 
02463     public function setActVendor( $oVendor )
02464     {
02465         $this->_oActVendor = $oVendor;
02466     }
02467 
02475     public function setActManufacturer( $oManufacturer )
02476     {
02477         $this->_oActManufacturer = $oManufacturer;
02478     }
02479 
02485     public function getActSearch()
02486     {
02487         if ( $this->_oActSearch === null ) {
02488             $this->_oActSearch = new oxStdClass();
02489             $sUrl = $this->getConfig()->getShopHomeURL();
02490             $this->_oActSearch->link = "{$sUrl}cl=search";
02491         }
02492         return $this->_oActSearch;
02493     }
02494 
02500     public function getCategoryTree()
02501     {
02502         return $this->_oCategoryTree;
02503     }
02504 
02512     public function setCategoryTree( $oCatTree )
02513     {
02514         $this->_oCategoryTree = $oCatTree;
02515     }
02516 
02522     public function getVendorTree()
02523     {
02524         return $this->_oVendorTree;
02525     }
02526 
02534     public function setVendorTree( $oVendorTree )
02535     {
02536         $this->_oVendorTree = $oVendorTree;
02537     }
02538 
02544     public function getManufacturerTree()
02545     {
02546         return $this->_oManufacturerTree;
02547     }
02548 
02556     public function setManufacturerTree( $oManufacturerTree )
02557     {
02558         $this->_oManufacturerTree = $oManufacturerTree;
02559     }
02560 
02566     public function getAddUrlParams()
02567     {
02568     }
02569 
02576     public function getTop5ArticleList()
02577     {
02578         if ( $this->_blTop5Action ) {
02579             if ( $this->_aTop5ArticleList === null ) {
02580                 $this->_aTop5ArticleList = false;
02581                 $myConfig = $this->getConfig();
02582                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02583                     // top 5 articles
02584                     $oArtList = oxNew( 'oxarticlelist' );
02585                     $oArtList->loadTop5Articles();
02586                     if ( $oArtList->count() ) {
02587                         $this->_aTop5ArticleList = $oArtList;
02588                     }
02589                 }
02590             }
02591         }
02592         return $this->_aTop5ArticleList;
02593     }
02594 
02601     public function getBargainArticleList()
02602     {
02603         if ( $this->_blBargainAction ) {
02604             if ( $this->_aBargainArticleList === null ) {
02605                 $this->_aBargainArticleList = array();
02606                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02607                     $oArtList = oxNew( 'oxarticlelist' );
02608                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02609                     if ( $oArtList->count() ) {
02610                         $this->_aBargainArticleList = $oArtList;
02611                     }
02612                 }
02613             }
02614         }
02615         return $this->_aBargainArticleList;
02616     }
02617 
02624     public function isLowOrderPrice()
02625     {
02626         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02627             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02628         }
02629 
02630         return $this->_blLowOrderPrice;
02631     }
02632 
02638     public function getMinOrderPrice()
02639     {
02640         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02641             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02642             $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice );
02643         }
02644         return $this->_sMinOrderPrice;
02645     }
02646 
02652     public function getNewsRealStatus()
02653     {
02654         return $this->_iNewsRealStatus;
02655     }
02656 
02662     protected function _canRedirect()
02663     {
02664         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02665             if ( oxConfig::getParameter( $sParam ) !== null ) {
02666                 return false;
02667             }
02668         }
02669 
02670         return true;
02671     }
02672 
02678     public function getProduct()
02679     {
02680     }
02681 
02687     public function getVendorlist()
02688     {
02689         return $this->_aVendorlist;
02690     }
02691 
02699     public function setVendorlist( $aList )
02700     {
02701         $this->_aVendorlist = $aList;
02702     }
02703 
02709     public function getManufacturerlist()
02710     {
02711         return $this->_aManufacturerlist;
02712     }
02713 
02721     public function setManufacturerlist( $aList )
02722     {
02723         $this->_aManufacturerlist = $aList;
02724     }
02725 
02733     public function setRootVendor( $oVendor )
02734     {
02735         $this->_oRootVendor = $oVendor;
02736     }
02737 
02743     public function getRootVendor()
02744     {
02745         return $this->_oRootVendor;
02746     }
02747 
02755     public function setRootManufacturer( $oManufacturer )
02756     {
02757         $this->_oRootManufacturer = $oManufacturer;
02758     }
02759 
02765     public function getRootManufacturer()
02766     {
02767         return $this->_oRootManufacturer;
02768     }
02769 
02775     public function getVendorId()
02776     {
02777         if ( $this->_sVendorId === null ) {
02778             $this->_sVendorId = false;
02779             if ( ( $oVendor = $this->getActVendor() ) ) {
02780                 $this->_sVendorId = $oVendor->getId();
02781             }
02782         }
02783         return $this->_sVendorId;
02784     }
02785 
02791     public function getManufacturerId()
02792     {
02793         if ( $this->_sManufacturerId === null ) {
02794             $this->_sManufacturerId = false;
02795             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02796                 $this->_sManufacturerId = $oManufacturer->getId();
02797             }
02798         }
02799         return $this->_sManufacturerId;
02800     }
02801 
02807     public function getSearchCatTree()
02808     {
02809         return $this->_aSearchCatTree;
02810     }
02811 
02819     public function setSearchCatTree( $aTree )
02820     {
02821         $this->_aSearchCatTree = $aTree;
02822     }
02823 
02829     public function getCatMoreUrl()
02830     {
02831         return $this->getConfig()->getShopHomeURL().'cnid=oxmore';
02832     }
02833 
02839     public function getCatMore()
02840     {
02841         return $this->_oCatMore;
02842     }
02843 
02851     public function setCatMore( $oCat )
02852     {
02853         $this->_oCatMore = $oCat;
02854     }
02855 
02861     public function getCatTreePath()
02862     {
02863         return $this->_sCatTreePath;
02864     }
02865 
02873     public function getContentByIdent( $sIdent )
02874     {
02875         if ( !isset( $this->_aContents[$sIdent] ) ) {
02876             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02877             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02878         }
02879         return $this->_aContents[$sIdent];
02880     }
02881 
02887     public function getContentCategory()
02888     {
02889         return false;
02890     }
02891 
02897     public function getMustFillFields()
02898     {
02899         if ( $this->_aMustFillFields === null ) {
02900             $this->_aMustFillFields = false;
02901 
02902             // passing must-be-filled-fields info
02903             $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02904             if ( is_array( $aMustFillFields ) ) {
02905                 $this->_aMustFillFields = array_flip( $aMustFillFields );
02906             }
02907         }
02908         return $this->_aMustFillFields;
02909     }
02910 
02918     public function isFieldRequired( $sField )
02919     {
02920         if ( $aMustFillFields = $this->getMustFillFields() ) {
02921             if ( isset( $aMustFillFields[$sField] ) ) {
02922                 return true;
02923             }
02924         }
02925 
02926         return false;
02927     }
02928 
02934     public function getFormId()
02935     {
02936         if ( $this->_sFormId === null ) {
02937             $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02938             oxSession::setVar( 'sessionuformid', $this->_sFormId );
02939         }
02940 
02941         return $this->_sFormId;
02942     }
02943 
02949     public function canAcceptFormData()
02950     {
02951         if ( $this->_blCanAcceptFormData === null ) {
02952             $this->_blCanAcceptFormData = false;
02953 
02954             $sFormId = oxConfig::getParameter( "uformid" );
02955             $sSessionFormId = oxSession::getVar( "sessionuformid" );
02956 
02957             // testing if form and session ids matches
02958             if ( $sFormId && $sFormId === $sSessionFormId ) {
02959                 $this->_blCanAcceptFormData = true;
02960             }
02961 
02962             // regenerating form data
02963             $this->getFormId();
02964         }
02965         return $this->_blCanAcceptFormData;
02966     }
02967 
02973     public function getPromoFinishedList()
02974     {
02975         if (isset($this->_oPromoFinishedList)) {
02976             return $this->_oPromoFinishedList;
02977         }
02978         $this->_oPromoFinishedList = oxNew( 'oxActionList' );
02979         $this->_oPromoFinishedList->loadFinishedByCount(2);
02980         return $this->_oPromoFinishedList;
02981     }
02982 
02988     public function getPromoCurrentList()
02989     {
02990         if (isset($this->_oPromoCurrentList)) {
02991             return $this->_oPromoCurrentList;
02992         }
02993         $this->_oPromoCurrentList = oxNew( 'oxActionList' );
02994         $this->_oPromoCurrentList->loadCurrent();
02995         return $this->_oPromoCurrentList;
02996     }
02997 
03003     public function getPromoFutureList()
03004     {
03005         if (isset($this->_oPromoFutureList)) {
03006             return $this->_oPromoFutureList;
03007         }
03008         $this->_oPromoFutureList = oxNew( 'oxActionList' );
03009         $this->_oPromoFutureList->loadFutureByCount(2);
03010         return $this->_oPromoFutureList;
03011     }
03012 
03018     public function getShowPromotionList()
03019     {
03020         if (isset($this->_blShowPromotions)) {
03021             return $this->_blShowPromotions;
03022         }
03023         $this->_blShowPromotions = false;
03024         if (oxNew('oxActionList')->areAnyActivePromotions()) {
03025             $this->_blShowPromotions = ( count( $this->getPromoFinishedList() ) + count( $this->getPromoCurrentList() ) + count( $this->getPromoFutureList() ) ) > 0;
03026         }
03027         return $this->_blShowPromotions;
03028     }
03029 
03035     public function isEnabledPrivateSales()
03036     {
03037         if ( $this->_blEnabledPrivateSales === null ) {
03038             $this->_blEnabledPrivateSales = (bool) $this->getConfig()->getConfigParam( 'blPsLoginEnabled' );
03039             if ( $this->_blEnabledPrivateSales && ( $blCanPreview = oxUtils::getInstance()->canPreview() ) !== null ) {
03040                 $this->_blEnabledPrivateSales = !$blCanPreview;
03041             }
03042         }
03043         return $this->_blEnabledPrivateSales;
03044     }
03045 
03051     public function getTagCloudManager()
03052     {
03053         if ( $this->_blShowTagCloud ) {
03054             return oxNew( "oxTagCloud" );
03055         } else {
03056             return false;
03057         }
03058     }
03059 
03065     public function getFieldValidationErrors()
03066     {
03067         return oxInputValidator::getInstance()->getFieldValidationErrors();
03068     }
03069 
03075     public function getBreadCrumb()
03076     {
03077         return null;
03078     }
03079 
03087     public function setRootCatChanged( $blRootCatChanged )
03088     {
03089         $this->_blRootCatChanged = $blRootCatChanged;
03090     }
03091 
03097     public function isRootCatChanged()
03098     {
03099         return $this->_blRootCatChanged;
03100     }
03101 
03107     public function getInvoiceAddress()
03108     {
03109         if ( $this->_aInvoiceAddress == null ) {
03110             $aAddress = oxConfig::getParameter( 'invadr');
03111             if ( $aAddress ) {
03112                 $this->_aInvoiceAddress = $aAddress;
03113             }
03114         }
03115         return $this->_aInvoiceAddress;
03116     }
03117 
03123     public function getDeliveryAddress()
03124     {
03125         if ( $this->_aDeliveryAddress == null ) {
03126             $aAddress = oxConfig::getParameter( 'deladr');
03127             if ( $aAddress ) {
03128                 $this->_aDeliveryAddress = $aAddress;
03129             }
03130         }
03131         return $this->_aDeliveryAddress;
03132     }
03133 
03141     public function setInvoiceAddress( $aAddress )
03142     {
03143         $this->_aInvoiceAddress = $aAddress;
03144     }
03145 
03151     public function getActiveUsername()
03152     {
03153         if ( $this->_sActiveUsername == null ) {
03154             $this->_sActiveUsername = false;
03155             $sUsername = oxConfig::getParameter( 'lgn_usr' );
03156             if ( $sUsername ) {
03157                 $this->_sActiveUsername = $sUsername;
03158             } elseif ( $oUser = $this->getUser() ) {
03159                 $this->_sActiveUsername = $oUser->oxuser__oxusername->value;
03160             }
03161         }
03162         return $this->_sActiveUsername;
03163     }
03164 
03170     public function getWishlistUserId()
03171     {
03172         return oxConfig::getParameter( 'wishid' );
03173     }
03174 
03180     public function getSearchCatId()
03181     {
03182     }
03183 
03189     public function getSearchVendor()
03190     {
03191     }
03192 
03198     public function getSearchManufacturer()
03199     {
03200     }
03201 
03207     public function getLastProducts()
03208     {
03209 
03210     }
03211 
03217     public function getNewBasketItemMsgType()
03218     {
03219         return (int) $this->getConfig()->getConfigParam( "iNewBasketItemMessage" );
03220     }
03221 
03227     public function showTags()
03228     {
03229         return (bool) $this->getConfig()->getConfigParam( "blShowTags" );
03230     }
03231 }