todo.html.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. /**
  3. * The todo view file of my module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  5. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  6. * @author Yuting Wang <wangyuting@easycorp.ltd>
  7. * @package my
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('changeDateLabel', $lang->todo->changeDate);
  12. featureBar
  13. (
  14. set::current($type),
  15. set::linkParams("type={key}&userID={$user->id}&status=all&orderBy={$orderBy}"),
  16. set::itemLink(array('undone' => createLink($app->rawModule, $app->rawMethod, "type=undone&userID={$user->id}&status=undone&orderBy={$orderBy}"))),
  17. datePicker
  18. (
  19. set::_class('w-32'),
  20. set::onChange(jsRaw("(value) => loadPage($.createLink('my', 'todo', 'date=' + (value ? zui.formatDate(value, 'yyyyMMdd') : '')))"))
  21. )
  22. );
  23. $canCreate = hasPriv('todo', 'create');
  24. $canBatchCreate = hasPriv('todo', 'batchCreate');
  25. toolbar
  26. (
  27. $config->edition != 'open' && !empty($app->user) && common::hasPriv('todo', 'calendar') ? item(set(array
  28. (
  29. 'type' => 'btnGroup',
  30. 'items' => array(array
  31. (
  32. 'icon' => 'cards-view',
  33. 'class' => 'btn-icon',
  34. 'hint' => $lang->todo->calendar,
  35. 'url' => createLink('todo', 'calendar')
  36. ), array
  37. (
  38. 'icon' => 'list',
  39. 'class' => 'btn-icon text-primary',
  40. 'hint' => $lang->todo->list,
  41. 'url' => createLink('my', 'todo', "type=all")
  42. ))
  43. ))) : null,
  44. hasPriv('todo', 'export') ? item
  45. (
  46. set(array(
  47. 'text' => $lang->todo->export,
  48. 'icon' => 'export',
  49. 'class' => 'ghost',
  50. 'url' => createLink('todo', 'export', "userID={$user->id}&orderBy=$orderBy"),
  51. 'data-toggle' => 'modal'
  52. ))
  53. ) : null,
  54. $canCreate || $canBatchCreate ? btngroup
  55. (
  56. $canCreate ? btn
  57. (
  58. setClass('btn primary'),
  59. set::icon('plus'),
  60. setData(array('toggle' => 'modal')),
  61. set::url(helper::createLink('todo', 'create')),
  62. $lang->todo->create
  63. ) : btn
  64. (
  65. setClass('btn primary'),
  66. set::icon('plus'),
  67. set::url(helper::createLink('todo', 'batchCreate')),
  68. setData('toggle', 'modal'),
  69. setData('size', 'lg'),
  70. setData('class-name', 'batchCreateTodoModal'),
  71. $lang->todo->batchCreate
  72. ),
  73. $canCreate && $canBatchCreate ? dropdown
  74. (
  75. btn(setClass('btn primary dropdown-toggle'), setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
  76. set::items(array
  77. (
  78. array('text' => $lang->todo->create, 'url' => helper::createLink('todo', 'create'), 'data-toggle' => 'modal'),
  79. array('text' => $lang->todo->batchCreate, 'url' => helper::createLink('todo', 'batchCreate'), 'data-toggle' => 'modal', 'data-size' => 'lg', 'data-class-name' => 'batchCreateTodoModal')
  80. )),
  81. set::placement('bottom-end')
  82. ) : null
  83. ) : null
  84. );
  85. $batchEdit = hasPriv('todo', 'batchEdit');
  86. $batchFinish = hasPriv('todo', 'batchFinish');
  87. $batchClose = hasPriv('todo', 'batchClose');
  88. $footToolbar = array('items' => array
  89. (
  90. $batchEdit ? array('text' => $lang->edit, 'className' => 'batch-btn', 'data-url' => helper::createLink('todo', 'batchEdit', "from=myTodo&type=$type&userID={$user->id}&status=$status")) : null,
  91. $batchFinish ? array('text' => $lang->todo->finish, 'className' => 'batch-btn ajax-btn', 'data-url' => helper::createLink('todo', 'batchFinish')) : null,
  92. $batchClose ? array('text' => $lang->todo->close, 'className' => 'batch-btn ajax-btn', 'data-url' => helper::createLink('todo', 'batchClose')) : null
  93. ), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary'));
  94. if($type == 'assignedToOther') unset($config->my->todo->dtable->fieldList['assignedBy']);
  95. if($type != 'assignedToOther') unset($config->my->todo->dtable->fieldList['assignedTo']);
  96. $todos = initTableData($todos, $config->my->todo->dtable->fieldList, $this->todo);
  97. $cols = array_values($config->my->todo->dtable->fieldList);
  98. $data = array_values($todos);
  99. $defaultSummary = sprintf($lang->todo->summary, count($todos), $waitCount, $doingCount);
  100. dtable
  101. (
  102. set::cols($cols),
  103. set::data($data),
  104. set::userMap($users),
  105. set::priList($lang->todo->priList),
  106. set::fixedLeftWidth('44%'),
  107. set::checkable(true),
  108. set::defaultSummary(array('html' => $defaultSummary)),
  109. set::checkedSummary($lang->todo->checkedSummary),
  110. set::checkInfo(jsRaw('function(checkedIDList){return window.setStatistics(this, checkedIDList);}')),
  111. set::orderBy($orderBy),
  112. set::sortLink(createLink('my', 'todo', "type={$type}&userID={$user->id}&status={$status}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
  113. set::emptyTip($lang->my->noTodo),
  114. set::createTip($lang->todo->create),
  115. set::createLink($canCreate ? createLink('todo', 'create') : ''),
  116. set::createAttr('data-toggle="modal"'),
  117. set::footToolbar($footToolbar),
  118. set::footPager(usePager()),
  119. set::footer(array('checkbox', 'toolbar', hasPriv('todo', 'import2Today') && $type != 'today' ? jsRaw('window.generateHtml') : '', 'checkedInfo', 'flex', 'pager'))
  120. );
  121. render();