Constants

VFS_ATTACH_PATH

VFS_ATTACH_PATH

Path to ticket attachments in the VFS.

VFS_MESSAGE_PATH

VFS_MESSAGE_PATH

Path to email messages in the VFS.

Properties

$_sortBy

$_sortBy : string

The current sort field.

Type

string

$_sortDir

$_sortDir : integer

The current sort direction.

Type

integer

$_users

$_users : array

Cached list of user information.

Type

array

$_fieldTypes

$_fieldTypes : array

All available form field types including all type information from the Horde_Form classes.

Type

array

Methods

urlFor()

urlFor(string  $controller, array|string  $data, boolean  $full = false, integer  $append_session) : \Horde_Url

URL factory.

Parameters

string $controller

The controller to link to, one of 'queue', 'ticket', 'ticket_rss', 'ticket_action', 'query', 'query_rss'.

array|string $data

URL data, depending on the controller.

boolean $full

@see Horde::url()

integer $append_session

@see Horde::url()

Returns

\Horde_Url —

The generated URL.

sortTickets()

sortTickets(array  $tickets, string  $by = null, string  $dir = null) 

Sorts tickets by requested direction and fields.

Parameters

array $tickets

The list of tickets to sort.

string $by

The field to sort by. If omitted, obtain from preferences.

string $dir

The direction to sort. If omitted, obtain from preferences.

sortBy()

sortBy(string  $b = null) : string

Sets or returns the current sort field.

Parameters

string $b

The field to sort by.

Returns

string —

If $b is null, returns the previously set value.

sortDir()

sortDir(integer  $d = null) : integer

Sets or returns the current sort direction.

Parameters

integer $d

The direction to sort by.

Returns

integer —

If $d is null, returns the previously set value.

getCAPTCHA()

getCAPTCHA(boolean  $new = false) : string

Returns a new or the current CAPTCHA string.

Parameters

boolean $new

If true, a new CAPTCHA is created and returned. The current, to-be-confirmed string otherwise.

Returns

string —

A CAPTCHA string.

listTemplates()

listTemplates(string  $type) : array

Lists all templates of a given type.

Parameters

string $type

The kind of template ('searchresults', etc.) to list.

Returns

array —

All templates of the requested type.

getCurrentTicket()

getCurrentTicket() : \Whups_Ticket

Returns the current ticket.

Uses the 'id' request variable to determine what to look for. Will redirect to the default view if the ticket isn't found or if permissions checks fail.

Returns

\Whups_Ticket

The current ticket.

addTopbarSearch()

addTopbarSearch() 

Adds topbar search to page

getTicketTabs()

getTicketTabs(  $vars,   $id) 

Returns the tabs for navigating between ticket actions.

Parameters

$vars
$id

hasPermission()

hasPermission(mixed  $in, string  $filter, string|integer  $permission, string  $user = null) : boolean

Returns whether a user has a certain permission on a single resource.

Parameters

mixed $in

A single resource to check.

string $filter

The kind of resource specified in $in, currently only 'queue'.

string|integer $permission

A permission, either 'assign' or 'update', 'requester', or one of the PERM_* constants.

string $user

A user name.

Returns

boolean —

True if the user has the specified permission.

permissionsFilter()

permissionsFilter(array  $in, string  $filter, integer  $permission = \Horde_Perms::READ, string  $user = null, string  $creator = null) : array

Filters a list of resources based on whether a user has certain permissions on it.

Parameters

array $in

A list of resources to check.

string $filter

The kind of resource specified in $in, one of 'queue', 'queue_id', 'reply', or 'comment'.

integer $permission

A permission, one of the PERM_* constants.

string $user

A user name.

string $creator

The creator of an object in the resource, e.g. a ticket creator.

Returns

array —

The list of resources matching the permission criteria.

getOwnerCriteria()

getOwnerCriteria(string  $user) : array

Builds a list of criteria for Whups_Driver#getTicketsByProperties() that match a certain user.

Merges the user's groups with the user name.

Parameters

string $user

A user name.

Returns

array —

A list of criteria that would match the user.

getUserAttributes()

getUserAttributes(string  $user = null) : array

Returns a hash with user information.

Parameters

string $user

A (Whups) user name, defaults to the current user.

Returns

array —

An information hash with 'user', 'name', 'email', and 'type' values.

formatUser()

formatUser(string|array  $user = null, boolean  $showemail = true, boolean  $showname = true, boolean  $html = false) 

Returns a user string from the user's name and email address.

Parameters

string|array $user

