|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
You may not change or alter any portion of this comment or credits |
|
4
|
|
|
of supporting developers from this source code or any supporting source code |
|
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
|
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* banners module |
|
14
|
|
|
* |
|
15
|
|
|
* @copyright XOOPS Project (http://xoops.org) |
|
16
|
|
|
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
|
17
|
|
|
* @package banners |
|
18
|
|
|
* @since 2.6.0 |
|
19
|
|
|
* @author Mage Gregory (AKA Mage) |
|
20
|
|
|
* @version $Id$ |
|
21
|
|
|
*/ |
|
22
|
|
|
function banners_blocks_show($options) |
|
23
|
|
|
{ |
|
24
|
|
|
$block = array(); |
|
25
|
|
|
$xoops = Xoops::getInstance(); |
|
|
|
|
|
|
26
|
|
|
require_once dirname(__DIR__) . '/class/bannerrender.php'; |
|
27
|
|
|
$render = new BannerRender(); |
|
28
|
|
|
switch ($options[0]) { |
|
29
|
|
|
case 'random': |
|
30
|
|
|
$nb_display = $options[1]; |
|
31
|
|
|
$align = $options[2]; |
|
32
|
|
|
array_shift($options); |
|
33
|
|
|
array_shift($options); |
|
34
|
|
|
array_shift($options); |
|
35
|
|
|
$client = $options; |
|
36
|
|
|
$block['banners'] = $render->displayBanner($nb_display, $align, $client); |
|
37
|
|
|
break; |
|
38
|
|
|
|
|
39
|
|
|
case 'id': |
|
40
|
|
|
$ids = $options[1]; |
|
41
|
|
|
$align = $options[2]; |
|
42
|
|
|
$block['banners'] = $render->displayBanner(1, $align, 0, $ids); |
|
|
|
|
|
|
43
|
|
|
break; |
|
44
|
|
|
} |
|
45
|
|
|
return $block; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
function banners_blocks_edit($options) |
|
49
|
|
|
{ |
|
50
|
|
|
$form = ''; |
|
51
|
|
|
switch ($options[0]) { |
|
52
|
|
|
|
|
53
|
|
|
case 'random': |
|
54
|
|
|
$form .= _MB_BANNERS_DISP . " \n"; |
|
55
|
|
|
$form .= "<input type=\"hidden\" name=\"options[0]\" value=\"" . $options[0] . "\" />\n"; |
|
56
|
|
|
$form .= "<input name=\"options[1]\" size=\"5\" maxlength=\"255\" value=\"" . $options[1] . "\" type=\"text\" /> " . _MB_BANNERS . "<br>\n"; |
|
57
|
|
|
switch ($options[2]) { |
|
58
|
|
|
case 'H': |
|
59
|
|
|
$checked_H = 'checked="checked"'; |
|
60
|
|
|
$checked_V = ''; |
|
61
|
|
|
break; |
|
62
|
|
|
|
|
63
|
|
|
case 'V': |
|
64
|
|
|
$checked_H = ''; |
|
65
|
|
|
$checked_V = 'checked="checked"'; |
|
66
|
|
|
break; |
|
67
|
|
|
} |
|
68
|
|
|
$form .= _MB_BANNERS_ALIGNEMENT . " : <input name=\"options[2]\" value=\"H\" type=\"radio\" " . $checked_H . "/>" . _MB_BANNERS_ALIGNEMENT_H . " \n"; |
|
|
|
|
|
|
69
|
|
|
$form .= "<input name=\"options[2]\" value=\"V\" type=\"radio\" " . $checked_V . "/>" . _MB_BANNERS_ALIGNEMENT_V . "<br>\n"; |
|
|
|
|
|
|
70
|
|
|
array_shift($options); |
|
71
|
|
|
array_shift($options); |
|
72
|
|
|
array_shift($options); |
|
73
|
|
|
$form .= _MB_BANNERS_CLIENTSTODISPLAY . "<br><select name=\"options[]\" multiple=\"multiple\" size=\"5\">\n"; |
|
74
|
|
|
$xoops = Xoops::getInstance(); |
|
75
|
|
|
$client_Handler = $xoops->getModuleHandler('bannerclient', 'banners'); |
|
76
|
|
|
$criteria = new CriteriaCompo(); |
|
77
|
|
|
$criteria->setSort('bannerclient_name'); |
|
78
|
|
|
$criteria->setOrder('ASC'); |
|
79
|
|
|
$client_arr = $client_Handler->getAll($criteria); |
|
|
|
|
|
|
80
|
|
|
$form .= "<option value=\"0\" " . (array_search(0, $options) === false ? '' : 'selected="selected"') . ">" . _MB_BANNERS_ALLCLIENTS . "</option>\n"; |
|
81
|
|
|
foreach (array_keys($client_arr) as $i) { |
|
82
|
|
|
$form .= "<option value=\"" . $client_arr[$i]->getVar('cid') . "\" " . (array_search($client_arr[$i]->getVar('cid'), $options) === false ? '' : 'selected="selected"') . ">" . $client_arr[$i]->getVar('name')."</option>\n"; |
|
83
|
|
|
} |
|
84
|
|
|
$form .= "</select>\n"; |
|
85
|
|
|
break; |
|
86
|
|
|
|
|
87
|
|
|
case 'id': |
|
88
|
|
|
$form .= _MB_BANNERS_IDDISPLAY . " \n"; |
|
89
|
|
|
$form .= "<input type=\"hidden\" name=\"options[0]\" value=\"" . $options[0] . "\" />\n"; |
|
90
|
|
|
$form .= "<input name=\"options[1]\" size=\"20\" maxlength=\"255\" value=\"" . $options[1] . "\" type=\"text\" /> " . _MB_BANNERS_SEP . "<br>\n"; |
|
91
|
|
|
switch ($options[2]) { |
|
92
|
|
|
case 'H': |
|
93
|
|
|
$checked_H = 'checked="checked"'; |
|
94
|
|
|
$checked_V = ''; |
|
95
|
|
|
break; |
|
96
|
|
|
|
|
97
|
|
|
case 'V': |
|
98
|
|
|
$checked_H = ''; |
|
99
|
|
|
$checked_V = 'checked="checked"'; |
|
100
|
|
|
break; |
|
101
|
|
|
} |
|
102
|
|
|
$form .= _MB_BANNERS_ALIGNEMENT . " : <input name=\"options[2]\" value=\"H\" type=\"radio\" " . $checked_H . "/>" . _MB_BANNERS_ALIGNEMENT_H . " \n"; |
|
103
|
|
|
$form .= "<input name=\"options[2]\" value=\"V\" type=\"radio\" " . $checked_V . "/>" . _MB_BANNERS_ALIGNEMENT_V . "<br>\n"; |
|
104
|
|
|
break; |
|
105
|
|
|
} |
|
106
|
|
|
return $form; |
|
107
|
|
|
} |
|
108
|
|
|
|