Public Member Functions | |
setPeriod ($period) | |
setInterval ($from, $to) | |
getIntervals () | |
getPeriods () | |
setStoreIds ($storeIds) | |
getStoreIds () | |
getSize () | |
setPageSize ($size) | |
getPageSize () | |
initReport ($modelClass) | |
getReportFull ($from, $to) | |
getReport ($from, $to) | |
timeShift ($datetime) | |
Protected Member Functions | |
_construct () | |
Protected Attributes | |
$_from | |
$_to | |
$_period | |
$_model | |
$_intervals | |
$_pageSize | |
$_storeIds |
Definition at line 35 of file Collection.php.
_construct | ( | ) | [protected] |
getIntervals | ( | ) |
Definition at line 66 of file Collection.php.
00067 { 00068 if (!$this->_intervals) { 00069 $this->_intervals = array(); 00070 if (!$this->_from && !$this->_to){ 00071 return $this->_intervals; 00072 } 00073 $dateStart = new Zend_Date($this->_from); 00074 $dateStart2 = new Zend_Date($this->_from); 00075 00076 $dateEnd = new Zend_Date($this->_to); 00077 00078 00079 $t = array(); 00080 while ($dateStart->compare($dateEnd)<=0) { 00081 00082 switch ($this->_period) { 00083 case 'day' : 00084 $t['title'] = $dateStart->toString(Mage::app()->getLocale()->getDateFormat()); 00085 $t['start'] = $dateStart->toString('yyyy-MM-dd HH:mm:ss'); 00086 $t['end'] = $dateStart->toString('yyyy-MM-dd 23:59:59'); 00087 $dateStart->addDay(1); 00088 break; 00089 case 'month': 00090 $t['title'] = $dateStart->toString('MM/yyyy'); 00091 $t['start'] = $dateStart->toString('yyyy-MM-01 00:00:00'); 00092 $t['end'] = $dateStart->toString('yyyy-MM-'.date('t', $dateStart->getTimestamp()).' 23:59:59'); 00093 $dateStart->addMonth(1); 00094 break; 00095 case 'year': 00096 $t['title'] = $dateStart->toString('yyyy'); 00097 $t['start'] = $dateStart->toString('yyyy-01-01 00:00:00'); 00098 $t['end'] = $dateStart->toString('yyyy-12-31 23:59:59'); 00099 $dateStart->addYear(1); 00100 break; 00101 } 00102 $this->_intervals[$t['title']] = $t; 00103 } 00104 00105 if ($this->_period != 'day') { 00106 $titles = array_keys($this->_intervals); 00107 if (count($titles) > 0) { 00108 $this->_intervals[$titles[0]]['start'] = $dateStart2->toString('yyyy-MM-dd 00:00:00'); 00109 $this->_intervals[$titles[count($titles)-1]]['end'] = $dateEnd->toString('yyyy-MM-dd 23:59:59'); 00110 } 00111 } 00112 } 00113 return $this->_intervals; 00114 }
getPageSize | ( | ) |
getPeriods | ( | ) |
Return date periods
Definition at line 122 of file Collection.php.
00123 { 00124 return array( 00125 'day'=>Mage::helper('reports')->__('Day'), 00126 'month'=>Mage::helper('reports')->__('Month'), 00127 'year'=>Mage::helper('reports')->__('Year') 00128 ); 00129 }
getReport | ( | $ | from, | |
$ | to | |||
) |
Definition at line 176 of file Collection.php.
00177 { 00178 return $this->_model->getReport($this->timeShift($from), $this->timeShift($to)); 00179 }
getReportFull | ( | $ | from, | |
$ | to | |||
) |
Definition at line 171 of file Collection.php.
00172 { 00173 return $this->_model->getReportFull($this->timeShift($from), $this->timeShift($to)); 00174 }
getSize | ( | ) |
Definition at line 141 of file Collection.php.
00142 { 00143 return count($this->getIntervals()); 00144 }
getStoreIds | ( | ) |
initReport | ( | $ | modelClass | ) |
Definition at line 157 of file Collection.php.
00158 { 00159 //$this->_modelArray = array(); 00160 //foreach ($this->getIntervals() as $key=>$interval) { 00161 $this->_model = Mage::getModel('reports/report') 00162 ->setPageSize($this->getPageSize()) 00163 ->setStoreIds($this->getStoreIds()) 00164 ->initCollection($modelClass); 00165 //->setPeriodTitle($interval['title']); 00166 //->setStartDate($interval['start']) 00167 //->setEndDate($interval['end']); 00168 //} 00169 }
setInterval | ( | $ | from, | |
$ | to | |||
) |
setPageSize | ( | $ | size | ) |
setPeriod | ( | $ | period | ) |
setStoreIds | ( | $ | storeIds | ) |
timeShift | ( | $ | datetime | ) |
Definition at line 181 of file Collection.php.
00182 { 00183 return date('Y-m-d H:i:s', strtotime($datetime) - Mage::getModel('core/date')->getGmtOffset()); 00184 }
$_from [protected] |
Definition at line 38 of file Collection.php.
$_intervals [protected] |
Definition at line 44 of file Collection.php.
$_model [protected] |
Definition at line 42 of file Collection.php.
$_pageSize [protected] |
Definition at line 46 of file Collection.php.
$_period [protected] |
Definition at line 40 of file Collection.php.
$_storeIds [protected] |
Definition at line 48 of file Collection.php.
$_to [protected] |
Definition at line 39 of file Collection.php.