docrecentupdateblock.html.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * The docrecentupdate block view file of block 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 block
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. $canView = common::hasPriv('doc', 'view');
  12. $docItems = array();
  13. foreach($docList as $doc)
  14. {
  15. $editTip = $lang->doc->todayUpdated;
  16. $interval = $doc->editInterval;
  17. if($interval->year)
  18. {
  19. $editTip = sprintf($lang->doc->yearsUpdated, $interval->year);
  20. }
  21. elseif($interval->month)
  22. {
  23. $editTip = sprintf($lang->doc->monthsUpdated, $interval->month);
  24. }
  25. elseif($interval->day)
  26. {
  27. $editTip = sprintf($lang->doc->daysUpdated, $interval->day);
  28. }
  29. $docType = $doc->type == 'text' ? 'wiki-file' : $doc->type;
  30. $docItems[] = cell
  31. (
  32. set::width('32%'),
  33. setStyle('width', '32%'),
  34. setClass('border rounded p-2'),
  35. a
  36. (
  37. setClass('text-left w-full'),
  38. set('href', $canView ? createLink('doc', 'view', "docID={$doc->id}") : null),
  39. span
  40. (
  41. setClass('text-gray my-2 pl-2 pull-right'),
  42. $editTip
  43. ),
  44. div
  45. (
  46. setClass('font-bold my-2 mr-2 clip doc-title'),
  47. img
  48. (
  49. setClass('inline pr-1'),
  50. set('src', "static/svg/{$docType}.svg")
  51. ),
  52. $doc->title
  53. ),
  54. p
  55. (
  56. setClass('edit-date text-gray'),
  57. $lang->doc->editedDate . (common::checkNotCN() ? ': ' : ':') . $doc->editedDate
  58. )
  59. )
  60. );
  61. }
  62. blockPanel(empty($docList) ? $lang->doc->noDoc : div(setClass('flex flex-wrap content-between gap-3'), $docItems));
  63. render();