1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: use Xoops\Core\Kernel\Criteria;
13: use Xoops\Core\Kernel\CriteriaCompo;
14:
15: 16: 17: 18: 19: 20: 21: 22: 23:
24:
25: 26: 27:
28:
29: function b_system_newmembers_show($options)
30: {
31: $xoops = Xoops::getInstance();
32: $block = array();
33: $criteria = new CriteriaCompo(new Criteria('level', 0, '>'));
34: $limit = (!empty($options[0])) ? $options[0] : 10;
35: $criteria->setOrder('DESC');
36: $criteria->setSort('user_regdate');
37: $criteria->setLimit($limit);
38: $member_handler = $xoops->getHandlerMember();
39: $newmembers = $member_handler->getUsers($criteria);
40: $count = count($newmembers);
41: for ($i = 0; $i < $count; ++$i) {
42: if ($options[1] == 1) {
43: $block['users'][$i]['avatar'] = $newmembers[$i]->getVar('user_avatar') !== 'blank.gif' ? \XoopsBaseConfig::get('uploads-url') . '/' . $newmembers[$i]->getVar('user_avatar') : '';
44: } else {
45: $block['users'][$i]['avatar'] = '';
46: }
47: $block['users'][$i]['id'] = $newmembers[$i]->getVar('uid');
48: $block['users'][$i]['name'] = $newmembers[$i]->getVar('uname');
49: $block['users'][$i]['joindate'] = XoopsLocale::formatTimestamp($newmembers[$i]->getVar('user_regdate'), 's');
50: }
51: return $block;
52: }
53:
54: function b_system_newmembers_edit($options)
55: {
56: $block_form = new Xoops\Form\BlockForm();
57: $block_form->addElement( new Xoops\Form\Text(SystemLocale::NUMBER_OF_USERS_TO_DISPLAY, 'options[0]', 1, 3, $options[0]), true);
58: $block_form->addElement(new Xoops\Form\RadioYesNo(SystemLocale::DISPLAY_USERS_AVATARS, 'options[1]', $options[1]));
59: return $block_form->render();
60: }
61: