PHP Class Whups, horde

Author: Robert E. Coyle ([email protected])
Author: Jan Schneider ([email protected])
Afficher le fichier Open project: horde/horde Class Usage Examples

Protected Properties

Свойство Type Description
$_fieldTypes array All available form field types including all type information from the Horde_Form classes.
$_sortBy string The current sort field.
$_sortDir integer The current sort direction.
$_users array Cached list of user information.

Méthodes publiques

Méthode Description
addFeedLink ( )
addTopbarSearch ( ) Adds topbar search to page
attachmentUrl ( integer $ticket, string $file, integer $queue ) : array Returns the links to view, download, and delete an attachment.
fieldTypeNames ( ) : array Returns the available field type names from the Horde_Form classes.
fieldTypeParams ( string $field_type ) : array Returns the parameters for a certain Horde_Form field type.
fieldTypes ( ) : array Returns all available form field types including all type information from the Horde_Form classes.
formatColumn ( array $info, string $value ) : string Formats a ticket property for a tabular ticket listing.
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.
getAddressbookSearchParams ( ) : array Returns the parameters necessary to run an address search.
getAttachments ( integer $ticket, string $name = null ) : array Returns attachment information hashes from the VFS backend.
getCAPTCHA ( boolean $new = false ) : string Returns a new or the current CAPTCHA string.
getCurrentTicket ( ) : Whups_Ticket Returns the current ticket.
getOwnerCriteria ( string $user ) : array Builds a list of criteria for Whups_Driver#getTicketsByProperties() that match a certain user.
getOwners ( integer $ticket, $showemail = true, boolean $showname = true, array $owners = null ) : string Returns formatted owner names of a ticket.
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.
getTicketTabs ( &$vars, $id ) Returns the tabs for navigating between ticket actions.
getUserAttributes ( string $user = null ) : array Returns a hash with user information.
hasMessage ( integer $ticket, integer $id ) : boolean Returns whether an original message for a ticket comment exists.
hasPermission ( mixed $in, string $filter, string | integer $permission, string $user = null ) : boolean Returns whether a user has a certain permission on a single resource.
listTemplates ( string $type ) : array Lists all templates of a given type.
messageUrls ( integer $ticket, $message, integer $queue ) : array Returns the links to view, download, and delete an original message.
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.
sendReminders ( Horde_Variables $vars ) Sends reminders, one email per user.
sortBy ( string $b = null ) : string Sets or returns the current sort field.
sortDir ( integer $d = null ) : integer Sets or returns the current sort direction.
sortTickets ( array &$tickets, string $by = null, string $dir = null ) Sorts tickets by requested direction and fields.
urlFor ( string $controller, array | string $data, boolean $full = false, integer $append_session ) : Horde_Url URL factory.

Méthodes protégées

Méthode Description
_prepareSort ( array $ticket ) : array Helper method to prepare an array of tickets for sorting.
_sort ( array $a, array $b, string $sortby = null, string $sortdir = null ) : integer Helper method to sort an array of tickets.

Method Details

_prepareSort() protected static méthode

Adds a sort_by key to each ticket array, with values lowercased. Used as a callback to array_map().
protected static _prepareSort ( array $ticket ) : array
$ticket array The ticket array to prepare.
Résultat array The altered $ticket array

_sort() protected static méthode

Used as callback to usort().
protected static _sort ( array $a, array $b, string $sortby = null, string $sortdir = null ) : integer
$a array The first ticket to compare.
$b array The second ticket to compare.
$sortby string The field to sort by. If null, uses the field from self::sortBy().
$sortdir string The direction to sort. If null, uses the value from self::sortDir().
Résultat integer

addTopbarSearch() public static méthode

Adds topbar search to page
public static addTopbarSearch ( )

attachmentUrl() public static méthode

Returns the links to view, download, and delete an attachment.
public static attachmentUrl ( integer $ticket, string $file, integer $queue ) : array
$ticket integer A ticket ID.
$file string An attachment name.
$queue integer The ticket's queue ID.
Résultat array List of URLs.

fieldTypeNames() public static méthode

Returns the available field type names from the Horde_Form classes.
public static fieldTypeNames ( ) : array
Résultat array A hash The with available field types and names.

fieldTypeParams() public static méthode

Returns the parameters for a certain Horde_Form field type.
public static fieldTypeParams ( string $field_type ) : array
$field_type string A field type.
Résultat array A list of field type parameters.

fieldTypes() public static méthode

Returns all available form field types including all type information from the Horde_Form classes.
public static fieldTypes ( ) : array
Résultat array The full field types array.

formatColumn() public static méthode

Formats a ticket property for a tabular ticket listing.
public static formatColumn ( array $info, string $value ) : string
$info array A ticket information hash.
$value string The column/property to format.
Résultat string The formatted property.

formatUser() public static méthode

Returns a user string from the user's name and email address.
public static formatUser ( string | array $user = null, boolean $showemail = true, boolean $showname = true, boolean $html = false )
$user string | array A user name or a hash as returned from {@link self::getUserAttributes()}.
$showemail boolean Whether to include the email address.
$showname boolean Whether to include the full name.
$html boolean 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.

getAddressbookSearchParams() public static méthode

Returns the parameters necessary to run an address search.
public static getAddressbookSearchParams ( ) : array
Résultat array An array with two keys: 'sources' and 'fields'.

getAttachments() public static méthode

