當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TimezoneInterface::isScopeDateInInterval方法代碼示例

本文整理匯總了PHP中Magento\Framework\Stdlib\DateTime\TimezoneInterface::isScopeDateInInterval方法的典型用法代碼示例。如果您正苦於以下問題:PHP TimezoneInterface::isScopeDateInInterval方法的具體用法?PHP TimezoneInterface::isScopeDateInInterval怎麽用?PHP TimezoneInterface::isScopeDateInInterval使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\Stdlib\DateTime\TimezoneInterface的用法示例。


在下文中一共展示了TimezoneInterface::isScopeDateInInterval方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _renderPage

 /**
  * Renders CMS page
  *
  * @param Action $action
  * @param int $pageId
  * @param bool $renderLayout
  * @return bool
  */
 protected function _renderPage(Action $action, $pageId = null, $renderLayout = true)
 {
     if (!is_null($pageId) && $pageId !== $this->_page->getId()) {
         $delimiterPosition = strrpos($pageId, '|');
         if ($delimiterPosition) {
             $pageId = substr($pageId, 0, $delimiterPosition);
         }
         $this->_page->setStoreId($this->_storeManager->getStore()->getId());
         if (!$this->_page->load($pageId)) {
             return false;
         }
     }
     if (!$this->_page->getId()) {
         return false;
     }
     $inRange = $this->_localeDate->isScopeDateInInterval(null, $this->_page->getCustomThemeFrom(), $this->_page->getCustomThemeTo());
     if ($this->_page->getCustomTheme()) {
         if ($inRange) {
             $this->_design->setDesignTheme($this->_page->getCustomTheme());
         }
     }
     $this->_view->getLayout()->getUpdate()->addHandle('default')->addHandle('cms_page_view');
     $this->_view->addPageLayoutHandles(array('id' => $this->_page->getIdentifier()));
     $this->_view->addActionLayoutHandles();
     if ($this->_page->getRootTemplate()) {
         if ($this->_page->getCustomRootTemplate() && $this->_page->getCustomRootTemplate() != 'empty' && $inRange) {
             $handle = $this->_page->getCustomRootTemplate();
         } else {
             $handle = $this->_page->getRootTemplate();
         }
         $this->_pageLayout->applyHandle($handle);
     }
     $this->_eventManager->dispatch('cms_page_render', array('page' => $this->_page, 'controller_action' => $action));
     $this->_view->loadLayoutUpdates();
     if ($this->_page->getCustomLayoutUpdateXml() && $inRange) {
         $layoutUpdate = $this->_page->getCustomLayoutUpdateXml();
     } else {
         $layoutUpdate = $this->_page->getLayoutUpdateXml();
     }
     if (!empty($layoutUpdate)) {
         $this->_view->getLayout()->getUpdate()->addUpdate($layoutUpdate);
     }
     $this->_view->generateLayoutXml()->generateLayoutBlocks();
     $contentHeadingBlock = $this->_view->getLayout()->getBlock('page_content_heading');
     if ($contentHeadingBlock) {
         $contentHeading = $this->_escaper->escapeHtml($this->_page->getContentHeading());
         $contentHeadingBlock->setContentHeading($contentHeading);
     }
     if ($this->_page->getRootTemplate()) {
         $this->_pageLayout->applyTemplate($this->_page->getRootTemplate());
     }
     /* @TODO: Move catalog and checkout storage types to appropriate modules */
     $messageBlock = $this->_view->getLayout()->getMessagesBlock();
     $messageBlock->addStorageType($this->messageManager->getDefaultGroup());
     $messageBlock->addMessages($this->messageManager->getMessages(true));
     if ($renderLayout) {
         $this->_view->renderLayout();
     }
     return true;
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:68,代碼來源:Page.php

示例2: calculateSpecialPrice

 /**
  * Calculate and apply special price
  *
  * @param float $finalPrice
  * @param float $specialPrice
  * @param string $specialPriceFrom
  * @param string $specialPriceTo
  * @param int|string|Store $store
  * @return float
  */
 public function calculateSpecialPrice($finalPrice, $specialPrice, $specialPriceFrom, $specialPriceTo, $store = null)
 {
     if ($specialPrice !== null && $specialPrice != false) {
         if ($this->_localeDate->isScopeDateInInterval($store, $specialPriceFrom, $specialPriceTo)) {
             $finalPrice = min($finalPrice, $specialPrice);
         }
     }
     return $finalPrice;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:19,代碼來源:Price.php

示例3: _extractSettings

 /**
  * Extract custom layout settings from category or product object
  *
  * @param \Magento\Catalog\Model\Category|\Magento\Catalog\Model\Product $object
  * @return \Magento\Framework\Object
  */
 protected function _extractSettings($object)
 {
     $settings = new \Magento\Framework\Object();
     if (!$object) {
         return $settings;
     }
     $date = $object->getCustomDesignDate();
     if (array_key_exists('from', $date) && array_key_exists('to', $date) && $this->_localeDate->isScopeDateInInterval(null, $date['from'], $date['to'])) {
         $settings->setCustomDesign($object->getCustomDesign())->setPageLayout($object->getPageLayout())->setLayoutUpdates((array) $object->getCustomLayoutUpdate());
     }
     return $settings;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:18,代碼來源:Design.php

示例4: prepareResultPage

 /**
  * Return result blog page
  *
  * @param Action $action
  * @param \Magento\Framework\Model\AbstractModel $page
  * @return \Magento\Framework\View\Result\Page|bool
  */
 public function prepareResultPage(Action $action, $page)
 {
     if ($page->getCustomThemeFrom() && $page->getCustomThemeTo()) {
         $inRange = $this->_localeDate->isScopeDateInInterval(null, $page->getCustomThemeFrom(), $page->getCustomThemeTo());
     } else {
         $inRange = false;
     }
     if ($page->getCustomTheme()) {
         if ($inRange) {
             $this->_design->setDesignTheme($page->getCustomTheme());
         }
     }
     /** @var \Magento\Framework\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     if ($inRange && $page->getCustomLayout() && $page->getCustomLayout() != 'empty') {
         $handle = $page->getCustomLayout();
     } else {
         $handle = $page->getPageLayout();
     }
     if ($handle) {
         $resultPage->getConfig()->setPageLayout($handle);
     }
     $fullActionName = $action->getRequest()->getFullActionName();
     $resultPage->addHandle($fullActionName);
     $resultPage->addPageLayoutHandles(['id' => $page->getIdentifier()]);
     $this->_eventManager->dispatch($fullActionName . '_render', ['page' => $page, 'controller_action' => $action]);
     if ($inRange && $page->getCustomLayoutUpdateXml()) {
         $layoutUpdate = $page->getCustomLayoutUpdateXml();
     } else {
         $layoutUpdate = $page->getLayoutUpdateXml();
     }
     if ($layoutUpdate) {
         $resultPage->getLayout()->getUpdate()->addUpdate($layoutUpdate);
     }
     return $resultPage;
 }
開發者ID:magefan,項目名稱:module-blog,代碼行數:43,代碼來源:Page.php

示例5: prepareResultPage

 /**
  * Return result CMS page
  *
  * @param Action $action
  * @param null $pageId
  * @return \Magento\Framework\View\Result\Page|bool
  */
 public function prepareResultPage(Action $action, $pageId = null)
 {
     if ($pageId !== null && $pageId !== $this->_page->getId()) {
         $delimiterPosition = strrpos($pageId, '|');
         if ($delimiterPosition) {
             $pageId = substr($pageId, 0, $delimiterPosition);
         }
         $this->_page->setStoreId($this->_storeManager->getStore()->getId());
         if (!$this->_page->load($pageId)) {
             return false;
         }
     }
     if (!$this->_page->getId()) {
         return false;
     }
     $inRange = $this->_localeDate->isScopeDateInInterval(null, $this->_page->getCustomThemeFrom(), $this->_page->getCustomThemeTo());
     if ($this->_page->getCustomTheme()) {
         if ($inRange) {
             $this->_design->setDesignTheme($this->_page->getCustomTheme());
         }
     }
     /** @var \Magento\Framework\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     $this->setLayoutType($inRange, $resultPage);
     $resultPage->addHandle('cms_page_view');
     $resultPage->addPageLayoutHandles(['id' => $this->_page->getIdentifier()]);
     $this->_eventManager->dispatch('cms_page_render', ['page' => $this->_page, 'controller_action' => $action]);
     if ($this->_page->getCustomLayoutUpdateXml() && $inRange) {
         $layoutUpdate = $this->_page->getCustomLayoutUpdateXml();
     } else {
         $layoutUpdate = $this->_page->getLayoutUpdateXml();
     }
     if (!empty($layoutUpdate)) {
         $resultPage->getLayout()->getUpdate()->addUpdate($layoutUpdate);
     }
     $contentHeadingBlock = $resultPage->getLayout()->getBlock('page_content_heading');
     if ($contentHeadingBlock) {
         $contentHeading = $this->_escaper->escapeHtml($this->_page->getContentHeading());
         $contentHeadingBlock->setContentHeading($contentHeading);
     }
     /* @TODO: Move catalog and checkout storage types to appropriate modules */
     $messageBlock = $resultPage->getLayout()->getMessagesBlock();
     $messageBlock->addStorageType($this->messageManager->getDefaultGroup());
     $messageBlock->addMessages($this->messageManager->getMessages(true));
     return $resultPage;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:53,代碼來源:Page.php

示例6: isScopeDateInInterval

 /**
  * @return bool
  */
 public function isScopeDateInInterval()
 {
     return $this->localeDate->isScopeDateInInterval($this->product->getStore(), $this->getSpecialFromDate(), $this->getSpecialToDate());
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:7,代碼來源:SpecialPrice.php


注:本文中的Magento\Framework\Stdlib\DateTime\TimezoneInterface::isScopeDateInInterval方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。