XOOPS
2.6.0
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
topposters.php
Go to the documentation of this file.
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
use
Xoops\Core\Kernel\Criteria
;
13
use
Xoops\Core\Kernel\CriteriaCompo
;
14
25
function
b_system_topposters_show
(
$options
)
26
{
27
$xoops
=
Xoops::getInstance
();
28
$block = array();
29
$criteria
=
new
CriteriaCompo
(
new
Criteria
(
'level'
, 0,
'>'
));
30
$limit
= (!empty(
$options
[0])) ?
$options
[0] : 10;
31
$size = count(
$options
);
32
for
(
$i
= 2;
$i
< $size; ++
$i
) {
33
$criteria
->add(
new
Criteria
(
'rank'
,
$options
[
$i
],
'<>'
));
34
}
35
$criteria
->setOrder(
'DESC'
);
36
$criteria
->setSort(
'posts'
);
37
$criteria
->setLimit(
$limit
);
38
$member_handler
=
$xoops
->getHandlerMember();
39
$topposters =
$member_handler
->getUsers(
$criteria
);
40
$count
= count($topposters);
41
for
(
$i
= 0;
$i
<
$count
; ++
$i
) {
42
$block[
'users'
][
$i
][
'rank'
] =
$i
+ 1;
43
if
(
$options
[1] == 1) {
44
$block[
'users'
][
$i
][
'avatar'
] = $topposters[
$i
]->getVar(
'user_avatar'
) !=
'blank.gif'
?
\XoopsBaseConfig::get
(
'uploads-url'
) .
'/'
. $topposters[
$i
]->getVar(
'user_avatar'
) :
''
;
45
}
else
{
46
$block[
'users'
][
$i
][
'avatar'
] =
''
;
47
}
48
$block[
'users'
][
$i
][
'id'
] = $topposters[
$i
]->getVar(
'uid'
);
49
$block[
'users'
][
$i
][
'name'
] = $topposters[
$i
]->getVar(
'uname'
);
50
$block[
'users'
][
$i
][
'posts'
] = $topposters[
$i
]->getVar(
'posts'
);
51
}
52
return
$block;
53
}
54
55
function
b_system_topposters_edit
(
$options
)
56
{
57
$block_form =
new
Xoops\Form\BlockForm
();
58
$block_form->addElement(
new
Xoops
\Form\Text(
SystemLocale::NUMBER_OF_USERS_TO_DISPLAY
,
'options[0]'
, 1, 3,
$options
[0]),
true
);
59
$block_form->addElement(
new
Xoops
\Form\RadioYesNo(
SystemLocale::DISPLAY_USERS_AVATARS
,
'options[1]'
,
$options
[1]));
60
61
$ranks = XoopsLists::getUserRankList();
62
$ranks_select =
new
Xoops\Form\Select
(
SystemLocale::C_DO_NOT_DISPLAY_USERS_WHOSE_RANK_IS
,
'options[2]'
, explode(
','
,
$options
[2]), 5,
true
);
63
$ranks_select->addOptionArray($ranks);
64
$block_form->addElement($ranks_select);
65
return
$block_form->render();
66
}
$count
$count
Definition:
page_tablesfill.php:45
$member_handler
if($uname== ''||$pass== '') $member_handler
Definition:
checklogin.php:44
b_system_topposters_show
b_system_topposters_show($options)
Definition:
topposters.php:25
$i
$i
Definition:
dialog.php:68
SystemLocaleEn_US\C_DO_NOT_DISPLAY_USERS_WHOSE_RANK_IS
const C_DO_NOT_DISPLAY_USERS_WHOSE_RANK_IS
Definition:
en_US.php:253
Xoops\getInstance
static getInstance()
Definition:
Xoops.php:160
Xoops\Core\Kernel\CriteriaCompo
Definition:
CriteriaCompo.php:30
CriteriaCompo
b_system_topposters_edit
b_system_topposters_edit($options)
Definition:
topposters.php:55
$options
$options['editor']
Definition:
sampleform.inc.php:44
Xoops\Core\Kernel\Criteria
Definition:
Criteria.php:30
Xoops
$xoops
$xoops
Definition:
admin.php:25
Xoops\Form\BlockForm
Definition:
BlockForm.php:27
XoopsBaseConfig\get
static get($name)
Definition:
XoopsBaseConfig.php:117
Criteria
$limit
$limit
Definition:
findusers.php:202
SystemLocaleEn_US\NUMBER_OF_USERS_TO_DISPLAY
const NUMBER_OF_USERS_TO_DISPLAY
Definition:
en_US.php:352
$criteria
$criteria
Definition:
page_configsite.php:52
Xoops\Form\Select
Definition:
Select.php:26
SystemLocaleEn_US\DISPLAY_USERS_AVATARS
const DISPLAY_USERS_AVATARS
Definition:
en_US.php:262
usr64
htdocs
modules
system
blocks
topposters.php
Generated on Fri May 22 2015 03:07:04 for XOOPS by
1.8.9.1