\Whups_Ticket

The Whups_Ticket class encapsulates some logic relating to tickets, sending updates, etc.

Copyright 2004-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (BSD). If you did not receive this file, see http://www.horde.org/licenses/bsdl.php.

Summary

Methods
Properties
Constants
makeTicket()
newTicket()
__construct()
getDetails()
getId()
get()
set()
change()
commit()
delete()
addMessage()
deleteMessage()
addAttachment()
deleteAttachment()
listAllAttachments()
show()
feedLink()
addCommentPerms()
setDetails()
notify()
toString()
__toString()
addAttributes()
No public properties found
No constants found
_getVfs()
$_id
$_details
$_changes
N/A
No private methods found
No private properties found
N/A

Properties

$_id

$_id : integer

The id of the ticket this object wraps.

Type

integer

$_details

$_details : array

The current values of the ticket.

Type

array

$_changes

$_changes : array

Array of changes to make to the ticket.

Type

array

Methods

makeTicket()

makeTicket(integer  $id) : \Whups_Ticket

Returns a ticket object for an id.

Parameters

integer $id

The ticket id.

Returns

\Whups_Ticket

Whups_Ticket object

newTicket()

newTicket(array  $info,   $requester) : \Whups_Ticket

Creates a new ticket.

Pretty bare wrapper around Whups_Driver::addTicket().

Parameters

array $info

A hash with ticket information.

$requester

Returns

\Whups_Ticket

Whups_Ticket object.

__construct()

__construct(integer  $id, array  $details) : \Whups_Ticket

Constructor.

Parameters

integer $id

The ticket id.

array $details

The hash of ticket information.

Returns

\Whups_Ticket

getDetails()

getDetails() : array

Returns all ticket information.

Returns

array —

The ticket information.

getId()

getId() : integer

Returns the ticket id.

Returns

integer —

The ticket id.

get()

get(string  $detail) : mixed

Returns a piece of information from this ticket.

Parameters

string $detail

The detail to return.

Returns

mixed —

The detail value.

set()

set(string  $detail, string  $value) 

Changes a detail of the ticket to a new value.

Never touches the backend; do not use for changes that you want to persist.

Parameters

string $detail

The detail to change.

string $value

The new detail value.

change()

change(string  $detail, string  $value) 

Tracks that a detail of the ticket should change, but does not actually make the change until commit() is called.

Parameters

string $detail

The detail to change.

string $value

The new detail value.

commit()

commit(string  $user = null, integer  $transaction = null, boolean  $notify = true) 

Goes through a list of built-up changes and commits them to the backend.

This will send email updates by default, update the ticket log, etc.

Parameters

string $user

The Horde user of the changes to be made. Defaults to the current user.

integer $transaction

The transaction these changes are part of. Defaults to a new transaction.

boolean $notify

Send ticket notifications?

delete()

delete() 

Deletes this ticket.

Throws

\Whups_Exception

addMessage()

addMessage(string  $message) : integer

Adds a message to this ticket.

Parameters

string $message

The email message content.

Throws

\Whups_Exception

Returns

integer —

The message ID.

deleteMessage()

deleteMessage(integer  $message) 

Removes a message from this ticket.

Parameters

integer $message

A message ID.

Throws

\Whups_Exception

addAttachment()

addAttachment(string  $attachment_name, string  $attachment_file) 

Adds an attachment to this ticket.

Parameters

string $attachment_name

The name of the attachment.

string $attachment_file

The temporary file containing the data to be stored.

Throws

\Whups_Exception

deleteAttachment()

deleteAttachment(string  $attachment_name) 

Removes an attachment from this ticket.

Parameters

string $attachment_name

The name of the attachment.

Throws

\Whups_Exception

listAllAttachments()

listAllAttachments(string  $filter = null) : array

Returns a list of all files that have been attached to this ticket, whether they still exist or not.

Parameters

string $filter

If set, only return this property of the change commit that included the attachment.

Throws

\Whups_Exception

Returns

array —

The list of file attachments

show()

show() 

Redirects the browser to this ticket's view.

feedLink()

feedLink() : array

Returns <link> data for this ticket's feed.

Returns

array —

Link data.

addCommentPerms()

addCommentPerms(integer  $commentId, string  $group) : integer

Sets exclusive read permissions on a comment to a certain group.

Parameters

integer $commentId

The id of the comment to restrict.

string $group

The group name to limit access by.

Returns

integer —

The permission id.

setDetails()

setDetails(\Horde_Variables  $vars, boolean  $split_owners = false) 

Sets all properties of the ticket necessary to display the TicketDetailsForm.

Parameters

\Horde_Variables $vars

The form variables object to set info in.

boolean $split_owners

This has to be set if you want to use the $vars var for saving later or otherwise $form->validate() will fail

notify()

notify(string  $author, boolean  $isNew, array  $listeners = array()) 

Notifies all appropriate people of the creation/update of this ticket.

Parameters

string $author

Who created/changed the ticket?

boolean $isNew

Is this a new ticket or a change to an existing one?

array $listeners

The list of listener that should receive the notification, with user names as keys and user roles as values. If empty, the list will be created automatically.

toString()

toString() 

Returns a plain text representation of a ticket.

__toString()

__toString() 

addAttributes()

addAttributes() : array

Adds ticket attribute values to the ticket's details, and returns the list of attributes.

Returns

array —

List of ticket attribute hashes.

_getVfs()

_getVfs() : \Horde_Vfs_Base

Returns a Horde_Vfs instance.

Returns

\Horde_Vfs_Base —

A VFS instance.