XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
legacy_themes.php
1<?php
14
19function b_legacy_themes_show($options): ?array
20{
21 global $xoopsConfig;
22
23 if (0 === (is_countable($xoopsConfig['theme_set_allowed']) ? count($xoopsConfig['theme_set_allowed']) : 0)) {
24 return null;
25 }
26
27 $block = [];
28 if ('POST' === xoops_getenv('REQUEST_METHOD')) {
29 $block['isEnableChanger'] = 0;
30 return $block;
31 }
32
33 $block['isEnableChanger'] = 1;
34
35 $theme_options = [];
36 $handler = xoops_getmodulehandler('theme', 'legacy');
37 foreach ($xoopsConfig['theme_set_allowed'] as $name) {
38 $theme = $handler->get($name);
39 if ( $theme !== null ) {
40 $theme_option['name'] = $name;
41 $theme_option['screenshot'] = $theme->getShow('screenshot');
42 $theme_option['screenshotUrl'] = XOOPS_THEME_URL . '/' . $name . '/' . $theme->getShow('screenshot');
43 if ($name === $xoopsConfig['theme_set']) {
44 $theme_option['selected'] = 'selected="selected"';
45 $block['theme_selected_screenshot'] = $theme->getShow('screenshot');
46 $block['theme_selected_name'] = $name;
47 } else {
48 $theme_option['selected'] = '';
49 }
50 $theme_options[] = $theme_option;
51 }
52 }
53
54 $block['count'] = is_countable($xoopsConfig['theme_set_allowed']) ? count($xoopsConfig['theme_set_allowed']) : 0;
55 $block['mode'] = $options[0];
56 $block['width'] = $options[1];
57 $block['theme_options'] = $theme_options;
58 return $block;
59}
60
61function b_legacy_themes_edit($options)
62{
63 $chk = '';
64 $form = '<div>'._MB_LEGACY_LANG_THSHOW.'&nbsp;&nbsp;';
65 if (1 == $options[0]) {
66 $chk = ' checked="checked"';
67 }
68 $form .= '<input type="radio" name="options[0]" id="display-yes" value="1" '.$chk.'><label for="display-yes">'._YES.'</label>';
69 $chk = '';
70 if (0 == $options[0]) {
71 $chk = ' checked="checked"';
72 }
73 $form .= '<input type="radio" name="options[0]" id="display-no" value="0" '.$chk.'><label for="display-no">'._NO.'</label></div>';
74 $form .= '<div><label for="screenshot">'._MB_LEGACY_LANG_THWIDTH.' </label>';
75 $form .= '<input type="text" name="options[1]" id="screenshot" size="3" value="'.$options[1].'"></div>';
76 return $form;
77}