Loading module/Oscar/src/Oscar/Service/NotificationService.php +15 −2 Changes for module/Oscar/src/Oscar/Service/NotificationService.php: 15 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ namespace Oscar\Service; use Doctrine\ORM\NoResultException; use Oscar\Entity\Activity; use Oscar\Entity\Notification; use Oscar\Provider\Privileges; Loading Loading @@ -69,11 +70,17 @@ class NotificationService implements ServiceLocatorAwareInterface, EntityManager public function notification( $message, $personsId, $context='Application', $contextId=-1, $key=null) { if ($key === null) { $key = $context.':'.$contextId.'-'.uniqid(); $key = $context.':'.$contextId; } $push = []; foreach ($personsId as $personid) { $hash = md5($personid . '/' . $key); try { // On commence par regarder si une notification n'existe pas déjà // pour cette person dans le context (basé sur le HASH) $exist = $this->getEntityManager()->getRepository(Notification::class)->findOneBy(['hash' => $hash]); if( !$exist ){ $date = new \DateTime(); $notification = new Notification(); $notification->setContext('Application') Loading @@ -88,9 +95,15 @@ class NotificationService implements ServiceLocatorAwareInterface, EntityManager ->setRecipientId($personid); $this->getEntityManager()->persist($notification); $this->getEntityManager()->flush($notification); $push[] = $notification->getId(); } else { $notification->setDateEffective(new \DateTime()); } } catch ( \Exception $e ){ } } $this->getEntityManager()->flush(); // Push vers le socket si besoin $configSocket = $this->getServiceLocator()->get('Config')['oscar']['socket']; Loading public/css/app.css +12 −0 Changes for public/css/app.css: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -7510,6 +7510,18 @@ span[class*="status-400"] .icon:before { [class*="icon-tutelle-de-gestion"]:before { content: '\e851'; } [class*="icon-Activity"]:before { content: '\e880'; } [class*="icon-Application"]:before { content: '\e87d'; } [class*="icon-Person"]:before { content: '\e89a'; } [class*="icon-Organization"]:before { content: '\e876'; } /* span[class*="status-102"] .icon:before{ content: '\e85e '} span[class*="status-4"] .icon:before{ content: '\e865 '} Loading public/css/app.scss +6 −0 Changes for public/css/app.scss: 6 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1874,6 +1874,12 @@ span[class*="status-400"] .icon:before{ content: '\e87f'; color: #550000; } [class*="icon-composante-responsable"],[class*="charge-de-valorisation"] { &:before{ content: '\e87f'; }} [class*="icon-tutelle-de-gestion"]:before{ content: '\e851'; } // Icon / Context [class*="icon-Activity"]:before{ content: '\e880'; } [class*="icon-Application"]:before{ content: '\e87d'; } [class*="icon-Person"]:before{ content: '\e89a'; } [class*="icon-Organization"]:before{ content: '\e876'; } /* span[class*="status-102"] .icon:before{ content: '\e85e '} Loading public/js/components/build/notifications.js +1 −1 Changes for public/js/components/build/notifications.js: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ define(['exports', 'vue', 'vue-resource', 'mm'], function (exports, _vue, _vueRe _vue2.default.http.options.emulateHTTP = true; var notifications = _vue2.default.extend({ template: ' <p class="navbar-text navbar-right" id="notifications-area" >\n <a class="navbar-link" @click="open = !open">\n <i class="icon-bell"></i> Notifications \n <span class="notifications-total" :class="notifications.length ? \'unread\' : \'\'">{{ notifications.length }}</span>\n </a>\n <section class="list" v-show="open">\n <header class="control">\n <h3>\n <span class="intitule">\n <i class="icon-bell"></i>\n {{ notifications.length }} notifications\n <i class="animate-spin icon-asterisk" v-show="loading"></i>\n </span>\n <a href="#" title="Tous effacer" @click="deleteNotification(notifications)"><i class="icon-trash-empty"></i></a>\n <a href="#" title="Tous marquer comme lu"><i class="icon-ok-circled"></i></a>\n </h3>\n </header>\n <article v-for="notification in orderedNotifications" :class="{ \'read\': notification.read, \'fresh\' : notification.fresh }" class="notification">\n <h4>\n <time datetime="">{{ notification.dateEffective | moment }}</time>\n <a href="#" @click="deleteNotification([notification])"><i class="icon-trash-empty"></i></a>\n </h4>\n <p>{{ notification.message }}</p>\n </article>\n </section>\n </p>', template: ' <p class="navbar-text navbar-right" id="notifications-area" >\n <a class="navbar-link" @click="open = !open">\n <i class="icon-bell"></i> Notifications \n <span class="notifications-total" :class="notifications.length ? \'unread\' : \'\'">{{ notifications.length }}</span>\n </a>\n <section class="list" v-show="open">\n <header class="control">\n <h3>\n <span class="intitule">\n <i class="icon-bell"></i>\n {{ notifications.length }} notifications\n <i class="animate-spin icon-asterisk" v-show="loading"></i>\n </span>\n <a href="#" title="Tous effacer" @click="deleteNotification(notifications)"><i class="icon-trash-empty"></i></a>\n <a href="#" title="Tous marquer comme lu"><i class="icon-ok-circled"></i></a>\n </h3>\n </header>\n <article v-for="notification in orderedNotifications" :class="{ \'read\': notification.read, \'fresh\' : notification.fresh }" class="notification">\n <h4>\n <i :class="\'icon-\'+notification.context"></i>\n <time datetime="">{{ notification.dateEffective | moment }}</time>\n <a href="#" @click="deleteNotification([notification])"><i class="icon-trash-empty"></i></a>\n </h4> \n <p>{{ notification.message }}</p>\n </article>\n </section>\n </p>', data: function data() { return { Loading public/js/components/src/notifications.js +1 −0 Changes for public/js/components/src/notifications.js: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ var notifications = Vue.extend({ </header> <article v-for="notification in orderedNotifications" :class="{ 'read': notification.read, 'fresh' : notification.fresh }" class="notification"> <h4> <i :class="'icon-'+notification.context"></i> <time datetime="">{{ notification.dateEffective | moment }}</time> <a href="#" @click="deleteNotification([notification])"><i class="icon-trash-empty"></i></a> </h4> Loading Loading
module/Oscar/src/Oscar/Service/NotificationService.php +15 −2 Changes for module/Oscar/src/Oscar/Service/NotificationService.php: 15 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ namespace Oscar\Service; use Doctrine\ORM\NoResultException; use Oscar\Entity\Activity; use Oscar\Entity\Notification; use Oscar\Provider\Privileges; Loading Loading @@ -69,11 +70,17 @@ class NotificationService implements ServiceLocatorAwareInterface, EntityManager public function notification( $message, $personsId, $context='Application', $contextId=-1, $key=null) { if ($key === null) { $key = $context.':'.$contextId.'-'.uniqid(); $key = $context.':'.$contextId; } $push = []; foreach ($personsId as $personid) { $hash = md5($personid . '/' . $key); try { // On commence par regarder si une notification n'existe pas déjà // pour cette person dans le context (basé sur le HASH) $exist = $this->getEntityManager()->getRepository(Notification::class)->findOneBy(['hash' => $hash]); if( !$exist ){ $date = new \DateTime(); $notification = new Notification(); $notification->setContext('Application') Loading @@ -88,9 +95,15 @@ class NotificationService implements ServiceLocatorAwareInterface, EntityManager ->setRecipientId($personid); $this->getEntityManager()->persist($notification); $this->getEntityManager()->flush($notification); $push[] = $notification->getId(); } else { $notification->setDateEffective(new \DateTime()); } } catch ( \Exception $e ){ } } $this->getEntityManager()->flush(); // Push vers le socket si besoin $configSocket = $this->getServiceLocator()->get('Config')['oscar']['socket']; Loading
public/css/app.css +12 −0 Changes for public/css/app.css: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -7510,6 +7510,18 @@ span[class*="status-400"] .icon:before { [class*="icon-tutelle-de-gestion"]:before { content: '\e851'; } [class*="icon-Activity"]:before { content: '\e880'; } [class*="icon-Application"]:before { content: '\e87d'; } [class*="icon-Person"]:before { content: '\e89a'; } [class*="icon-Organization"]:before { content: '\e876'; } /* span[class*="status-102"] .icon:before{ content: '\e85e '} span[class*="status-4"] .icon:before{ content: '\e865 '} Loading
public/css/app.scss +6 −0 Changes for public/css/app.scss: 6 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1874,6 +1874,12 @@ span[class*="status-400"] .icon:before{ content: '\e87f'; color: #550000; } [class*="icon-composante-responsable"],[class*="charge-de-valorisation"] { &:before{ content: '\e87f'; }} [class*="icon-tutelle-de-gestion"]:before{ content: '\e851'; } // Icon / Context [class*="icon-Activity"]:before{ content: '\e880'; } [class*="icon-Application"]:before{ content: '\e87d'; } [class*="icon-Person"]:before{ content: '\e89a'; } [class*="icon-Organization"]:before{ content: '\e876'; } /* span[class*="status-102"] .icon:before{ content: '\e85e '} Loading
public/js/components/build/notifications.js +1 −1 Changes for public/js/components/build/notifications.js: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ define(['exports', 'vue', 'vue-resource', 'mm'], function (exports, _vue, _vueRe _vue2.default.http.options.emulateHTTP = true; var notifications = _vue2.default.extend({ template: ' <p class="navbar-text navbar-right" id="notifications-area" >\n <a class="navbar-link" @click="open = !open">\n <i class="icon-bell"></i> Notifications \n <span class="notifications-total" :class="notifications.length ? \'unread\' : \'\'">{{ notifications.length }}</span>\n </a>\n <section class="list" v-show="open">\n <header class="control">\n <h3>\n <span class="intitule">\n <i class="icon-bell"></i>\n {{ notifications.length }} notifications\n <i class="animate-spin icon-asterisk" v-show="loading"></i>\n </span>\n <a href="#" title="Tous effacer" @click="deleteNotification(notifications)"><i class="icon-trash-empty"></i></a>\n <a href="#" title="Tous marquer comme lu"><i class="icon-ok-circled"></i></a>\n </h3>\n </header>\n <article v-for="notification in orderedNotifications" :class="{ \'read\': notification.read, \'fresh\' : notification.fresh }" class="notification">\n <h4>\n <time datetime="">{{ notification.dateEffective | moment }}</time>\n <a href="#" @click="deleteNotification([notification])"><i class="icon-trash-empty"></i></a>\n </h4>\n <p>{{ notification.message }}</p>\n </article>\n </section>\n </p>', template: ' <p class="navbar-text navbar-right" id="notifications-area" >\n <a class="navbar-link" @click="open = !open">\n <i class="icon-bell"></i> Notifications \n <span class="notifications-total" :class="notifications.length ? \'unread\' : \'\'">{{ notifications.length }}</span>\n </a>\n <section class="list" v-show="open">\n <header class="control">\n <h3>\n <span class="intitule">\n <i class="icon-bell"></i>\n {{ notifications.length }} notifications\n <i class="animate-spin icon-asterisk" v-show="loading"></i>\n </span>\n <a href="#" title="Tous effacer" @click="deleteNotification(notifications)"><i class="icon-trash-empty"></i></a>\n <a href="#" title="Tous marquer comme lu"><i class="icon-ok-circled"></i></a>\n </h3>\n </header>\n <article v-for="notification in orderedNotifications" :class="{ \'read\': notification.read, \'fresh\' : notification.fresh }" class="notification">\n <h4>\n <i :class="\'icon-\'+notification.context"></i>\n <time datetime="">{{ notification.dateEffective | moment }}</time>\n <a href="#" @click="deleteNotification([notification])"><i class="icon-trash-empty"></i></a>\n </h4> \n <p>{{ notification.message }}</p>\n </article>\n </section>\n </p>', data: function data() { return { Loading
public/js/components/src/notifications.js +1 −0 Changes for public/js/components/src/notifications.js: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ var notifications = Vue.extend({ </header> <article v-for="notification in orderedNotifications" :class="{ 'read': notification.read, 'fresh' : notification.fresh }" class="notification"> <h4> <i :class="'icon-'+notification.context"></i> <time datetime="">{{ notification.dateEffective | moment }}</time> <a href="#" @click="deleteNotification([notification])"><i class="icon-trash-empty"></i></a> </h4> Loading