themeswitch.html.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * The theme switch 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. /**
  12. * 展示主题切换页面。
  13. * Print theme switch.
  14. */
  15. function printThemeSwitch()
  16. {
  17. global $lang, $config, $app;
  18. $themes = array();
  19. foreach($lang->block->themes as $themeKey => $themeName)
  20. {
  21. $image = $config->webRoot . "theme/default/images/guide/theme_{$themeKey}.png";
  22. $themes[] = cell
  23. (
  24. set::width($app->getClientLang() == 'en' ? '168px' : '172px'),
  25. setClass("p-1 pb-0 rounded-md block theme-{$themeKey}", $app->cookie->theme == $themeKey ? 'active' : ''),
  26. div
  27. (
  28. div
  29. (
  30. setClass('w-full theme-block state'),
  31. set('data-theme', $themeKey),
  32. img
  33. (
  34. set('src', $image)
  35. ),
  36. div
  37. (
  38. setClass("px-2 py-1 text-center text-white"),
  39. span
  40. (
  41. icon('check-circle mr-2 hidden'),
  42. $themeName
  43. )
  44. )
  45. )
  46. )
  47. );
  48. }
  49. return div
  50. (
  51. setClass('theme-switch'),
  52. div
  53. (
  54. div
  55. (
  56. setClass('flex flex-wrap gap-7 px-10 pt-6'),
  57. $themes
  58. )
  59. )
  60. );
  61. }