/** * Returns the number of open/closed issues. * * @param string Status ('open'), 'closed' * @param IDF_Tag Subfilter with a label (null) * @return int Count */ public function getIssueCountByStatus($status = 'open', $label = null) { switch ($status) { case 'open': $key = 'labels_issue_open'; $default = IDF_Form_IssueTrackingConf::init_open; break; case 'closed': default: $key = 'labels_issue_closed'; $default = IDF_Form_IssueTrackingConf::init_closed; break; } $tags = array(); foreach ($this->getTagsFromConfig($key, $default, 'Status') as $tag) { $tags[] = (int) $tag->id; } if (count($tags) == 0) { return array(); } $sql = new Pluf_SQL(sprintf('project=%%s AND status IN (%s)', implode(', ', $tags)), array($this->id)); if (!is_null($label)) { $sql2 = new Pluf_SQL('idf_tag_id=%s', array($label->id)); $sql->SAnd($sql2); } $params = array('filter' => $sql->gen()); if (!is_null($label)) { $params['view'] = 'join_tags'; } $gissue = new IDF_Issue(); return $gissue->getCount($params); }