15if (!defined(
'XOOPS_ROOT_PATH')) {
19include_once XOOPS_ROOT_PATH.
'/include/notification_constants.php';
20include_once XOOPS_ROOT_PATH.
'/include/notification_functions.php';
22$xoops_notification = [];
23$xoops_notification[
'show'] = isset($xoopsModule) && is_object($xoopsUser) && notificationEnabled(
'inline') ? 1 : 0;
24if ($xoops_notification[
'show']) {
25 $root =& XCube_Root::getSingleton();
26 $root->mLanguageManager->loadPageTypeMessageCatalog(
'notification');
27 $categories =& notificationSubscribableCategoryInfo();
29 if (!empty($categories)) {
30 $notification_handler =& xoops_gethandler(
'notification');
31 foreach ($categories as $category) {
32 $section[
'name'] = $category[
'name'];
33 $section[
'title'] = $category[
'title'];
34 $section[
'description'] = $category[
'description'];
35 $section[
'itemid'] = $category[
'item_id'];
36 $section[
'events'] = [];
37 $subscribed_events =& $notification_handler->getSubscribedEvents($category[
'name'], $category[
'item_id'], $xoopsModule->getVar(
'mid'), $xoopsUser->getVar(
'uid'));
38 foreach (notificationEvents($category[
'name'],
true) as $event) {
39 if (!empty($event[
'admin_only']) && !$xoopsUser->isAdmin($xoopsModule->getVar(
'mid'))) {
42 if (!empty($event[
'invisible'])) {
45 $subscribed = in_array($event[
'name'], $subscribed_events,
true) ? 1 : 0;
46 $section[
'events'][$event[
'name']] = [
'name' => $event[
'name'],
'title' => $event[
'title'],
'caption' => $event[
'caption'],
'description' => $event[
'description'],
'subscribed' =>$subscribed];
49 $xoops_notification[
'categories'][$category[
'name']] = $section;
51 $xoops_notification[
'target_page'] =
'notification_update.php';
52 $xoops_notification[
'redirect_script'] = xoops_getenv(
'PHP_SELF');
54 [
'lang_activenotifications' => _NOT_ACTIVENOTIFICATIONS,
'lang_notificationoptions' => _NOT_NOTIFICATIONOPTIONS,
'lang_updateoptions' => _NOT_UPDATEOPTIONS,
'lang_updatenow' => _NOT_UPDATENOW,
'lang_category' => _NOT_CATEGORY,
'lang_event' => _NOT_EVENT,
'lang_events' => _NOT_EVENTS,
'lang_checkall' => _NOT_CHECKALL,
'lang_notificationmethodis' => _NOT_NOTIFICATIONMETHODIS,
'lang_change' => _NOT_CHANGE,
'editprofile_url' => XOOPS_URL .
'/edituser.php?uid=' . $xoopsUser->getVar(
'uid')]
56 switch ($xoopsUser->getVar(
'notify_method')) {
57 case XOOPS_NOTIFICATION_METHOD_DISABLE:
58 $xoopsTpl->assign(
'user_method', _NOT_DISABLE);
60 case XOOPS_NOTIFICATION_METHOD_PM:
61 $xoopsTpl->assign(
'user_method', _NOT_PM);
63 case XOOPS_NOTIFICATION_METHOD_EMAIL:
64 $xoopsTpl->assign(
'user_method', _NOT_EMAIL);
68 $xoops_notification[
'show'] = 0;
70 if (0 == $event_count) {
71 $xoops_notification[
'show'] = 0;
75if (isset($xoopsTpl)&&is_object($xoopsTpl)) {
76 $xoopsTpl->assign(
'xoops_notification', $xoops_notification);