gantt.html.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. /**
  3. * The gantt view file of programplan module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
  6. * @license ZPL (http://zpl.pub/page/zplv12.html)
  7. * @author Yidong Wang <yidong@cnezsoft.com>
  8. * @package programplan
  9. * @version $Id$
  10. * @link http://www.zentao.net
  11. */
  12. namespace zin;
  13. include './ganttfields.html.php';
  14. $showFields = str_replace('PM', 'owner_id', $showFields);
  15. $isFromDoc = $from === 'doc';
  16. if($isFromDoc)
  17. {
  18. jsVar('ganttOptions', $plans);
  19. jsVar('ganttFields', $ganttFields);
  20. jsVar('showFields', $showFields);
  21. $this->app->loadLang('doc');
  22. $projectChangeLink = createLink('programPlan', 'browse', "projectID={projectID}&productID={$productID}&type={$type}&orderBy=$orderBy&baselineID=&browseType={$browseType}&queryID={$queryID}&from=$from&blockID=$blockID");
  23. $insertLink = createLink('programPlan', 'browse', "projectID=$projectID&productID={$productID}&type={$type}&orderBy=$orderBy&baselineID=&browseType={$browseType}&queryID={$queryID}&from=$from&blockID={blockID}");
  24. formPanel
  25. (
  26. setID('zentaolist'),
  27. setClass('mb-4-important'),
  28. set::title(sprintf($this->lang->doc->insertTitle, $this->lang->doc->zentaoList['gantt'])),
  29. set::actions(array()),
  30. set::showExtra(false),
  31. to::titleSuffix
  32. (
  33. span
  34. (
  35. setClass('text-muted text-sm text-gray-600 font-light'),
  36. span(setClass('text-warning mr-1'), icon('help')),
  37. $lang->doc->previewTip
  38. )
  39. ),
  40. formRow
  41. (
  42. formGroup
  43. (
  44. set::width('1/2'),
  45. set::name('project'),
  46. set::label($lang->doc->project),
  47. set::control(array('required' => false)),
  48. set::items($projects),
  49. set::value($projectID),
  50. set::required(),
  51. span
  52. (
  53. setClass('error-tip text-danger hidden'),
  54. $lang->doc->emptyError
  55. ),
  56. on::change('[name="project"]')->do("loadModal('$projectChangeLink'.replace('{projectID}', $(this).val()))")
  57. )
  58. )
  59. );
  60. }
  61. if($app->rawModule == 'programplan' && !$isFromDoc)
  62. {
  63. $productDropdown = null;
  64. if($project->stageBy == 'product' && empty($project->isTpl))
  65. {
  66. $viewName = $productID != 0 ? zget($productList, $productID) : $lang->product->allProduct;
  67. $items = array(array('text' => $lang->product->allProduct, 'url' => $this->createLink('programplan', 'browse', "projectID=$projectID&productID=0&type=gantt"), 'active' => $productID == 'all' || $productID == '0'));
  68. foreach($productList as $key => $productName) $items[] = array('text' => $productName, 'url' => $this->createLink('programplan', 'browse', "projectID=$projectID&productID=$key&type=gantt"), 'active' => ($productID == $key || ($key == 0 && $productID == 'all')));
  69. $productDropdown = dropdown
  70. (
  71. btn(set::type('link'), setClass('no-underline'), $viewName),
  72. set::items($items)
  73. );
  74. }
  75. featureBar
  76. (
  77. btn(setClass('ghost mr-2', ($browseType != 'bysearch' ? 'active' : '')), $lang->programplan->gantt, set::url($this->createLink('programplan', 'browse', "projectID=$projectID&productID=$productID&type=gantt"))),
  78. $productDropdown,
  79. $hasSearch ? li(searchToggle(set::module('projectTask'), set::open($browseType == 'bysearch'))) : null
  80. );
  81. toolbar
  82. (
  83. btnGroup
  84. (
  85. btn(setClass('square switchBtn text-primary'), set::title($lang->programplan->gantt), icon('gantt-alt')),
  86. btn(setClass('square switchBtn'), set::title($lang->project->bylist), set::url($this->createLink('project', 'execution', "status=all&projectID=$projectID")), icon('list'))
  87. ),
  88. btn(setClass('no-underline text-primary'), set::type('link'), setID('criticalPath'), $lang->execution->gantt->showCriticalPath, set::url('javascript:updateCriticalPath()')),
  89. btn(setClass('no-underline'), set::type('link'), setID('fullScreenBtn'), set::icon('fullscreen'), $lang->programplan->full),
  90. dropdown
  91. (
  92. btn(set::type('link'), setClass('no-underline'), set::icon('export'), $lang->export),
  93. set::items(array
  94. (
  95. array('text' => $lang->execution->gantt->exportImg, 'url' => 'javascript:exportGantt()'),
  96. array('text' => $lang->execution->gantt->exportPDF, 'url' => 'javascript:exportGantt("pdf")')
  97. ))
  98. ),
  99. btn(set::url($this->createLink('programplan', 'ajaxcustom')), set::icon('cog-outline'), $lang->settings, setClass('no-underline'), set::type('link'), set('data-toggle', 'modal'), set('data-size', 'sm')),
  100. common::hasPriv('programplan', 'relation') ? btn(set::url($this->createLink('programplan', 'relation', "projectID={$projectID}")), set::icon('list-alt'), $lang->programplan->setTaskRelation, setClass('no-underline'), set::type('link')) : null,
  101. (common::canModify('project', $project) && common::hasPriv('programplan', 'create') && empty($product->deleted)) ? btn(set::url($this->createLink('programplan', 'create', "projectID=$projectID&productID=$productID")), set::icon('plus'), $lang->programplan->create, setClass('primary programplan-create-btn')) : null
  102. );
  103. }
  104. gantt
  105. (
  106. set('ganttLang', $ganttLang),
  107. set('ganttFields', $ganttFields),
  108. set('canEdit', $isFromDoc ? false : hasPriv('programplan', 'ganttEdit')),
  109. set('canEditDeadline', $isFromDoc ? false : hasPriv('review', 'edit')),
  110. set('zooming', isset($zooming) ? $zooming : 'day'),
  111. set('showChart', !$dateDetails),
  112. set('users', $users),
  113. set('showFields', $showFields),
  114. set::exportFileName('gantt-export-' . $projectID),
  115. set::weekend(array('weekend' => zget($config->execution, 'weekend', 2), 'restDay' => zget($config->execution, 'restDay', 0))),
  116. set('options', $plans)
  117. );
  118. $isFromDoc ? btn
  119. (
  120. setClass('mt-4'),
  121. set::type('primary'),
  122. on::click("insertToDoc($blockID, '$insertLink')"),
  123. $lang->doc->insertText
  124. ) : null;