当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Core_Model_Abstract::getDateFrom方法代码示例

本文整理汇总了PHP中Mage_Core_Model_Abstract::getDateFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::getDateFrom方法的具体用法?PHP Mage_Core_Model_Abstract::getDateFrom怎么用?PHP Mage_Core_Model_Abstract::getDateFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Core_Model_Abstract的用法示例。


在下文中一共展示了Mage_Core_Model_Abstract::getDateFrom方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _beforeSave

 /**
  * Perform actions before object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Resource_Db_Abstract
  * @throws Mage_Core_Exception
  */
 public function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if ($date = $object->getDateFrom()) {
         $object->setDateFrom($this->formatDate($date));
     } else {
         $object->setDateFrom(null);
     }
     if ($date = $object->getDateTo()) {
         $object->setDateTo($this->formatDate($date));
     } else {
         $object->setDateTo(null);
     }
     if (!is_null($object->getDateFrom()) && !is_null($object->getDateTo()) && Varien_Date::toTimestamp($object->getDateFrom()) > Varien_Date::toTimestamp($object->getDateTo())) {
         Mage::throwException(Mage::helper('core')->__('Start date cannot be greater than end date.'));
     }
     $check = $this->_checkIntersection($object->getStoreId(), $object->getDateFrom(), $object->getDateTo(), $object->getId());
     if ($check) {
         Mage::throwException(Mage::helper('core')->__('Your design change for the specified store intersects with another one, please specify another date range.'));
     }
     if ($object->getDateFrom() === null) {
         $object->setDateFrom(new Zend_Db_Expr('null'));
     }
     if ($object->getDateTo() === null) {
         $object->setDateTo(new Zend_Db_Expr('null'));
     }
     parent::_beforeSave($object);
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:34,代码来源:Design.php

示例2: _beforeSave

 public function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     if ($date = $object->getDateFrom()) {
         $date = Mage::app()->getLocale()->date($date, $format, null, false);
         $object->setDateFrom($date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
     } else {
         $object->setDateFrom(null);
     }
     if ($date = $object->getDateTo()) {
         $date = Mage::app()->getLocale()->date($date, $format, null, false);
         $object->setDateTo($date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
     } else {
         $object->setDateTo(null);
     }
     if (!is_null($object->getDateFrom()) && !is_null($object->getDateTo()) && strtotime($object->getDateFrom()) > strtotime($object->getDateTo())) {
         Mage::throwException(Mage::helper('core')->__('Start date can\'t be greater than end date'));
     }
     $check = $this->_checkIntersection($object->getStoreId(), $object->getDateFrom(), $object->getDateTo(), $object->getId());
     if ($check) {
         Mage::throwException(Mage::helper('core')->__('Your design change for the specified store intersects with another one, please specify another date range'));
     }
     if (is_null($object->getDateFrom())) {
         $object->setDateFrom(new Zend_Db_Expr('null'));
     }
     if (is_null($object->getDateTo())) {
         $object->setDateTo(new Zend_Db_Expr('null'));
     }
     parent::_beforeSave($object);
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:30,代码来源:Design.php

示例3: _beforeSave

 public function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $object->setDateFrom($this->formatDate($object->getDateFrom()));
     $object->setDateTo($this->formatDate($object->getDateTo()));
     if (strtotime($object->getDateFrom()) > strtotime($object->getDateTo())) {
         Mage::throwException(Mage::helper('core')->__('Start date can\'t be greater than end date'));
     }
     $check = $this->_checkIntersection($object->getStoreId(), $object->getDateFrom(), $object->getDateTo(), $object->getId());
     if ($check) {
         Mage::throwException(Mage::helper('core')->__('Your design change for the specified store intersects with another one, please specify another date range'));
     }
     parent::_beforeSave($object);
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:13,代码来源:Design.php

示例4: _beforeSave

 /**
  * Perform actions before object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Resource_Db_Abstract
  * @throws Mage_Core_Exception
  */
 public function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $dateFrom = $object->getDateFrom();
     $dateTo = $object->getDateTo();
     if (!empty($dateFrom) && !empty($dateTo)) {
         $validator = new Zend_Validate_Date();
         if (!$validator->isValid($dateFrom) || !$validator->isValid($dateTo)) {
             Mage::throwException(Mage::helper('core')->__('Invalid date'));
         }
         if (Varien_Date::toTimestamp($dateFrom) > Varien_Date::toTimestamp($dateTo)) {
             Mage::throwException(Mage::helper('core')->__('Start date cannot be greater than end date.'));
         }
     }
     $check = $this->_checkIntersection($object->getStoreId(), $dateFrom, $dateTo, $object->getId());
     if ($check) {
         Mage::throwException(Mage::helper('core')->__('Your design change for the specified store intersects with another one, please specify another date range.'));
     }
     parent::_beforeSave($object);
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:26,代码来源:Design.php


注:本文中的Mage_Core_Model_Abstract::getDateFrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。