Returns attachment information hashes from the VFS backend.
public static getAttachments ( integer $ticket, string $name = null ) : array
$ticket integer A ticket ID.
$name string An attachment name.
Résultat array If $name is empty a list of all attachments' information hashes, otherwise only the hash for the attachment of that name.

getCAPTCHA() public static méthode

Returns a new or the current CAPTCHA string.
public static getCAPTCHA ( boolean $new = false ) : string
$new boolean If true, a new CAPTCHA is created and returned. The current, to-be-confirmed string otherwise.
Résultat string A CAPTCHA string.

getCurrentTicket() public static méthode

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.
public static getCurrentTicket ( ) : Whups_Ticket
Résultat Whups_Ticket The current ticket.

getOwnerCriteria() public static méthode

Merges the user's groups with the user name.
public static getOwnerCriteria ( string $user ) : array
$user string A user name.
Résultat array A list of criteria that would match the user.

getOwners() public static méthode

Returns formatted owner names of a ticket.
public static getOwners ( integer $ticket, $showemail = true, boolean $showname = true, array $owners = null ) : string
$ticket integer A ticket id. Only used if $owners is null.
$showname boolean Should we include the name in the output?
$owners array 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.
Résultat string The formatted owner string.

getSearchResultColumns() public static méthode

The results can depend on the current user preferences, which search function was executed, and the $columns parameter.
public static getSearchResultColumns ( integer $search_type = null, array $columns = null )
$search_type integer The type of search that was executed. Currently only 'block' is supported.
$columns array The columns to return, overriding the defaults for some $search_type.

getTicketTabs() public static méthode

Returns the tabs for navigating between ticket actions.
public static getTicketTabs ( &$vars, $id )

getUserAttributes() public static méthode

Returns a hash with user information.
public static getUserAttributes ( string $user = null ) : array
$user string A (Whups) user name, defaults to the current user.
Résultat array An information hash with 'user', 'name', 'email', and 'type' values.

hasMessage() public static méthode

Returns whether an original message for a ticket comment exists.
public static hasMessage ( integer $ticket, integer $id ) : boolean
$ticket integer A ticket ID.
$id integer A message ID.
Résultat boolean True if the original message exists.

hasPermission() public static méthode

Returns whether a user has a certain permission on a single resource.
public static hasPermission ( mixed $in, string $filter, string | integer $permission, string $user = null ) : boolean
$in mixed A single resource to check.
$filter string The kind of resource specified in $in, currently only 'queue'.
$permission string | integer A permission, either 'assign' or 'update', 'requester', or one of the PERM_* constants.
$user string A user name.
Résultat boolean True if the user has the specified permission.

listTemplates() public static méthode

Lists all templates of a given type.
public static listTemplates ( string $type ) : array
$type string The kind of template ('searchresults', etc.) to list.
Résultat array All templates of the requested type.

messageUrls() public static méthode

Returns the links to view, download, and delete an original message.
public static messageUrls ( integer $ticket, $message, integer $queue ) : array
$ticket integer A ticket ID.
$queue integer The ticket's queue ID.
Résultat array List of URLs.

permissionsFilter() public static méthode

Filters a list of resources based on whether a user has certain permissions on it.
public static permissionsFilter ( array $in, string $filter, integer $permission = Horde_Perms::READ, string $user = null, string $creator = null ) : array
$in array A list of resources to check.
$filter string The kind of resource specified in $in, one of 'queue', 'queue_id', 'reply', or 'comment'.
$permission integer A permission, one of the PERM_* constants.
$user string A user name.
$creator string The creator of an object in the resource, e.g. a ticket creator.
Résultat array The list of resources matching the permission criteria.

sendReminders() public static méthode

Sends reminders, one email per user.
public static sendReminders ( Horde_Variables $vars )
$vars Horde_Variables 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.

sortBy() public static méthode

Sets or returns the current sort field.
public static sortBy ( string $b = null ) : string
$b string The field to sort by.
Résultat string If $b is null, returns the previously set value.

sortDir() public static méthode

Sets or returns the current sort direction.
public static sortDir ( integer $d = null ) : integer
$d integer The direction to sort by.
Résultat integer If $d is null, returns the previously set value.

sortTickets() public static méthode

Sorts tickets by requested direction and fields.
public static sortTickets ( array &$tickets, string $by = null, string $dir = null )
$tickets array The list of tickets to sort.
$by string The field to sort by. If omitted, obtain from preferences.
$dir string The direction to sort. If omitted, obtain from preferences.

urlFor() public static méthode

URL factory.
public static urlFor ( string $controller, array | string $data, boolean $full = false, integer $append_session ) : Horde_Url
$controller string The controller to link to, one of 'queue', 'ticket', 'ticket_rss', 'ticket_action', 'query', 'query_rss'.
$data array | string URL data, depending on the controller.
$full boolean @see Horde::url()
$append_session integer @see Horde::url()
Résultat Horde_Url The generated URL.

Property Details

$_fieldTypes protected_oe static_oe property

All available form field types including all type information from the Horde_Form classes.
See also: fieldTypes()
protected static array $_fieldTypes
Résultat array

$_sortBy protected_oe static_oe property

The current sort field.
See also: sortBy()
protected static string $_sortBy
Résultat string

$_sortDir protected_oe static_oe property

The current sort direction.
See also: sortDir()
protected static int $_sortDir
Résultat integer

$_users protected_oe static_oe property

Cached list of user information.
See also: getUserAttributes()
protected static array $_users
Résultat array