Stud.IP  2.4 Revision 48548
 All Data Structures Namespaces Files Functions Variables Groups Pages
PersonalNotifications Class Reference
Inheritance diagram for PersonalNotifications:
Inheritance graph
Collaboration diagram for PersonalNotifications:
Collaboration graph

Public Member Functions

 getLiElement ()
 __construct ($id=null)
- Public Member Functions inherited from SimpleORMap
 __clone ()
 getRelationOptions ($relation)
 getTableMetadata ()
 hasAutoIncrementColumn ()
 setId ($id)
 getId ()
 getNewId ()
 toArray ($only_these_fields=null)
 toArrayRecursive ($depth=1, $only_these_fields=null)
 getValue ($field)
 getRelationValue ($relation, $field)
 setValue ($field, $value)
 __get ($field)
 __set ($field, $value)
 __isset ($field)
 offsetExists ($offset)
 offsetGet ($offset)
 offsetSet ($offset, $value)
 offsetUnset ($offset)
 getIterator ()
 count ()
 isField ($field)
 isAdditionalField ($field)
 isAliasField ($field)
 setData ($data, $reset=false)
 haveData ()
 isNew ()
 isDeleted ()
 setNew ($is_new)
 getWhereQuery ()
 restore ()
 store ()
 triggerChdate ()
 delete ()
 isDirty ()
 isFieldDirty ($field)
 revertValue ($field)
 initRelation ($relation)
 resetRelation ($relation)

Static Public Member Functions

static add ($user_ids, $url, $text, $html_id=null, $avatar=null)
static getMyNotifications ($only_unread=true, $user_id=null)
static markAsRead ($notification_id, $user_id=null)
static activate ($user_id=null)
static deactivate ($user_id=null)
static activateAudioFeedback ($user_id=null)
static deactivateAudioFeedback ($user_id=null)
static isGloballyActivated ()
static isActivated ($user_id=null)
static isAudioActivated ($user_id=null)
- Static Public Member Functions inherited from SimpleORMap
static expireTableScheme ()
static find ($id)
static exists ($id)
static countBySql ($where=1, $params=array())
static create ($data)
static import ($data)
static findBySQL ($where, $params=array())
static findThru ($foreign_key_value, $options)
static findEachBySQL ($callable, $where, $params=array())
static findMany ($pks=array(), $order= '')
static findEachMany ($callable, $pks=array(), $order= '')
static deleteBySQL ($where, $params=array())
static toObject ($id_or_object)
static __callStatic ($name, $arguments)

Additional Inherited Members

- Protected Member Functions inherited from SimpleORMap
 parseRelationOptions ($type, $name, $options)
 getTableScheme ()
 storeRelations ()
 deleteRelations ()
 initializeContent ()
 applyCallbacks ($type)
 registerCallback ($types, $cb)
 unregisterCallback ($types, $cb)
 cbAutoIncrementColumn ($type)
 cbAutoKeyCreation ()
- Static Protected Member Functions inherited from SimpleORMap
static tableScheme ($db_table)
- Protected Attributes inherited from SimpleORMap
 $content = array()
 $content_db = array()
 $is_new = true
 $db_table = ''
 $db_fields = null
 $pk = null
 $default_values = array()
 $alias_fields = array()
 $additional_fields = array()
 $relations = array()
 $has_many = array()
 $has_one = array()
 $belongs_to = array()
 $has_and_belongs_to_many = array()
 $registered_callbacks
 $known_slots = array()
 $reserved_slots = array('value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id')
- Static Protected Attributes inherited from SimpleORMap
static $schemes

Detailed Description

This is an easy to use class to display personal notifications to the user, that are shown in real-time. Users can deactivate the feature of personal notifications, but by default it is turned on.

For example if user A subscribed to the changes of a special wiki-page, and another user B changed this wiki-page, you can inform user A about the change by the following one-liner:

