Notifications

Have an icon in top menu about notifications to user. Can be bound to user or survey.

Also need an 'irritating' message type that will be 'new' until a certain condition is fulfilled (like survey must be activated).

GUI

 * Bell icon
 * List of all messages in menu where you can can see which messages are new
 * Delete all messages

Usage
All notifications are created on server side with PHP. A page reload is always necessary to see new notifications.

A notification can either be of type 'important' or the default type 'log'. Important messages will show a modal popup at page load. Default messages will only show a notification at the bell in the admin menu.

See examples below for more information.

Database
New database table required to make notifications persist between login/logout.

Fields:


 * id
 * entity, like survey, user, ...
 * entity_id, survey id, user id, ...
 * title, title of message (shown in dropdown and overview)
 * message, the actual message
 * display_class, success, danger, default
 * importance, 1 = normal, 3 = high/popup on page load
 * status, new, read
 * hash, a hashed value of title, message and entity/entity id; indexed; useful for unique notifications
 * created, datetime
 * first_read, datetime

Examples
Create a new notification for a survey

This notification will be visible for all users who visit the survey.

Note that it will only be marked as unread for the first user that reads it.

Send an important notification

Visible on page load as popup.

Notification to a specific user

Only this user can see this notification.

Broadcast

All users will get this notification.

Broadcast to superadmin

This is how your broadcast a message to all superadmins. Also using localization.

Display class

You can change the modal class of the modal popup using display_class.

Unique notification

If you only want to create one copy of a message, but want to mark it as unread depending on program logic, use the UniqueNotifcation class:

Unique notification with less nagging

The above unique message will popup first time, and then second time be marked as unread. If you want a message to continue to be marked as unread no matter the times you save it, use UniqueNotification with :

Open issues

 * Merge with Yii flash system?
 * More plugin friendly? E.g. having a message history page, adding soft delete.