* @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_user_in_project extends baseCalc { public $dataset = 'getTeamMembers'; public $fieldList = array('t3.id as project', 't1.account'); public $result = array(); public function calculate($row) { $project = $row->project; $account = $row->account; if(!isset($this->result[$project])) $this->result[$project] = array(); $this->result[$project][$account] = $account; } public function getResult($options = array()) { foreach($this->result as $project => $users) { if(!is_array($users)) continue; $this->result[$project] = count($users); } $records = $this->getRecords(array('project', 'value')); return $this->filterByOptions($records, $options); } }