* @package * @uses func * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html) * @Link https://www.zentao.net */ class count_of_weekly_created_release extends baseCalc { public $dataset = 'getAllReleases'; public $fieldList = array('t1.date'); public $result = array(); public function calculate($row) { $year = $this->getYear($row->date); $week = $this->getWeek($row->date); if(!$year) return false; if(!isset($this->result[$year])) $this->result[$year] = array(); if(!isset($this->result[$year][$week])) $this->result[$year][$week] = 0; $this->result[$year][$week] ++; } public function getResult($options = array()) { $records = $this->getRecords(array('year', 'week', 'value')); return $this->filterByOptions($records, $options); } }