PHP Class Basecoat\Messages

Author: Brent Baisley ([email protected])
显示文件 Open project: shutterstock/basecoat

Protected Properties

Property Type Description
$tpl_file Template file to use for message output

Public Methods

Method Description
__construct ( ) : Object Create an instance of the Message class
clear ( String $msg_type = null ) : integer Clear all currently loaded messages
display ( $view, boolean $clear = true ) : integer Add current messages to the page for output
error ( $message ) Add an error type message to output
get ( String $msg_type = null ) : Array Get currently loaded messages Optionally filter on message type
info ( $message ) Add an information type message to output
setTemplate ( String $tpl_file ) Set the template file to use for message output
warn ( $message ) Add an warning type message to output

Protected Methods

Method Description
add ( String $type, String $message ) : integer Add a message of the specified type

Method Details

__construct() public method

Create an instance of the Message class
public __construct ( ) : Object
return Object instance of Message class

add() protected method

Messages are stored in the SESSION so they persist until they are outputted to the page
protected add ( String $type, String $message ) : integer
$type String message type to add
$message String message to add
return integer current number of messages of the specified type

clear() public method

Clear all currently loaded messages
public clear ( String $msg_type = null ) : integer
$msg_type String optionally clear only messages of specified type (default is to clear all)
return integer number of messages cleared

display() public method

Add current messages to the page for output
public display ( $view, boolean $clear = true ) : integer
$clear boolean clear messages after added to output
return integer number of messages added to output

error() public method

Add an error type message to output
public error ( $message )

get() public method

Get currently loaded messages Optionally filter on message type
public get ( String $msg_type = null ) : Array
$msg_type String message type to return (info, warn, error)
return Array list of currently loaded messages

info() public method

Add an information type message to output
public info ( $message )

setTemplate() public method

Set the template file to use for message output
public setTemplate ( String $tpl_file )
$tpl_file String path to the template file to load

warn() public method

Add an warning type message to output
public warn ( $message )

Property Details

$tpl_file protected_oe property

Template file to use for message output
protected $tpl_file