1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: 13: 14: 15: 16: 17: 18: 19: 20:
21:
22: function b_system_info_show($options)
23: {
24: $xoops = Xoops::getInstance();
25: $xoops->db();
26: $myts = \Xoops\Core\Text\Sanitizer::getInstance();
27: $block = array();
28: if (!empty($options[3])) {
29: $block['showgroups'] = true;
30: $qb = $xoops->db()->createXoopsQueryBuilder();
31: $eb = $qb->expr();
32: $sql = $qb->select('u.uid')
33: ->addSelect('u.uname')
34: ->addSelect('u.email')
35: ->addSelect('u.user_viewemail')
36: ->addSelect('u.user_avatar')
37: ->addSelect('g.name AS groupname')
38: ->fromPrefix('system_usergroup', 'l')
39: ->leftJoinPrefix('l', 'system_user', 'u', 'l.uid=u.uid')
40: ->leftJoinPrefix('l', 'system_group', 'g', 'l.groupid=g.groupid')
41: ->where($eb->eq('g.group_type', ':gtype'))
42: ->orderBy('l.groupid')
43: ->addOrderBy('u.uid')
44: ->setParameter(':gtype', 'Admin', \PDO::PARAM_STR);
45: $result = $sql->execute();
46: if ($result->errorCode() < 2000) {
47: $prev_caption = "";
48: $i = 0;
49: while ($userinfo = $result->fetch(PDO::FETCH_ASSOC)) {
50: $response = $xoops->service("Avatar")->getAvatarUrl($userinfo);
51: $avatar = $response->getValue();
52: $avatar = empty($avatar) ? \XoopsBaseConfig::get('uploads-url') . '/blank.gif' : $avatar;
53: if ($prev_caption != $userinfo['groupname']) {
54: $prev_caption = $userinfo['groupname'];
55: $block['groups'][$i]['name'] = $myts->htmlSpecialChars($userinfo['groupname']);
56: }
57: if ($xoops->isUser()) {
58: $block['groups'][$i]['users'][] = array(
59: 'id' => $userinfo['uid'],
60: 'name' => $myts->htmlSpecialChars($userinfo['uname']),
61: 'pm_link' => \XoopsBaseConfig::get('url') . "/pmlite.php?send2=1&to_userid=" . $userinfo['uid'],
62: 'avatar' => $avatar
63: );
64: } else {
65: if ($userinfo['user_viewemail']) {
66: $block['groups'][$i]['users'][] = array(
67: 'id' => $userinfo['uid'],
68: 'name' => $myts->htmlSpecialChars($userinfo['uname']),
69: 'msg_link' => $userinfo['email'],
70: 'avatar' => $avatar
71: );
72: } else {
73: $block['groups'][$i]['users'][] = array(
74: 'id' => $userinfo['uid'],
75: 'name' => $myts->htmlSpecialChars($userinfo['uname'])
76: );
77: }
78: }
79: ++$i;
80: }
81: }
82: } else {
83: $block['showgroups'] = false;
84: }
85: $block['logourl'] = \XoopsBaseConfig::get('url') . '/images/' . $options[2];
86: $block['recommendlink'] = "<a href=\"javascript:openWithSelfMain('" . \XoopsBaseConfig::get('url') . "/misc.php?action=showpopups&type=friend&op=sendform&t=" . time() . "','friend'," . $options[0] . "," . $options[1] . ")\">" . SystemLocale::RECOMMEND_US . "</a>";
87: return $block;
88: }
89:
90: function b_system_info_edit($options)
91: {
92: $block_form = new Xoops\Form\BlockForm();
93: $block_form->addElement(new Xoops\Form\Text(SystemLocale::POPUP_WINDOW_WIDTH, 'options[0]', 1, 3, $options[0]), true);
94: $block_form->addElement(new Xoops\Form\Text(SystemLocale::POPUP_WINDOW_HEIGHT, 'options[1]', 1, 3, $options[1]), true);
95: $block_form->addElement(new Xoops\Form\Text(sprintf(SystemLocale::F_LOGO_IMAGE_FILE_IS_LOCATED_UNDER, \XoopsBaseConfig::get('url') . "/images/"), 'options[2]', 5, 100, $options[2]), true);
96: $block_form->addElement(new Xoops\Form\RadioYesNo(SystemLocale::SHOW_ADMIN_GROUPS, 'options[3]', $options[3]));
97: return $block_form->render();
98: }
99: