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             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
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         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02225         $iActPage = $this->getActPage();
02226         $pageNavigation->actPage   = $iActPage + 1;
02227         $sUrl = $this->generatePageNavigationUrl();
02228 
02229         if ( $iPositionCount == 0 || ($iPositionCount >= $pageNavigation->NrOfPages) ) {
02230              $iStartNo = 2;
02231              $iFinishNo = $pageNavigation->NrOfPages;
02232              $bStart = false;
02233              $bFinish =false;
02234         } else {
02235             $iTmpVal = $iPositionCount - 3;
02236             $iTmpVal2 = floor( ( $iPositionCount - 4 ) / 2 );
02237 
02238             // actual page is at the start
02239             if ( $pageNavigation->actPage <= $iTmpVal ) {
02240                 $iStartNo = 2;
02241                 $iFinishNo = $iTmpVal + 1;
02242                 $bStart = false;
02243                 $bFinish = true;
02244             // actual page is at the end
02245             } elseif ( $pageNavigation->actPage >= $pageNavigation->NrOfPages - $iTmpVal ) {
02246                 $iStartNo = $pageNavigation->NrOfPages - $iTmpVal;
02247                 $iFinishNo = $pageNavigation->NrOfPages - 1;
02248                 $bStart = true;
02249                 $bFinish = false;
02250             // actual page is in the midle
02251             } else {
02252                 $iStartNo = $pageNavigation->actPage - $iTmpVal2;
02253                 $iFinishNo = $pageNavigation->actPage + $iTmpVal2;
02254                 $bStart = true;
02255                 $bFinish = true;
02256             }
02257         }
02258 
02259         if ( $iActPage > 0) {
02260             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02261         }
02262 
02263         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02264             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02265         }
02266 
02267         if ( $pageNavigation->NrOfPages > 1 ) {
02268 
02269             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02270 
02271                 if ( $i == 1 || $i == $pageNavigation->NrOfPages || ( $i >= $iStartNo && $i <= $iFinishNo ) ) {
02272                     $page = new Oxstdclass();
02273                     $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02274                     $page->selected = ( $i == $pageNavigation->actPage ) ? 1 : 0;
02275                     $pageNavigation->changePage[$i] = $page;
02276                 }
02277             }
02278 
02279             // first/last one
02280             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02281             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02282         }
02283 
02284         stopProfile('generatePageNavigation');
02285 
02286         return $pageNavigation;
02287     }
02288 
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 }