appview.html.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php
  2. /**
  3. * The appview view file of store module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  6. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Ke Zhao<zhaoke@easycorp.ltd>
  8. * @package store
  9. * @link https://www.zentao.net
  10. */
  11. namespace zin;
  12. $screenshots = array_filter($cloudApp->screenshot_urls);
  13. if(!empty($screenshots) && count($screenshots)%3) $screenshots = array_merge($screenshots, array_fill(0, count($screenshots)%3, ''));
  14. $screenshotsWg = array();
  15. foreach($screenshots as $screenshot)
  16. {
  17. $screenshotsWg[] = div
  18. (
  19. setClass('flex-1 img-thumbnail'),
  20. $screenshot ? img
  21. (
  22. set::src($screenshot),
  23. setClass('state'),
  24. on::click('window.open("' . $screenshot . '")')
  25. ) : null
  26. );
  27. }
  28. $dynamicArticlesWd = array();
  29. foreach($dynamicArticles as $article)
  30. {
  31. $dynamicArticlesWd[] = h::tr(h::td(a($article->title, set::href($article->url), set::target('_bland'))));
  32. }
  33. $dropMenus = array();
  34. $dropMenus[] = array('text' => $lang->store->gitUrl, 'icon' => 'github', 'id' => 'git', 'target' => '_blank', 'url' => zget($cloudApp, 'git_url', '#'));
  35. $dropMenus[] = array('text' => $lang->store->dockerfileUrl, 'icon' => 'docker', 'id' => 'docker', 'target' => '_blank', 'url' => zget($cloudApp, 'dockerfile_url', '#'));
  36. $dropMenus[] = array('text' => $lang->store->forumUrl, 'icon' => 'forum', 'id' => 'forum', 'target' => '_blank', 'url' => 'https://www.qucheng.com/forum/usage.html');
  37. detailHeader(
  38. to::prefix
  39. (
  40. backBtn
  41. (
  42. set::icon('back'),
  43. set::type('secondary'),
  44. set::url(inLink('browse')),
  45. $lang->goback
  46. )
  47. ),
  48. to::title(''),
  49. to::suffix
  50. (
  51. div
  52. (
  53. setID('store-detail-action'),
  54. dropdown
  55. (
  56. set::staticMenu(true),
  57. btn(setClass('ghost text-black mr-2'), set::icon('info-sign'), $lang->store->support),
  58. set::items($dropMenus)
  59. ),
  60. hasPriv('instance', 'manage') ? btn
  61. (
  62. $lang->store->install,
  63. setClass('primary btn install-btn w-20'),
  64. set::type('primary'),
  65. set::url($this->createLink('space', 'createApplication', "id={$cloudApp->id}")),
  66. setData('toggle', 'modal')
  67. ) : null
  68. )
  69. )
  70. );
  71. detailBody
  72. (
  73. sectionList
  74. (
  75. section
  76. (
  77. div
  78. (
  79. setClass('flex'),
  80. img(set::src($cloudApp->logo), setStyle(array('width' => '50px', 'height' => '50px'))),
  81. div(setClass('app-name-container'),div($cloudApp->alias, setClass('app-name')))
  82. )
  83. ),
  84. section
  85. (
  86. set::title($lang->store->appBasicInfo),
  87. set::content($cloudApp->desc),
  88. set::useHtml(true),
  89. h::table
  90. (
  91. setStyle('min-width', '600px'),
  92. setClass('table w-auto max-w-full bordered mt-4 text-center store-info'),
  93. h::tr
  94. (
  95. h::th($lang->store->appVersion),
  96. h::th($lang->store->appType),
  97. h::th($lang->store->author),
  98. h::th($lang->store->releaseDate)
  99. ),
  100. h::tr
  101. (
  102. h::td($cloudApp->app_version),
  103. h::td(trim(implode('/', helper::arrayColumn($cloudApp->categories, 'alias')), '/')),
  104. h::td($cloudApp->author),
  105. h::td((new \DateTime($cloudApp->publish_time))->format('Y-m-d'))
  106. )
  107. )
  108. ),
  109. section
  110. (
  111. set::title($lang->store->screenshots),
  112. div
  113. (
  114. setClass('flex gap-5 flex-wrap'),
  115. empty($screenshotsWg) ? div($lang->store->noScreenshot, setClass('errorBox')) : '',
  116. ...$screenshotsWg
  117. )
  118. ),
  119. section
  120. (
  121. set::title($lang->store->appDynamic),
  122. set::content(empty($dynamicArticles) ? $lang->store->noDynamicArticle : ''),
  123. empty($dynamicArticles) ? '' : div
  124. (
  125. setClass('border pb-5 pt-5'),
  126. h::table(setID('dynamicTable'), setClass('table borderless table-hover mb-3'), ...$dynamicArticlesWd),
  127. pager(set::props(array('id' => 'dynamicPager')))
  128. )
  129. )
  130. )
  131. );