PHP Класс NotificationTarget, glpi

Наследование: extends CommonDBChild
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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

Открытые методы

Метод Описание
__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)

Описание методов

__construct() публичный Метод

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

addAdditionnalInfosForTarget() публичный Метод

addAdditionnalUserInfo() публичный Метод

public addAdditionnalUserInfo ( array $data ) : empty
$data array
Результат empty array

addGroupsToTargets() публичный Метод

public addGroupsToTargets ( $entity )
$entity

addProfilesToTargets() публичный Метод

addTagToList() публичный Метод

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

addTarget() публичный Метод

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

addToAddressesList() публичный Метод

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 clearAddressesList ( )

countForGroup() статический публичный Метод

Count Notification for a group
static public countForGroup ( Group $group ) : integer
$group Group Group object
Результат integer

displayTabContentForItem() статический публичный Метод

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

formatURL() публичный Метод

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

getAdditionalTargets() публичный Метод

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() публичный Метод

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() публичный Метод

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

getAdminAddress() публичный Метод

Get GLPI's global administrator email
public getAdminAddress ( )

getAllEvents() публичный Метод

Return all (GLPI + plugins) notification events for the object type
public getAllEvents ( ) : an
Результат an array which contains : event => event label

getContentFooter() публичный Метод

Get footer to add to content
public getContentFooter ( )

getContentHeader() публичный Метод

Get header to add to content
public getContentHeader ( )

getDatasForTemplate() публичный Метод

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 getDefaultUserType ( )

getDistinctUserSql() публичный Метод

public getDistinctUserSql ( )

getEntity() публичный Метод

public getEntity ( )

getEntityAdminAddress() публичный Метод

Get entity admin email

getEvents() публичный Метод

Return main notification events for the object type Internal use only => should use getAllEvents
public getEvents ( ) : an
Результат an array which contains : event => event label

getForTemplate() публичный Метод

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

getFromDBForTarget() публичный Метод

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
Результат true if succeed else false

getInstance() статический публичный Метод

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
Результат a notificationtarget class or false

getInstanceByType() статический публичный Метод

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
Результат a notificationtarget class or false

getItemAuthorAddress() публичный Метод

Get the email of the item's user

getItemGroupAddress() публичный Метод

Get Group of the item
public getItemGroupAddress ( )

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
public getItemOwnerAddress ( )

getItemTechnicianInChargeAddress() публичный Метод

Get technician in charge of the item

getMessageID() публичный Метод

public getMessageID ( ) : message
Результат message id for notification

getNotificationTargets() публичный Метод

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() публичный Метод

Get item associated with the object on which the event was raised
public getObjectItem ( $event = '' ) : the
$event (default '')
Результат the object associated with the itemtype

getProfileJoinSql() публичный Метод

public getProfileJoinSql ( )

getRawName() публичный Метод

Get a notificationtarget class by giving the object which raises the event
См. также: CommonDBTM::getRawName
public getRawName ( )

getReplyTo() публичный Метод

Get the reply to address
public getReplyTo ( $options = [] ) : the
$options array
Результат the reply to address

getSender() публичный Метод

Get admin which sends the notification
public getSender ( $options = [] ) : the
$options array
Результат the sender's address

getSpecificTargets() публичный Метод

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

getSubjectPrefix() публичный Метод

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

getTabNameForItem() публичный Метод

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

getTable() статический публичный Метод

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

getTags() публичный Метод

public getTags ( )

getTargets() публичный Метод

public getTargets ( )

getTypeName() статический публичный Метод

static public getTypeName ( $nb )

getUserByField() публичный Метод

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() публичный Метод

Get users emails by profile
public getUsersAddressesByProfile ( $profiles_id ) : nothing
$profiles_id the profile ID to get users emails
Результат nothing

showForGroup() статический публичный Метод

Display notification registered for a group
static public showForGroup ( Group $group ) : nothing
$group Group Group object
Результат nothing

showForNotification() публичный Метод

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

updateTargets() статический публичный Метод

static public updateTargets ( $input )
$input

validateSendTo() публичный Метод

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)
Результат true

Описание свойств

$datas публичное свойство

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

$dohistory публичное свойство

From CommonDBTM
public $dohistory

$entity публичное свойство

public $entity

$events публичное свойство

array of event name => event label
public $events

$html_tags публичное свойство

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

$items_id публичное статическое свойство

public static $items_id

$itemtype публичное статическое свойство

From CommonDBChild
public static $itemtype

$notification_targets публичное свойство

public $notification_targets

$notification_targets_labels публичное свойство

public $notification_targets_labels

$notificationoptions публичное свойство

public $notificationoptions

$obj публичное свойство

Object which raises the notification event
public $obj

$options публичное свойство

public $options

$prefix публичное свойство

public $prefix

$raiseevent публичное свойство

public $raiseevent

$table публичное свойство

public $table

$tag_descriptions публичное свойство

public $tag_descriptions

$target публичное свойство

Array to store emails by notification
public $target

$target_object публичное свойство

Object which is associated with the event
public $target_object