page.list.php 5.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. global $myUser;
  3. User::check_access('notification','read');
  4. require_once(__DIR__.SLASH.'Notification.class.php');
  5. require_once(__DIR__.SLASH.'UserNotification.class.php');
  6. $categories = array();
  7. $unreads = UserNotification::get_unreads_count($myUser);
  8. foreach(Notification::types() as $slug => $type){
  9. $type['slug'] = $slug;
  10. $type['unread'] = isset($unreads['detailled'][$slug]) ? $unreads['detailled'][$slug] : 0;
  11. if(!isset($type['category'])) $type['category'] = 'Général';
  12. if(!isset($categories[slugify($type['category'])]))
  13. $categories[slugify($type['category'])] = array(
  14. 'label' => $type['category'],
  15. 'items' => array()
  16. );
  17. $categories[slugify($type['category'])]['items'][] = $type;
  18. }
  19. ?>
  20. <div class="row notifications-list">
  21. <div class="notification-summary">
  22. <span class="summary w-100 d-inline-flex flex-column">
  23. <div class="text-info">
  24. <i class="fas fa-bell mr-1 ml-1"></i>
  25. <span id="notifCounterFilter" class="badge badge-light pointer mr-1 ml-1">0</span>
  26. <span id="notifWord">notification</span>
  27. en attente
  28. </div>
  29. <hr class="mx-0">
  30. <ul class="categories">
  31. <?php foreach($categories as $slug => $category): ?>
  32. <li class="category" data-category="<?php echo $slug; ?>">
  33. <div class="boxTitle">
  34. <input class="categoryCheckbox"
  35. type="checkbox"
  36. id="checkbox_<?php echo $slug; ?>"
  37. name="checkbox_<?php echo $slug; ?>"
  38. data-type="checkbox">
  39. <span onclick="$(this).closest('.category').toggleClass('folded');">
  40. <i class="categoryIcon fas fa-chevron-right"></i>
  41. <span class="categoryLabel pointer"><?php echo $category['label']; ?></span>
  42. </span>
  43. <span class="categoryBadge badge badge-pill badge-light float-right mt-1" data-category="<?php echo $slug; ?>">0</span>
  44. </div>
  45. <ul class="items" data-category="<?php echo $slug; ?>">
  46. <?php foreach ($category['items'] as $key => $item): ?>
  47. <li class="item" data-category="<?php echo $slug; ?>" data-item="<?php echo $item['slug']; ?>">
  48. <input class="itemCheckbox"
  49. type="checkbox"
  50. data-category="<?php echo $slug; ?>"
  51. data-item="<?php echo $item['slug']; ?>"
  52. id="checkbox_<?php echo $item['slug']; ?>"
  53. name="checkbox_<?php echo $item['slug']; ?>"
  54. data-type="checkbox">
  55. <div class="itemLabel d-inline">
  56. <i style="color:<?php echo $item['color']; ?>" class="itemIcon <?php echo $item['icon']; ?>"></i>
  57. <span class="pointer"><?php echo $item['label']; ?></span>
  58. </div>
  59. <span class="itemBadge badge badge-pill badge-light float-right" data-category="<?php echo $slug; ?>" data-item="<?php echo $item['slug']; ?>">0</span>
  60. </li>
  61. <?php endforeach; ?>
  62. </ul>
  63. </li>
  64. <?php endforeach; ?>
  65. </ul>
  66. </span>
  67. </div>
  68. <div class="notification-detail">
  69. <div class="d-flex flex-row-reverse font-weight-light">
  70. <a href="#" onclick="notification_user_notification_delete_all('notifications', event);" id="deleteState">Tout supprimer <!-- <i class="far fa-trash-alt ml-1"></i> --></a>
  71. <a href="#" onclick="notification_user_notification_read_all('notifications', event);" class="mr-3" id="readState">Tout marquer comme lu <!-- <i class="fas fa-eye ml-1"></i> --></a>
  72. </div>
  73. <!-- Voir pour mettre en place un lazy loading -->
  74. <ul id="notifications" class="mid-pane notifications">
  75. <li data-id="{{id}}" data-category="{{category}}" data-item="{{type}}" class="hidden notification-item {{class}}">
  76. <h5 onclick="document.location.href='{{link}}';" class="pointer">{{label}}</h5>
  77. {{{html}}}
  78. <div class="notification-options">
  79. <div class="btn-group btn-group-sm" role="group">
  80. <div class="btn btn-info" title="Marquer comme {{readState}}" onclick="notification_user_notification_toggle_read(this);"><i class="fas fa-eye"></i></div>
  81. <div class="btn btn-danger btn-delete" title="Supprimer la notification" onclick="notification_user_notification_delete(this);"><i class="far fa-trash-alt"></i></div>
  82. </div>
  83. <small>{{{created-relative}}}</small>
  84. </div>
  85. </li>
  86. </ul>
  87. </div>
  88. </div>
  89. <br>