XoopsModules25x /
suico
| 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 | use XoopsModules\Suico\Helper; |
||
| 24 | |||
| 25 | if (!defined('XOOPS_ROOT_PATH')) { |
||
| 26 | exit(); |
||
| 27 | } |
||
| 28 | //include_once(XOOPS_ROOT_PATH."/class/criteria.php"); |
||
| 29 | //require_once XOOPS_ROOT_PATH . '/modules/suico/class/Image.php'; |
||
| 30 | /** |
||
| 31 | * @param $options |
||
| 32 | * @return array |
||
| 33 | */ |
||
| 34 | function b_suico_lastpictures_show($options) |
||
| 35 | { |
||
| 36 | global $xoopsDB; |
||
| 37 | |||
| 38 | /** @var Helper $helper */ |
||
| 39 | if (!class_exists(Helper::class)) { |
||
| 40 | return false; |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 41 | } |
||
| 42 | |||
| 43 | $helper = Helper::getInstance(); |
||
| 44 | $helper->loadLanguage('main'); |
||
| 45 | |||
| 46 | $myts = \MyTextSanitizer::getInstance(); |
||
| 47 | $block = []; |
||
| 48 | /** |
||
| 49 | * Criteria for Pictures Block |
||
| 50 | */ |
||
| 51 | $criteria = new Criteria('image_id', 0, '>'); |
||
| 52 | $criteria->setSort('image_id'); |
||
| 53 | $criteria->setOrder('DESC'); |
||
| 54 | $criteria->setLimit($options[4]); |
||
| 55 | /** |
||
| 56 | * Creating factories of pictures |
||
| 57 | */ |
||
| 58 | $imageFactory = new \XoopsModules\Suico\ImageHandler($xoopsDB); |
||
| 59 | $block['picture'] = $imageFactory->getLastPicturesForBlock($options[4]); |
||
| 60 | $block['showtitle'] = $options[0]; |
||
| 61 | $block['showcaption'] = $options[1]; |
||
| 62 | $block['showdate'] = $options[2]; |
||
| 63 | $block['showowner'] = $options[3]; |
||
| 64 | return $block; |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @param $options |
||
| 69 | * @return string |
||
| 70 | */ |
||
| 71 | function b_suico_lastpictures_edit($options) |
||
| 72 | { |
||
| 73 | $form = _MB_SUICO_SHOWPICTURETITLE . ' '; |
||
| 74 | $chk = ''; |
||
| 75 | if (isset($options[0]) && 0 != $options[0]) { |
||
| 76 | $chk = ' checked'; |
||
| 77 | } |
||
| 78 | $form .= "<input type='radio' name='options[0]' value='1'" . $chk . ' > ' . _YES . ''; |
||
| 79 | $chk = ''; |
||
| 80 | if (!isset($options[0]) || 0 == $options[0]) { |
||
| 81 | $chk = ' checked'; |
||
| 82 | } |
||
| 83 | $form .= " <input type='radio' name='options[0]' value='0'" . $chk . ' >' . _NO . '<br>'; |
||
| 84 | $form .= _MB_SUICO_SHOWPICTURECAPTION . ' '; |
||
| 85 | if (isset($options[1]) && 1 == $options[1]) { |
||
| 86 | $chk = ' checked'; |
||
| 87 | } |
||
| 88 | $form .= "<input type='radio' name='options[1]' value='1'" . $chk . ' > ' . _YES . ''; |
||
| 89 | $chk = ''; |
||
| 90 | if (!isset($options[1]) || 0 == $options[1]) { |
||
| 91 | $chk = ' checked'; |
||
| 92 | } |
||
| 93 | $form .= " <input type='radio' name='options[1]' value='0'" . $chk . ' >' . _NO . '<br>'; |
||
| 94 | $form .= _MB_SUICO_SHOWPICTUREDATE . ' '; |
||
| 95 | if (isset($options[2]) && 1 == $options[2]) { |
||
| 96 | $chk = ' checked'; |
||
| 97 | } |
||
| 98 | $form .= "<input type='radio' name='options[2]' value='1'" . $chk . ' > ' . _YES . ''; |
||
| 99 | $chk = ''; |
||
| 100 | if (!isset($options[2]) || 0 == $options[2]) { |
||
| 101 | $chk = ' checked'; |
||
| 102 | } |
||
| 103 | $form .= " <input type='radio' name='options[2]' value='0'" . $chk . ' >' . _NO . '<br>'; |
||
| 104 | $form .= _MB_SUICO_SHOWPICTUREOWNER . ' '; |
||
| 105 | if (isset($options[3]) && 1 == $options[3]) { |
||
| 106 | $chk = ' checked'; |
||
| 107 | } |
||
| 108 | $form .= "<input type='radio' name='options[3]' value='1'" . $chk . ' > ' . _YES . ''; |
||
| 109 | $chk = ''; |
||
| 110 | if (!isset($options[3]) || 0 == $options[3]) { |
||
| 111 | $chk = ' checked'; |
||
| 112 | } |
||
| 113 | $form .= " <input type='radio' name='options[3]' value='0'" . $chk . ' >' . _NO . '<br>'; |
||
| 114 | $form .= _MB_SUICO_TOTALPICTUREDISPLAY . ' '; |
||
| 115 | $form .= "<input type='text' name='options[4]' value='" . (isset($options[4]) ? $options[4] : 0) . "'>"; |
||
| 116 | return $form; |
||
| 117 | } |
||
| 118 |