PersonalNotifications::add( $user_A_user_id, //id of user A or array of ´multiple user_ids $url_of_wiki_page, //when user A clicks this URL he/she should jump directly to the changed wiki-page "User B changed wiki-page xyz", //a small text that describes the notification "wiki_page_1234", //an (optional) html-id of the content of the wiki page. If the user is looking at the content already, the notification will disappear automatically Assets::image_path("icons/40/blue/wiki"), //an (optional) icon that is displayed next to the notification-text );

Appearing to the user, deleting by the user and so on of the notification is handled by this class automatically.

Constructor & Destructor Documentation

__construct (   $id = null)

Constructor of PersonalNotifications

Parameters
type$id

Reimplemented from SimpleORMap.

Member Function Documentation

static activate (   $user_id = null)
static

Activates personal notifications for a given user.

Parameters
string | null$user_id: ID of special user the notification should belong to or (default:) null for current user

Here is the call graph for this function:

Here is the caller graph for this function:

static activateAudioFeedback (   $user_id = null)
static

Activates audio plopp for new personal notifications for a given user.

Parameters
string | null$user_id: ID of special user the notification should belong to or (default:) null for current user

Here is the call graph for this function:

Here is the caller graph for this function:

static add (   $user_ids,
  $url,
  $text,
  $html_id = null,
  $avatar = null 
)
static

Central function to add a personal notification to the user. This could be anything that needs to catch the attention of the user. The notification will be displayed in realtime to the user and he/she can get to the url.

Parameters
array | string$user_ids: array of user_ids or a single md5-user_id
string$url: URL of the point of interest of the notification
string$text: a displayed text that describes the notification
null | string$html_id: id in the html-document. If user reaches this html-element the notification will be marked as read, so the user does not need to handle the information twice. Optional. Default: null
string$avatar: URL of an image for the notification. Best size: 40px x 40px
Returns
boolean : true on success

Here is the call graph for this function:

Here is the caller graph for this function:

static deactivate (   $user_id = null)
static

Deactivates personal notifications for a given user.

Parameters
string | null$user_id: ID of special user the notification should belong to or (default:) null for current user

Here is the call graph for this function:

Here is the caller graph for this function:

static deactivateAudioFeedback (   $user_id = null)
static

Deactivates audio plopp for new personal notifications for a given user.

Parameters
string | null$user_id: ID of special user the notification should belong to or (default:) null for current user

Here is the call graph for this function:

Here is the caller graph for this function:

getLiElement ( )

Returns HTML-represantation of the notification which is a list-element.

Returns
string : html-output;
static getMyNotifications (   $only_unread = true,
  $user_id = null 
)
static

Returns all notifications fitting to the parameters.

Parameters
boolean$only_unread: true for getting only unread notifications, false for all.
null | string$user_id: ID of special user the notification should belong to or (default:) null for current user
Returns
array of in ascending order of mkdate

Here is the call graph for this function:

Here is the caller graph for this function:

static isActivated (   $user_id = null)
static

Checks if a given user should see the personal notification. Either the Stud.IP or the user could deactivate personal notification. If neither is the case, this function returns true.

Parameters
string | null$user_id: ID of special user the notification should belong to or (default:) null for current user
Returns
boolean : true if activated else false

Here is the call graph for this function:

Here is the caller graph for this function:

static isAudioActivated (   $user_id = null)
static

Checks if a given user should hear audio plopp for new personal notification. Either the Stud.IP or the user could deactivate personal notification or audio feedback. If neither is the case, this function returns true.

Parameters
string | null$user_id: ID of special user the notification should belong to or (default:) null for current user
Returns
boolean : true if activated else false

Here is the call graph for this function:

static isGloballyActivated ( )
static

Checks if personal notifications are activated for the whole Stud.IP. This could be false for performance issues.

Returns
boolean : true if activated else false

Here is the caller graph for this function:

static markAsRead (   $notification_id,
  $user_id = null 
)
static

Mark a notification as read by the user. It won't appear anymore in the notification-list on top of its site.

Parameters
string$notification_id: ID of the notification
string | null$user_id: ID of special user the notification should belong to or (default:) null for current user
Returns
boolean : true on success, false if it failed.

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: