XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
Legacy_EventFunctions.class.php
1<?php
10
11if (!defined('XOOPS_ROOT_PATH')) {
12 exit();
13}
14
16{
17 public static function imageManager()
18 {
19 require_once XOOPS_MODULE_PATH . '/legacy/class/ActionFrame.class.php';
20
21 $root =& XCube_Root::getSingleton();
22 $root->mController->setupModuleContext('legacy');
23
24 $moduleRunner =new Legacy_ActionFrame(false);
25
26 $action = isset($_REQUEST['op']) ? ucfirst(xoops_getrequest('op')) : 'List';
27 $moduleRunner->setMode(LEGACY_FRAME_MODE_IMAGE);
28 $moduleRunner->setActionName($action);
29
30 $root->mController->mExecute->add([&$moduleRunner, 'execute']);
31
32 $root->mController->execute();
33
34 $root->mController->executeView();
35 }
36
37 public static function backend()
38 {
39 require_once XOOPS_MODULE_PATH . '/legacy/class/ActionFrame.class.php';
40
41 $root =& XCube_Root::getSingleton();
42 $root->mController->setupModuleContext('legacy');
43
44 $moduleRunner =new Legacy_ActionFrame(false);
45 $moduleRunner->setActionName('Backend');
46
47 $root->mController->mExecute->add([&$moduleRunner, 'execute']);
48
49 $root->mController->execute();
50
51 $root->mController->executeView();
52 }
53
54 public static function search()
55 {
56 require_once XOOPS_MODULE_PATH . '/legacy/class/ActionFrame.class.php';
57
58 $root =& XCube_Root::getSingleton();
59 $root->mController->setupModuleContext('legacy');
60
61 $moduleRunner =new Legacy_ActionFrame(false);
62 $moduleRunner->setMode(LEGACY_FRAME_MODE_SEARCH);
63 $moduleRunner->setActionName(ucfirst(xoops_getrequest('action')));
64
65 $root->mController->mExecute->add([&$moduleRunner, 'execute']);
66
67 $root->mController->execute();
68
69 $root->mController->executeView();
70 }
71
72 public static function misc()
73 {
74 require_once XOOPS_LEGACY_PATH . '/class/ActionFrame.class.php';
75
76 $root =& XCube_Root::getSingleton();
77 $root->mController->setupModuleContext('legacy');
78
79 $actionName = isset($_REQUEST['type']) ? ucfirst(xoops_getrequest('type')) : 'Smilies';
80
81 $moduleRunner = new Legacy_ActionFrame(false);
82 $moduleRunner->setMode(LEGACY_FRAME_MODE_MISC);
83 $moduleRunner->setActionName($actionName);
84
85 $root->mController->mExecute->add([&$moduleRunner, 'execute']);
86
87 $root->mController->setDialogMode(true);
88
89 $root->mController->execute();
90
91 $root->mController->executeView();
92 }
93
94 public static function notifications()
95 {
96 require_once XOOPS_LEGACY_PATH . '/class/ActionFrame.class.php';
97
98 $root =& XCube_Root::getSingleton();
99 $root->mController->setupModuleContext('legacy');
100
101 //
102 // 'Notify' is prefix to guard accessing from misc.php.
103 //
104 $actionName = isset($_REQUEST['op']) ? trim(xoops_getrequest('op')) : 'List';
105 $deleteValue = $root->mContext->mRequest->getRequest('delete');
106 $cancelValue = $root->mContext->mRequest->getRequest('delete_cancel');
107 if (isset($deleteValue)) {
108 $actionName = 'Delete';
109 }
110 if (isset($cancelValue)) {
111 $actionName = 'Cancel';
112 }
113
114 $moduleRunner = new Legacy_ActionFrame(false);
115 $moduleRunner->setMode(LEGACY_FRAME_MODE_NOTIFY);
116 $moduleRunner->setActionName($actionName);
117
118 $root->mController->mExecute->add([&$moduleRunner, 'execute']);
119
120 $root->mController->execute();
121
122 $root->mController->executeView();
123 }
124
130 public static function notifications_select(&$render)
131 {
132 require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
133 require_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
134
135 $root =& XCube_Root::getSingleton();
136 $xoopsModule =& $root->mContext->mXoopsModule;
137 $moduleConfig =& $root->mContext->mModuleConfig;
138 $xoopsUser =& $root->mContext->mXoopsUser;
139
140 $xoops_notification = [];
141 $xoops_notification['show'] = is_object($xoopsModule) && is_object($xoopsUser) && notificationEnabled('inline') ? 1 : 0;
142
143 if ($xoops_notification['show']) {
144 $root->mLanguageManager->loadPageTypeMessageCatalog('notification');
145 $categories =& notificationSubscribableCategoryInfo();
146 $event_count = 0;
147 if (!empty($categories)) {
148 $notification_handler =& xoops_gethandler('notification');
149 foreach ($categories as $category) {
150 $section['name'] = $category['name'];
151 $section['title'] = $category['title'];
152 $section['description'] = $category['description'];
153 $section['itemid'] = $category['item_id'];
154 $section['events'] = [];
155 $subscribed_events =& $notification_handler->getSubscribedEvents($category['name'], $category['item_id'], $xoopsModule->get('mid'), $xoopsUser->get('uid'));
156 foreach (notificationEvents($category['name'], true) as $event) {
157 if (!empty($event['admin_only']) && !$xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
158 continue;
159 }
160 if (!empty($event['invisible'])) {
161 continue;
162 }
163 $subscribed = in_array ($event[ 'name' ], $subscribed_events) ? 1 : 0;
164 $section['events'][$event['name']] = ['name' => $event['name'], 'title' => $event['title'], 'caption' => $event['caption'], 'description' => $event['description'], 'subscribed' =>$subscribed];
165 $event_count ++;
166 }
167 $xoops_notification['categories'][$category['name']] = $section;
168 }
169 $xoops_notification['target_page'] = 'notification_update.php';
170 $xoops_notification['redirect_script'] = xoops_getenv('PHP_SELF');
171
172 $render->setAttribute('editprofile_url', XOOPS_URL . '/edituser.php?uid=' . $xoopsUser->getShow('uid'));
173
174 switch ($xoopsUser->getVar('notify_method')) {
175 case XOOPS_NOTIFICATION_METHOD_DISABLE:
176 $render->setAttribute('user_method', _NOT_DISABLE);
177 break;
178 case XOOPS_NOTIFICATION_METHOD_PM:
179 $render->setAttribute('user_method', _NOT_PM);
180 break;
181 case XOOPS_NOTIFICATION_METHOD_EMAIL:
182 $render->setAttribute('user_method', _NOT_EMAIL);
183 break;
184 }
185 } else {
186 $xoops_notification['show'] = 0;
187 }
188 if (0 == $event_count) {
189 $xoops_notification['show'] = 0;
190 }
191 }
192
193 $render->setAttribute('xoops_notification', $xoops_notification);
194 }
195
204 public static function recountPost(&$posts, $xoopsUser)
205 {
206 $handler =& xoops_gethandler('comment');
207 $criteria =new Criteria('com_uid', $xoopsUser->get('uid'));
208 $posts += $handler->getCount($criteria);
209 }
210}
static recountPost(&$posts, $xoopsUser)