PHP Class NotificationTarget, glpi

Inheritance: extends CommonDBChild
Afficher le fichier Open project: glpi-project/glpi Class Usage Examples

Méthodes publiques

Свойство Type Description
$datas See https://forge.indepnet.net/projects/5/wiki/NotificationTemplatesTags
$dohistory From CommonDBTM
$entity
$events array of event name => event label
$html_tags Tags which have data in HTML : do not try to clean them
$items_id
$itemtype From CommonDBChild
$notification_targets
$notification_targets_labels
$notificationoptions
$obj Object which raises the notification event
$options
$prefix
$raiseevent
$table
$tag_descriptions
$target Array to store emails by notification
$target_object Object which is associated with the event

Méthodes publiques

Méthode Description
__construct ( $entity = '', $event = '', $object = null, $options = [] )
addAdditionnalInfosForTarget ( )
addAdditionnalUserInfo ( array $data ) : empty
addGroupsToTargets ( $entity )
addProfilesToTargets ( )
addTagToList ( $options = [] )
addTarget ( $target = '', $label = '', $type = Notification::USER_TYPE )
addToAddressesList ( array $data ) Add new mail with lang to current email array
clearAddressesList ( )
countForGroup ( Group $group ) : integer Count Notification for a group
displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
formatURL ( $usertype, $redirect )
getAdditionalTargets ( $event = '' ) Allows to add more notification targets Can be overridden in some case (for example Ticket)
getAddressesByGroup ( $manager, $group_id ) Get targets for all the users of a group
getAddressesByTarget ( $data, $options = [] ) Get addresses by type of notification
getAdminAddress ( ) Get GLPI's global administrator email
getAllEvents ( ) : an Return all (GLPI + plugins) notification events for the object type
getContentFooter ( ) Get footer to add to content
getContentHeader ( ) Get header to add to content
getDatasForTemplate ( $event, $options = [] ) Get all data needed for template processing Provides minimum information for alerts Can be overridden by each NotificationTartget class if needed
getDefaultUserType ( )
getDistinctUserSql ( )
getEntity ( )
getEntityAdminAddress ( ) Get entity admin email
getEvents ( ) : an Return main notification events for the object type Internal use only => should use getAllEvents
getForTemplate ( $event, $options )
getFromDBForTarget ( $notifications_id, $type, $ID ) : true Retrieve an item from the database for a specific target
getInstance ( $item, $event = '', $options = [] ) : a Get a notificationtarget class by giving the object which raises the event
getInstanceByType ( $itemtype, $event = '', $options = [] ) : a Get a notificationtarget class by giving an itemtype
getItemAuthorAddress ( ) Get the email of the item's user
getItemGroupAddress ( ) Get Group of the item
getItemGroupSupervisorAddress ( ) Get Group supervisor of the item
getItemGroupTechInChargeAddress ( ) Get Group of technicians in charge of the item
getItemGroupWithoutSupervisorAddress ( ) Get Group without supervisor of the item
getItemOwnerAddress ( ) Get user owner of the material
getItemTechnicianInChargeAddress ( ) Get technician in charge of the item
getMessageID ( ) : message
getNotificationTargets ( $entity ) Return all the targets for this notification Values returned by this method are the ones for the alerts Can be updated by implementing the getAdditionnalTargets() method Can be overwitten (like dbconnection)
getObjectItem ( $event = '' ) : the Get item associated with the object on which the event was raised
getProfileJoinSql ( )
getRawName ( ) Get a notificationtarget class by giving the object which raises the event
getReplyTo ( $options = [] ) : the Get the reply to address
getSender ( $options = [] ) : the Get admin which sends the notification
getSpecificTargets ( $data, $options ) Get addresses by a method not defined in NotificationTarget (specific to an itemtype)
getSubjectPrefix ( $event = '' )
getTabNameForItem ( CommonGLPI $item, $withtemplate )
getTable ( ) Temporary hack for this class since 0.84
getTags ( )
getTargets ( )
getTypeName ( $nb )
getUserByField ( $field, $search_in_object = false ) Add user to the notified users list
getUsersAddressesByProfile ( $profiles_id ) : nothing Get users emails by profile
showForGroup ( Group $group ) : nothing Display notification registered for a group
showForNotification ( Notification $notification )
updateTargets ( $input )
validateSendTo ( $event, array $infos, $notify_me = false ) : true Validate send before doing it (may be overloaded : exemple for private tasks or followups)

