本文整理汇总了PHP中TiendaHelperBase::setDateVariables方法的典型用法代码示例。如果您正苦于以下问题:PHP TiendaHelperBase::setDateVariables方法的具体用法?PHP TiendaHelperBase::setDateVariables怎么用?PHP TiendaHelperBase::setDateVariables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiendaHelperBase
的用法示例。
在下文中一共展示了TiendaHelperBase::setDateVariables方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getData
/**
* Override parent::_getData() to insert groupBy and orderBy clauses into query
*
* @return unknown_type
*/
function _getData()
{
$state = $this->_getState();
$order_states = array('3', '5', '17');
$filter_date_from = $state['filter_date_from'];
$filter_date_to = $state['filter_date_to'];
if (empty($filter_date_to) and empty($filter_date_from)) {
$date = JFactory::getDate();
$today = $date->toFormat("%Y-%m-%d 00:00:00");
$filter_date_to = $today;
$database = JFactory::getDBO();
$query = " SELECT DATE_SUB('" . $today . "', INTERVAL 1 MONTH) ";
$database->setQuery($query);
$filter_date_from = $database->loadResult();
} else {
if (empty($filter_date_to) and !empty($filter_date_from)) {
$filter_date_to = $filter_date_from;
} else {
if (!empty($filter_date_to) and empty($filter_date_from)) {
$filter_date_from = $filter_date_to;
}
}
}
$date_tmp = date_create($filter_date_to);
date_modify($date_tmp, '24 hour');
$database = JFactory::getDBO();
$curdate = TiendaHelperBase::local_to_GMT_data($filter_date_from);
$enddate = TiendaHelperBase::local_to_GMT_data(date_format($date_tmp, 'Y-m-d H:i:s'));
while ($curdate < $enddate) {
// set working variables
$variables = TiendaHelperBase::setDateVariables($curdate, $enddate, 'daily');
$thisdate = $variables->thisdate;
$nextdate = $variables->nextdate;
$query = new TiendaQuery();
$query->select('COUNT(tbl.order_id) AS num, SUM(order_total) AS amount');
$query->from('#__tienda_orders AS tbl');
$query->where("tbl.order_state_id IN (" . $this->getStatesCSV() . ")");
$query->where("tbl.modified_date >= '" . $curdate . "'");
$query->where("tbl.modified_date <= '" . $nextdate . "'");
$database->setQuery((string) $query);
$return_daily_report = $database->loadObject();
$date_tmp = date_create(TiendaHelperBase::GMT_to_local_data($curdate));
$data_print = date_format($date_tmp, 'd-m-Y');
$return_range_report->{$data_print} = $return_daily_report;
// increase curdate to the next value
$curdate = $nextdate;
}
return $return_range_report;
}