effort.html.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * The effort view file of execution module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author sun guangming <sunguangming@cnezsoft.com>
  8. * @package execution
  9. * @link https://www.zentao.net
  10. */
  11. namespace zin;
  12. $filterItems = array();
  13. foreach($this->lang->execution->featureBar['effortcalendar'] as $period => $label)
  14. {
  15. if($period == 'calendar' && !hasPriv('execution', 'effortcalendar')) continue;
  16. if($period != 'calendar' && !hasPriv('execution', 'effort')) break;
  17. $method = $period == 'calendar' ? 'effortcalendar' : 'effort';
  18. $vars = $period == 'calendar' ? "executionID=$executionID" : "executionID=$executionID&date=$period&userID=$userID";
  19. $filterItems[] = array('text' => $label, 'url' => inlink($method, $vars), 'active' => $period == $date);
  20. if($period == $date) $filterItems[count($filterItems) - 1]['badge'] = $pager->recTotal;
  21. }
  22. featureBar
  23. (
  24. set::items($filterItems),
  25. datePicker
  26. (
  27. setClass('ml-4 w-36'),
  28. set::value($today),
  29. set::onChange(jsRaw("(value) => {if(!value) return; loadPage($.createLink('execution', 'effort', 'executionID=$executionID&date=' + zui.formatDate(value, 'yyyyMMdd') + '&userID=$userID'))}"))
  30. ),
  31. picker
  32. (
  33. setClass('ml-4'),
  34. set::width(150),
  35. set::placeholder($users['']),
  36. set::items($users),
  37. set::value($userID),
  38. set::onChange(jsRaw("(val) => loadPage($.createLink('execution', 'effort', 'executionID=$executionID&date=$date&userID=' + (val || '')))"))
  39. )
  40. );
  41. $toolbarItems = array();
  42. if(hasPriv('effort', 'export')) $toolbarItems[] = array('type' => 'ghost', 'text' => $lang->effort->export, 'icon' => 'import', 'url' => createLink('effort', 'export', "userID=$userID&orderBy=date_asc&executionID=$executionID"), 'data-toggle' => 'modal');
  43. toolbar(set::items($toolbarItems));
  44. $canExport = hasPriv('effort', 'export');
  45. $consumed = 0;
  46. foreach($efforts as $effort) $consumed += (float)$effort->consumed;
  47. $cols = $this->loadModel('datatable')->getSetting('execution', 'effort');
  48. dtable
  49. (
  50. set::cols($cols),
  51. set::data($efforts),
  52. set::customCols(true),
  53. set::userMap($accounts),
  54. set::checkable($canExport),
  55. set::checkInfo(jsRaw("function(checkedIDList){return {html: '" . sprintf($lang->company->effort->timeStat, round($consumed, 2)) . "'}}")),
  56. set::orderBy($orderBy),
  57. set::sortLink(createLink('execution', 'effort', "executionID=$executionID&date=$date&userID=$userID&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
  58. set::footPager(usePager()),
  59. set::onRenderCell(jsRaw("window.renderCell"))
  60. );