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


PHP CitruscartHelperBase::getOffsetDate方法代码示例

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


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

示例1: check

 /**
  * Checks row for data integrity.
  * Assumes working dates have been converted to local time for display,
  * so will always convert working dates to GMT
  *
  * @return unknown_type
  */
 function check()
 {
     if (empty($this->product_id)) {
         $this->setError(JText::_('COM_CITRUSCART_PRODUCT_ASSOCIATION_REQUIRED'));
         return false;
     }
     $offset = JFactory::getConfig()->getValue('config.offset');
     if (isset($this->publishing_date)) {
         $this->publishing_date = date('Y-m-d H:i:s', strtotime(CitruscartHelperBase::getOffsetDate($this->publishing_date, -$offset)));
     }
     $nullDate = $this->_db->getNullDate();
     Citruscart::load('CitruscartHelperBase', 'helpers._base');
     if (empty($this->created_date) || $this->created_date == $nullDate) {
         $date = JFactory::getDate();
         $this->created_date = $date->toSql();
     }
     $date = JFactory::getDate();
     $this->modified_date = $date->toSql();
     $act = strtotime(Date('Y-m-d', strtotime($this->publishing_date)));
     $db = $this->_db;
     if (empty($this->product_issue_id)) {
         $q = 'SELECT `publishing_date` FROM `#__citruscart_productissues` WHERE `product_id`=' . $this->product_id . ' ORDER BY `publishing_date` DESC LIMIT 1';
         $db->setQuery($q);
         $next = $db->loadResult();
         if ($next === null) {
             return true;
         }
         $next = strtotime($next);
         if ($act <= $next) {
             $this->setError(JText::_('COM_CITRUSCART_PUBLISHING_DATE_IS_NOT_PRESERVING_ISSUE_ORDER') . ' - ' . $this->publishing_date);
             return false;
         }
     } else {
         $q = 'SELECT `publishing_date` FROM `#__citruscart_productissues` WHERE `product_issue_id`=' . $this->product_issue_id;
         $db->setQuery($q);
         $original = $db->loadResult();
         if ($act == strtotime(Date('Y-m-d', strtotime($original)))) {
             return true;
         }
         $q = 'SELECT `publishing_date` FROM `#__citruscart_productissues` WHERE `product_id`=' . $this->product_id . ' AND `publishing_date` < \'' . $original . '\' ORDER BY `publishing_date` DESC LIMIT 1';
         $db->setQuery($q);
         $prev = $db->loadResult();
         $q = 'SELECT `publishing_date` FROM `#__citruscart_productissues` WHERE `product_id`=' . $this->product_id . ' AND `publishing_date` > \'' . $original . '\' ORDER BY `publishing_date` ASC LIMIT 1';
         $db->setQuery($q);
         $next = $db->loadResult();
         if ($prev === null) {
             $prev = 0;
         } else {
             $prev = strtotime($prev);
         }
         if ($next) {
             $next = strtotime($next);
         }
         if ($prev >= $act || $next && $next <= $act) {
             $this->setError(JText::_('COM_CITRUSCART_PUBLISHING_DATE_IS_NOT_PRESERVING_ISSUE_ORDER') . ' - ' . $this->publishing_date);
             return false;
         }
     }
     return true;
 }
开发者ID:joomlacorner,项目名称:citruscart,代码行数:67,代码来源:productissues.php

示例2: check

 /**
  * Checks row for data integrity.
  * Assumes working dates have been converted to local time for display,
  * so will always convert working dates to GMT
  *
  * @return unknown_type
  */
 function check()
 {
     if (empty($this->product_id)) {
         $this->setError(JText::_('COM_CITRUSCART_PRODUCT_ASSOCIATION_REQUIRED'));
         return false;
     }
     $nullDate = $this->_db->getNullDate();
     Citruscart::load('CitruscartHelperBase', 'helpers._base');
     $CitruscartHelperBase = new CitruscartHelperBase();
     $this->product_price_startdate = $this->product_price_startdate != $nullDate ? $CitruscartHelperBase->getOffsetDate($this->product_price_startdate) : $this->product_price_startdate;
     $this->product_price_enddate = $this->product_price_enddate != $nullDate ? $CitruscartHelperBase->getOffsetDate($this->product_price_enddate) : $this->product_price_enddate;
     if (empty($this->created_date) || $this->created_date == $nullDate) {
         $date = JFactory::getDate();
         $this->created_date = $date->toSql();
     }
     $date = JFactory::getDate();
     $this->modified_date = $date->toSql();
     return true;
 }
开发者ID:joomlacorner,项目名称:citruscart,代码行数:26,代码来源:productprices.php

示例3: store

 public function store($updateNulls = false)
 {
     // Check the table activation status first
     if (!$this->active) {
         // Activate it with a default value
         $this->setType('');
     }
     if ($this->getType() == 'datetime') {
         if (isset($this->eavvalue_value)) {
             $null_date = JFactory::getDbo()->getNullDate();
             if ($this->eavvalue_value == $null_date || $this->eavvalue_value == '') {
                 $this->eavvalue_value = $null_date;
             } else {
                 $offset = JFactory::getConfig()->getValue('config.offset');
                 $this->eavvalue_value = date('Y-m-d H:i:s', strtotime(CitruscartHelperBase::getOffsetDate($this->eavvalue_value, -$offset)));
             }
         }
     }
     return parent::store($updateNulls);
 }
开发者ID:joomlacorner,项目名称:citruscart,代码行数:20,代码来源:eavvalues.php

示例4: deleteExpiredSessionProductsCompared

 /**
  * Method to delete expired session compared products
  * @return void
  */
 function deleteExpiredSessionProductsCompared()
 {
     $config = Citruscart::getInstance();
     $last_run = $config->get('last_deleted_expired_sessionproductscompared');
     Citruscart::load("CitruscartHelperBase", 'helpers._base');
     $helper = new CitruscartHelperBase();
     $date = JFactory::getDate();
     $now = $date->toSql();
     $three_hours_ago = $helper->getOffsetDate($now, '-3');
     // when was this last run?
     // if it was run more than 3 hours ago, run again
     if ($last_run < $three_hours_ago) {
         // run it
         jimport('joomla.application.component.model');
         JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models');
         $model = JModelLegacy::getInstance('ProductCompare', 'CitruscartModel');
         $model->deleteExpiredSessionProductCompared();
     }
     return;
 }
开发者ID:joomlacorner,项目名称:citruscart,代码行数:24,代码来源:citruscart.php


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