account.notification.php 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. global $myUser;
  3. global $conf;
  4. User::check('notification', 'read');
  5. require_once(__DIR__.SLASH.'Notification.class.php');
  6. $myUser->loadPreferences();
  7. $userPreferences = Notification::settingPreferences($myUser->login);
  8. $categories = Notification::categories()
  9. ?>
  10. <div class="row">
  11. <div class="col-md-12" id="notification_preference">
  12. <br>
  13. <div onclick="notification_user_save_preference()" class="btn btn-success float-right"><i class="fas fa-check"></i> Enregistrer</div>
  14. <h3>Notifications</h3>
  15. <div class="clear"></div>
  16. <hr>
  17. <div class="row">
  18. <div class="col-md-12 notification_categories" id="notification_categories">
  19. <h5>Suivre les catégories : </h5>
  20. <div class="row">
  21. <div class="col-3">
  22. <div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
  23. <?php
  24. $i = 0;
  25. foreach($categories as $categorySlug=>$category): ?>
  26. <a class="nav-link <?php echo $i==0?'active':'' ?>" id="v-pills-home-tab" data-toggle="pill" href="#category-<?php echo $categorySlug ?>" role="tab" aria-controls="v-pills-home" aria-selected="true"><i class="far fa-bookmark"></i> <?php echo $category['label'] ?></a>
  27. <?php
  28. $i++;
  29. endforeach; ?>
  30. </div>
  31. </div>
  32. <div class="col-9">
  33. <div class="tab-content" id="v-pills-tabContent">
  34. <?php
  35. $i = 0;
  36. foreach($categories as $categorySlug=>$category): ?>
  37. <div class="tab-pane fade show <?php echo $i==0?'active':'' ?>" id="category-<?php echo $categorySlug ?>" role="tabpanel" aria-labelledby="v-pills-home-tab">
  38. <?php foreach($category['items'] as $type): ?>
  39. <div data-slug="<?php echo $type['slug']; ?>" class="list-group-item list-group-item-action flex-column align-items-start category user-select-none">
  40. <div class="d-flex w-100 justify-content-between">
  41. <h5 class="mb-1" style="color:<?php echo $type['color']; ?>;"><i class="<?php echo $type['icon']; ?>"></i> <?php echo $type['label']; ?></h5>
  42. </div>
  43. <p class="mb-3"><?php echo $type['description']; ?>.</p>
  44. <ul class="notificationType mb-0">
  45. <?php
  46. $methods = array();
  47. Plugin::callHook("notification_methods", array(&$methods));
  48. foreach ($methods as $method) {
  49. $slug = $type['slug'].'_'.$method['slug'];
  50. $typePreference = $userPreferences[$type['slug']];
  51. $checked = isset($typePreference[$type['slug'].'_'.$method['slug']]) && $typePreference[$type['slug'].'_'.$method['slug']]==true ? 'checked="checked"': '';
  52. ?>
  53. <li class="d-inline-block">
  54. <input data-type="checkbox" data-category="<?php echo $type['slug']; ?>" data-method="<?php echo $method['slug']; ?>" id="<?php echo $slug; ?>" <?php echo $checked ?> class="">
  55. <label for="<?php echo $slug; ?>" class="pointer">
  56. <i class="<?php echo $method['icon'] ?>"></i>
  57. <?php echo $method['label'] ?>
  58. </label><br>
  59. <small class="ml-1 text-muted"><?php echo $method['explain']; ?></small>
  60. </li>
  61. <?php } ?>
  62. </ul>
  63. </div>
  64. <?php
  65. $i++;
  66. endforeach; ?>
  67. </div>
  68. <?php endforeach; ?>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </div><br>