XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
notification_select.php
Go to the documentation of this file.
1 <?php
20 defined('XOOPS_ROOT_PATH') or die('Restricted access');
21 
22 include_once $GLOBALS['xoops']->path('include/notification_constants.php');
23 include_once $GLOBALS['xoops']->path('include/notification_functions.php');
24 
26 $xoops_notification['show'] = isset($xoopsModule) && is_object($xoopsUser) && notificationEnabled('inline') ? 1 : 0;
27 if ($xoops_notification['show']) {
28  xoops_loadLanguage('notification');
29  $categories =& notificationSubscribableCategoryInfo();
30  $event_count = 0;
31  if (!empty($categories)) {
32  $notification_handler =& xoops_gethandler('notification');
33  foreach ($categories as $category) {
34  $section['name'] = $category['name'];
35  $section['title'] = $category['title'];
36  $section['description'] = $category['description'];
37  $section['itemid'] = $category['item_id'];
38  $section['events'] = array();
39  $subscribed_events = $notification_handler->getSubscribedEvents($category['name'], $category['item_id'], $xoopsModule->getVar('mid'), $xoopsUser->getVar('uid'));
40  foreach (notificationEvents($category['name'], true) as $event) {
41  if (!empty($event['admin_only']) && !$xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
42  continue;
43  }
44  if (!empty($event['invisible'])) {
45  continue;
46  }
47  $subscribed = in_array($event['name'], $subscribed_events) ? 1 : 0;
48  $section['events'][$event['name']] = array ('name'=>$event['name'], 'title'=>$event['title'], 'caption'=>$event['caption'], 'description'=>$event['description'], 'subscribed'=>$subscribed);
49  $event_count ++;
50  }
51  $xoops_notification['categories'][$category['name']] = $section;
52  }
53  $xoops_notification['target_page'] = 'notification_update.php';
54  $xoops_notification['redirect_script'] = xoops_getenv('PHP_SELF');
55  $xoopsTpl->assign(array('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')) {
58  $xoopsTpl->assign('user_method', _NOT_DISABLE);
59  break;
61  $xoopsTpl->assign('user_method', _NOT_PM);
62  break;
64  $xoopsTpl->assign('user_method', _NOT_EMAIL);
65  break;
66  }
67  } else {
68  $xoops_notification['show'] = 0;
69  }
70  if ($event_count == 0) {
71  $xoops_notification['show'] = 0;
72  }
73 }
74 $xoopsTpl->assign('xoops_notification', $xoops_notification);
75 
76 ?>