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.7KB

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