\CGClientTicketsmessage

Each message is tied to a ticket. It has a sender, and a group, and regular message components. Also one or more files can be attached to a message.

Summary

Methods
Properties
Constants
validate()
get_persist_actor()
set_persist_actor()
get_notify_actor()
set_notify_actor()
set_viewed()
load_by_id()
save()
delete()
send()
get_attachment_path()
has_attachments()
get_attachments()
clear_attachments()
queue_attach()
attach_file()
$ticket_id
$sender
$dest
$subject
$body
$id
$
$viewed
$viewed-by
$created
$modified
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$ticket_id

$ticket_id : int

The ticket that this message is associated with.

Type

int

$sender

$sender : int

The person who sent the message. Positive values indicate an FEU uid. Negative values indicate an admin uid.

Type

int

$dest

$dest : int

The person who will receive the message. Positive values indicate an FEU uid. Negative value indicates a CMSMS admin group id.

Type

int

$subject

$subject : string

The subject of the message.

Type

string

$body

$body : string

The body of the message, which can contain HTML text.

Type

string

$id

$id : int

The message id.

Type

int

$

$ : string

int $sent The unix timestamp of the time when this message was sent.

Type

string

$viewed

$viewed : int

The unix timestamp of the time when this message was viewed.

Type

int

$viewed-by

$viewed-by : int

The person who viewed the message. Positive values indicate an FEU uid. Negative values indicate an admin uid.

Type

int

$created

$created : int

The date that this message was first saved to the database.

Type

int

$modified

$modified : int

The date that this message was last saved to th the database.

Type

int

Methods

validate()

validate()

Validate this message before it is saved to the database.

This method will throw exceptions if the content of the message are invalid.

get_persist_actor()

get_persist_actor() : \CGClientTickets\Actor\PersistActor

Get the object that has the responsibility of saving this object.

Returns

\CGClientTickets\Actor\PersistActor

set_persist_actor()

set_persist_actor(\CGClientTickets\Actor\PersistActor $actor)

Set the object that has responsibility of saving and reading this object from a persistent store.

Parameters

\CGClientTickets\Actor\PersistActor $actor

get_notify_actor()

get_notify_actor() : \CGClientTickets\Actor\NotifyActor;

Get the object that has responsibility for sending notifications related to this message.

Returns

\CGClientTickets\Actor\NotifyActor;

set_viewed()

set_viewed(int $uid)

Set this message as viewed.

Parameters

int $uid

The userid of the individual that viewed the message. A positive value indicates an FEU user id. A negative value indicates an admin user id.

load_by_id()

load_by_id(int $id) : \CGClientTickets\message

Load a message with the specified id.

This utilizes the persist actor.

Parameters

int $id

The message id.

Returns

\CGClientTickets\message

save()

save()

Save the object.

This utilizes the persist actor.

After saving the object, any queued attachments will be copied into the appropriate attachment directory.

delete()

delete()

Delete this message object.

This utilizes the persist actor.

An exception will be thrown if the object has not already been saved to the database. After deletion this message will be ready for saving again (with a new id).

send()

send()

Send this message to the appropriate recipients.

This utilizes the notify actor.

get_attachment_path()

get_attachment_path() : string

Get the attachment path.

Returns

string

has_attachments()

has_attachments() : bool

Test if the current message has attachments.

Returns

bool

get_attachments()

get_attachments() : string[]

Return any filenames attached to this message.

Attachments for a message are stored in a single directory named with respect to the message id. Therefore the message needs to have been saved at least once before a file can be attached.

Returns

string[]

clear_attachments()

clear_attachments()

Permanently remove any files attached to this message.

queue_attach()

queue_attach(string $filename, string $destname)

Queue a file for attaching to this message after the message has been saved.

Parameters

string $filename

The complete path to the file to attach.

string $destname

An optional destination filename for the attachment.

attach_file()

attach_file(string $filename, string $destname)

Attach a file to the message.

The message must have already been saved at least once.

Parameters

string $filename

The complete path to the file to attach.

string $destname

An optional destination filename for the attachment.