A user name or a hash as returned from {@link self::getUserAttributes()}.

boolean $showemail

Whether to include the email address.

boolean $showname

Whether to include the full name.

boolean $html

Whether to "prettify" the result. If true, email addresses are obscured, the result is escaped for HTML output, and a group icon might be added.

formatColumn()

formatColumn(array  $info, string  $value) : string

Formats a ticket property for a tabular ticket listing.

Parameters

array $info

A ticket information hash.

string $value

The column/property to format.

Returns

string —

The formatted property.

getSearchResultColumns()

getSearchResultColumns(integer  $search_type = null, array  $columns = null) 

Returns the set of columns and their associated parameter from the backend that should be displayed to the user.

The results can depend on the current user preferences, which search function was executed, and the $columns parameter.

Parameters

integer $search_type

The type of search that was executed. Currently only 'block' is supported.

array $columns

The columns to return, overriding the defaults for some $search_type.

sendReminders()

sendReminders(\Horde_Variables  $vars) 

Sends reminders, one email per user.

Parameters

\Horde_Variables $vars

The selection criteria:

  • 'id' (integer) for individual tickets
  • 'queue' (integer) for tickets of a queue.
    • 'category' (array) for ticket categories, defaults to unresolved tickets.
  • 'unassigned' (boolean) for unassigned tickets.

Throws

\Whups_Exception

hasMessage()

hasMessage(integer  $ticket, integer  $id) : boolean

Returns whether an original message for a ticket comment exists.

Parameters

integer $ticket

A ticket ID.

integer $id

A message ID.

Throws

\Whups_Exception

if the VFS object cannot be created.

Returns

boolean —

True if the original message exists.

messageUrls()

messageUrls(integer  $ticket,   $message, integer  $queue) : array

Returns the links to view, download, and delete an original message.

Parameters

integer $ticket

A ticket ID.

$message
integer $queue

The ticket's queue ID.

Returns

array —

List of URLs.

getAttachments()

getAttachments(integer  $ticket, string  $name = null) : array

Returns attachment information hashes from the VFS backend.

Parameters

integer $ticket

A ticket ID.

string $name

An attachment name.

Throws

\Whups_Exception

if the VFS object cannot be created.

Returns

array —

If $name is empty a list of all attachments' information hashes, otherwise only the hash for the attachment of that name.

attachmentUrl()

attachmentUrl(integer  $ticket, string  $file, integer  $queue) : array

Returns the links to view, download, and delete an attachment.

Parameters

integer $ticket

A ticket ID.

string $file

An attachment name.

integer $queue

The ticket's queue ID.

Returns

array —

List of URLs.

getOwners()

getOwners(integer  $ticket,   $showemail = true, boolean  $showname = true, array  $owners = null) : string

Returns formatted owner names of a ticket.

Parameters

integer $ticket

A ticket id. Only used if $owners is null.

$showemail
boolean $showname

Should we include the name in the output?

array $owners

An array of owners as returned from Whups_Driver::getOwners() to be formatted. If this is provided, they are used instead of the owners from $ticket.

Returns

string —

The formatted owner string.

fieldTypes()

fieldTypes() : array

Returns all available form field types including all type information from the Horde_Form classes.

Returns

array —

The full field types array.

fieldTypeNames()

fieldTypeNames() : array

Returns the available field type names from the Horde_Form classes.

Returns

array —

A hash The with available field types and names.

fieldTypeParams()

fieldTypeParams(string  $field_type) : array

Returns the parameters for a certain Horde_Form field type.

Parameters

string $field_type

A field type.

Returns

array —

A list of field type parameters.

getAddressbookSearchParams()

getAddressbookSearchParams() : array

Returns the parameters necessary to run an address search.

Returns

array —

An array with two keys: 'sources' and 'fields'.

addFeedLink()

addFeedLink() 

_prepareSort()

_prepareSort(array  $ticket) : array

Helper method to prepare an array of tickets for sorting.

Adds a sort_by key to each ticket array, with values lowercased. Used as a callback to array_map().

Parameters

array $ticket

The ticket array to prepare.

Returns

array —

The altered $ticket array

_sort()

_sort(array  $a, array  $b, string  $sortby = null, string  $sortdir = null) : integer

Helper method to sort an array of tickets.

Used as callback to usort().

Parameters

array $a

The first ticket to compare.

array $b

The second ticket to compare.

string $sortby

The field to sort by. If null, uses the field from self::sortBy().

string $sortdir

The direction to sort. If null, uses the value from self::sortDir().

Returns

integer