123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- global $myUser;
- require_once(__DIR__.SLASH.'Notification.class.php');
- require_once(__DIR__.SLASH.'UserNotification.class.php');
- $types = $widget->data('types');
- $types = $types==''? array('announcement'):$types;
- $max = $widget->data('notification-number');
- $max = $max =="" ? 5 : $max ;
- $maxlength = $widget->data('notification-length');
- $maxlength = $maxlength =="" ? 150 : $maxlength ;
- $userNotifications = UserNotification::byUser($myUser,array(
- 'limit' => $max,
- 'unread' => false,
- 'types' => $types,
- ));
- ?>
- <div class="notificationContainer">
-
- <h4><i class="far fa-bell"></i> ALERTES</h4>
- <ul class="notification-widget-list">
- <?php
- foreach($userNotifications as $infos):
- $infos['created-relative'] = isset($_['synthesis']) ? relative_time($infos['created'], null, 7) : relative_time($infos['created'], null, 7, true);
- $meta = json_decode($infos['meta']);
- $infos['link'] = 'index.php?module=notification#'.$infos['id'];
-
- $type = Notification::types($infos['type']);
- ?>
- <li>
- <h5 onclick="document.location.href='<?php echo $infos['link']; ?>';" class="pointer mb-0"><i title="<?php echo $type['label'] ?>" class="<?php echo $type['icon'] ?>"></i> <?php echo $infos['label']; ?> <small class="text-muted"> - <i class="far fa-clock"></i> <?php echo $infos['created-relative']; ?></small></h5>
-
- <p class="mt-2"><?php echo truncate($infos['html'],$maxlength,array('html'=>true)); ?></p>
- <a class="btn btn-link" href="<?php echo $infos['link']; ?>">+ d'information</a>
- </li>
- <?php endforeach; ?>
- </ul>
- </div>
|