XOOPS  2.6.0
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 
14 
26 {
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 
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 }
if($uname== ''||$pass== '') $member_handler
Definition: checklogin.php:44
b_system_topposters_show($options)
Definition: topposters.php:25
$i
Definition: dialog.php:68
const C_DO_NOT_DISPLAY_USERS_WHOSE_RANK_IS
Definition: en_US.php:253
static getInstance()
Definition: Xoops.php:160
b_system_topposters_edit($options)
Definition: topposters.php:55
$options['editor']
$xoops
Definition: admin.php:25
static get($name)
$limit
Definition: findusers.php:202
const NUMBER_OF_USERS_TO_DISPLAY
Definition: en_US.php:352
$criteria
const DISPLAY_USERS_AVATARS
Definition: en_US.php:262