Method Details

__construct() public méthode

public __construct ( $entity = '', $event = '', $object = null, $options = [] )
$entity (default '')
$event (default '')
$object (default null)
$options array

addAdditionnalInfosForTarget() public méthode

addAdditionnalUserInfo() public méthode

public addAdditionnalUserInfo ( array $data ) : empty
$data array
Résultat empty array

addGroupsToTargets() public méthode

public addGroupsToTargets ( $entity )
$entity

addProfilesToTargets() public méthode

addTagToList() public méthode

public addTagToList ( $options = [] )
$options array

addTarget() public méthode

public addTarget ( $target = '', $label = '', $type = Notification::USER_TYPE )
$target (default '')
$label (default '')
$type (=Notification::USER_TYPE)

addToAddressesList() public méthode

Add new mail with lang to current email array
public addToAddressesList ( array $data )
$data array array of data (mail, lang[, id for user])

clearAddressesList() public méthode

public clearAddressesList ( )

countForGroup() static public méthode

Count Notification for a group
static public countForGroup ( Group $group ) : integer
$group Group Group object
Résultat integer

displayTabContentForItem() static public méthode

static public displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
$item CommonGLPI

formatURL() public méthode

public formatURL ( $usertype, $redirect )
$usertype
$redirect

getAdditionalTargets() public méthode

Allows to add more notification targets Can be overridden in some case (for example Ticket)
public getAdditionalTargets ( $event = '' )
$event specif event to get additional targets (default '')

getAddressesByGroup() public méthode

Get targets for all the users of a group
public getAddressesByGroup ( $manager, $group_id )
$manager 0 all users, 1 only supervisors, 2 all users without supervisors
$group_id id of the group

getAddressesByTarget() public méthode

Get addresses by type of notification
public getAddressesByTarget ( $data, $options = [] )
$data
$options array

getAdminAddress() public méthode

Get GLPI's global administrator email
public getAdminAddress ( )

getAllEvents() public méthode

Return all (GLPI + plugins) notification events for the object type
public getAllEvents ( ) : an
Résultat an array which contains : event => event label

getContentFooter() public méthode

Get footer to add to content
public getContentFooter ( )

getContentHeader() public méthode

Get header to add to content
public getContentHeader ( )

getDatasForTemplate() public méthode

Get all data needed for template processing Provides minimum information for alerts Can be overridden by each NotificationTartget class if needed
public getDatasForTemplate ( $event, $options = [] )
$event
$options array

getDefaultUserType() public méthode

public getDefaultUserType ( )

getDistinctUserSql() public méthode

public getDistinctUserSql ( )

getEntity() public méthode

public getEntity ( )

getEntityAdminAddress() public méthode

Get entity admin email

getEvents() public méthode

Return main notification events for the object type Internal use only => should use getAllEvents
public getEvents ( ) : an
Résultat an array which contains : event => event label

getForTemplate() public méthode

public getForTemplate ( $event, $options )
$event
$options

getFromDBForTarget() public méthode

Retrieve an item from the database for a specific target
public getFromDBForTarget ( $notifications_id, $type, $ID ) : true
$notifications_id integer notification ID
$type type of the target to retrive
$ID integer ID of the target to retrieve
Résultat true if succeed else false

getInstance() static public méthode

Get a notificationtarget class by giving the object which raises the event
static public getInstance ( $item, $event = '', $options = [] ) : a
$item the object which raises the event
$event the event which will be used (default '')
$options array of options
Résultat a notificationtarget class or false

getInstanceByType() static public méthode

Get a notificationtarget class by giving an itemtype
static public getInstanceByType ( $itemtype, $event = '', $options = [] ) : a
$itemtype the itemtype of the object which raises the event
$event the event which will be used (default '')
$options array of options
Résultat a notificationtarget class or false

getItemAuthorAddress() public méthode

Get the email of the item's user

getItemGroupAddress() public méthode

Get Group of the item
public getItemGroupAddress ( )

getItemGroupSupervisorAddress() public méthode

Get Group supervisor of the item

getItemGroupTechInChargeAddress() public méthode

Get Group of technicians in charge of the item

getItemGroupWithoutSupervisorAddress() public méthode

Get Group without supervisor of the item

getItemOwnerAddress() public méthode

Get user owner of the material
public getItemOwnerAddress ( )

getItemTechnicianInChargeAddress() public méthode

Get technician in charge of the item

getMessageID() public méthode

public getMessageID ( ) : message
Résultat message id for notification

getNotificationTargets() public méthode

Return all the targets for this notification Values returned by this method are the ones for the alerts Can be updated by implementing the getAdditionnalTargets() method Can be overwitten (like dbconnection)
public getNotificationTargets ( $entity )
$entity the entity on which the event is raised

getObjectItem() public méthode

Get item associated with the object on which the event was raised
public getObjectItem ( $event = '' ) : the
$event (default '')
Résultat the object associated with the itemtype

getProfileJoinSql() public méthode

public getProfileJoinSql ( )

getRawName() public méthode

Get a notificationtarget class by giving the object which raises the event
See also: CommonDBTM::getRawName
public getRawName ( )

getReplyTo() public méthode

Get the reply to address
public getReplyTo ( $options = [] ) : the
$options array
Résultat the reply to address

getSender() public méthode

Get admin which sends the notification
public getSender ( $options = [] ) : the
$options array
Résultat the sender's address

getSpecificTargets() public méthode

Get addresses by a method not defined in NotificationTarget (specific to an itemtype)
public getSpecificTargets ( $data, $options )
$data
$options

getSubjectPrefix() public méthode

public getSubjectPrefix ( $event = '' )
$event (default '')

getTabNameForItem() public méthode

public getTabNameForItem ( CommonGLPI $item, $withtemplate )
$item CommonGLPI

getTable() static public méthode

Temporary hack for this class since 0.84
static public getTable ( )

getTags() public méthode

public getTags ( )

getTargets() public méthode

public getTargets ( )

getTypeName() static public méthode

static public getTypeName ( $nb )

getUserByField() public méthode

Add user to the notified users list
public getUserByField ( $field, $search_in_object = false )
$field look for user looking for this field in the object which raises the event
$search_in_object search is done in the object ? if not in target object (false by default)

getUsersAddressesByProfile() public méthode

Get users emails by profile
public getUsersAddressesByProfile ( $profiles_id ) : nothing
$profiles_id the profile ID to get users emails
Résultat nothing

showForGroup() static public méthode

Display notification registered for a group
static public showForGroup ( Group $group ) : nothing
$group Group Group object
Résultat nothing

showForNotification() public méthode

public showForNotification ( Notification $notification )
$notification Notification Notification object

updateTargets() static public méthode

static public updateTargets ( $input )
$input

validateSendTo() public méthode

Validate send before doing it (may be overloaded : exemple for private tasks or followups)
public validateSendTo ( $event, array $infos, $notify_me = false ) : true
$event string notification event
$infos array array of destination of the notification
$notify_me boolean notify me on my action ? ($infos contains users_id to check if the target is me) (false by default)
Résultat true

Property Details

$datas public_oe property

See https://forge.indepnet.net/projects/5/wiki/NotificationTemplatesTags
public $datas

$dohistory public_oe property

From CommonDBTM
public $dohistory

$entity public_oe property

public $entity

$events public_oe property

array of event name => event label
public $events

$html_tags public_oe property

Tags which have data in HTML : do not try to clean them
public $html_tags

$items_id public_oe static_oe property

public static $items_id

$itemtype public_oe static_oe property

From CommonDBChild
public static $itemtype

$notification_targets public_oe property

public $notification_targets

$notification_targets_labels public_oe property

public $notification_targets_labels

$notificationoptions public_oe property

public $notificationoptions

$obj public_oe property

Object which raises the notification event
public $obj

$options public_oe property

public $options

$prefix public_oe property

public $prefix

$raiseevent public_oe property

public $raiseevent

$table public_oe property

public $table

$tag_descriptions public_oe property

public $tag_descriptions

$target public_oe property

Array to store emails by notification
public $target

$target_object public_oe property

Object which is associated with the event
public $target_object