XOOPS  2.6.0
info.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 
23 {
25  $xoops->db();
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('groups_users_link', 'l')
39  ->leftJoinPrefix('l', 'users', 'u', 'l.uid=u.uid')
40  ->leftJoinPrefix('l', 'groups', '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) { // return 00000 is ok, 01nnn is warning
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&amp;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&amp;type=friend&amp;op=sendform&amp;t=" . time() . "','friend'," . $options[0] . "," . $options[1] . ")\">" . SystemLocale::RECOMMEND_US . "</a>";
87  return $block;
88 }
89 
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 }
const POPUP_WINDOW_HEIGHT
Definition: en_US.php:359
$i
Definition: dialog.php:68
static getInstance()
Definition: Xoops.php:160
b_system_info_edit($options)
Definition: info.php:90
$options['editor']
$result
Definition: pda.php:33
const SHOW_ADMIN_GROUPS
Definition: en_US.php:388
$xoops
Definition: admin.php:25
const POPUP_WINDOW_WIDTH
Definition: en_US.php:360
const F_LOGO_IMAGE_FILE_IS_LOCATED_UNDER
Definition: en_US.php:307
static get($name)
$sql
Definition: pda.php:32
$avatar
Definition: userinfo.php:94
if($xoops->isUser()&&$isAdmin) $response
Definition: userinfo.php:83
b_system_info_show($options)
Definition: info.php:22
$myts
Definition: edituser.php:38
const RECOMMEND_US
Definition: en_US.php:366