oxview.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxView extends oxSuperCfg
00008 {
00014     protected $_oaComponents = array();
00015 
00021     protected $_aViewData = array();
00022 
00028     protected $_sClassLocation = null;
00029 
00035     protected $_sThisAction = null;
00036 
00042     protected $_oParent = null;
00043 
00049     protected $_blIsOrderStep = false;
00050 
00056     protected $_blIsComponent = false;
00057 
00063     protected $_oActCategory = null;
00064 
00070     protected $_oActVendor = null;
00071 
00077     protected $_oActSearch = null;
00078 
00084     protected $_sThisTemplate = null;
00085 
00091     protected $_aComponentNames = array();
00092 
00098     protected $_blIsCallForCache = false;
00099 
00105     protected $_sViewId = null;
00106 
00112     protected $_sListType = null;
00113 
00119     protected $_sCategoryId = null;
00120 
00126     protected $_sClass = null;
00127 
00133     protected $_sFnc = null;
00134 
00140     protected static $_blExecuted = false;
00141 
00146     protected $_oClickCat = null;
00147 
00152     protected $_sAdditionalParams = null;
00153 
00158     protected $_blShowSorting = false;
00159 
00164     protected $_blShowRightBasket = null;
00165 
00170     protected $_blShowLeftBasket = null;
00171 
00176     protected $_blShowTopBasket = null;
00177 
00182     protected $_blLoadCurrency = null;
00183 
00188     protected $_blLoadVendorTree = null;
00189 
00194     protected $_blDontShowEmptyCats = null;
00195 
00200     protected $_sTrustedShopId = null;
00201 
00206     protected $_blLoadLanguage = null;
00207 
00212     protected $_blShowTopCatNav = null;
00213 
00218     protected $_iTopCatNavItmCnt = null;
00219 
00224     protected $_sCharSet = null;
00225 
00230     protected $_sVersion = null;
00231 
00236     protected $_blDemoVersion = null;
00237 
00242     protected $_blDemoShop = null;
00243 
00248     protected $_aRssLinks = null;
00249 
00254     protected $_blActiveSorting = null;
00255 
00260     protected $_sListOrderBy = null;
00261 
00266     protected $_sListOrderDir = null;
00267 
00272     protected $_sMetaDescription = null;
00273 
00278     protected $_sMetaKeywords = null;
00279 
00284     protected $_oActCurrency = null;
00285 
00290     protected $_iCompItemsCnt = null;
00291 
00296     protected $_sWishlistName = null;
00297 
00302     protected $_aMenueList = null;
00303 
00310     protected $_iViewIndexState = 0;
00311 
00316     protected $_iNewsStatus = null;
00317 
00322     protected $_sShopLogo = null;
00323 
00329     public function init()
00330     {
00331         // setting current view class name
00332         $this->_sThisAction = strtolower( get_class( $this ) );
00333 
00334         if ( !$this->_blIsComponent ) {
00335             // storing current view
00336 
00337             $blInit = true;
00338 
00339 
00340             // init all components if there are any
00341             foreach ( $this->_aComponentNames as $sComponentName => $blNotCacheable ) {
00342                 // do not override initiated components
00343                 if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00344                     // component objects MUST be created to support user called functions
00345                     $oComponent = oxNew( $sComponentName );
00346                     $oComponent->setParent( $this );
00347                     $oComponent->setThisAction( $sComponentName );
00348                     $this->_oaComponents[$sComponentName] = $oComponent;
00349                 }
00350 
00351                 // do we really need to initiate them ?
00352                 if ( $blInit ) {
00353                     $this->_oaComponents[$sComponentName]->init();
00354 
00355                     // executing only is view does not have action method
00356                     if ( !method_exists( $this, $this->getFncName() ) ) {
00357                         $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00358                     }
00359                 }
00360             }
00361 
00362             // assume that cached components does not affect this method ...
00363             $this->addGlobalParams();
00364 
00365             // enable sorting ?
00366             if ( $this->showSorting() ) {
00367                 $this->prepareSortColumns();
00368             }
00369             $this->_aViewData['showsorting']    = $this->isSortingActive();
00370             $this->_aViewData["allsortcolumns"] = $this->getSortColumns();
00371             $this->_aViewData['listorderby']    = $this->getListOrderBy();
00372             $this->_aViewData['listorder']      = $this->getListOrderDirection();
00373         }
00374     }
00375 
00381     public function showSorting()
00382     {
00383         return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00384     }
00385 
00392     public function getViewId()
00393     {
00394         if ( $this->_sViewId ) {
00395             return $this->_sViewId;
00396         }
00397 
00398         //$iLang = (int) oxConfig::getParameter( 'language' );
00399         $iLang = oxLang::getInstance()->getBaseLanguage();
00400 
00401         $iCur  = (int) oxConfig::getParameter( 'currency' );
00402 
00403 
00404             $this->_sViewId =  "ox|$iLang|$iCur";
00405 
00406         return $this->_sViewId;
00407     }
00408 
00409 
00416     public function getViewResetId()
00417     {
00418         if ( $this->_sViewResetID ) {
00419             return $this->_sViewResetID;
00420         }
00421 
00422         $sCategoryID = $this->_oClickCat?$this->_oClickCat->getId():'-';
00423         $this->_sViewResetID =  "ox|cid={$sCategoryID}|cl=".$this->getClassName();
00424         return $this->_sViewResetID;
00425     }
00426 
00427 
00436     public function render()
00437     {
00438         $this->_aViewData['meta_description'] = $this->getMetaDescription();
00439         $this->_aViewData['meta_keywords']    = $this->getMetaKeywords();
00440 
00441         // only if this is no component
00442         if ( !$this->_blIsComponent ) {
00443             foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
00444                 $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
00445             }
00446 
00447             // set url and form navigation string
00448             $this->_setNavigationParams();
00449         }
00450 
00451         return $this->_sThisTemplate;
00452     }
00453 
00467     public function addGlobalParams( $oShop = null)
00468     {
00469         $mySession  = $this->getSession();
00470         $myConfig   = $this->getConfig();
00471 
00472         //deprecated template vars
00473 
00474         $this->_aViewData['isnewsletter'] = true;
00475         $this->_aViewData['isvarianten'] = true;
00476         $this->_aViewData['isreview'] = true;
00477         $this->_aViewData['isaddsales'] = true;
00478         $this->_aViewData['isvoucher'] = true;
00479         $this->_aViewData['isdtaus'] = true;
00480         $this->_aViewData['ispricealarm'] = true;
00481         $this->_aViewData['iswishlist'] = true;
00482         $this->_aViewData['isipayment'] = true;
00483         $this->_aViewData['istrusted'] = true;
00484         $this->_aViewData['isfiltering'] = true;
00485         $this->_aViewData['isgooglestats'] = true;
00486         $this->_aViewData['iswishlist'] = true;
00487         $this->_aViewData['isstaffelpreis'] = true;
00488 
00489         // by default we allways display newsletter bar
00490         $this->_iNewsStatus = 1;
00491 
00492         $this->_aViewData['charset']       = $this->getCharSet();
00493         $this->_aViewData['version']       = $this->getShopVersion();
00494         $this->_aViewData['edition']       = $this->getShopEdition();
00495         $this->_aViewData['fulledition']   = $this->getShopFullEdition();
00496         $this->_aViewData['isdemoversion'] = $this->isDemoVersion();
00497 
00498         $this->_aViewData['isfiltering'] = true;
00499 
00500         // show baskets
00501         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
00502         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
00503         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
00504 
00505         // allow currency swiching
00506         $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
00507 
00508         // show/hide vendors
00509         $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
00510 
00511         // show/hide empty categories
00512         $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
00513 
00514         $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
00515 
00516         // used for compatibility with older templates
00517         $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
00518         $this->_aViewData['urlsign']    = '&';
00519         $this->_aViewData['wishid']    = oxConfig::getParameter( 'wishid' );
00520         $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
00521 
00522         $this->_aViewData['sListType'] = $this->getListType();
00523 
00524         // set additional params
00525         $this->_setAdditionalParams();
00526         $this->_aViewData["additionalparams"] = $this->getAdditionalParams();
00527 
00528         $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
00529 
00530         // new navigation ?
00531         $this->_aViewData['showtopcatnavigation']   = $this->showTopCatNavigation();
00532         $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
00533 
00534         $this->_setNrOfArtPerPage();
00535 
00536         // assigning shop to view config ..
00537         $oViewConf = $this->getViewConfig();
00538         if ( $oShop ) {
00539             $oViewConf->setViewShop( $oShop, $this->_aViewData );
00540         }
00541 
00542         //sending all view to smarty
00543         $this->_aViewData['oView'] = $this;
00544         $this->_aViewData['oViewConf'] = $this->getViewConfig();
00545 
00546         // @deprecated
00547         $this->_aViewData['shop'] = $this->getViewConfig();
00548 
00549         return $oViewConf;
00550     }
00551 
00560     public function addRssFeed($sTitle, $sUrl, $key = null)
00561     {
00562         if (!is_array($this->_aRssLinks)) {
00563             $this->_aRssLinks = array();
00564         }
00565         if ($key === null) {
00566             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
00567         } else {
00568             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
00569         }
00570 
00571         $this->_aViewData['rsslinks'] = $this->getRssLinks();
00572     }
00573 
00582     public function addTplParam( $sPara, $sValue )
00583     {
00584         $this->_aViewData[$sPara] = $sValue;
00585     }
00586 
00601     public function prepareSortColumns()
00602     {
00603         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
00604         if ( count( $aSortColumns ) > 0 ) {
00605 
00606             $this->_blActiveSorting = true;
00607             $this->_aSortColumns = $aSortColumns;
00608 
00609             $sCnid = oxConfig::getParameter( 'cnid' );
00610 
00611             $sSortBy  = oxConfig::getParameter( 'listorderby' );
00612             $sSortDir = oxConfig::getParameter( 'listorder' );
00613 
00614             if ( !$sSortBy && $aSorting = $this->getSorting( $sCnid ) ) {
00615                 $sSortBy  = $aSorting['sortby'];
00616                 $sSortDir = $aSorting['sortdir'];
00617             }
00618 
00619             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
00620                  $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
00621 
00622                 $this->_sListOrderBy  = $sSortBy;
00623                 $this->_sListOrderDir = $sSortDir;
00624 
00625                 // caching sorting config
00626                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
00627             }
00628         }
00629     }
00630 
00640     protected function _setAdditionalParams()
00641     {
00642         // #1018A
00643         $this->_sAdditionalParams = 'cl='.$this->getConfig()->getActiveView()->getClassName();
00644 
00645         // #1834M - specialchar search
00646         $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
00647         if ( isset( $sSearchParamForLink ) ) {
00648             $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
00649         }
00650 
00651         if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
00652             $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
00653         }
00654         if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
00655             $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
00656         }
00657         if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
00658             $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
00659         }
00660     }
00661 
00667     public function getViewConfig()
00668     {
00669         if ( $this->_oViewConf === null ) {
00670             $this->_oViewConf = oxNew( 'oxViewConfig' );
00671         }
00672 
00673         return $this->_oViewConf;
00674     }
00675 
00681     protected function _setNrOfArtPerPage()
00682     {
00683         $myConfig  = $this->getConfig();
00684         $aViewData = array();
00685 
00686         //setting default values to avoid possible errors showing article list
00687         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
00688         $iNrofCatArticles = ( $iNrofCatArticles) ? $iNrofCatArticles : 10;
00689 
00690         // checking if all needed data is set
00691         $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
00692         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
00693             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
00694         } else {
00695             $iNrofCatArticles = $aNrofCatArticles[0];
00696         }
00697 
00698         $oViewConf = $this->getViewConfig();
00699         //value from user input
00700         if ( ( $iUserArtPerPage = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
00701             // performing floor() to skip such variants as 7.5 etc
00702             $iNrofArticles = ( $iUserArtPerPage > 100 ) ? 10 : abs( $iUserArtPerPage );
00703             // M45 Possibility to push any "Show articles per page" number parameter
00704             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
00705             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
00706             oxSession::setVar( '_artperpage', $iNrofCatArticles );
00707         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
00708             // M45 Possibility to push any "Show articles per page" number parameter
00709             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
00710             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
00711             $iNrofCatArticles = $iSessArtPerPage;
00712         } else {
00713             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
00714         }
00715 
00716         //setting number of articles per page to config value
00717         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
00718 
00719         $this->_aViewData = array_merge( $this->_aViewData, $aViewData );
00720     }
00721 
00727     protected function _getSeoObjectId()
00728     {
00729     }
00730 
00740     public function setMetaDescription ( $aInput, $iLength = 1024, $blDescTag = false )
00741     {
00742         if ( oxUtils::getInstance()->seoIsActive() && ( $sOxid = $this->_getSeoObjectId() ) ) {
00743 
00744             // found special meta description ?
00745             if ( ( $sDescription = oxSeoEncoder::getInstance()->getMetaData( $sOxid , 'oxdescription' ) ) ) {
00746                 return $this->_sMetaDescription = $sDescription;
00747             }
00748 
00749         }
00750 
00751         return $this->_sMetaDescription = $this->_prepareMetaDescription( $aInput, $iLength, $blDescTag );
00752     }
00753 
00766     protected function _prepareMetaDescription( $aInput, $iLength = 1024, $blDescTag = false )
00767     {
00768         /* performance - we dont need a huge amount of initial text.
00769            assume that effective text may be double longer than $iLength
00770            and simple turncate it
00771         */
00772 
00773         $sString = $aInput;
00774         if ( is_array( $aInput ) ) {
00775             $sString = implode( '  ', $aInput );
00776         }
00777 
00778         if ( $iLength != -1 ) {
00779             $iELength = ( $iLength * 2 );
00780             $sString = substr( $sString, 0, $iELength );
00781         }
00782 
00783         // decoding html entities
00784         $sString = html_entity_decode( $sString );
00785         // stripping HTML tags
00786         $sString = strip_tags( $sString );
00787 
00788         // removing some special chars
00789         $aRemoveChars = array( "\"", "'", ".", ":", "!", "?", "\n", "\r", "\t", "\x95", "\xA0", ";" );
00790         $sString = str_replace( $aRemoveChars, ' ', $sString );
00791 
00792         // removing duplicat words
00793         if ( !$blDescTag ) {
00794             $sString = $this->_removeDuplicatedWords( $sString );
00795         }
00796 
00797         // some special cases
00798         $sString = str_replace( ' ,', ',', $sString );
00799         $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
00800         $sString = preg_replace( $aPattern, ',', $sString );;
00801         $sString = oxUtilsString::getInstance()->minimizeTruncateString( $sString, $iLength );
00802 
00803         return $sString;
00804     }
00805 
00813     public function setMetaKeywords( $aInput )
00814     {
00815         if ( oxUtils::getInstance()->seoIsActive() && ( $sOxid = $this->_getSeoObjectId() )  ) {
00816             // found special meta description ?
00817             if ( ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, 'oxkeywords' ) ) ) {
00818                 return $this->_sMetaKeywords = $sKeywords;
00819             }
00820         }
00821 
00822         return $this->_sMetaKeywords = $this->_prepareMetaKeyword( $aInput );
00823     }
00824 
00833     protected function _prepareMetaKeyword( $aInput )
00834     {
00835         $sString = $this->_prepareMetaDescription( $aInput, -1, true );
00836         $sString = $this->_removeDuplicatedWords( $sString );
00837         // removing in admin defined strings
00838         $aSkipTags = $this->getConfig()->getConfigParam( 'aSkipTags' );
00839         if ( is_array( $aSkipTags ) && $sString ) {
00840             foreach ( $aSkipTags as $sSkip ) {
00841                 $aPattern = array( '/\W'.$sSkip.'\W/i', '/^'.$sSkip.'\W/i', '/\"'.$sSkip.'$/i' );
00842                 $sString  = preg_replace( $aPattern, '', $sString);
00843             }
00844         }
00845         return $sString;
00846     }
00847 
00855     protected function _removeDuplicatedWords( $aInput )
00856     {
00857         if ( is_array( $aInput ) ) {
00858             $aStrings = $aInput;
00859         } else {
00860             //is String
00861             $aStrings = preg_split( "/[\s,]+/", $aInput );
00862         }
00863 
00864         foreach ( $aStrings as $iANum => $sAString ) {
00865             foreach ( $aStrings as $iBNum => $sBString ) {
00866                 // duplicates
00867                 if ( $sAString && $iANum != $iBNum && !strcasecmp( $sAString, $sBString ) ) {
00868                     unset( $aStrings[$iANum] );
00869                 }
00870             }
00871         }
00872 
00873         return implode( ', ', $aStrings );
00874     }
00875 
00881     protected function _setNavigationParams()
00882     {
00883         $aParams = $this->_getNavigationParams();
00884 
00885         $aNavString['url']  = '';
00886         $aNavString['form'] = '';
00887 
00888         foreach ( $aParams as $sKey => $sValue ) {
00889             if ( $sValue ) {
00890 
00891                 $aNavString['url'] .= '&amp;'.$sKey.'='.rawurlencode( $sValue );
00892 
00893                 // get searchparam for form in different way
00894                 if ( $sKey == 'searchparam' )
00895                     $sValue = oxConfig::getParameter( 'searchparam' );
00896 
00897                 $aNavString['form'] .= "<input type=\"hidden\" name=\"$sKey\" value=\"$sValue\">\n";
00898             }
00899         }
00900 
00901         $oViewConf = $this->getViewConfig();
00902         $oViewConf->setViewConfigParam( 'navurlparams', $aNavString['url'] );
00903         $oViewConf->setViewConfigParam( 'navformparams', $aNavString['form'] );
00904     }
00905 
00911     protected function _getNavigationParams()
00912     {
00913         $aParams['cnid']     = $this->getCategoryId();
00914         $aParams['listtype'] = $this->getListType();
00915 
00916         $aParams['recommid']     = oxConfig::getParameter( 'recommid' );
00917         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
00918         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
00919         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
00920         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
00921         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', 1 );
00922 
00923         return $aParams;
00924     }
00925 
00931     public function getListType()
00932     {
00933         if ( $this->_sListType == null && ( $sListType = oxConfig::getParameter( 'listtype' ) ) ) {
00934             $this->_sListType = $sListType;
00935         }
00936         return $this->_sListType;
00937     }
00938 
00946     public function setListType( $sType )
00947     {
00948         $this->_sListType = $sType;
00949     }
00950 
00956     public function getCategoryId()
00957     {
00958         if ( $this->_sCategoryId == null && ( $sCatId = oxConfig::getParameter( 'cnid' ) ) ) {
00959             $this->_sCategoryId = $sCatId;
00960         }
00961 
00962         return $this->_sCategoryId;
00963     }
00964 
00972     public function setCategoryId( $sCategoryId )
00973     {
00974         $this->_sCategoryId = $sCategoryId;
00975     }
00976 
00982     public function getTemplateName()
00983     {
00984         return $this->_sThisTemplate;
00985     }
00986 
00994     public function setClassName( $sClassName )
00995     {
00996         $this->_sClass = $sClassName;
00997     }
00998 
01004     public function getClassName()
01005     {
01006         return $this->_sClass;
01007     }
01008 
01016     public function setFncName( $sFncName )
01017     {
01018         $this->_sFnc = $sFncName;
01019     }
01020 
01026     public function getFncName()
01027     {
01028         return $this->_sFnc;
01029     }
01030 
01038     public function setComponents( $aComponents = null )
01039     {
01040         $this->_oaComponents = $aComponents;
01041     }
01042 
01048     public function getComponents()
01049     {
01050         return $this->_oaComponents;
01051     }
01052 
01060     public function setViewData( $aViewData = null )
01061     {
01062         $this->_aViewData = $aViewData;
01063     }
01064 
01070     public function getViewData()
01071     {
01072         return $this->_aViewData;
01073     }
01074 
01082     public function getViewDataElement( $sParamId = null )
01083     {
01084         if ( $sParamId && isset( $this->_aViewData[$sParamId] ) ) {
01085             return $this->_aViewData[$sParamId];
01086         }
01087     }
01088 
01096     public function setClassLocation( $sClassLocation = null )
01097     {
01098         $this->_sClassLocation = $sClassLocation;
01099     }
01105     public function getClassLocation()
01106     {
01107         return $this->_sClassLocation;
01108     }
01109 
01117     public function setThisAction( $sThisAction = null )
01118     {
01119         $this->_sThisAction = $sThisAction;
01120     }
01121 
01127     public function getThisAction()
01128     {
01129         return $this->_sThisAction;
01130     }
01131 
01139     public function setParent( $oParent = null )
01140     {
01141         $this->_oParent = $oParent;
01142     }
01143 
01149     public function getParent()
01150     {
01151         return $this->_oParent;
01152     }
01153 
01161     public function setIsOrderStep( $blIsOrderStep = null )
01162     {
01163         $this->_blIsOrderStep = $blIsOrderStep;
01164     }
01165 
01171     public function getIsOrderStep()
01172     {
01173         return $this->_blIsOrderStep;
01174     }
01175 
01183     public function setIsComponent( $blIsComponent = null )
01184     {
01185         $this->_blIsComponent = $blIsComponent;
01186     }
01187 
01193     public function getIsComponent()
01194     {
01195         return $this->_blIsComponent;
01196     }
01197 
01207     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01208     {
01209         $aSorting = oxSession::getVar( 'aSorting' );
01210         $aSorting[$sCnid]['sortby']  = $sSortBy;
01211         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01212 
01213         oxSession::setVar( 'aSorting', $aSorting );
01214     }
01215 
01223     public function getSorting( $sCnid )
01224     {
01225         $aSorting = oxSession::getVar( 'aSorting' );
01226         if ( isset( $aSorting[$sCnid] ) ) {
01227             return $aSorting[$sCnid];
01228         }
01229     }
01230 
01238     public function getSortingSql( $sCnid )
01239     {
01240         $aSorting = $this->getSorting( $sCnid );
01241         if ( is_array( $aSorting ) ) {
01242             return implode( " ", $aSorting );
01243         }
01244     }
01245 
01253     public function setIsCallForCache( $blIsCallForCache = null )
01254     {
01255         $this->_blIsCallForCache = $blIsCallForCache;
01256     }
01257 
01263     public function getIsCallForCache()
01264     {
01265         return $this->_blIsCallForCache;
01266     }
01267 
01277     public function executeFunction( $sFunction )
01278     {
01279         $sNewAction = null;
01280 
01281         // execute
01282         if ( $sFunction && !self::$_blExecuted ) {
01283             if ( method_exists( $this, $sFunction ) ) {
01284 
01285 
01286                 $sNewAction = $this->$sFunction();
01287                 self::$_blExecuted = true;
01288             }
01289 
01290             // was not executed on any level ?
01291             if ( !$this->_blIsComponent && !self::$_blExecuted ) {
01292                 $oEx = oxNew( 'oxSystemComponentException' );
01293                 $oEx->setMessage( 'EXCEPTION_SYSTEMCOMPONENT_FUNCTIONNOTFOUND' );
01294                 $oEx->setComponent( $sFunction );
01295                 throw $oEx;
01296             }
01297         }
01298 
01299         $this->_executeNewAction( $sNewAction );
01300     }
01301 
01312     protected function _executeNewAction( $sNewAction )
01313     {
01314         if ( $sNewAction ) {
01315             $myConfig  = $this->getConfig();
01316 
01317             // page parameters is the part which goes after '?'
01318             $aParams = explode( '?', $sNewAction );
01319 
01320             // action parameters is the part before '?'
01321             $sPageParams = isset( $aParams[1] )?$aParams[1]:null;
01322 
01323             // looking for function name
01324             $aParams    = explode( '/', $aParams[0] );
01325             $sClassName = $aParams[0];
01326 
01327             // looking for component name
01328             $aParams    = explode( '@', $aParams[0] );
01329             $sCmpName   = ( count( $aParams ) > 1 )?$aParams[0]:null;
01330             $sClassName = ( $sCmpName !== null )?$aParams[1]:$sClassName;
01331 
01332             // building redirect path ...
01333             $sHeader  = ( $sClassName )?"cl=$sClassName&":'';  // adding view name
01334             $sHeader .= ( $sPageParams )?"$sPageParams&":'';   // adding page params
01335             $sHeader .= $this->getSession()->sid();       // adding session Id
01336 
01337             // choosing URL to redirect
01338             $sURL = $myConfig->isSsl()?$myConfig->getSslShopUrl():$myConfig->getShopUrl();
01339 
01340             // different redirect URL in SEO mode
01341             if ( $this->isAdmin() ) {
01342                 $sURL .= $myConfig->getConfigParam( 'sAdminDir' ) . '/';
01343             }
01344 
01345             $sURL = "{$sURL}index.php?{$sHeader}";
01346 
01347             //#M341 do not add redirect parameter
01348             oxUtils::getInstance()->redirect( $sURL, (bool) oxConfig::getParameter( 'redirected' ) );
01349         }
01350     }
01351 
01357     public function getAdditionalParams()
01358     {
01359         return $this->_sAdditionalParams;
01360     }
01361 
01368     public function noIndex()
01369     {
01370         if ( oxConfig::getParameter( 'cur' ) ) {
01371             return $this->_iViewIndexState = 1;
01372         }
01373 
01374         switch ( oxConfig::getParameter( 'fnc' ) ) {
01375             case 'tocomparelist':
01376             case 'tobasket':
01377                 return $this->_iViewIndexState = 1;
01378             default: break;
01379         }
01380         return $this->_iViewIndexState;
01381     }
01382 
01388     public function getTitleSuffix()
01389     {
01390         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01391     }
01392 
01399     public function getTitlePrefix()
01400     {
01401         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01402     }
01403 
01410     protected function getSubject()
01411     {
01412         return null;
01413     }
01414 
01420     public function getDynUrlParams()
01421     {
01422         $sRet = '';
01423         $sListType = $this->getListType();
01424 
01425         switch ($sListType) {
01426             default:
01427                 break;
01428             case 'search':
01429                 $sRet .= "&amp;listtype={$sListType}";
01430                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01431                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01432                 }
01433 
01434                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01435                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01436                 }
01437                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01438                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01439                 }
01440                break;
01441         }
01442 
01443         return $sRet;
01444     }
01445 
01453     public function getLink($iLang = null)
01454     {
01455         if ( !isset( $iLang ) ) {
01456             $iLang = oxLang::getInstance()->getBaseLanguage();
01457         }
01458 
01459         $oDisplayObj = null;
01460         if ( oxUtils::getInstance()->seoIsActive() ) {
01461             $blTrySeo = true;
01462             $oDisplayObj = $this->getSubject();
01463         }
01464 
01465         if ( $oDisplayObj ) {
01466             return $oDisplayObj->getLink( $iLang );
01467         } else {
01468             $myConfig = oxConfig::getInstance();
01469 
01470             if ( $blTrySeo ) {
01471                 $oEncoder = oxSeoEncoder::getInstance();
01472                 if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL() . $this->_getSeoRequestParams(), $iLang ) ) ) {
01473                     return $sSeoUrl;
01474                 }
01475             }
01476 
01477             $sForceLangChange = '';
01478             if ( oxLang::getInstance()->getBaseLanguage() != $iLang ) {
01479                 $sForceLangChange = "&amp;lang={$iLang}";
01480             }
01481 
01482             // fallback to old non seo url
01483             return $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams() . $sForceLangChange;
01484         }
01485     }
01486 
01493     public function getSimilarRecommLists()
01494     {
01495         return null;
01496     }
01497 
01505     protected function _getRequestParams( $blAddPageNr  = true )
01506     {
01507 
01508         $sClass = $this->getClassName();
01509         $sFnc   = $this->getFncName();
01510 
01511         // #921 S
01512         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01513         if ( in_array( $sFnc, $aFnc ) ) {
01514             $sFnc = '';
01515         }
01516 
01517         // #680
01518         $sURL = "cl={$sClass}";
01519         if ( $sFnc ) {
01520             $sURL       .= "&amp;fnc={$sFnc}";
01521         }
01522         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01523             $sURL       .= "&amp;cnid={$sVal}";
01524         }
01525         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01526             $sURL .= "&amp;anid={$sVal}";
01527         }
01528 
01529         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01530             $sURL       .= "&amp;page={$sVal}";
01531         }
01532 
01533         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01534             $sURL       .= "&amp;tpl={$sVal}";
01535         }
01536 
01537         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01538         // don't include page number for navigation
01539         // it will be done in oxubase::generatePageNavigation
01540         if ( $blAddPageNr && $iPgNr > 0 ) {
01541             $sURL .= "&amp;pgNr={$iPgNr}";
01542         }
01543 
01544         // #1184M - specialchar search
01545         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01546             $sURL .= "&amp;searchparam={$sVal}";
01547         }
01548 
01549         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01550             $sURL .= "&amp;searchcnid={$sVal}";
01551         }
01552 
01553         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01554             $sURL .= "&amp;searchvendor={$sVal}";
01555         }
01556 
01557         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01558             $sUrl .= "&amp;searchrecomm={$sVal}";
01559         }
01560 
01561         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01562             $sUrl .= "&amp;searchtag={$sVal}";
01563         }
01564 
01565         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01566             $sURL .= "&amp;recommid={$sVal}";
01567         }
01568 
01569         return $sURL;
01570     }
01571 
01577     protected function _getSeoRequestParams()
01578     {
01579 
01580         $sClass = $this->getClassName();
01581         $sFnc   = $this->getFncName();
01582 
01583         // #921 S
01584         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01585         if ( in_array( $sFnc, $aFnc ) ) {
01586             $sFnc = '';
01587         }
01588 
01589         // #680
01590         $sURL = "cl={$sClass}";
01591         if ( $sFnc ) {
01592             $sURL       .= "&amp;fnc={$sFnc}";
01593         }
01594         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01595             $sURL       .= "&amp;page={$sVal}";
01596         }
01597 
01598         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01599             $sURL       .= "&amp;tpl={$sVal}";
01600         }
01601 
01602         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01603         if ( $iPgNr > 0 ) {
01604             $sURL .= "&amp;pgNr={$iPgNr}";
01605         }
01606 
01607         return $sURL;
01608     }
01609 
01615     public function showRightBasket()
01616     {
01617         if ( $this->_blShowRightBasket === null ) {
01618             if ( $blShowRightBasket = $this->getConfig()->getConfigParam( 'bl_perfShowRightBasket' ) )  {
01619                 $this->_blShowRightBasket = $blShowRightBasket;
01620             }
01621         }
01622         return $this->_blShowRightBasket;
01623     }
01624 
01632     public function setShowRightBasket( $blShowBasket )
01633     {
01634         $this->_blShowRightBasket = $blShowBasket;
01635     }
01636 
01642     public function showLeftBasket()
01643     {
01644         if ( $this->_blShowLeftBasket === null ) {
01645             if ( $blShowLeftBasket = $this->getConfig()->getConfigParam( 'bl_perfShowLeftBasket' ) ) {
01646                 $this->_blShowLeftBasket = $blShowLeftBasket;
01647             }
01648         }
01649         return $this->_blShowLeftBasket;
01650     }
01651 
01659     public function setShowLeftBasket( $blShowBasket )
01660     {
01661         $this->_blShowLeftBasket = $blShowBasket;
01662     }
01663 
01669     public function showTopBasket()
01670     {
01671         if ( $this->_blShowTopBasket === null ) {
01672             if ( $blShowTopBasket = $this->getConfig()->getConfigParam( 'bl_perfShowTopBasket' ) ) {
01673                 $this->_blShowTopBasket = $blShowTopBasket;
01674             }
01675         }
01676         return $this->_blShowTopBasket;
01677     }
01678 
01686     public function setShowTopBasket( $blShowBasket )
01687     {
01688         $this->_blShowTopBasket = $blShowBasket;
01689     }
01690 
01696     public function loadCurrency()
01697     {
01698         if ( $this->_blLoadCurrency == null ) {
01699             $this->_blLoadCurrency = false;
01700             if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
01701                 $this->_blLoadCurrency = $blLoadCurrency;
01702             }
01703         }
01704         return $this->_blLoadCurrency;
01705     }
01706 
01712     public function loadVendorTree()
01713     {
01714         if ( $this->_blLoadVendorTree == null ) {
01715             $this->_blLoadVendorTree = false;
01716             if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
01717                 $this->_blLoadVendorTree = $blLoadVendorTree;
01718             }
01719         }
01720         return $this->_blLoadVendorTree;
01721     }
01722 
01728     public function dontShowEmptyCategories()
01729     {
01730         if ( $this->_blDontShowEmptyCats == null ) {
01731             $this->_blDontShowEmptyCats = false;
01732             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
01733                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
01734             }
01735         }
01736         return $this->_blDontShowEmptyCats;
01737     }
01738 
01744     public function getTrustedShopId()
01745     {
01746         if ( $this->_sTrustedShopId == null && ( $aTrustedShopIds = $this->getConfig()->getConfigParam( 'iShopID_TrustedShops' ) ) ) {
01747             $iLangId = oxLang::getInstance()->getBaseLanguage();
01748             $this->_sTrustedShopId = $aTrustedShopIds[$iLangId];
01749         }
01750         return $this->_sTrustedShopId;
01751     }
01752 
01758     public function isLanguageLoaded()
01759     {
01760         if ( $this->_blLoadLanguage == null ) {
01761             $this->_blLoadLanguage = false;
01762             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01763                 $this->_blLoadLanguage = $blLoadLanguage;
01764             }
01765         }
01766         return $this->_blLoadLanguage;
01767     }
01768 
01774     public function showTopCatNavigation()
01775     {
01776         if ( $this->_blShowTopCatNav == null ) {
01777             $this->_blShowTopCatNav = false;
01778             if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
01779                 $this->_blShowTopCatNav = $blShowTopCatNav;
01780             }
01781         }
01782         return $this->_blShowTopCatNav;
01783     }
01784 
01790     public function getTopNavigationCatCnt()
01791     {
01792         if ( $this->_iTopCatNavItmCnt == null ) {
01793             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
01794             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
01795         }
01796         return $this->_iTopCatNavItmCnt;
01797     }
01798 
01804     public function getCharSet()
01805     {
01806         if ( $this->_sCharSet == null ) {
01807             $this->_sCharSet = oxLang::getInstance()->translateString( 'charset' );
01808         }
01809         return $this->_sCharSet;
01810     }
01811 
01817     public function getShopVersion()
01818     {
01819         if ( $this->_sVersion == null ) {
01820             $this->_sVersion = $this->getConfig()->getActiveShop()->oxshops__oxversion->value;
01821         }
01822         return $this->_sVersion;
01823     }
01824 
01830     public function getShopEdition()
01831     {
01832         return $this->getConfig()->getActiveShop()->oxshops__oxedition->value;
01833     }
01834 
01840     public function getShopFullEdition()
01841     {
01842         $sEdition = $this->getShopEdition();
01843         $sFullEdition = "Community Edition";
01844         if ($sEdition == "PE")
01845             $sFullEdition = "Professional Edition";
01846 
01847         if ($sEdition == "EE")
01848             $sFullEdition = "Enterprise Edition";
01849 
01850         return $sFullEdition;
01851     }
01852 
01853 
01859     public function isDemoVersion()
01860     {
01861         if ( $this->_blDemoVersion == null ) {
01862             $this->_blDemoVersion = $this->getConfig()->detectVersion() == 1;
01863         }
01864         return $this->_blDemoVersion;
01865     }
01866 
01872     public function isDemoShop()
01873     {
01874         if ( $this->_blDemoShop == null ) {
01875             $this->_blDemoShop = $this->getConfig()->isDemoShop();
01876         }
01877         return $this->_blDemoShop;
01878     }
01879     
01885     public function getRssLinks()
01886     {
01887         return $this->_aRssLinks;
01888     }
01889 
01895     public function isSortingActive()
01896     {
01897         return $this->_blActiveSorting;
01898     }
01899 
01905     public function getSortColumns()
01906     {
01907         return $this->_aSortColumns;
01908     }
01909 
01915     public function getListOrderBy()
01916     {
01917         return $this->_sListOrderBy;
01918     }
01919 
01925     public function getListOrderDirection()
01926     {
01927         return $this->_sListOrderDir;
01928     }
01929 
01935     public function getMetaDescription()
01936     {
01937         return $this->_sMetaDescription;
01938     }
01939 
01945     public function getMetaKeywords()
01946     {
01947         return $this->_sMetaKeywords;
01948     }
01949 
01955     public function getActCurrency()
01956     {
01957         return $this->_oActCurrency;
01958     }
01959 
01967     public function setActCurrency( $oCur )
01968     {
01969         $this->_oActCurrency = $oCur;
01970     }
01971 
01977     public function getCompareItemsCnt()
01978     {
01979         return $this->_iCompItemsCnt;
01980     }
01981 
01989     public function setCompareItemsCnt( $iCount )
01990     {
01991         $this->_iCompItemsCnt = $iCount;
01992     }
01993 
01999     public function getWishlistName()
02000     {
02001         return $this->_sWishlistName;
02002     }
02003 
02011     public function setWishlistName( $sName )
02012     {
02013         $this->_sWishlistName = $sName;
02014     }
02015 
02021     public function getMenueList()
02022     {
02023         return $this->_aMenueList;
02024     }
02025 
02033     public function setMenueList( $aMenue )
02034     {
02035         $this->_aMenueList = $aMenue;
02036     }
02037 
02043     public function getEditTags()
02044     {
02045     }
02046 
02052     public function getRecommSearch()
02053     {
02054         return null;
02055     }
02056 
02062     public function getReviewUserId()
02063     {
02064     }
02065 
02071     public function getPaymentList()
02072     {
02073     }
02074 
02080     public function getActiveRecommList()
02081     {
02082     }
02083 
02089     public function getAccessoires()
02090     {
02091     }
02092 
02098     public function getCrossSelling()
02099     {
02100     }
02101 
02107     public function getSimilarProducts()
02108     {
02109     }
02110 
02116     public function getAlsoBoughtThiesProducts()
02117     {
02118     }
02119 
02125     public function getArticleId()
02126     {
02127     }
02128 
02136     public function setActiveCategory( $oCategory )
02137     {
02138         $this->_oActCategory = $oCategory;
02139     }
02140 
02148     public function getActiveCategory()
02149     {
02150         return $this->_oActCategory;
02151     }
02152 
02158     public function isMoreTagsVisible()
02159     {
02160         return false;
02161     }
02162 
02168     public function getTitle()
02169     {
02170     }
02171 
02177     public function showNewsletter()
02178     {
02179         if ( $this->_iNewsStatus === null) {
02180             return 1;
02181         }
02182         return $this->_iNewsStatus;
02183     }
02184 
02192     public function setShowNewsletter( $blShow )
02193     {
02194         $this->_iNewsStatus = $blShow;
02195     }
02196 
02202     public function getShopLogo()
02203     {
02204         return $this->_sShopLogo;
02205     }
02206 
02214     public function setShopLogo( $sLogo )
02215     {
02216         $this->_sShopLogo = $sLogo;
02217     }
02218 
02219 }

Generated on Thu Dec 4 12:04:57 2008 for OXID eShop CE by  doxygen 1.5.5