backupview.html.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * The backupview view file of system 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 Li Yang<liyang@chandao.com>
  7. * @package system
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. $backupDetail = zget($backup, 'backup_details', array());
  12. $backupList = array();
  13. if(!empty($backupDetail) && empty($backup->message))
  14. {
  15. foreach($backupDetail as $type => $infoList)
  16. {
  17. if(!in_array($type, array('db', 'volume'))) continue;
  18. foreach($infoList as $info)
  19. {
  20. $size = $type == 'db' ? zget($info, 'size', 0) : zget($info, 'total_bytes', 0);
  21. $backupList[] = h::tr
  22. (
  23. h::td(zget($lang->system->backup->backupTypeList, $type)),
  24. h::td($type == 'db' ? zget($info, 'db_name', '') : zget($info, 'pvc_name', '')),
  25. h::td(round($size / 1024 / 1024, 2) == 0 ? $size . ' B' : round($size / 1024 / 1024, 2) . ' MB'),
  26. h::td(zget($lang->system->backup->statusList, $info->status))
  27. );
  28. }
  29. }
  30. }
  31. detailHeader
  32. (
  33. to::prefix(''),
  34. to::title
  35. (
  36. entityLabel
  37. (
  38. set::level(1),
  39. set::text($title)
  40. )
  41. )
  42. );
  43. div
  44. (
  45. !empty($backup->message) ? sectionList(div(setClass('w-full text-center pt-10'), sprintf($lang->system->backup->error->backupFailNotice, $backup->message))) : sectionList
  46. (
  47. empty($backupList) ? div(setClass('w-full text-center pt-10'), $lang->noData) : div
  48. (
  49. setClass('flex-none'),
  50. h::table
  51. (
  52. setClass('table w-full max-w-full bordered text-center'),
  53. h::thead
  54. (
  55. h::tr
  56. (
  57. h::th($lang->system->backup->type),
  58. h::th($lang->system->backup->backupName),
  59. h::th($lang->system->backup->size),
  60. h::th($lang->system->backup->status)
  61. )
  62. ),
  63. h::tbody
  64. (
  65. $backupList
  66. )
  67. )
  68. )
  69. )
  70. );