|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Module: WF-links |
|
4
|
|
|
* Developer: McDonald |
|
5
|
|
|
* Licence: GNU |
|
6
|
|
|
* @param mixed $options |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* @param $options |
|
11
|
|
|
* |
|
12
|
|
|
* @return array |
|
13
|
|
|
*/ |
|
14
|
|
|
function b_wflinks_banner_show($options) |
|
|
|
|
|
|
15
|
|
|
{ |
|
16
|
|
|
$moduleDirName = basename(__DIR__); |
|
17
|
|
|
global $xoopsDB; |
|
18
|
|
|
|
|
19
|
|
|
$block = []; |
|
20
|
|
|
$time = time(); |
|
|
|
|
|
|
21
|
|
|
/** @var \XoopsModuleHandler $moduleHandler */ |
|
22
|
|
|
$moduleHandler = xoops_getHandler('module'); |
|
23
|
|
|
$wflModule = $moduleHandler->getByDirname($moduleDirName); |
|
24
|
|
|
|
|
25
|
|
|
$result = $xoopsDB->query( |
|
26
|
|
|
'SELECT a.cid AS acid, a.title, a.client_id, a.banner_id, b.bid, b.cid, b.imptotal, b.impmade, b.clicks FROM ' . $xoopsDB->prefix('wflinks_cat') . ' a, ' . $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' |
|
27
|
|
|
); |
|
28
|
|
|
|
|
29
|
|
|
while (false !== ($myrow = $xoopsDB->fetchArray($result))) { |
|
30
|
|
|
$impmade = $myrow['impmade']; |
|
31
|
|
|
$clicks = $myrow['clicks']; |
|
32
|
|
|
$imptotal = $myrow['imptotal']; |
|
33
|
|
|
$bannerload = []; |
|
34
|
|
|
$result2 = $xoopsDB->query('SELECT name FROM ' . $xoopsDB->prefix('bannerclient') . ' WHERE cid=' . (int)$myrow['cid']); |
|
35
|
|
|
$myclient = $xoopsDB->fetchArray($result2); |
|
36
|
|
|
if (0 == $impmade) { |
|
37
|
|
|
$percent = 0; |
|
38
|
|
|
} else { |
|
39
|
|
|
$percent = mb_substr(100 * $clicks / $impmade, 0, 5); |
|
40
|
|
|
} |
|
41
|
|
|
if (0 == $imptotal) { |
|
42
|
|
|
$left = 'Unlimited'; |
|
43
|
|
|
} else { |
|
44
|
|
|
$left = ($imptotal - $impmade); |
|
45
|
|
|
} |
|
46
|
|
|
$bannerload['cat'] = (int)$myrow['acid']; |
|
47
|
|
|
$bannerload['bid'] = (int)$myrow['bid']; |
|
48
|
|
|
$bannerload['cid'] = (int)$myrow['cid']; |
|
49
|
|
|
$bannerload['imptotal'] = (int)$myrow['imptotal']; |
|
50
|
|
|
$bannerload['impmade'] = (int)$myrow['impmade']; |
|
51
|
|
|
$bannerload['impleft'] = $left; |
|
52
|
|
|
$bannerload['clicks'] = (int)$myrow['clicks']; |
|
53
|
|
|
$bannerload['client'] = $myclient['name']; |
|
54
|
|
|
$bannerload['percent'] = $percent; |
|
55
|
|
|
$bannerload['cattitle'] = $myrow['title']; |
|
56
|
|
|
$bannerload['dirname'] = $wflModule->getVar('dirname'); |
|
57
|
|
|
$block['banners'][] = $bannerload; |
|
58
|
|
|
} |
|
59
|
|
|
unset($_block_check_array); |
|
|
|
|
|
|
60
|
|
|
|
|
61
|
|
|
return $block; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @param $options |
|
66
|
|
|
* |
|
67
|
|
|
* @return string |
|
68
|
|
|
*/ |
|
69
|
|
|
function b_wflinks_banner_edit($options) |
|
|
|
|
|
|
70
|
|
|
{ |
|
71
|
|
|
$form = ''; |
|
72
|
|
|
|
|
73
|
|
|
return $form; |
|
74
|
|
|
} |
|
75
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.