Oppaitime'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.5KB

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