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


PHP TiendaHelperBase::getOffsetDate方法代码示例

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


在下文中一共展示了TiendaHelperBase::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_TIENDA_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(TiendaHelperBase::getOffsetDate($this->publishing_date, -$offset)));
     }
     $nullDate = $this->_db->getNullDate();
     Tienda::load('TiendaHelperBase', 'helpers._base');
     if (empty($this->created_date) || $this->created_date == $nullDate) {
         $date = JFactory::getDate();
         $this->created_date = $date->toMysql();
     }
     $date = JFactory::getDate();
     $this->modified_date = $date->toMysql();
     $act = strtotime(Date('Y-m-d', strtotime($this->publishing_date)));
     $db = $this->_db;
     if (empty($this->product_issue_id)) {
         $q = 'SELECT `publishing_date` FROM `#__tienda_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_TIENDA_PUBLISHING_DATE_IS_NOT_PRESERVING_ISSUE_ORDER') . ' - ' . $this->publishing_date);
             return false;
         }
     } else {
         $q = 'SELECT `publishing_date` FROM `#__tienda_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 `#__tienda_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 `#__tienda_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_TIENDA_PUBLISHING_DATE_IS_NOT_PRESERVING_ISSUE_ORDER') . ' - ' . $this->publishing_date);
             return false;
         }
     }
     return true;
 }
开发者ID:annggeel,项目名称:tienda,代码行数: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_TIENDA_PRODUCT_ASSOCIATION_REQUIRED'));
         return false;
     }
     $nullDate = $this->_db->getNullDate();
     Tienda::load('TiendaHelperBase', 'helpers._base');
     $TiendaHelperBase = new TiendaHelperBase();
     $this->product_price_startdate = $this->product_price_startdate != $nullDate ? $TiendaHelperBase->getOffsetDate($this->product_price_startdate) : $this->product_price_startdate;
     $this->product_price_enddate = $this->product_price_enddate != $nullDate ? $TiendaHelperBase->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->toMysql();
     }
     $date = JFactory::getDate();
     $this->modified_date = $date->toMysql();
     return true;
 }
开发者ID:annggeel,项目名称:tienda,代码行数: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(TiendaHelperBase::getOffsetDate($this->eavvalue_value, -$offset)));
             }
         }
     }
     return parent::store($updateNulls);
 }
开发者ID:annggeel,项目名称:tienda,代码行数:20,代码来源:eavvalues.php

示例4: deleteExpiredSessionProductsCompared

 /**
  * Method to delete expired session compared products 
  * @return void
  */
 function deleteExpiredSessionProductsCompared()
 {
     $config = Tienda::getInstance();
     $last_run = $config->get('last_deleted_expired_sessionproductscompared');
     Tienda::load("TiendaHelperBase", 'helpers._base');
     $helper = new TiendaHelperBase();
     $date = JFactory::getDate();
     $now = $date->toMySQL();
     $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');
         JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models');
         $model = JModel::getInstance('ProductCompare', 'TiendaModel');
         $model->deleteExpiredSessionProductCompared();
     }
     return;
 }
开发者ID:annggeel,项目名称:tienda,代码行数:24,代码来源:tienda.php


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