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
00159 public function init()
00160 {
00161
00162 $this->_sThisAction = strtolower( get_class( $this ) );
00163
00164 if ( !$this->_blIsComponent ) {
00165
00166 $this->addGlobalParams();
00167 }
00168 }
00169
00177 public function setIsCallForCache( $blIsCallForCache = null )
00178 {
00179 $this->_blIsCallForCache = $blIsCallForCache;
00180 }
00181
00187 public function getIsCallForCache()
00188 {
00189 return $this->_blIsCallForCache;
00190 }
00191
00197 public function getViewId()
00198 {
00199 }
00200
00206 public function render()
00207 {
00208 return $this->getTemplateName();
00209 }
00210
00224 public function addGlobalParams( $oShop = null)
00225 {
00226
00227 $this->_iNewsStatus = 1;
00228
00229
00230 $oViewConf = $this->getViewConfig();
00231 if ( $oShop ) {
00232 $oViewConf->setViewShop( $oShop, $this->_aViewData );
00233 }
00234
00235
00236 $this->_aViewData['oView'] = $this;
00237 $this->_aViewData['oViewConf'] = $this->getViewConfig();
00238
00239 return $oViewConf;
00240 }
00241
00250 public function addTplParam( $sPara, $sValue )
00251 {
00252 $this->_aViewData[$sPara] = $sValue;
00253 }
00254
00266 protected function _setAdditionalParams()
00267 {
00268 $this->getAdditionalParams();
00269 }
00270
00276 public function getBelboonParam()
00277 {
00278 if ( $sBelboon = oxSession::getVar( 'belboon' ) ) {
00279 return $sBelboon;
00280 }
00281 if ( ( $sBelboon = oxConfig::getParameter( 'belboon' ) ) ) {
00282 oxSession::setVar( 'belboon', $sBelboon );
00283 }
00284
00285 return $sBelboon;
00286 }
00287
00293 public function getViewConfig()
00294 {
00295 if ( $this->_oViewConf === null ) {
00296 $this->_oViewConf = oxNew( 'oxViewConfig' );
00297 }
00298
00299 return $this->_oViewConf;
00300 }
00301
00307 public function getTemplateName()
00308 {
00309 return $this->_sThisTemplate;
00310 }
00311
00319 public function setClassName( $sClassName )
00320 {
00321 $this->_sClass = $sClassName;
00322 }
00323
00329 public function getClassName()
00330 {
00331 return $this->_sClass;
00332 }
00333
00341 public function setFncName( $sFncName )
00342 {
00343 $this->_sFnc = $sFncName;
00344 }
00345
00351 public function getFncName()
00352 {
00353 return $this->_sFnc;
00354 }
00355
00363 public function setViewData( $aViewData = null )
00364 {
00365 $this->_aViewData = $aViewData;
00366 }
00367
00373 public function getViewData()
00374 {
00375 return $this->_aViewData;
00376 }
00377
00385 public function getViewDataElement( $sParamId = null )
00386 {
00387 if ( $sParamId && isset( $this->_aViewData[$sParamId] ) ) {
00388 return $this->_aViewData[$sParamId];
00389 }
00390 }
00391
00399 public function setClassLocation( $sClassLocation = null )
00400 {
00401 $this->_sClassLocation = $sClassLocation;
00402 }
00408 public function getClassLocation()
00409 {
00410 return $this->_sClassLocation;
00411 }
00412
00420 public function setThisAction( $sThisAction = null )
00421 {
00422 $this->_sThisAction = $sThisAction;
00423 }
00424
00430 public function getThisAction()
00431 {
00432 return $this->_sThisAction;
00433 }
00434
00442 public function setParent( $oParent = null )
00443 {
00444 $this->_oParent = $oParent;
00445 }
00446
00452 public function getParent()
00453 {
00454 return $this->_oParent;
00455 }
00456
00464 public function setIsComponent( $blIsComponent = null )
00465 {
00466 $this->_blIsComponent = $blIsComponent;
00467 }
00468
00474 public function getIsComponent()
00475 {
00476 return $this->_blIsComponent;
00477 }
00478
00489 public function executeFunction( $sFunction )
00490 {
00491
00492 if ( $sFunction && !self::$_blExecuted ) {
00493 if ( method_exists( $this, $sFunction ) ) {
00494
00495
00496 $sNewAction = $this->$sFunction();
00497 self::$_blExecuted = true;
00498
00499 if (isset($sNewAction)) {
00500 $this->_executeNewAction( $sNewAction );
00501 }
00502 } else {
00503
00504 if ( !$this->_blIsComponent ) {
00505 $oEx = oxNew( 'oxSystemComponentException' );
00506 $oEx->setMessage( 'ERROR_MESSAGE_SYSTEMCOMPONENT_FUNCTIONNOTFOUND' );
00507 $oEx->setComponent( $sFunction );
00508 throw $oEx;
00509 }
00510 }
00511 }
00512 }
00513
00523 protected function _executeNewAction( $sNewAction )
00524 {
00525 if ( $sNewAction ) {
00526 $myConfig = $this->getConfig();
00527
00528
00529 $aParams = explode( '?', $sNewAction );
00530
00531
00532 $sPageParams = isset( $aParams[1] )?$aParams[1]:null;
00533
00534
00535 $aParams = explode( '/', $aParams[0] );
00536 $sClassName = $aParams[0];
00537
00538
00539 $sHeader = ( $sClassName )?"cl=$sClassName&":'';
00540 $sHeader .= ( $sPageParams )?"$sPageParams&":'';
00541 $sHeader .= $this->getSession()->sid();
00542
00543 $sUrl = $myConfig->getCurrentShopUrl($this->isAdmin());
00544
00545 $sUrl = "{$sUrl}index.php?{$sHeader}";
00546
00547 $sUrl = oxUtilsUrl::getInstance()->processUrl($sUrl);
00548
00549
00550 oxUtils::getInstance()->redirect( $sUrl, (bool) oxConfig::getParameter( 'redirected' ), 302 );
00551 }
00552 }
00553
00559 public function getAdditionalParams()
00560 {
00561 return oxUtilsUrl::getInstance()->processUrl( '', false );
00562 }
00563
00569 public function getTrustedShopId()
00570 {
00571 if ( $this->_sTrustedShopId == null ) {
00572 $this->_sTrustedShopId = false;
00573 $oConfig = $this->getConfig();
00574 $aTsType = $oConfig->getConfigParam( 'tsSealType' );
00575 $sTsActive = $oConfig->getConfigParam( 'tsSealActive' );
00576 $aTrustedShopIds = $oConfig->getConfigParam( 'iShopID_TrustedShops' );
00577 $iLangId = (int) oxLang::getInstance()->getBaseLanguage();
00578 if ( $sTsActive && $aTrustedShopIds && $aTsType[$iLangId] == 'CLASSIC' ) {
00579
00580 if ( !is_array( $aTrustedShopIds ) && $iLangId == 0 ) {
00581 $this->_sTrustedShopId = $aTrustedShopIds;
00582 }
00583 if ( is_array( $aTrustedShopIds ) ) {
00584 $this->_sTrustedShopId = $aTrustedShopIds[$iLangId];
00585 }
00586 if ( strlen( $this->_sTrustedShopId ) != 33 || substr( $this->_sTrustedShopId, 0, 1 ) != 'X' ) {
00587 $this->_sTrustedShopId = false;
00588 }
00589 }
00590 }
00591 return $this->_sTrustedShopId;
00592 }
00593
00599 public function getTSExcellenceId()
00600 {
00601 if ( $this->_sTSExcellenceId == null ) {
00602 $this->_sTSExcellenceId = false;
00603 $oConfig = $this->getConfig();
00604 $aTsType = $oConfig->getConfigParam( 'tsSealType' );
00605 $sTsActive = $oConfig->getConfigParam( 'tsSealActive' );
00606 $aTrustedShopIds = $oConfig->getConfigParam( 'iShopID_TrustedShops' );
00607 $iLangId = (int) oxLang::getInstance()->getBaseLanguage();
00608 if ( $sTsActive && $aTrustedShopIds && $aTsType[$iLangId] == 'EXCELLENCE' ) {
00609 $this->_sTSExcellenceId = $aTrustedShopIds[$iLangId];
00610 }
00611 }
00612 return $this->_sTSExcellenceId;
00613 }
00614
00620 public function getCharSet()
00621 {
00622 if ( $this->_sCharSet == null ) {
00623 $this->_sCharSet = oxLang::getInstance()->translateString( 'charset' );
00624 }
00625 return $this->_sCharSet;
00626 }
00627
00633 public function getShopVersion()
00634 {
00635 if ( $this->_sVersion == null ) {
00636 $this->_sVersion = $this->getConfig()->getActiveShop()->oxshops__oxversion->value;
00637 }
00638 return $this->_sVersion;
00639 }
00640
00646 public function getShopEdition()
00647 {
00648 return $this->getConfig()->getActiveShop()->oxshops__oxedition->value;
00649 }
00650
00656 public function getRevision()
00657 {
00658 return $this->getConfig()->getRevision();
00659 }
00660
00666 public function getPackageInfo()
00667 {
00668 return $this->getConfig()->getPackageInfo();
00669 }
00670
00676 public function getShopFullEdition()
00677 {
00678 $sEdition = $this->getShopEdition();
00679 $sFullEdition = "Community Edition";
00680 if ( $sEdition == "PE" ) {
00681 $sFullEdition = "Professional Edition";
00682 }
00683
00684 if ( $sEdition == "EE" ) {
00685 $sFullEdition = "Enterprise Edition";
00686 }
00687
00688 return $sFullEdition;
00689 }
00690
00691
00697 public function isDemoVersion()
00698 {
00699 if ( $this->_blDemoVersion == null ) {
00700 $this->_blDemoVersion = $this->getConfig()->detectVersion() == 1;
00701 }
00702 return $this->_blDemoVersion;
00703 }
00704
00710 public function isDemoShop()
00711 {
00712 if ( $this->_blDemoShop == null ) {
00713 $this->_blDemoShop = $this->getConfig()->isDemoShop();
00714 }
00715 return $this->_blDemoShop;
00716 }
00717
00723 public function showNewsletter()
00724 {
00725 if ( $this->_iNewsStatus === null) {
00726 return 1;
00727 }
00728 return $this->_iNewsStatus;
00729 }
00730
00738 public function setShowNewsletter( $blShow )
00739 {
00740 $this->_iNewsStatus = $blShow;
00741 }
00742
00748 public function getShopLogo()
00749 {
00750 return $this->_sShopLogo;
00751 }
00752
00760 public function setShopLogo( $sLogo )
00761 {
00762 $this->_sShopLogo = $sLogo;
00763 }
00764
00772 public function getActCategory()
00773 {
00774
00775
00776
00777 if ( $this->_oClickCat === null ) {
00778
00779 $this->_oClickCat = false;
00780 $oCategory = oxNew( 'oxcategory' );
00781 if ( $oCategory->load( $this->getCategoryId() ) ) {
00782 $this->_oClickCat = $oCategory;
00783 }
00784 }
00785
00786 return $this->_oClickCat;
00787 }
00788
00796 public function setActCategory( $oCategory )
00797 {
00798 $this->_oClickCat = $oCategory;
00799 }
00800
00806 public function getCategoryId()
00807 {
00808 if ( $this->_sCategoryId == null && ( $sCatId = oxConfig::getParameter( 'cnid' ) ) ) {
00809 $this->_sCategoryId = $sCatId;
00810 }
00811
00812 return $this->_sCategoryId;
00813 }
00814
00822 public function setCategoryId( $sCategoryId )
00823 {
00824 $this->_sCategoryId = $sCategoryId;
00825 }
00826
00832 public function getErrorDestination()
00833 {
00834 }
00835
00842 public function getActionClassName()
00843 {
00844 return $this->getClassName();
00845 }
00846
00852 public function isConnectedWithFb()
00853 {
00854 $myConfig = $this->getConfig();
00855
00856 if ( $myConfig->getConfigParam( "bl_showFbConnect" ) ) {
00857 $oFb = oxFb::getInstance();
00858 return $oFb->isConnected();
00859 }
00860
00861 return false;
00862 }
00863
00869 public function getFbUserId()
00870 {
00871 if ( $this->getConfig()->getConfigParam( "bl_showFbConnect" ) ) {
00872 $oFb = oxFb::getInstance();
00873 return $oFb->getUser();
00874 }
00875 }
00876
00883 public function showFbConnectToAccountMsg()
00884 {
00885 if ( $this->getConfig()->getParameter( "fblogin" ) ) {
00886 if ( !$this->getUser() || ($this->getUser() && oxSession::getVar( '_blFbUserIdUpdated' ) ) ) {
00887 return true;
00888 } else {
00889 return false;
00890 }
00891 }
00892
00893 return false;
00894 }
00895
00901 public function isMall()
00902 {
00903 return false;
00904 }
00905
00911 public function showRdfa()
00912 {
00913 return false;
00914 }
00915
00916 }