summary.html.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. /**
  3. * The summary view of budget module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Guangming Sun<sunguangming@chandao.com>
  8. * @package budget
  9. * @link http://www.zentao.net
  10. */
  11. namespace zin;
  12. $canModify = common::canModify('project', $project);
  13. $itemLink = array(
  14. 'summary' => createLink('budget', 'summary', "projectID=$projectID"),
  15. 'list' => createLink('budget', 'browse', "projectID=$projectID")
  16. );
  17. featureBar
  18. (
  19. set::current('summary'),
  20. set::itemLink($itemLink),
  21. set::module('budget'),
  22. set::method('summary')
  23. );
  24. toolbar
  25. (
  26. $canModify && hasPriv('budget', 'batchCreate') ? item(set(array(
  27. 'url' => createLink('budget', 'batchcreate', "projectID=$projectID"),
  28. 'class' => 'btn secondary',
  29. 'icon' => 'plus',
  30. 'text' => $lang->budget->batchCreate
  31. ))) : null,
  32. $canModify && hasPriv('budget', 'create') ? item(set(array(
  33. 'url' => createLink('budget', 'create', "projectID=$projectID"),
  34. 'class' => 'btn primary',
  35. 'icon' => 'plus',
  36. 'text' => $lang->budget->create
  37. ))) : null
  38. );
  39. if(empty($subjects))
  40. {
  41. div(
  42. setClass('dtable'),
  43. div(setClass('dtable-empty-tip'), p(setClass('text-muted'), $lang->noData))
  44. );
  45. }
  46. else
  47. {
  48. $header1Cells = array(h::th(set('rowspan', $hasSubSubject ? 2 : 1), $lang->budget->stage));
  49. foreach($subjects as $id => $subject) $header1Cells[] = h::th(set('colspan', count($subject)), zget($modules, $id));
  50. $header1Cells[] = h::th(set('rowspan', $hasSubSubject ? 2 : 1), $lang->budget->summary);
  51. $header2Cells = array();
  52. if($hasSubSubject)
  53. {
  54. foreach($subjects as $id => $subject)
  55. {
  56. foreach($subject as $subjectID) $header2Cells[] = h::th(zget($modules, $subjectID));
  57. }
  58. }
  59. $bodyRows = array();
  60. foreach($summary['stages'] as $stageID => $subject)
  61. {
  62. $cells = array(h::td(zget($plans, $stageID, $stageID)));
  63. foreach($subject as $cost) $cells[] = h::td($cost);
  64. $cells[] = h::td(array_sum($subject));
  65. $bodyRows[] = h::tr($cells);
  66. }
  67. $footCells = array(h::td(setClass('font-bold'), $lang->budget->summary));
  68. foreach($summary['subjects'] as $cost) $footCells[] = h::td(setClass('font-bold'), $cost);
  69. $footCells[] = h::td(setClass('font-bold'), array_sum($summary['subjects']));
  70. div
  71. (
  72. setClass('center-block'),
  73. h::table
  74. (
  75. setClass('table bordered'),
  76. h::thead
  77. (
  78. h::tr(setClass('text-left table-title'), $header1Cells),
  79. $hasSubSubject ? h::tr(setClass('text-left table-title'), $header2Cells) : null
  80. ),
  81. h::tbody($bodyRows),
  82. h::tfoot(h::tr(setClass('summary font-bold'), $footCells))
  83. ),
  84. div
  85. (
  86. setClass('alert alert-info mg-0'),
  87. $lang->budget->total . ':' . array_sum($summary['subjects']) . (isset($project->budgetUnit) ? $lang->budget->{$project->budgetUnit} : '')
  88. )
  89. );
  90. }