Go to the documentation of this file.00001 <?php
00002
00007 class oxView extends oxSuperCfg
00008 {
00014 protected $_aViewData = array();
00015
00021 protected $_sClassLocation = null;
00022
00028 protected $_sThisAction = null;
00029
00035 protected $_oParent = null;
00036
00042 protected $_blIsComponent = false;
00043
00049 protected $_sThisTemplate = null;
00050
00056 protected $_sViewId = null;
00057
00063 protected $_sClass = null;
00064
00070 protected $_sFnc = null;
00071
00077 protected static $_blExecuted = false;
00078
00083 protected $_sTrustedShopId = null;
00084
00089 protected $_sTSExcellenceId = null;
00090
00095 protected $_sCharSet = null;
00096
00101 protected $_sVersion = null;
00102
00107 protected $_blDemoVersion = null;
00108
00113 protected $_blDemoShop = null;
00114
00119 protected $_iNewsStatus = null;
00120
00125 protected $_sShopLogo = null;
00126
00132 protected $_sCategoryId = null;
00133
00138 protected $_oClickCat = null;
00139
00145 protected $_blIsCallForCache = false;
00146
00152 protected $_oViewConf = null;
00153
00154
00160 public function init()
00161 {
00162
00163 $this->_sThisAction = strtolower( get_class( $this ) );
00164
00165 if ( !$this->_blIsComponent ) {
00166
00167 $this->addGlobalParams();
00168 }
00169 }
00170
00178 public function setViewParameters( $aParams = null )
00179 {
00180 $this->_aViewParams = $aParams;
00181 }
00182
00190 public function getViewParameter( $sKey )
00191 {
00192 $sValue = ( isset( $this->_aViewParams[$sKey] ) ) ? $this->_aViewParams[$sKey] : $this->getConfig()->getRequestParameter( $sKey );
00193
00194 return $sValue;
00195 }
00196
00204 public function setIsCallForCache( $blIsCallForCache = null )
00205 {
00206 $this->_blIsCallForCache = $blIsCallForCache;
00207 }
00208
00214 public function getIsCallForCache()
00215 {
00216 return $this->_blIsCallForCache;
00217 }
00218
00224 public function getViewId()
00225 {
00226 }
00227
00233 public function render()
00234 {
00235 return $this->getTemplateName();
00236 }
00237
00251 public function addGlobalParams( $oShop = null)
00252 {
00253
00254 $this->_iNewsStatus = 1;
00255
00256
00257 $oViewConf = $this->getViewConfig();
00258 if ( $oShop ) {
00259 $oViewConf->setViewShop( $oShop, $this->_aViewData );
00260 }
00261
00262
00263 $this->_aViewData['oView'] = $this;
00264 $this->_aViewData['oViewConf'] = $this->getViewConfig();
00265
00266 return $oViewConf;
00267 }
00268
00277 public function addTplParam( $sPara, $sValue )
00278 {
00279 $this->_aViewData[$sPara] = $sValue;
00280 }
00281
00287 public function getBelboonParam()
00288 {
00289 if ( $sBelboon = $this->getSession()->getVariable( 'belboon' ) ) {
00290 return $sBelboon;
00291 }
00292 if ( ( $sBelboon = $this->getConfig()->getRequestParameter( 'belboon' ) ) ) {
00293 $this->getSession()->setVariable( 'belboon', $sBelboon );
00294 }
00295
00296 return $sBelboon;
00297 }
00298
00304 public function getViewConfig()
00305 {
00306 if ( $this->_oViewConf === null ) {
00307 $this->_oViewConf = oxNew( 'oxViewConfig' );
00308 }
00309
00310 return $this->_oViewConf;
00311 }
00312
00318 public function getTemplateName()
00319 {
00320 return $this->_sThisTemplate;
00321 }
00322
00330 public function setTemplateName( $sTemplate )
00331 {
00332 $this->_sThisTemplate = $sTemplate;
00333 }
00334
00342 public function setClassName( $sClassName )
00343 {
00344 $this->_sClass = $sClassName;
00345 }
00346
00352 public function getClassName()
00353 {
00354 return $this->_sClass;
00355 }
00356
00364 public function setFncName( $sFncName )
00365 {
00366 $this->_sFnc = $sFncName;
00367 }
00368
00374 public function getFncName()
00375 {
00376 return $this->_sFnc;
00377 }
00378
00386 public function setViewData( $aViewData = null )
00387 {
00388 $this->_aViewData = $aViewData;
00389 }
00390
00396 public function getViewData()
00397 {
00398 return $this->_aViewData;
00399 }
00400
00408 public function getViewDataElement( $sParamId = null )
00409 {
00410 if ( $sParamId && isset( $this->_aViewData[$sParamId] ) ) {
00411 return $this->_aViewData[$sParamId];
00412 }
00413 }
00414
00422 public function setClassLocation( $sClassLocation = null )
00423 {
00424 $this->_sClassLocation = $sClassLocation;
00425 }
00431 public function getClassLocation()
00432 {
00433 return $this->_sClassLocation;
00434 }
00435
00443 public function setThisAction( $sThisAction = null )
00444 {
00445 $this->_sThisAction = $sThisAction;
00446 }
00447
00453 public function getThisAction()
00454 {
00455 return $this->_sThisAction;
00456 }
00457
00465 public function setParent( $oParent = null )
00466 {
00467 $this->_oParent = $oParent;
00468 }
00469
00475 public function getParent()
00476 {
00477 return $this->_oParent;
00478 }
00479
00487 public function setIsComponent( $blIsComponent = null )
00488 {
00489 $this->_blIsComponent = $blIsComponent;
00490 }
00491
00497 public function getIsComponent()
00498 {
00499 return $this->_blIsComponent;
00500 }
00501
00512 public function executeFunction( $sFunction )
00513 {
00514
00515 if ( $sFunction && !self::$_blExecuted ) {
00516 if ( method_exists( $this, $sFunction ) ) {
00517
00518
00519 $sNewAction = $this->$sFunction();
00520 self::$_blExecuted = true;
00521
00522 if ( isset ( $sNewAction ) ) {
00523 $this->_executeNewAction( $sNewAction );
00524 }
00525 } else {
00526
00527 if ( !$this->_blIsComponent ) {
00528 $oEx = oxNew( 'oxSystemComponentException' );
00529 $oEx->setMessage( 'ERROR_MESSAGE_SYSTEMCOMPONENT_FUNCTIONNOTFOUND' );
00530 $oEx->setComponent( $sFunction );
00531 throw $oEx;
00532 }
00533 }
00534 }
00535 }
00536
00546 protected function _executeNewAction( $sNewAction )
00547 {
00548 if ( $sNewAction ) {
00549 $myConfig = $this->getConfig();
00550
00551
00552 $aParams = explode( '?', $sNewAction );
00553
00554
00555 $sPageParams = isset( $aParams[1] )?$aParams[1]:null;
00556
00557
00558 $aParams = explode( '/', $aParams[0] );
00559 $sClassName = $aParams[0];
00560
00561
00562 $sHeader = ( $sClassName )?"cl=$sClassName&":'';
00563 $sHeader .= ( $sPageParams )?"$sPageParams&":'';
00564 $sHeader .= $this->getSession()->sid();
00565
00566 $sUrl = $myConfig->getCurrentShopUrl($this->isAdmin());
00567
00568 $sUrl = "{$sUrl}index.php?{$sHeader}";
00569
00570 $sUrl = oxRegistry::get("oxUtilsUrl")->processUrl($sUrl);
00571
00572 if ( oxRegistry::getUtils()->seoIsActive() && $sSeoUrl = oxRegistry::get( "oxSeoEncoder" )->getStaticUrl( $sUrl ) ) {
00573 $sUrl = $sSeoUrl;
00574 }
00575
00576
00577
00578 oxRegistry::getUtils()->redirect( $sUrl, (bool) $myConfig->getRequestParameter( 'redirected' ), 302 );
00579 }
00580 }
00581
00587 public function getAdditionalParams()
00588 {
00589 return oxRegistry::get("oxUtilsUrl")->processUrl( '', false );
00590 }
00591
00597 public function getTrustedShopId()
00598 {
00599 if ( $this->_sTrustedShopId == null ) {
00600 $this->_sTrustedShopId = false;
00601 $oConfig = $this->getConfig();
00602 $aTsType = $oConfig->getConfigParam( 'tsSealType' );
00603 $sTsActive = $oConfig->getConfigParam( 'tsSealActive' );
00604 $aTrustedShopIds = $oConfig->getConfigParam( 'iShopID_TrustedShops' );
00605 $iLangId = (int) oxRegistry::getLang()->getBaseLanguage();
00606 if ( $sTsActive && $aTrustedShopIds && $aTsType[$iLangId] == 'CLASSIC' ) {
00607
00608 if ( !is_array( $aTrustedShopIds ) && $iLangId == 0 ) {
00609 $this->_sTrustedShopId = $aTrustedShopIds;
00610 }
00611 if ( is_array( $aTrustedShopIds ) ) {
00612 $this->_sTrustedShopId = $aTrustedShopIds[$iLangId];
00613 }
00614 if ( strlen( $this->_sTrustedShopId ) != 33 || substr( $this->_sTrustedShopId, 0, 1 ) != 'X' ) {
00615 $this->_sTrustedShopId = false;
00616 }
00617 }
00618 }
00619 return $this->_sTrustedShopId;
00620 }
00621
00627 public function getTSExcellenceId()
00628 {
00629 if ( $this->_sTSExcellenceId == null ) {
00630 $this->_sTSExcellenceId = false;
00631 $oConfig = $this->getConfig();
00632 $aTsType = $oConfig->getConfigParam( 'tsSealType' );
00633 $sTsActive = $oConfig->getConfigParam( 'tsSealActive' );
00634 $aTrustedShopIds = $oConfig->getConfigParam( 'iShopID_TrustedShops' );
00635 $iLangId = (int) oxRegistry::getLang()->getBaseLanguage();
00636 if ( $sTsActive && $aTrustedShopIds && $aTsType[$iLangId] == 'EXCELLENCE' ) {
00637 $this->_sTSExcellenceId = $aTrustedShopIds[$iLangId];
00638 }
00639 }
00640 return $this->_sTSExcellenceId;
00641 }
00642
00648 public function getCharSet()
00649 {
00650 if ( $this->_sCharSet == null ) {
00651 $this->_sCharSet = oxRegistry::getLang()->translateString( 'charset' );
00652 }
00653 return $this->_sCharSet;
00654 }
00655
00661 public function getShopVersion()
00662 {
00663 if ( $this->_sVersion == null ) {
00664 $this->_sVersion = $this->getConfig()->getActiveShop()->oxshops__oxversion->value;
00665 }
00666 return $this->_sVersion;
00667 }
00668
00674 public function getShopEdition()
00675 {
00676 return $this->getConfig()->getActiveShop()->oxshops__oxedition->value;
00677 }
00678
00684 public function getRevision()
00685 {
00686 return $this->getConfig()->getRevision();
00687 }
00688
00694 public function getPackageInfo()
00695 {
00696 return $this->getConfig()->getPackageInfo();
00697 }
00698
00704 public function getShopFullEdition()
00705 {
00706 $sEdition = $this->getShopEdition();
00707 $sFullEdition = "Community Edition";
00708 if ( $sEdition == "PE" ) {
00709 $sFullEdition = "Professional Edition";
00710 }
00711
00712 if ( $sEdition == "EE" ) {
00713 $sFullEdition = "Enterprise Edition";
00714 }
00715
00716 return $sFullEdition;
00717 }
00718
00719
00725 public function isDemoVersion()
00726 {
00727 if ( $this->_blDemoVersion == null ) {
00728 $this->_blDemoVersion = $this->getConfig()->detectVersion() == 1;
00729 }
00730 return $this->_blDemoVersion;
00731 }
00732
00738 public function isDemoShop()
00739 {
00740 if ( $this->_blDemoShop == null ) {
00741 $this->_blDemoShop = $this->getConfig()->isDemoShop();
00742 }
00743 return $this->_blDemoShop;
00744 }
00745
00751 public function showNewsletter()
00752 {
00753 if ( $this->_iNewsStatus === null) {
00754 return 1;
00755 }
00756 return $this->_iNewsStatus;
00757 }
00758
00766 public function setShowNewsletter( $blShow )
00767 {
00768 $this->_iNewsStatus = $blShow;
00769 }
00770
00776 public function getShopLogo()
00777 {
00778 if ( $this->_sShopLogo === null ) {
00779 $this->setShopLogo( $this->getConfig()->getConfigParam( 'sShopLogo' ) );
00780 }
00781
00782 return $this->_sShopLogo;
00783 }
00784
00792 public function setShopLogo( $sLogo )
00793 {
00794 $this->_sShopLogo = $sLogo;
00795 }
00796
00806 public function getActCategory()
00807 {
00808
00809
00810
00811 if ( $this->_oClickCat === null ) {
00812
00813 $this->_oClickCat = false;
00814 $oCategory = oxNew( 'oxcategory' );
00815 if ( $oCategory->load( $this->getCategoryId() ) ) {
00816 $this->_oClickCat = $oCategory;
00817 }
00818 }
00819
00820 return $this->_oClickCat;
00821 }
00822
00832 public function setActCategory( $oCategory )
00833 {
00834 $this->_oClickCat = $oCategory;
00835 }
00836
00842 public function getCategoryId()
00843 {
00844 if ( $this->_sCategoryId == null && ( $sCatId = $this->getConfig()->getRequestParameter( 'cnid' ) ) ) {
00845 $this->_sCategoryId = $sCatId;
00846 }
00847
00848 return $this->_sCategoryId;
00849 }
00850
00858 public function setCategoryId( $sCategoryId )
00859 {
00860 $this->_sCategoryId = $sCategoryId;
00861 }
00862
00868 public function getErrorDestination()
00869 {
00870 }
00871
00878 public function getActionClassName()
00879 {
00880 return $this->getClassName();
00881 }
00882
00888 public function isConnectedWithFb()
00889 {
00890 $myConfig = $this->getConfig();
00891
00892 if ( $myConfig->getConfigParam( "bl_showFbConnect" ) ) {
00893 $oFb = oxRegistry::get("oxFb");
00894 return $oFb->isConnected();
00895 }
00896
00897 return false;
00898 }
00899
00905 public function getFbUserId()
00906 {
00907 if ( $this->getConfig()->getConfigParam( "bl_showFbConnect" ) ) {
00908 $oFb = oxRegistry::get("oxFb");
00909 return $oFb->getUser();
00910 }
00911 }
00912
00919 public function showFbConnectToAccountMsg()
00920 {
00921 if ( $this->getConfig()->getRequestParameter( "fblogin" ) ) {
00922 if ( !$this->getUser() || ($this->getUser() && $this->getSession()->getVariable( '_blFbUserIdUpdated' ) ) ) {
00923 return true;
00924 } else {
00925 return false;
00926 }
00927 }
00928
00929 return false;
00930 }
00931
00937 public function isMall()
00938 {
00939 return false;
00940 }
00941
00947 public function showRdfa()
00948 {
00949 return false;
00950 }
00951
00952 }