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