PHP Класс Piwik\Notification

UI notifications are messages displayed to the user near the top of the screen. Notifications consist of a message, a context (the message type), a priority and a display type. **The context** affects the way the message looks, but not how it is displayed. **The display type** determines how the message is displayed. **The priority** determines where it is shown in the list of all displayed notifications. ### Examples **Display an error message** $notification = new Notification('My Error Message'); $notification->context = Notification::CONTEXT_ERROR; Notification\Manager::notify('myUniqueNotificationId', $notification); **Display a temporary success message** $notification = new Notificiation('Success'); $notification->context = Notification::CONTEXT_SUCCESS; $notification->type = Notification::TYPE_TOAST; Notification\Manager::notify('myUniqueNotificationId', $notification); **Display a message near the top of the screen** $notification = new Notification('Urgent: Your password has expired!'); $notification->context = Notification::CONTEXT_INFO; $notification->type = Notification::TYPE_PERSISTENT; $notification->priority = Notification::PRIORITY_MAX;
Показать файл Открыть проект

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

Свойство Тип Описание
$context string A notification's context determines how it will be styled.
$flags integer Usage: $notification->flags = Notification::FLAG_BAR | Notification::FLAG_FOO.
$message string The notification message. Must be set.
$priority integer The notification's priority. The higher the priority, the higher the order. See PRIORITY_* constants in {@link Notification} to see possible priority values.
$raw boolean If true, the message will not be escaped before being outputted as HTML. If you set this to true, make sure you escape text yourself in order to avoid XSS vulnerabilities.
$title string The notification title. The title is optional and is displayed directly before the message content.
$type string The notification's display type. See TYPE_* constants in {@link Notification}.

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

Метод Описание
__construct ( string $message ) Constructor.
getPriority ( ) : integer Returns the notification's priority. If no priority has been set, a priority will be set based on the notification's context.
hasNoClear ( ) : integer Returns 1 if the notification will be displayed without a close button, 0 if otherwise.

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

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

Constructor.
public __construct ( string $message )
$message string The notification message.

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

Returns the notification's priority. If no priority has been set, a priority will be set based on the notification's context.
public getPriority ( ) : integer
Результат integer

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

Returns 1 if the notification will be displayed without a close button, 0 if otherwise.
public hasNoClear ( ) : integer
Результат integer `1` or `0`.

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

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

A notification's context determines how it will be styled.
public string $context
Результат string

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

Usage: $notification->flags = Notification::FLAG_BAR | Notification::FLAG_FOO.
public int $flags
Результат integer

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

The notification message. Must be set.
public string $message
Результат string

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

The notification's priority. The higher the priority, the higher the order. See PRIORITY_* constants in {@link Notification} to see possible priority values.
public int $priority
Результат integer

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

If true, the message will not be escaped before being outputted as HTML. If you set this to true, make sure you escape text yourself in order to avoid XSS vulnerabilities.
public bool $raw
Результат boolean

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

The notification title. The title is optional and is displayed directly before the message content.
public string $title
Результат string

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

The notification's display type. See TYPE_* constants in {@link Notification}.
public string $type
Результат string