count_of_annual_created_doc.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * 按系统统计的年度新增文档个数。
  4. * Count of annual created doc.
  5. *
  6. * 范围:system
  7. * 对象:doc
  8. * 目的:scale
  9. * 度量名称:按系统统计的年度新增文档个数
  10. * 单位:个
  11. * 描述:按系统统计的年度新增文档个数是指在某年度系统或组织中新建的文档数量。反映了组织中信息产生的速度和增长的趋势。年度新增文档个数越大,说明组织的信息需求和创造力较强,也可能需要投入更多的资源来管理和维护这些新增文档。该度量项还可以用于评估组织的创新能力和知识管理水平。
  12. * 定义:所有文档个数求和;创建时间为某年;过滤已删除的文档;
  13. *
  14. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  15. * @author qixinzhi <qixinzhi@easycorp.ltd>
  16. * @package
  17. * @uses func
  18. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  19. * @Link https://www.zentao.net
  20. */
  21. class count_of_annual_created_doc extends baseCalc
  22. {
  23. public $dataset = 'getDocs';
  24. public $fieldList = array('t1.addedDate');
  25. public $result = array();
  26. public function calculate($row)
  27. {
  28. $year = $this->getYear($row->addedDate);
  29. if(!$year) return false;
  30. if(!isset($this->result[$year])) $this->result[$year] = 0;
  31. $this->result[$year] += 1;
  32. }
  33. public function getResult($options = array())
  34. {
  35. $records = $this->getRecords(array('year', 'value'));
  36. return $this->filterByOptions($records, $options);
  37. }
  38. }