本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}