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_legacy_notification_show()
23: {
24: global $xoopsConfig, $xoopsUser, $xoopsModule;
25: include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
26:
27: $root =& XCube_Root::getSingleton();
28: $root->mLanguageManager->loadPageTypeMessageCatalog('notification');
29:
30:
31: if (empty($xoopsUser) || !notificationEnabled('block')) {
32: return false;
33: }
34: $notification_handler =& xoops_gethandler('notification');
35:
36:
37: $block = array();
38: $categories =& notificationSubscribableCategoryInfo();
39: if (empty($categories)) {
40: return false;
41: }
42: foreach ($categories as $category) {
43: $section['name'] = $category['name'];
44: $section['title'] = $category['title'];
45: $section['description'] = $category['description'];
46: $section['itemid'] = $category['item_id'];
47: $section['events'] = array();
48: $subscribed_events =& $notification_handler->getSubscribedEvents ($category['name'], $category['item_id'], $xoopsModule->getVar('mid'), $xoopsUser->getVar('uid'));
49: foreach (notificationEvents($category['name'], true) as $event) {
50: if (!empty($event['admin_only']) && !$xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
51: continue;
52: }
53: $subscribed = in_array($event['name'], $subscribed_events) ? 1 : 0;
54: $section['events'][$event['name']] = array ('name'=>$event['name'], 'title'=>$event['title'], 'caption'=>$event['caption'], 'description'=>$event['description'], 'subscribed'=>$subscribed);
55: }
56: $block['categories'][$category['name']] = $section;
57: }
58:
59: $block['target_page'] = "notification_update.php";
60:
61: $script_url = explode('/', xoops_getenv('PHP_SELF'));
62: $script_name = $script_url[count($script_url)-1];
63: $block['redirect_script'] = $script_name;
64: $block['submit_button'] = _NOT_UPDATENOW;
65: return $block;
66: }
67: ?>
68: