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
00573
00574 oxRegistry::getUtils()->redirect( $sUrl, (bool) $myConfig->getRequestParameter( 'redirected' ), 302 );
00575 }
00576 }
00577
00583 public function getAdditionalParams()
00584 {
00585 return oxRegistry::get("oxUtilsUrl")->processUrl( '', false );
00586 }
00587
00593 public function getTrustedShopId()
00594 {
00595 if ( $this->_sTrustedShopId == null ) {
00596 $this->_sTrustedShopId = false;
00597 $oConfig = $this->getConfig();
00598 $aTsType = $oConfig->getConfigParam( 'tsSealType' );
00599 $sTsActive = $oConfig->getConfigParam( 'tsSealActive' );
00600 $aTrustedShopIds = $oConfig->getConfigParam( 'iShopID_TrustedShops' );
00601 $iLangId = (int) oxRegistry::getLang()->getBaseLanguage();
00602 if ( $sTsActive && $aTrustedShopIds && $aTsType[$iLangId] == 'CLASSIC' ) {
00603
00604 if ( !is_array( $aTrustedShopIds ) && $iLangId == 0 ) {
00605 $this->_sTrustedShopId = $aTrustedShopIds;
00606 }
00607 if ( is_array( $aTrustedShopIds ) ) {
00608 $this->_sTrustedShopId = $aTrustedShopIds[$iLangId];
00609 }
00610 if ( strlen( $this->_sTrustedShopId ) != 33 || substr( $this->_sTrustedShopId, 0, 1 ) != 'X' ) {
00611 $this->_sTrustedShopId = false;
00612 }
00613 }
00614 }
00615 return $this->_sTrustedShopId;
00616 }
00617
00623 public function getTSExcellenceId()
00624 {
00625 if ( $this->_sTSExcellenceId == null ) {
00626 $this->_sTSExcellenceId = false;
00627 $oConfig = $this->getConfig();
00628 $aTsType = $oConfig->getConfigParam( 'tsSealType' );
00629 $sTsActive = $oConfig->getConfigParam( 'tsSealActive' );
00630 $aTrustedShopIds = $oConfig->getConfigParam( 'iShopID_TrustedShops' );
00631 $iLangId = (int) oxRegistry::getLang()->getBaseLanguage();
00632 if ( $sTsActive && $aTrustedShopIds && $aTsType[$iLangId] == 'EXCELLENCE' ) {
00633 $this->_sTSExcellenceId = $aTrustedShopIds[$iLangId];
00634 }
00635 }
00636 return $this->_sTSExcellenceId;
00637 }
00638
00644 public function getCharSet()
00645 {
00646 if ( $this->_sCharSet == null ) {
00647 $this->_sCharSet = oxRegistry::getLang()->translateString( 'charset' );
00648 }
00649 return $this->_sCharSet;
00650 }
00651
00657 public function getShopVersion()
00658 {
00659 if ( $this->_sVersion == null ) {
00660 $this->_sVersion = $this->getConfig()->getActiveShop()->oxshops__oxversion->value;
00661 }
00662 return $this->_sVersion;
00663 }
00664
00670 public function getShopEdition()
00671 {
00672 return $this->getConfig()->getActiveShop()->oxshops__oxedition->value;
00673 }
00674
00680 public function getRevision()
00681 {
00682 return $this->getConfig()->getRevision();
00683 }
00684
00690 public function getPackageInfo()
00691 {
00692 return $this->getConfig()->getPackageInfo();
00693 }
00694
00700 public function getShopFullEdition()
00701 {
00702 $sEdition = $this->getShopEdition();
00703 $sFullEdition = "Community Edition";
00704 if ( $sEdition == "PE" ) {
00705 $sFullEdition = "Professional Edition";
00706 }
00707
00708 if ( $sEdition == "EE" ) {
00709 $sFullEdition = "Enterprise Edition";
00710 }
00711
00712 return $sFullEdition;
00713 }
00714
00715
00721 public function isDemoVersion()
00722 {
00723 if ( $this->_blDemoVersion == null ) {
00724 $this->_blDemoVersion = $this->getConfig()->detectVersion() == 1;
00725 }
00726 return $this->_blDemoVersion;
00727 }
00728
00734 public function isDemoShop()
00735 {
00736 if ( $this->_blDemoShop == null ) {
00737 $this->_blDemoShop = $this->getConfig()->isDemoShop();
00738 }
00739 return $this->_blDemoShop;
00740 }
00741
00747 public function showNewsletter()
00748 {
00749 if ( $this->_iNewsStatus === null) {
00750 return 1;
00751 }
00752 return $this->_iNewsStatus;
00753 }
00754
00762 public function setShowNewsletter( $blShow )
00763 {
00764 $this->_iNewsStatus = $blShow;
00765 }
00766
00772 public function getShopLogo()
00773 {
00774 if ( $this->_sShopLogo === null ) {
00775 $this->setShopLogo( $this->getConfig()->getConfigParam( 'sShopLogo' ) );
00776 }
00777
00778 return $this->_sShopLogo;
00779 }
00780
00788 public function setShopLogo( $sLogo )
00789 {
00790 $this->_sShopLogo = $sLogo;
00791 }
00792
00802 public function getActCategory()
00803 {
00804
00805
00806
00807 if ( $this->_oClickCat === null ) {
00808
00809 $this->_oClickCat = false;
00810 $oCategory = oxNew( 'oxcategory' );
00811 if ( $oCategory->load( $this->getCategoryId() ) ) {
00812 $this->_oClickCat = $oCategory;
00813 }
00814 }
00815
00816 return $this->_oClickCat;
00817 }
00818
00828 public function setActCategory( $oCategory )
00829 {
00830 $this->_oClickCat = $oCategory;
00831 }
00832
00838 public function getCategoryId()
00839 {
00840 if ( $this->_sCategoryId == null && ( $sCatId = $this->getConfig()->getRequestParameter( 'cnid' ) ) ) {
00841 $this->_sCategoryId = $sCatId;
00842 }
00843
00844 return $this->_sCategoryId;
00845 }
00846
00854 public function setCategoryId( $sCategoryId )
00855 {
00856 $this->_sCategoryId = $sCategoryId;
00857 }
00858
00864 public function getErrorDestination()
00865 {
00866 }
00867
00874 public function getActionClassName()
00875 {
00876 return $this->getClassName();
00877 }
00878
00884 public function isConnectedWithFb()
00885 {
00886 $myConfig = $this->getConfig();
00887
00888 if ( $myConfig->getConfigParam( "bl_showFbConnect" ) ) {
00889 $oFb = oxRegistry::get("oxFb");
00890 return $oFb->isConnected();
00891 }
00892
00893 return false;
00894 }
00895
00901 public function getFbUserId()
00902 {
00903 if ( $this->getConfig()->getConfigParam( "bl_showFbConnect" ) ) {
00904 $oFb = oxRegistry::get("oxFb");
00905 return $oFb->getUser();
00906 }
00907 }
00908
00915 public function showFbConnectToAccountMsg()
00916 {
00917 if ( $this->getConfig()->getRequestParameter( "fblogin" ) ) {
00918 if ( !$this->getUser() || ($this->getUser() && $this->getSession()->getVariable( '_blFbUserIdUpdated' ) ) ) {
00919 return true;
00920 } else {
00921 return false;
00922 }
00923 }
00924
00925 return false;
00926 }
00927
00933 public function isMall()
00934 {
00935 return false;
00936 }
00937
00943 public function showRdfa()
00944 {
00945 return false;
00946 }
00947
00948 }