UNB Components Code Reference

UnbMessageRevision::Create method

Creates a new message revision instance for a message.

public static function UnbMessageRevision::Create ($messageId, $subject, $content, $summary = null, $contentType = null, $data = null, $dataFileName = null, $writeToFile = null, $draft = false);

Parameters

messageId

(int/UnbMessage) Message to add the revision to

subject

(string) Subject of the new message revision or null (max. 255 characters)

content

(string) Content of the new message revision or null (max. 16,777,215 characters)

summary  –  optional, default: null

(string) Summary of the changes in the new revision to the previous one or null (max. 255 characters)

contentType  –  optional, default: null

(string) MIME content type of attached file data (max. 255 characters, ignored if no data is specified)

data  –  optional, default: null

(string) Attached file data contents or null

dataFileName  –  optional, default: null

(string) Local file name for attached file data or null (do not use together with date)

writeToFile  –  optional, default: null

(bool) Write the attached file data into a file instead of the database or null for automatic decision

draft  –  optional, default: false

(bool) Declare the new message revision as draft

Return value

The newly created UnbMessageRevision object, if successful, null otherwise.

Remarks

The newly created message revision instance is also stored in the database. If the session user is a moderator, the new message revision is automatically approved.

NOTE: This method is only meant to be called from UnbMessage::Create, although this is not strictly enforced. If calling from somewhere else, take care not to add or remove attachment data other than indicated in the message instance!

Exceptions thrown

InvalidArgumentException No description available.
LengthException No description available.
Exception 

If the input file could not be read or copied.

UnbSecurityException 

If not logged in or no read/alter access on the message.

UnbDatabaseException No description available.

Privileges required

Must be logged in and need read and alter access on the message

Member of class: UnbMessageRevision

Implementation file: messagerevision.class.php, line 119

© 2011 Yves Goergen. UNB Components Homepage. Reference generated on 2011-02-22.