Stud.IP  5.4
PersonalNotifications Class Reference
Inheritance diagram for PersonalNotifications:
SimpleORMap

Public Member Functions

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

Static Public Member Functions

static doGarbageCollect ()
 
static add ($user_ids, $url, $text, $html_id=null, $avatar=null, $dialog=false)
 
static getMyNotifications ($only_unread=true, $user_id=null, $limit=15)
 
static markAsRead ($notification_id, $user_id=null)
 
static markAllAsRead ($user_id=null)
 
static markAsReadByHTML ($html_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 tableScheme ($db_table)
 
static expireTableScheme ()
 
static exists ($id)
 
static countBySql ($sql='1', $params=[])
 
static create ($data)
 
static build ($data, $is_new=true)
 
static buildExisting ($data)
 
static import ($data)
 
static findBySQL ($sql, $params=[])
 
static findOneBySQL ($where, $params=[])
 
static findThru ($foreign_key_value, $options)
 
static findEachBySQL ($callable, $sql, $params=[])
 
static findMany ($pks=[], $order='', $order_params=[])
 
static findEachMany ($callable, $pks=[], $order='', $order_params=[])
 
static findAndMapBySQL ($callable, $where, $params=[])
 
static findAndMapMany ($callable, $pks=[], $order='', $order_params=[])
 
static deleteBySQL ($where, $params=[])
 
static toObject ($id_or_object)
 
static __callStatic (string $name, array $arguments)
 

Data Fields

const GC_MAX_DAYS = 30
 
const CACHE_DURATION = 86400
 
- Data Fields inherited from SimpleORMap
const ID_SEPARATOR = '_'
 

Protected Member Functions

 cbExpireCache ()
 
- Protected Member Functions inherited from SimpleORMap
 _getId ($field)
 
 _setId ($field, $value)
 
 _getAdditionalValueFromRelation ($field)
 
 _setAdditionalValueFromRelation ($field, $value)
 
 _getAdditionalValue ($field)
 
 _setAdditionalValue ($field, $value)
 
 parseRelationOptions ($type, $name, $options)
 
 storeRelations ($only_these=null)
 
 deleteRelations ()
 
 initializeContent ()
 
 applyCallbacks ($type)
 
 cbNotificationMapper ($cb_type)
 
 cbAfterInitialize ($cb_type)
 
 setSerializedValue ($field, $value)
 
 setI18nValue ($field, $value)
 

Static Protected Member Functions

static configure ($config=[])
 
static getCacheHash ($user_id)
 
static getCache ($user_id)
 
static setCache ($user_id, $items)
 
static expireCache ($user_id)
 
- Static Protected Member Functions inherited from SimpleORMap
static db_table ()
 
static db_fields ()
 
static pk ()
 
static default_values ()
 
static serialized_fields ()
 
static alias_fields ()
 
static i18n_fields ()
 
static additional_fields ()
 
static has_many ()
 
static has_one ()
 
static belongs_to ()
 
static has_and_belongs_to_many ()
 
static registered_callbacks ()
 
static known_slots ()
 
static notification_map ()
 
static getter_setter_map ()
 
static configure ($config=[])
 
static config ($key)
 
static registerCallback ($types, $cb)
 
static unregisterCallback ($types, $cb)
 

Protected Attributes

 $unseen = null
 
- Protected Attributes inherited from SimpleORMap
 $content = []
 
 $content_db = []
 
 $is_new = true
 
 $is_deleted = false
 
 $relations = []
 
 $additional_data = []
 

Additional Inherited Members

- Static Public Attributes inherited from SimpleORMap
static $schemes = null
 
- Static Protected Attributes inherited from SimpleORMap
static $config = []
 
static $reserved_slots = ['value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id']
 
static $performs_batch_operation = false
 

Member Function Documentation

◆ activate()

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

◆ activateAudioFeedback()

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

◆ add()

static add (   $user_ids,
  $url,
  $text,
  $html_id = null,
  $avatar = null,
  $dialog = false 
)
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
Icon | string$avatar: either an Icon or a URL of an image for the notification. Best size: 40px x 40px
Returns
boolean : true on success

◆ cbExpireCache()

cbExpireCache ( )
protected

◆ configure()

static configure (   $config = [])
staticprotected

◆ deactivate()

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

◆ deactivateAudioFeedback()

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

◆ doGarbageCollect()

static doGarbageCollect ( )
static

Garbage collector the personal notifications. Removes all notifications older than 30 days.

◆ expireCache()

static expireCache (   $user_id)
staticprotected

Removes the cached entries for a specific user.

Parameters
String$user_idId of the user

◆ getCache()

static getCache (   $user_id)
staticprotected

Returns the cached values for a specific user.

Parameters
String$user_idId of the user
Returns
mixed Array of item data (may be empty) or false if no data is cached

◆ getCacheHash()

static getCacheHash (   $user_id)
staticprotected

Returns the cache hash to use for a specific user.

Parameters
String$user_idId of the user
Returns
String Cache hash to use for the user

◆ getLiElement()

getLiElement ( )

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

Returns
string : html-output;

◆ getmore_unseen()

getmore_unseen ( )

Returns (or retrieves) the number of "more unseen" notifications.

Returns
int Number of "more unseen" notifications

◆ getMyNotifications()

static getMyNotifications (   $only_unread = true,
  $user_id = null,
  $limit = 15 
)
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

◆ isActivated()

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

◆ isAudioActivated()

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

◆ isGloballyActivated()

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

◆ link()

link (   $user_id_or_object)

Links this notification to user.

Parameters
User | string$user_id_or_objectUser object or id of user
Returns
PersonalNotificationsUser|false

◆ markAllAsRead()

static markAllAsRead (   $user_id = null)
static

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

Parameters
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.

◆ markAsRead()

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

◆ markAsReadByHTML()

static markAsReadByHTML (   $html_id,
  $user_id = null 
)
static

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

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

◆ setCache()

static setCache (   $user_id,
  $items 
)
staticprotected

Stored the provided item data in cache for a specific user.

Parameters
String$user_idId of the user
Array$itemsRaw db data of the items

◆ setmore_unseen()

setmore_unseen (   $unseen)

Sets the value of the "more unseen" notifications (notification with same url but a different id).

Parameters
int$unseenNumber of more unseen notifications

Field Documentation

◆ $unseen

$unseen = null
protected

◆ CACHE_DURATION

const CACHE_DURATION = 86400

◆ GC_MAX_DAYS

const GC_MAX_DAYS = 30

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