|
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 http://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
|
|
|
function xtubeShowBannerB($options) |
|
|
|
|
|
|
25
|
|
|
{ |
|
26
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
|
27
|
|
|
|
|
28
|
|
|
$block = array(); |
|
29
|
|
|
$time = time(); |
|
|
|
|
|
|
30
|
|
|
$moduleHandler = xoops_getHandler('module'); |
|
31
|
|
|
$xoopstubeModule = $moduleHandler->getByDirname($moduleDirName); |
|
32
|
|
|
$configHandler = xoops_getHandler('config'); |
|
33
|
|
|
$xoopstubeModuleConfig = $configHandler->getConfigsByCat(0, $xoopstubeModule->getVar('mid')); |
|
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
$result = $GLOBALS['xoopsDB']->query('SELECT a.cid as acid, a.title, a.client_id, a.banner_id, b.bid, b.cid, b.imptotal, b.impmade, b.clicks FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') |
|
36
|
|
|
. ' a, ' . $GLOBALS['xoopsDB']->prefix('banner') . ' b WHERE (b.cid = a.client_id) OR (b.bid = a.banner_id) ORDER BY b.cid, b.bid, a.title ASC'); |
|
37
|
|
|
|
|
38
|
|
|
while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
39
|
|
|
$impmade = $myrow['impmade']; |
|
40
|
|
|
$clicks = $myrow['clicks']; |
|
41
|
|
|
$imptotal = $myrow['imptotal']; |
|
42
|
|
|
$bannerload = array(); |
|
43
|
|
|
$result2 = $GLOBALS['xoopsDB']->query('SELECT name FROM ' . $GLOBALS['xoopsDB']->prefix('bannerclient') . ' WHERE cid=' . (int)$myrow['cid']); |
|
44
|
|
|
$myclient = $GLOBALS['xoopsDB']->fetchArray($result2); |
|
45
|
|
|
if ($impmade == 0) { |
|
46
|
|
|
$percent = 0; |
|
47
|
|
|
} else { |
|
48
|
|
|
$percent = substr(100 * $clicks / $impmade, 0, 5); |
|
49
|
|
|
} |
|
50
|
|
|
if ($imptotal == 0) { |
|
51
|
|
|
$left = 'Unlimited'; |
|
52
|
|
|
} else { |
|
53
|
|
|
$left = (int)$imptotal - (int)$impmade; |
|
54
|
|
|
} |
|
55
|
|
|
$bannerload['cat'] = (int)$myrow['acid']; |
|
56
|
|
|
$bannerload['bid'] = (int)$myrow['bid']; |
|
57
|
|
|
$bannerload['cid'] = (int)$myrow['cid']; |
|
58
|
|
|
$bannerload['imptotal'] = (int)$myrow['imptotal']; |
|
59
|
|
|
$bannerload['impmade'] = (int)$myrow['impmade']; |
|
60
|
|
|
$bannerload['impleft'] = $left; |
|
61
|
|
|
$bannerload['clicks'] = (int)$myrow['clicks']; |
|
62
|
|
|
$bannerload['client'] = $myclient['name']; |
|
63
|
|
|
$bannerload['percent'] = $percent; |
|
64
|
|
|
$bannerload['cattitle'] = $myrow['title']; |
|
65
|
|
|
$bannerload['dirname'] = $xoopstubeModule->getVar('dirname'); |
|
66
|
|
|
$block['banners'][] = $bannerload; |
|
67
|
|
|
} |
|
68
|
|
|
unset($_block_check_array); |
|
69
|
|
|
|
|
70
|
|
|
return $block; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @param $options |
|
75
|
|
|
* |
|
76
|
|
|
* @return string |
|
77
|
|
|
*/ |
|
78
|
|
|
function xtubeEditBannerB($options) |
|
|
|
|
|
|
79
|
|
|
{ |
|
80
|
|
|
$form = ''; |
|
81
|
|
|
|
|
82
|
|
|
return $form; |
|
83
|
|
|
} |
|
84
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.