XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
AdminBlockLogInfo.class.php
1<?php
11
12if (!defined('XOOPS_ROOT_PATH')) {
13 exit();
14}
15
17{
18 public function getName()
19 {
20 return 'block_loginfo';
21 }
22
23 public function getTitle()
24 {
25 return _AD_BLOCK_ACCOUNT;
26 }
27
28 public function getEntryIndex()
29 {
30 return 0;
31 }
32
33 public function isEnableCache()
34 {
35 return false;
36 }
37
38 public function execute()
39 {
40 $inbox_url = null;
41 $new_messages = null;
42 $root =& XCube_Root::getSingleton();
43 $xoopsUser =& $root->mController->mRoot->mContext->mXoopsUser;
44
45 // Language catalog
46 $root->mLanguageManager->loadBlockMessageCatalog('legacy');
47
48 if (is_object($xoopsUser)) {
49
50 $uid = $xoopsUser->get('uid');
51 $uname =$xoopsUser->get('uname');
52 $flagShowInbox = false;
53
54 //
55 // Check does this system have PrivateMessage feature.
56 //
57 $url = null;
58 $service =& $root->mServiceManager->getService('privateMessage');
59 if (null != $service) {
60 $client =& $root->mServiceManager->createClient($service);
61 $url = $client->call('getPmInboxUrl', ['uid' => $xoopsUser->get('uid')]);
62
63 if (null != $url) {
64 $inbox_url = $url;
65 $new_messages = $client->call('getCountUnreadPM', ['uid' => $xoopsUser->get('uid')]);
66 $flagShowInbox = true;
67 }
68 }
69
70 // $show_adminlink = $root->mContext->mUser->isInRole('Site.Administrator');
71
72
73 $useragent = xoops_getenv('HTTP_USER_AGENT');
74
75 // XCube RenderTarget
76 $render = $this->getRenderTarget();
77
78 // Load theme template i.e. fallback
79 $render->setAttribute('legacy_module', 'legacy');
80 // Attributes Smarty vars
81 $render->setAttribute('uid', $uid);
82 $render->setAttribute('uname', $uname);
83 $render->setAttribute('inbox_url', $inbox_url);
84 $render->setAttribute('new_messages', $new_messages);
85 $render->setAttribute('flagShowInbox', $flagShowInbox);
86 $render->setAttribute('useragent', $useragent);
87 $render->setAttribute('blockid', $this->getName());
88 // Render Template
89 $render->setTemplateName('legacy_admin_block_loginfo.html');
90 // Render Template
91 $renderSystem = $root->getRenderSystem($this->getRenderSystemName());
92 // Render Template
93 $renderSystem->renderBlock($render);
94 }
95 }
96
97 public function hasResult()
98 {
99 return true;
100 }
101
102 public function &getResult()
103 {
104 $dmy = 'dummy';
105 return $dmy;
106 }
107
108 public function getRenderSystemName()
109 {
110 return 'Legacy_AdminRenderSystem';
111 }
112}
113
114