home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / CMS / xoops-2.0.18.1.exe / xoops-2.0.18.1 / htdocs / include / notification_select.php < prev    next >
Encoding:
PHP Script  |  2006-09-04  |  4.8 KB  |  84 lines

  1. <?php
  2. // $Id: notification_select.php 694 2006-09-04 11:33:22Z skalpa $
  3. //  ------------------------------------------------------------------------ //
  4. //                XOOPS - PHP Content Management System                      //
  5. //                    Copyright (c) 2000 XOOPS.org                           //
  6. //                       <http://www.xoops.org/>                             //
  7. //  ------------------------------------------------------------------------ //
  8. //  This program is free software; you can redistribute it and/or modify     //
  9. //  it under the terms of the GNU General Public License as published by     //
  10. //  the Free Software Foundation; either version 2 of the License, or        //
  11. //  (at your option) any later version.                                      //
  12. //                                                                           //
  13. //  You may not change or alter any portion of this comment or credits       //
  14. //  of supporting developers from this source code or any supporting         //
  15. //  source code which is considered copyrighted (c) material of the          //
  16. //  original comment or credit authors.                                      //
  17. //                                                                           //
  18. //  This program is distributed in the hope that it will be useful,          //
  19. //  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
  20. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
  21. //  GNU General Public License for more details.                             //
  22. //                                                                           //
  23. //  You should have received a copy of the GNU General Public License        //
  24. //  along with this program; if not, write to the Free Software              //
  25. //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
  26. //  ------------------------------------------------------------------------ //
  27.  
  28. if (!defined('XOOPS_ROOT_PATH')) {
  29.     exit();
  30. }
  31. include_once XOOPS_ROOT_PATH.'/include/notification_constants.php';
  32. include_once XOOPS_ROOT_PATH.'/include/notification_functions.php';
  33. $xoops_notification = array();
  34. $xoops_notification['show'] = isset($xoopsModule) && is_object($xoopsUser) && notificationEnabled('inline') ? 1 : 0;
  35. if ($xoops_notification['show']) {
  36.     include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/notification.php';
  37.     $categories =& notificationSubscribableCategoryInfo();
  38.     $event_count = 0;
  39.     if (!empty($categories)) {
  40.         $notification_handler =& xoops_gethandler('notification');
  41.         foreach ($categories as $category) {
  42.             $section['name'] = $category['name'];
  43.             $section['title'] = $category['title'];
  44.             $section['description'] = $category['description'];
  45.             $section['itemid'] = $category['item_id'];
  46.             $section['events'] = array();
  47.             $subscribed_events = $notification_handler->getSubscribedEvents($category['name'], $category['item_id'], $xoopsModule->getVar('mid'), $xoopsUser->getVar('uid'));
  48.             foreach (notificationEvents($category['name'], true) as $event) {
  49.                 if (!empty($event['admin_only']) && !$xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
  50.                     continue;
  51.                 }
  52.                 if (!empty($event['invisible'])) {
  53.                     continue;
  54.                 }
  55.                 $subscribed = in_array($event['name'], $subscribed_events) ? 1 : 0;
  56.                 $section['events'][$event['name']] = array ('name'=>$event['name'], 'title'=>$event['title'], 'caption'=>$event['caption'], 'description'=>$event['description'], 'subscribed'=>$subscribed);
  57.                 $event_count ++;
  58.             }
  59.             $xoops_notification['categories'][$category['name']] = $section;
  60.         }
  61.         $xoops_notification['target_page'] = "notification_update.php";
  62.         $xoops_notification['redirect_script'] = xoops_getenv('PHP_SELF');
  63.         $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')));
  64.         switch ($xoopsUser->getVar('notify_method')) {
  65.         case XOOPS_NOTIFICATION_METHOD_DISABLE:
  66.             $xoopsTpl->assign('user_method', _NOT_DISABLE);
  67.             break;
  68.         case XOOPS_NOTIFICATION_METHOD_PM:
  69.             $xoopsTpl->assign('user_method', _NOT_PM);
  70.             break;
  71.         case XOOPS_NOTIFICATION_METHOD_EMAIL:
  72.             $xoopsTpl->assign('user_method', _NOT_EMAIL);
  73.             break;
  74.         }
  75.     } else {
  76.         $xoops_notification['show'] = 0;
  77.     }
  78.     if ($event_count == 0) {
  79.         $xoops_notification['show'] = 0;
  80.     }
  81. }
  82. $xoopsTpl->assign('xoops_notification', $xoops_notification);
  83. ?>
  84.