* @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_monthly_created_task extends baseCalc { public $dataset = 'getTasks'; public $fieldList = array('t1.openedDate'); public $result = array(); public function calculate($row) { $openedDate = $row->openedDate; $year = $this->getYear($openedDate); if(!$year) return false; $month = substr($openedDate, 5, 2); if(!isset($this->result[$year])) $this->result[$year] = array(); if(!isset($this->result[$year][$month])) $this->result[$year][$month] = 0; $this->result[$year][$month] += 1; } public function getResult($options = array()) { $records = $this->getRecords(array('year', 'month', 'value')); return $this->filterByOptions($records, $options); } }