ipd.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * 更新IPD项目下评审点是否启用。
  4. * Update whether the evaluation point is enabled under the IPD project.
  5. *
  6. * @param int $projectID
  7. * @param array $points
  8. * @access public
  9. * @return bool
  10. */
  11. public function updatePoint($projectID = 0, $points = array())
  12. {
  13. $this->dao->update(TABLE_OBJECT)->set('enabled')->eq(0)->where('project')->eq($projectID)->exec();
  14. $this->dao->update(TABLE_OBJECT)
  15. ->set('enabled')->eq(1)
  16. ->where('project')->eq($projectID)
  17. ->andWhere('category')->in(implode(',', $points))
  18. ->exec();
  19. return true;
  20. }
  21. /**
  22. * 获取项目流程对应的阶段对应的评审点。
  23. * Get stage points by project.
  24. *
  25. * @param int $projectID
  26. * @access public
  27. * @return array
  28. */
  29. public function getStagePointsByProject($projectID)
  30. {
  31. $stagePointGroup = $this->dao->select('execution AS stage,category AS id,categoryTitle AS title')->from(TABLE_OBJECT)
  32. ->where('type')->eq('decision')
  33. ->andWhere('project')->eq($projectID)
  34. ->fetchGroup('stage', 'id');
  35. if(empty($stagePointGroup))
  36. {
  37. $project = $this->dao->findByID($projectID)->from(TABLE_PROJECT)->fetch();
  38. $stagePointGroup = $this->dao->select('stage,id,title')->from(TABLE_DECISION)
  39. ->where('workflowGroup')->eq($project->workflowGroup)
  40. ->andWhere('deleted')->eq('0')
  41. ->orderBy('type_desc,order_asc')
  42. ->fetchGroup('stage', 'id');
  43. }
  44. $ipdStagePoint = array();
  45. foreach($stagePointGroup as $stageID => $pointList)
  46. {
  47. if(!isset($ipdStagePoint[$stageID])) $ipdStagePoint[$stageID] = array();
  48. foreach($pointList as $point) $ipdStagePoint[$stageID][$point->id] = $point->title;
  49. }
  50. return $ipdStagePoint;
  51. }