silverorange Code


Swat.SwatMessage
/Swat/SwatMessage.php at line 31

Class SwatMessage

SwatObject
└─SwatMessage

public class SwatMessage
extends SwatObject

A data class to store a message

SwatMessage objects are used thoughout Swat. The most noticeable place they are used is for validating entry widgets. See also SwatMessageDisplay, a control for displaying messages.

A message has primary text, optional secondary text and a type. In order to ease the creation of new messages types, message types are not strictly defined. There are, however, several conventional message types. They are:

Messages do not have to use one of these types, but if they do, the message will automatically be appropriately styled by Swat.

Copyright:
2005-2008 silverorange
License:
http://www.gnu.org/copyleft/lesser.html LGPL License 2.1

Field Summary
final mixed

ERROR

Error message type.

final mixed

NOTIFICATION

Notification message type.

final mixed

SYSTEM_ERROR

System Error message type.

final mixed

WARNING

Warning message type.

string

$content_type

Optional content type for both primary and secondary content.

string

$primary_content

Primary message content.

string

$secondary_content

Secondary message text.

string

$type

Type of message.

Constructor Summary

SwatMessage(string primary_content, string type)

Creates a new SwatMessage.

Method Summary
string

getCSSClassString()

Gets the CSS class names of this message as a string.

string

getCssClass()

An alias for SwatMessage::getCSSClassString().

Field Detail

/Swat/SwatMessage.php at line 63

ERROR

public final mixed ERROR = 'error'

Error message type

An error message that requires the attention of the user and that is expected/handled by the application. eg. Missing required fields

Deprecated:
Use the string 'error' instead.

/Swat/SwatMessage.php at line 42

NOTIFICATION

public final mixed NOTIFICATION = 'notice'

Notification message type

An informative message that doesn't require any action by the user.

Deprecated:
Use the string 'notice' instead.

/Swat/SwatMessage.php at line 73

SYSTEM_ERROR

public final mixed SYSTEM_ERROR = 'system-error'

System Error message type

A system error that requires the attention of the user. eg. Database connection error

Deprecated:
Use the string 'system-error' instead.

/Swat/SwatMessage.php at line 52

WARNING

public final mixed WARNING = 'warning'

Warning message type

A warning message that requires the attention of the user, but is not critical and does not necessarily require any action by the user.

Deprecated:
Use the string 'warning' instead.

/Swat/SwatMessage.php at line 112

content_type

public string $content_type = 'text/plain'

Optional content type for both primary and secondary content

Default text/plain, use text/xml for XHTML fragments.


/Swat/SwatMessage.php at line 93

primary_content

public string $primary_content = null

Primary message content

The primary message content is a brief description. It should be about one sentence long.


/Swat/SwatMessage.php at line 103

secondary_content

public string $secondary_content = null

Secondary message text

The secondary message content is an optional longer description. Its length should be at most the length of a small paragraph.


/Swat/SwatMessage.php at line 83

type

public string $type

Type of message


Constructor Detail

/Swat/SwatMessage.php at line 124

SwatMessage

public SwatMessage(string primary_content, string type)

Creates a new SwatMessage

Parameters:
primary_content - the primary text of the message.
type - optional. The type of message. If not specified, 'notice' is used.

Method Detail

/Swat/SwatMessage.php at line 138

getCSSClassString

public string getCSSClassString()

Gets the CSS class names of this message as a string

Returns:
the CSS class names of this message.

/Swat/SwatMessage.php at line 169

getCssClass

public string getCssClass()

An alias for SwatMessage::getCSSClassString()

Returns:
the CSS class names of this message.
Deprecated:
Use SwatMessage::getCSSClassString() instead.

silverorange Code