1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | /* |
||
5 | You may not change or alter any portion of this comment or credits |
||
6 | of supporting developers from this source code or any supporting source code |
||
7 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
8 | |||
9 | This program is distributed in the hope that it will be useful, |
||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
12 | */ |
||
13 | |||
14 | /** |
||
15 | * @category Module |
||
16 | * @package suico |
||
17 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
18 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
19 | * @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
||
20 | */ |
||
21 | |||
22 | use XoopsModules\Suico; |
||
23 | |||
24 | if (!defined('XOOPS_ROOT_PATH')) { |
||
25 | exit(); |
||
26 | } |
||
27 | //include_once(XOOPS_ROOT_PATH."/class/criteria.php"); |
||
28 | //require_once XOOPS_ROOT_PATH . '/modules/suico/class/Image.php'; |
||
29 | /** |
||
30 | * @param $options |
||
31 | * @return array |
||
32 | */ |
||
33 | function b_suico_lastpictures_show($options) |
||
34 | { |
||
35 | global $xoopsDB, $xoopsModule, $xoopsModuleConfig; |
||
36 | $myts = MyTextSanitizer::getInstance(); |
||
37 | $block = []; |
||
38 | |||
39 | /** |
||
40 | * Criteria for Pictures Block |
||
41 | */ |
||
42 | $criteria = new Criteria('image_id', 0, '>'); |
||
43 | $criteria->setSort('image_id'); |
||
44 | $criteria->setOrder('DESC'); |
||
45 | $criteria->setLimit($options[4]); |
||
46 | |||
47 | /** |
||
48 | * Creating factories of pictures |
||
49 | */ |
||
50 | $imageFactory = new Suico\ImageHandler($xoopsDB); |
||
51 | $block['picture'] = $imageFactory->getLastPicturesForBlock($options[4]); |
||
52 | $block['showtitle'] = $options[0]; |
||
53 | $block['showcaption'] = $options[1]; |
||
54 | $block['showdate'] = $options[2]; |
||
55 | $block['showowner'] = $options[3]; |
||
56 | return $block; |
||
57 | |||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @param $options |
||
62 | * @return string |
||
63 | */ |
||
64 | function b_suico_lastpictures_edit($options) |
||
65 | { |
||
66 | $form = _MB_SUICO_SHOWPICTURETITLE . ' '; |
||
67 | if (1 == $options[0]) { |
||
68 | $chk = " checked='checked'"; |
||
69 | } |
||
70 | $form .= "<input type='radio' name='options[0]' value='1'" . $chk . ' > ' . _YES . ''; |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
71 | $chk = ''; |
||
72 | if (0 == $options[0]) { |
||
73 | $chk = " checked='checked'"; |
||
74 | } |
||
75 | $form .= " <input type='radio' name='options[0]' value='0'" . $chk . ' >' . _NO . '<br>'; |
||
76 | |||
77 | $form .= _MB_SUICO_SHOWPICTURECAPTION . ' '; |
||
78 | if (1 == $options[1]) { |
||
79 | $chk = " checked='checked'"; |
||
80 | } |
||
81 | $form .= "<input type='radio' name='options[1]' value='1'" . $chk . ' > ' . _YES . ''; |
||
82 | $chk = ''; |
||
83 | if (0 == $options[1]) { |
||
84 | $chk = " checked='checked'"; |
||
85 | } |
||
86 | $form .= " <input type='radio' name='options[1]' value='0'" . $chk . ' >' . _NO . '<br>'; |
||
87 | |||
88 | $form .= _MB_SUICO_SHOWPICTUREDATE . ' '; |
||
89 | if (1 == $options[2]) { |
||
90 | $chk = " checked='checked'"; |
||
91 | } |
||
92 | $form .= "<input type='radio' name='options[2]' value='1'" . $chk . ' > ' . _YES . ''; |
||
93 | $chk = ''; |
||
94 | if (0 == $options[2]) { |
||
95 | $chk = " checked='checked'"; |
||
96 | } |
||
97 | $form .= " <input type='radio' name='options[2]' value='0'" . $chk . ' >' . _NO . '<br>'; |
||
98 | |||
99 | $form .= _MB_SUICO_SHOWPICTUREOWNER . ' '; |
||
100 | if (1 == $options[3]) { |
||
101 | $chk = " checked='checked'"; |
||
102 | } |
||
103 | $form .= "<input type='radio' name='options[3]' value='1'" . $chk . ' > ' . _YES . ''; |
||
104 | $chk = ''; |
||
105 | if (0 == $options[3]) { |
||
106 | $chk = " checked='checked'"; |
||
107 | } |
||
108 | $form .= " <input type='radio' name='options[3]' value='0'" . $chk . ' >' . _NO . '<br>'; |
||
109 | |||
110 | $form .= _MB_SUICO_TOTALPICTUREDISPLAY . ' '; |
||
111 | $form .= "<input type='text' name='options[4]' value='" . $options[4] . "'>"; |
||
112 | return $form; |
||
113 | } |
||
114 |