1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* XoopsTube - a multicategory video management module |
4
|
|
|
* |
5
|
|
|
* Based upon WF-Links |
6
|
|
|
* |
7
|
|
|
* File: blocks/xoopstube_banner.php |
8
|
|
|
* |
9
|
|
|
* @copyright https://xoops.org/ XOOPS Project |
10
|
|
|
* @copyright XOOPS_copyrights.txt |
11
|
|
|
* @copyright http://www.impresscms.org/ The ImpressCMS Project |
12
|
|
|
* @license GNU General Public License (GPL) |
13
|
|
|
* a copy of the GNU license is enclosed. |
14
|
|
|
* ---------------------------------------------------------------------------------------------------------- |
15
|
|
|
* @package XoopsTube |
16
|
|
|
* @since 1.00 |
17
|
|
|
* @author McDonald |
18
|
|
|
* |
19
|
|
|
* @param $options |
20
|
|
|
* |
21
|
|
|
* @return array |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
use XoopsModules\Xoopstube; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @param $options |
28
|
|
|
* @return array |
29
|
|
|
*/ |
30
|
|
|
function xtubeShowBannerB($options) |
|
|
|
|
31
|
|
|
{ |
32
|
|
|
$moduleDirName = \basename(\dirname(__DIR__)); |
33
|
|
|
|
34
|
|
|
$block = []; |
35
|
|
|
$time = time(); |
|
|
|
|
36
|
|
|
/** @var \XoopsModuleHandler $moduleHandler */ |
37
|
|
|
$moduleHandler = xoops_getHandler('module'); |
38
|
|
|
$xoopstubeModule = $moduleHandler->getByDirname($moduleDirName); |
39
|
|
|
/** @var \XoopsConfigHandler $configHandler */ |
40
|
|
|
$configHandler = xoops_getHandler('config'); |
41
|
|
|
$xoopstubeModuleConfig = $configHandler->getConfigsByCat(0, $xoopstubeModule->getVar('mid')); |
|
|
|
|
42
|
|
|
|
43
|
|
|
$result = $GLOBALS['xoopsDB']->query( |
44
|
|
|
'SELECT a.cid AS acid, a.title, a.client_id, a.banner_id, b.bid, b.cid, b.imptotal, b.impmade, b.clicks FROM ' |
45
|
|
|
. $GLOBALS['xoopsDB']->prefix('xoopstube_cat') |
46
|
|
|
. ' a, ' |
47
|
|
|
. $GLOBALS['xoopsDB']->prefix('banner') |
48
|
|
|
. ' b WHERE (b.cid = a.client_id) OR (b.bid = a.banner_id) ORDER BY b.cid, b.bid, a.title ASC' |
49
|
|
|
); |
50
|
|
|
|
51
|
|
|
while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
52
|
|
|
$impmade = $myrow['impmade']; |
53
|
|
|
$clicks = $myrow['clicks']; |
54
|
|
|
$imptotal = $myrow['imptotal']; |
55
|
|
|
$bannerload = []; |
56
|
|
|
$result2 = $GLOBALS['xoopsDB']->query('SELECT name FROM ' . $GLOBALS['xoopsDB']->prefix('bannerclient') . ' WHERE cid=' . (int)$myrow['cid']); |
57
|
|
|
$myclient = $GLOBALS['xoopsDB']->fetchArray($result2); |
58
|
|
|
if (0 == $impmade) { |
59
|
|
|
$percent = 0; |
60
|
|
|
} else { |
61
|
|
|
$percent = mb_substr(100 * $clicks / $impmade, 0, 5); |
62
|
|
|
} |
63
|
|
|
if (0 == $imptotal) { |
64
|
|
|
$left = 'Unlimited'; |
65
|
|
|
} else { |
66
|
|
|
$left = (int)$imptotal - (int)$impmade; |
67
|
|
|
} |
68
|
|
|
$bannerload['cat'] = (int)$myrow['acid']; |
69
|
|
|
$bannerload['bid'] = (int)$myrow['bid']; |
70
|
|
|
$bannerload['cid'] = (int)$myrow['cid']; |
71
|
|
|
$bannerload['imptotal'] = (int)$myrow['imptotal']; |
72
|
|
|
$bannerload['impmade'] = (int)$myrow['impmade']; |
73
|
|
|
$bannerload['impleft'] = $left; |
74
|
|
|
$bannerload['clicks'] = (int)$myrow['clicks']; |
75
|
|
|
$bannerload['client'] = $myclient['name']; |
76
|
|
|
$bannerload['percent'] = $percent; |
77
|
|
|
$bannerload['cattitle'] = $myrow['title']; |
78
|
|
|
$bannerload['dirname'] = $xoopstubeModule->getVar('dirname'); |
79
|
|
|
$block['banners'][] = $bannerload; |
80
|
|
|
} |
81
|
|
|
unset($_block_check_array); |
|
|
|
|
82
|
|
|
|
83
|
|
|
return $block; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @param $options |
88
|
|
|
* |
89
|
|
|
* @return string |
90
|
|
|
*/ |
91
|
|
|
function xtubeEditBannerB($options) |
|
|
|
|
92
|
|
|
{ |
93
|
|
|
$form = ''; |
94
|
|
|
|
95
|
|
|
return $form; |
96
|
|
|
} |
97
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.