Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Messaging_Service Class Reference
Inheritance diagram for Messaging_Service:
MySource_Object

Public Member Functions

 Messaging_Service ()
 
 getLogTypes ($msg_type)
 
 openQueue ()
 
 closeQueue ()
 
 abortQueue ()
 
 enqueueMessage ($message)
 
 queueContents ()
 
 openLog ()
 
 closeLog ()
 
 abortLog ()
 
 logMessage ($message)
 
 logContents ()
 
 newMessage ($to=Array(), $type='', $reps=Array())
 
 send ($msgs)
 
 getMessages ($userid, $type=NULL, $statii=Array(), $messageids=Array(), $from=NULL, $to=NULL, $get_user_name=NULL, $parameters=Array(), $max_msgs=0, $count_only=FALSE)
 
 getLogs ($type, $parameters=Array())
 
 getMessageById ($messageid)
 
 queueEmail ($from, $to, $subject, $body, $reply_to='')
 
 sendQueuedEmails ()
 
 formatEmail ($body, &$user, $type='text')
 
- Public Member Functions inherited from MySource_Object
 MySource_Object ()
 
 __sleep ()
 
 __wakeup ()
 

Static Public Member Functions

static sortMessages ($a, $b)
 

Data Fields

 $_levels
 
 $_emails = Array()
 
 $sending_queue = FALSE
 
- Data Fields inherited from MySource_Object
 $_tmp
 

Detailed Description

Definition at line 43 of file messaging_service.inc.

Member Function Documentation

abortLog ( )

Aborts a log or nested log, and removes it's messages from the log

Returns
boolean public

Definition at line 324 of file messaging_service.inc.

abortQueue ( )

Aborts a queue or nested queue, and removes it's messages from the queue

Returns
boolean public

Definition at line 218 of file messaging_service.inc.

closeLog ( )

Closes a log or nested log, and add's it messages to the main log If the last log is closed, the messages in the log are sent

Returns
boolean public

Definition at line 286 of file messaging_service.inc.

closeQueue ( )

Closes a queue or nested queue, and add's it messages to the main queue If the last queue is closed, the messages in the queue are sent

Returns
boolean public

Definition at line 193 of file messaging_service.inc.

enqueueMessage (   $message)

Adds an internal message into the queue

It takes Internal_Message object as an argument

Parameters
object$messagethe message to add to the queue
Returns
void public

Definition at line 237 of file messaging_service.inc.

formatEmail (   $body,
$user,
  $type = 'text' 
)

formats the body of an email with a header and a footer

Parameters
string$bodythe email body
mixed&$usereither the user object or a string containing the user's name that the email is intended for
string$typethe type of the email (text or html)
Returns
string public

Definition at line 847 of file messaging_service.inc.

getLogs (   $type,
  $parameters = Array() 
)

Get logged messages of the passed typed

This is just a cut down version of getMessages so you can get logs without having to call getMessages will a bunch of array and NULL arguments

Parameters
string$typethe type of the message eg. asset.attributes
array$parameterscan limit returned messages to those with these params set
Returns
array public
See Also
getMessages()

Definition at line 633 of file messaging_service.inc.

getLogTypes (   $msg_type)

Returns the log types that are to be used for the passed message type Log Types: 'log_to_file', 'log_to_db', 'send_mail' ('string'=>bool) array of log type => boolen for whether to use or not

Parameters
string$msg_typethe message type (eg 'asset.workflow.announce.approve')
Returns
array public

Definition at line 97 of file messaging_service.inc.

getMessageById (   $messageid)

Returns the message object for the passed id

It returns NULL on error or Internal_Message

Parameters
int$messageidid of the message the you want to get
Returns
object public

Definition at line 650 of file messaging_service.inc.

getMessages (   $userid,
  $type = NULL,
  $statii = Array(),
  $messageids = Array(),
  $from = NULL,
  $to = NULL,
  $get_user_name = NULL,
  $parameters = Array(),
  $max_msgs = 0,
  $count_only = FALSE 
)

Gets all messages for the passed userid

Parameters
string$useridid of the user you are fetching messages for (0 = system, NULL = any user except system)
string$typethe type of the message eg. asset.workflow or asset.attributes.*
array$statiican limit returned messages to those with a status in this array
array$messageidscan limit returned messages to those with a messageid in this array
int$fromtimestamp that every msg returned must be this time or after (NULL to ignore)
int$totimestamp that every msg returned must be this time or before (NULL to ignore)
string$get_user_name[name|short_name], used to return the name/short_name of the from user with the return, which will be returned in the field 'from_name'. (NULL to ignore)
array$parameterscan limit returned messages to those with these params set
int$max_msgsthe maximum number of messages
boolean$count_onlywhether to only get a count of the number of messages or not. defaults to FALSE
Returns
array public

Definition at line 450 of file messaging_service.inc.

logContents ( )

Returns the messages in the current log or nested log (array of object Internal_Message)

Only the contents of the most inside nested log are available from this function

Returns
array public

Definition at line 358 of file messaging_service.inc.

logMessage (   $message)

Adds an internal message into the log

It takes Internal_Message object as an argument

Parameters
object$messagethe message to add to the log
Returns
void public

Definition at line 343 of file messaging_service.inc.

Constructor

Definition at line 80 of file messaging_service.inc.

newMessage (   $to = Array(),
  $type = '',
  $reps = Array() 
)

Creates and returns a new internal message

Some variables of a message can be passed in for simple messages but messages that want to utilise other options need to set these manually so as to not clutter this functions

Parameters
array$toan array of user or group IDs to send this message to (integers)
string$typethe log type of this message (if any)
array$repsthe main body replacement
Returns
object public

Definition at line 382 of file messaging_service.inc.

openLog ( )

Opens a new log or nested log Note that this function really just updates how many logs are open

Returns
boolean public

Definition at line 272 of file messaging_service.inc.

openQueue ( )

Opens a new queue or nested queue Note that this function really just updates how many queues are open

Returns
boolean public

Definition at line 179 of file messaging_service.inc.

queueContents ( )

Returns the messages in the current queue or nested queue (array of object Internal_Message)

Only the contents of the most inside nested queue are available from this function

Returns
array public

Definition at line 255 of file messaging_service.inc.

queueEmail (   $from,
  $to,
  $subject,
  $body,
  $reply_to = '' 
)

queue up an email to send at the conclusion of the script

Parameters
string$fromthe assetid of the user to send from (0 for system)
string$tothe assetid of the user to send to (0 for system)
string$subjectsubject of the internal message
string$bodybody of the internal message
Returns
void public

Definition at line 688 of file messaging_service.inc.

send (   $msgs)

Sends all messages passed in, doing some amalgamation of msg bodies for same user and same subject

Parameters
array$msgsan array of Internal_Message to send
Returns
void public

Definition at line 405 of file messaging_service.inc.

sendQueuedEmails ( )

Sends queued-up emails

Returns
boolean public

Definition at line 717 of file messaging_service.inc.

static sortMessages (   $a,
  $b 
)
static

Sorts two messages based on the sent date (newest message first)

Parameters
array$athe first message to compare
array$bthe second message to compare
Returns
int public

Definition at line 669 of file messaging_service.inc.

Field Documentation

$_levels
Initial value:
= Array(
'queues' => Array(),
'logs' => Array(),
)

Definition at line 51 of file messaging_service.inc.


The documentation for this class was generated from the following file: