15function b_legacy_notification_show()
17 global $xoopsConfig, $xoopsUser, $xoopsModule;
18 include_once XOOPS_ROOT_PATH .
'/include/notification_functions.php';
20 $root =& XCube_Root::getSingleton();
21 $root->mLanguageManager->loadPageTypeMessageCatalog(
'notification');
24 if (empty($xoopsUser) || !notificationEnabled(
'block')) {
27 $notification_handler =& xoops_gethandler(
'notification');
31 $categories =& notificationSubscribableCategoryInfo();
32 if (empty($categories)) {
35 foreach ($categories as $category) {
36 $section[
'name'] = $category[
'name'];
37 $section[
'title'] = $category[
'title'];
38 $section[
'description'] = $category[
'description'];
39 $section[
'itemid'] = $category[
'item_id'];
40 $section[
'events'] = [];
41 $subscribed_events =& $notification_handler->getSubscribedEvents($category[
'name'], $category[
'item_id'], $xoopsModule->getVar(
'mid'), $xoopsUser->getVar(
'uid'));
42 foreach (notificationEvents($category[
'name'],
true) as $event) {
43 if (!empty($event[
'admin_only']) && !$xoopsUser->isAdmin($xoopsModule->getVar(
'mid'))) {
46 $subscribed = in_array($event[
'name'], $subscribed_events,
true) ? 1 : 0;
47 $section[
'events'][$event[
'name']] = [
'name' => $event[
'name'],
'title' => $event[
'title'],
'caption' => $event[
'caption'],
'description' => $event[
'description'],
'subscribed' =>$subscribed];
49 $block[
'categories'][$category[
'name']] = $section;
52 $block[
'target_page'] =
'notification_update.php';
54 $script_url = explode(
'/', xoops_getenv(
'PHP_SELF'));
55 $script_name = $script_url[count($script_url)-1];
56 $block[
'redirect_script'] = $script_name;
57 $block[
'submit_button'] = _NOT_UPDATENOW;