Go to the documentation of this file.00001 <?php
00002
00007 class oxView extends oxSuperCfg
00008 {
00009
00015 protected $_aViewData = array();
00016
00022 protected $_sClassLocation = null;
00023
00029 protected $_sThisAction = null;
00030
00036 protected $_oParent = null;
00037
00043 protected $_blIsComponent = false;
00044
00050 protected $_sThisTemplate = null;
00051
00057 protected $_sViewId = null;
00058
00064 protected $_sClass = null;
00065
00071 protected $_sFnc = null;
00072
00078 protected static $_blExecuted = false;
00079
00085 protected $_sTrustedShopId = null;
00086
00092 protected $_sTSExcellenceId = null;
00093
00099 protected $_sCharSet = null;
00100
00106 protected $_sVersion = null;
00107
00113 protected $_blDemoVersion = null;
00114
00120 protected $_blDemoShop = null;
00121
00127 protected $_iNewsStatus = null;
00128
00134 protected $_sShopLogo = null;
00135
00141 protected $_sCategoryId = null;
00142
00148 protected $_oClickCat = null;
00149
00155 protected $_blIsCallForCache = false;
00156
00162 protected $_oViewConf = null;
00163
00164
00168 public function init()
00169 {
00170
00171 $this->_sThisAction = strtolower(get_class($this));
00172
00173 if (!$this->_blIsComponent) {
00174
00175 $this->addGlobalParams();
00176 }
00177 }
00178
00184 public function setViewParameters($aParams = null)
00185 {
00186 $this->_aViewParams = $aParams;
00187 }
00188
00196 public function getViewParameter($sKey)
00197 {
00198 $sValue = (isset($this->_aViewParams[$sKey])) ? $this->_aViewParams[$sKey] : $this->getConfig()->getRequestParameter($sKey);
00199
00200 return $sValue;
00201 }
00202
00208 public function setIsCallForCache($blIsCallForCache = null)
00209 {
00210 $this->_blIsCallForCache = $blIsCallForCache;
00211 }
00212
00218 public function getIsCallForCache()
00219 {
00220 return $this->_blIsCallForCache;
00221 }
00222
00226 public function getViewId()
00227 {
00228 }
00229
00235 public function render()
00236 {
00237 return $this->getTemplateName();
00238 }
00239
00253 public function addGlobalParams($oShop = null)
00254 {
00255
00256 $this->_iNewsStatus = 1;
00257
00258
00259 $oViewConf = $this->getViewConfig();
00260 if ($oShop) {
00261 $oViewConf->setViewShop($oShop, $this->_aViewData);
00262 }
00263
00264
00265 $this->_aViewData['oView'] = $this;
00266 $this->_aViewData['oViewConf'] = $this->getViewConfig();
00267
00268 return $oViewConf;
00269 }
00270
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
00328 public function setTemplateName($sTemplate)
00329 {
00330 $this->_sThisTemplate = $sTemplate;
00331 }
00332
00338 public function setClassName($sClassName)
00339 {
00340 $this->_sClass = $sClassName;
00341 }
00342
00348 public function getClassName()
00349 {
00350 return $this->_sClass;
00351 }
00352
00358 public function setFncName($sFncName)
00359 {
00360 $this->_sFnc = $sFncName;
00361 }
00362
00368 public function getFncName()
00369 {
00370 return $this->_sFnc;
00371 }
00372
00378 public function setViewData($aViewData = null)
00379 {
00380 $this->_aViewData = $aViewData;
00381 }
00382
00388 public function getViewData()
00389 {
00390 return $this->_aViewData;
00391 }
00392
00400 public function getViewDataElement($sParamId = null)
00401 {
00402 if ($sParamId && isset($this->_aViewData[$sParamId])) {
00403 return $this->_aViewData[$sParamId];
00404 }
00405 }
00406
00412 public function setClassLocation($sClassLocation = null)
00413 {
00414 $this->_sClassLocation = $sClassLocation;
00415 }
00416
00422 public function getClassLocation()
00423 {
00424 return $this->_sClassLocation;
00425 }
00426
00432 public function setThisAction($sThisAction = null)
00433 {
00434 $this->_sThisAction = $sThisAction;
00435 }
00436
00442 public function getThisAction()
00443 {
00444 return $this->_sThisAction;
00445 }
00446
00452 public function setParent($oParent = null)
00453 {
00454 $this->_oParent = $oParent;
00455 }
00456
00462 public function getParent()
00463 {
00464 return $this->_oParent;
00465 }
00466
00472 public function setIsComponent($blIsComponent = null)
00473 {
00474 $this->_blIsComponent = $blIsComponent;
00475 }
00476
00482 public function getIsComponent()
00483 {
00484 return $this->_blIsComponent;
00485 }
00486
00495 public function executeFunction($sFunction)
00496 {
00497
00498 if ($sFunction && !self::$_blExecuted) {
00499 if (method_exists($this, $sFunction)) {
00500
00501
00502 $sNewAction = $this->$sFunction();
00503 self::$_blExecuted = true;
00504
00505 if (isset ($sNewAction)) {
00506 $this->_executeNewAction($sNewAction);
00507 }
00508 } else {
00509
00510 if (!$this->_blIsComponent) {
00512 $oEx = oxNew('oxSystemComponentException');
00513 $oEx->setMessage('ERROR_MESSAGE_SYSTEMCOMPONENT_FUNCTIONNOTFOUND');
00514 $oEx->setComponent($sFunction);
00515 throw $oEx;
00516 }
00517 }
00518 }
00519 }
00520
00528 protected function _executeNewAction($sNewAction)
00529 {
00530 if ($sNewAction) {
00531 $myConfig = $this->getConfig();
00532
00533
00534 $aParams = explode('?', $sNewAction);
00535
00536
00537 $sPageParams = isset($aParams[1]) ? $aParams[1] : null;
00538
00539
00540 $aParams = explode('/', $aParams[0]);
00541 $sClassName = $aParams[0];
00542
00543
00544 $sHeader = ($sClassName) ? "cl=$sClassName&" : '';
00545 $sHeader .= ($sPageParams) ? "$sPageParams&" : '';
00546 $sHeader .= $this->getSession()->sid();
00547
00548 $sUrl = $myConfig->getCurrentShopUrl($this->isAdmin());
00549
00550 $sUrl = "{$sUrl}index.php?{$sHeader}";
00551
00552 $sUrl = oxRegistry::get("oxUtilsUrl")->processUrl($sUrl);
00553
00554 if (oxRegistry::getUtils()->seoIsActive() && $sSeoUrl = oxRegistry::get("oxSeoEncoder")->getStaticUrl($sUrl)) {
00555 $sUrl = $sSeoUrl;
00556 }
00557
00558
00559
00560 oxRegistry::getUtils()->redirect($sUrl, (bool) $myConfig->getRequestParameter('redirected'), 302);
00561 }
00562 }
00563
00569 public function getAdditionalParams()
00570 {
00571 return oxRegistry::get("oxUtilsUrl")->processUrl('', false);
00572 }
00573
00579 public function getTrustedShopId()
00580 {
00581 if ($this->_sTrustedShopId == null) {
00582 $this->_sTrustedShopId = false;
00583 $oConfig = $this->getConfig();
00584 $aTsType = $oConfig->getConfigParam('tsSealType');
00585 $sTsActive = $oConfig->getConfigParam('tsSealActive');
00586 $aTrustedShopIds = $oConfig->getConfigParam('iShopID_TrustedShops');
00587 $iLangId = (int) oxRegistry::getLang()->getBaseLanguage();
00588 if ($sTsActive && $aTrustedShopIds && $aTsType[$iLangId] == 'CLASSIC') {
00589
00590 if (!is_array($aTrustedShopIds) && $iLangId == 0) {
00591 $this->_sTrustedShopId = $aTrustedShopIds;
00592 }
00593 if (is_array($aTrustedShopIds)) {
00594 $this->_sTrustedShopId = $aTrustedShopIds[$iLangId];
00595 }
00596 if (strlen($this->_sTrustedShopId) != 33 || substr($this->_sTrustedShopId, 0, 1) != 'X') {
00597 $this->_sTrustedShopId = false;
00598 }
00599 }
00600 }
00601
00602 return $this->_sTrustedShopId;
00603 }
00604
00610 public function getTSExcellenceId()
00611 {
00612 if ($this->_sTSExcellenceId == null) {
00613 $this->_sTSExcellenceId = false;
00614 $oConfig = $this->getConfig();
00615 $aTsType = $oConfig->getConfigParam('tsSealType');
00616 $sTsActive = $oConfig->getConfigParam('tsSealActive');
00617 $aTrustedShopIds = $oConfig->getConfigParam('iShopID_TrustedShops');
00618 $iLangId = (int) oxRegistry::getLang()->getBaseLanguage();
00619 if ($sTsActive && $aTrustedShopIds && $aTsType[$iLangId] == 'EXCELLENCE') {
00620 $this->_sTSExcellenceId = $aTrustedShopIds[$iLangId];
00621 }
00622 }
00623
00624 return $this->_sTSExcellenceId;
00625 }
00626
00632 public function getCharSet()
00633 {
00634 if ($this->_sCharSet == null) {
00635 $this->_sCharSet = oxRegistry::getLang()->translateString('charset');
00636 }
00637
00638 return $this->_sCharSet;
00639 }
00640
00646 public function getShopVersion()
00647 {
00648 if ($this->_sVersion == null) {
00649 $this->_sVersion = $this->getConfig()->getActiveShop()->oxshops__oxversion->value;
00650 }
00651
00652 return $this->_sVersion;
00653 }
00654
00660 public function getShopEdition()
00661 {
00662 return $this->getConfig()->getActiveShop()->oxshops__oxedition->value;
00663 }
00664
00670 public function getRevision()
00671 {
00672 return $this->getConfig()->getRevision();
00673 }
00674
00680 public function getPackageInfo()
00681 {
00682 return $this->getConfig()->getPackageInfo();
00683 }
00684
00690 public function getShopFullEdition()
00691 {
00692 $sEdition = $this->getShopEdition();
00693 $sFullEdition = "Community Edition";
00694 if ($sEdition == "PE") {
00695 $sFullEdition = "Professional Edition";
00696 }
00697
00698 if ($sEdition == "EE") {
00699 $sFullEdition = "Enterprise Edition";
00700 }
00701
00702 return $sFullEdition;
00703 }
00704
00705
00711 public function isDemoVersion()
00712 {
00713 if ($this->_blDemoVersion == null) {
00714 $this->_blDemoVersion = $this->getConfig()->detectVersion() == 1;
00715 }
00716
00717 return $this->_blDemoVersion;
00718 }
00719
00725 public function isBetaVersion()
00726 {
00727 $blBetaVersion = false;
00728
00729 if (stripos($this->getConfig()->getVersion(), 'beta') !== false) {
00730 $blBetaVersion = true;
00731 }
00732
00733 return $blBetaVersion;
00734 }
00735
00741 public function isRCVersion()
00742 {
00743 $blRCVersion = false;
00744
00745 if (stripos($this->getConfig()->getVersion(), 'rc') !== false) {
00746 $blRCVersion = true;
00747 }
00748
00749 return $blRCVersion;
00750 }
00751
00757 public function showBetaNote()
00758 {
00759 $blBetaNote = false;
00760
00761 if ($this->isBetaVersion() || $this->isRCVersion()) {
00762 $blBetaNote = true;
00763 }
00764
00765 return $blBetaNote;
00766 }
00767
00773 public function isDemoShop()
00774 {
00775 if ($this->_blDemoShop == null) {
00776 $this->_blDemoShop = $this->getConfig()->isDemoShop();
00777 }
00778
00779 return $this->_blDemoShop;
00780 }
00781
00787 public function showNewsletter()
00788 {
00789 if ($this->_iNewsStatus === null) {
00790 return 1;
00791 }
00792
00793 return $this->_iNewsStatus;
00794 }
00795
00801 public function setShowNewsletter($blShow)
00802 {
00803 $this->_iNewsStatus = $blShow;
00804 }
00805
00813 public function getShopLogo()
00814 {
00815 if ($this->_sShopLogo === null) {
00816 $this->setShopLogo($this->getConfig()->getConfigParam('sShopLogo'));
00817 }
00818
00819 return $this->_sShopLogo;
00820 }
00821
00829 public function setShopLogo($sLogo)
00830 {
00831 $this->_sShopLogo = $sLogo;
00832 }
00833
00841 public function getActCategory()
00842 {
00843
00844
00845
00846 if ($this->_oClickCat === null) {
00847
00848 $this->_oClickCat = false;
00849 $oCategory = oxNew('oxcategory');
00850 if ($oCategory->load($this->getCategoryId())) {
00851 $this->_oClickCat = $oCategory;
00852 }
00853 }
00854
00855 return $this->_oClickCat;
00856 }
00857
00863 public function setActCategory($oCategory)
00864 {
00865 $this->_oClickCat = $oCategory;
00866 }
00867
00873 public function getCategoryId()
00874 {
00875 if ($this->_sCategoryId == null && ($sCatId = $this->getConfig()->getRequestParameter('cnid'))) {
00876 $this->_sCategoryId = $sCatId;
00877 }
00878
00879 return $this->_sCategoryId;
00880 }
00881
00887 public function setCategoryId($sCategoryId)
00888 {
00889 $this->_sCategoryId = $sCategoryId;
00890 }
00891
00895 public function getErrorDestination()
00896 {
00897 }
00898
00905 public function getActionClassName()
00906 {
00907 return $this->getClassName();
00908 }
00909
00915 public function isConnectedWithFb()
00916 {
00917 $myConfig = $this->getConfig();
00918
00919 if ($myConfig->getConfigParam("bl_showFbConnect")) {
00920 $oFb = oxRegistry::get("oxFb");
00921
00922 return $oFb->isConnected();
00923 }
00924
00925 return false;
00926 }
00927
00933 public function getFbUserId()
00934 {
00935 if ($this->getConfig()->getConfigParam("bl_showFbConnect")) {
00936 $oFb = oxRegistry::get("oxFb");
00937
00938 return $oFb->getUser();
00939 }
00940 }
00941
00948 public function showFbConnectToAccountMsg()
00949 {
00950 if ($this->getConfig()->getRequestParameter("fblogin")) {
00951 if (!$this->getUser() || ($this->getUser() && $this->getSession()->getVariable('_blFbUserIdUpdated'))) {
00952 return true;
00953 } else {
00954 return false;
00955 }
00956 }
00957
00958 return false;
00959 }
00960
00966 public function isMall()
00967 {
00968 return false;
00969 }
00970
00976 public function showRdfa()
00977 {
00978 return false;
00979 }
00980
00981
00989 public function getSidForWidget()
00990 {
00991 $sRet = null;
00992 $oSession = $this->getSession();
00993
00994 if (!$oSession->isActualSidInCookie()) {
00995 $sRet = $oSession->getId();
00996 }
00997
00998 return $sRet;
00999 }
01000 }