BioTorrents.de’s version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

notificationsmanagerview.class.php 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. class NotificationsManagerView
  3. {
  4. private static $Settings;
  5. public static function load_js()
  6. {
  7. $JSIncludes = array(
  8. 'noty/noty.js',
  9. 'noty/layouts/bottomRight.js',
  10. 'noty/themes/default.js',
  11. 'user_notifications.js');
  12. foreach ($JSIncludes as $JSInclude) {
  13. $Path = STATIC_SERVER."functions/$JSInclude"; ?>
  14. <script
  15. src="<?=$Path?>?v=<?=filemtime(SERVER_ROOT."/$Path")?>"
  16. type="text/javascript"></script>
  17. <?php
  18. }
  19. }
  20. public static function render_settings($Settings)
  21. {
  22. self::$Settings = $Settings; ?>
  23. <tr>
  24. <td class="label">
  25. <strong>News Announcements</strong>
  26. </td>
  27. <td>
  28. <?php self::render_checkbox(NotificationsManager::NEWS); ?>
  29. </td>
  30. </tr>
  31. <tr>
  32. <td class="label">
  33. <strong>Blog Announcements</strong>
  34. </td>
  35. <td>
  36. <?php self::render_checkbox(NotificationsManager::BLOG); ?>
  37. </td>
  38. </tr>
  39. <tr>
  40. <td class="label">
  41. <strong>Inbox Messages</strong>
  42. </td>
  43. <td>
  44. <?php self::render_checkbox(NotificationsManager::INBOX, true); ?>
  45. </td>
  46. </tr>
  47. <tr>
  48. <td class="label tooltip"
  49. title="Notify when you receive a new private message from <?=SITE_NAME?> staff">
  50. <strong>Staff Messages</strong>
  51. </td>
  52. <td>
  53. <?php self::render_checkbox(NotificationsManager::STAFFPM, false, false); ?>
  54. </td>
  55. </tr>
  56. <tr>
  57. <td class="label">
  58. <strong>Thread Subscriptions</strong>
  59. </td>
  60. <td>
  61. <?php self::render_checkbox(NotificationsManager::SUBSCRIPTIONS, false, false); ?>
  62. </td>
  63. </tr>
  64. <tr>
  65. <td class="label tooltip" title="Notify whenever someone quotes you in the forums">
  66. <strong>Quote Notifications</strong>
  67. </td>
  68. <td>
  69. <?php self::render_checkbox(NotificationsManager::QUOTES); ?>
  70. </td>
  71. </tr>
  72. <?php if (check_perms('site_torrents_notify')) { ?>
  73. <tr>
  74. <td class="label tooltip" title="Notify when your torrent notification filters are triggered">
  75. <strong>Torrent Notifications</strong>
  76. </td>
  77. <td>
  78. <?php self::render_checkbox(NotificationsManager::TORRENTS, true, false); ?>
  79. </td>
  80. </tr>
  81. <?php } ?>
  82. <tr>
  83. <td class="label tooltip" title="Notify when a torrent is added to a subscribed collage">
  84. <strong>Collage Subscriptions</strong>
  85. </td>
  86. <td>
  87. <?php self::render_checkbox(NotificationsManager::COLLAGES. false, false); ?>
  88. </td>
  89. </tr>
  90. <?php
  91. }
  92. private static function render_checkbox($Name, $Traditional = false)
  93. {
  94. $Checked = self::$Settings[$Name];
  95. $PopupChecked = $Checked === NotificationsManager::OPT_POPUP || !isset($Checked) ? ' checked="checked"' : '';
  96. $TraditionalChecked = $Checked === NotificationsManager::OPT_TRADITIONAL ? ' checked="checked"' : ''; ?>
  97. <label>
  98. <input type="checkbox" name="notifications_<?=$Name?>_popup"
  99. id="notifications_<?=$Name?>_popup" <?=$PopupChecked?> />
  100. Pop-up
  101. </label>
  102. <?php if ($Traditional) { ?>
  103. <label>
  104. <input type="checkbox" name="notifications_<?=$Name?>_traditional"
  105. id="notifications_<?=$Name?>_traditional" <?=$TraditionalChecked?> />
  106. Traditional
  107. </label>
  108. <?php
  109. }
  110. }
  111. public static function format_traditional($Contents)
  112. {
  113. return "<a href=\"$Contents[url]\">$Contents[message]</a>";
  114. }
  115. }