1: <?php
2: /**
3: *
4: * @package XOOPS2
5: * @version $Id: legacy_usermenu.php,v 1.3 2008/09/25 15:12:13 kilica Exp $
6: * @copyright Copyright (c) 2000 XOOPS.org <http://www.xoops.org/>
7: * @license https://github.com/xoopscube/legacy/blob/master/docs/GPL_V2.txt GNU GENERAL PUBLIC LICENSE Version 2
8: *
9: */
10: // ------------------------------------------------------------------------ //
11: // XOOPS - PHP Content Management System //
12: // Copyright (c) 2000 XOOPS.org //
13: // <http://www.xoops.org/> //
14: // ------------------------------------------------------------------------ //
15: // Author: Kazumi Ono (AKA onokazu) //
16: // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
17: // Project: The XOOPS Project //
18: // ------------------------------------------------------------------------- //
19: // This file has been modified for Legacy from XOOPS2 System module block //
20: // ------------------------------------------------------------------------- //
21:
22:
23: /**
24: * This function is called back to display the user menu.
25: *
26: * [Template Variables]
27: * $block.uid ... Curent user id for the menu.
28: * $block.flagShowInbox ... If there is the pm module, set true.
29: * $block.inbox_url ... Return url to access inbox of pm.
30: * $block.new_messages ... amount of unread messages.
31: */
32: function b_legacy_usermenu_show()
33: {
34: $root =& XCube_Root::getSingleton();
35: $xoopsUser =& $root->mController->mRoot->mContext->mXoopsUser;
36:
37: if (is_object($xoopsUser)) {
38: $block = array();
39:
40: $block['uid'] = $xoopsUser->get('uid');
41: $block['flagShowInbox'] = false;
42:
43: //
44: // Check does this system have PrivateMessage feature.
45: //
46: $url = null;
47: $service =& $root->mServiceManager->getService('privateMessage');
48: if ($service != null) {
49: $client =& $root->mServiceManager->createClient($service);
50: $url = $client->call('getPmInboxUrl', array('uid' => $xoopsUser->get('uid')));
51:
52: if ($url != null) {
53: $block['inbox_url'] = $url;
54: $block['new_messages'] = $client->call('getCountUnreadPM', array('uid' => $xoopsUser->get('uid')));
55: $block['flagShowInbox']=true;
56: }
57: }
58:
59: $block['show_adminlink'] = $root->mContext->mUser->isInRole('Site.Administrator');
60:
61: return $block;
62: }
63: return false;
64: }
65: ?>
66: