Overview

Packages

  • Horde
    • Form
    • MIME
      • Viewer
    • Scheduler
  • None
  • Whups
    • UnitTests

Classes

  • Horde_Core_Ui_VarRenderer_whups
  • Whups
  • Whups_Ajax_Imple_ContactAutoCompleter
  • Whups_Api
  • Whups_Driver
  • Whups_Driver_Sql
  • Whups_Form_AddComment
  • Whups_Form_Admin_AddAttribute
  • Whups_Form_Admin_AddPriority
  • Whups_Form_Admin_AddQueue
  • Whups_Form_Admin_AddReply
  • Whups_Form_Admin_AddState
  • Whups_Form_Admin_AddType
  • Whups_Form_Admin_AddUser
  • Whups_Form_Admin_AddVersion
  • Whups_Form_Admin_CloneType
  • Whups_Form_Admin_DefaultPriority
  • Whups_Form_Admin_DefaultState
  • Whups_Form_Admin_DeleteAttribute
  • Whups_Form_Admin_DeletePriority
  • Whups_Form_Admin_DeleteQueue
  • Whups_Form_Admin_DeleteReply
  • Whups_Form_Admin_DeleteState
  • Whups_Form_Admin_DeleteType
  • Whups_Form_Admin_DeleteVersion
  • Whups_Form_Admin_EditAttributeStepOne
  • Whups_Form_Admin_EditAttributeStepTwo
  • Whups_Form_Admin_EditPriorityStepOne
  • Whups_Form_Admin_EditPriorityStepTwo
  • Whups_Form_Admin_EditQueueStepOne
  • Whups_Form_Admin_EditQueueStepTwo
  • Whups_Form_Admin_EditReplyStepOne
  • Whups_Form_Admin_EditReplyStepTwo
  • Whups_Form_Admin_EditStateStepOne
  • Whups_Form_Admin_EditStateStepTwo
  • Whups_Form_Admin_EditTypeStepOne
  • Whups_Form_Admin_EditTypeStepTwo
  • Whups_Form_Admin_EditUser
  • Whups_Form_Admin_EditVersionStepOne
  • Whups_Form_Admin_EditVersionStepTwo
  • Whups_Form_InsertBranch
  • Whups_Form_Query_AttributeCriterion
  • Whups_Form_Query_ChooseNameForLoad
  • Whups_Form_Query_ChooseNameForSave
  • Whups_Form_Query_DateCriterion
  • Whups_Form_Query_Delete
  • Whups_Form_Query_GroupCriterion
  • Whups_Form_Query_Parameter
  • Whups_Form_Query_PropertyCriterion
  • Whups_Form_Query_TextCriterion
  • Whups_Form_Query_UserCriterion
  • Whups_Form_Renderer_Comment
  • Whups_Form_Search
  • Whups_Form_SendReminder
  • Whups_Form_Ticket_CreateStepFour
  • Whups_Form_Ticket_CreateStepOne
  • Whups_Form_Ticket_CreateStepThree
  • Whups_Form_Ticket_CreateStepTwo
  • Whups_Form_Ticket_Edit
  • Whups_Form_TicketDetails
  • Whups_LoginTasks_SystemTask_Upgrade
  • Whups_Mail
  • Whups_Query
  • Whups_Query_Manager
  • Whups_Reports
  • Whups_Ticket
  • Whups_View_Base
  • Whups_View_Results
  • Whups_View_SavedQueries
  • Overview
  • Package
  • Class
  • Tree

Class Whups_Driver_Sql

Whups backend driver for the Horde_Db abstraction layer.

Copyright 2001-2002 Robert E. Coyle robertecoyle@hotmail.com Copyright 2001-2012 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.

Whups_Driver
Extended by Whups_Driver_Sql
Package: Whups
Author: Robert E. Coyle robertecoyle@hotmail.com
Author: Chuck Hagenbuch chuck@horde.org
Located at Driver/Sql.php
Methods summary
public
# setStorage( mixed $storage )
public integer
# addQueue( mixed $name, mixed $description, mixed $slug = '', mixed $email = '' )

Adds a new queue.

Adds a new queue.

Returns

integer
The new queue ID.

Throws

Whups_Exception

Params

string $name A queue name.
string $description A queue description.
string $slug A queue slug.
string $email A queue email address.
public integer
# addType( string $name, string $description )

Adds a new ticket type.

Adds a new ticket type.

Parameters

$name
A type name.
$description
A type description.

Returns

integer
The new type ID.

Throws

Whups_Exception
public integer
# addState( integer $typeId, string $name, string $description, string $category )

Adds a new state to a ticket type.

Adds a new state to a ticket type.

Parameters

$typeId
A ticket type ID.
$name
A state name
$description
A state description.
$category
A state category.

Returns

integer
The new state ID.

Throws

Whups_Exception
public integer
# addPriority( integer $typeId, string $name, string $description )

Adds a new priority to a ticket type.

Adds a new priority to a ticket type.

Parameters

$typeId
A ticket type ID.
$name
A priority name.
$description
A priority description.

Returns

integer
The new priority ID.

Throws

Whups_Exception
public integer
# addVersion( integer $queueId, string $name, string $description, boolean $active )

Adds a new version to a queue.

Adds a new version to a queue.

Parameters

$queueId
A queue ID.
$name
A version name.
$description
A version description.
$active
Whether the version is active.

Returns

integer
The new version ID.

Throws

Whups_Exception
public integer
# addReply( integer $type, string $name, string $text )

Adds a form reply.

Adds a form reply.

Parameters

$type
A ticket type ID.
$name
A reply name.
$text
A reply text.

Returns

integer
The new form reply ID.

Throws

Whups_Exception
public integer
# addTicket( array & $info, string $requester )

Adds a ticket.

Adds a ticket.

Parameters

$info
<p>A ticket info hash. Will get a 'last-transaction' value added.</p>
$requester
A ticket requester.

Returns

integer
The new ticket ID.

Throws

Whups_Exception
public integer
# addComment( integer $ticket_id, string $comment, string $creator, string $creator_email = null )

Adds a new ticket comment.

Adds a new ticket comment.

Parameters

$ticket_id
A ticket ID.
$comment
A comment text.
$creator
The creator of the comment.
$creator_email
The creator's email address.

Returns

integer
The new comment ID.

Throws

Whups_Exception
public
# updateTicket( integer $ticketId, array $attributes )

Updates a ticket.

Updates a ticket.

Does not update the ticket log (so that it can be used for things low-level enough to not show up there. In general, you should always update the log; Whups_Ticket::commit() will take care of this in most cases).

Parameters

$ticketId
A ticket ID.
$attributes
An attribute hash.

Throws

Whups_Exception
public
# addTicketOwner( integer $ticketId, string $owner )

Adds a ticket owner.

Adds a ticket owner.

Parameters

$ticketId
A ticket ID.
$owner
An owner ID.

Throws

Whups_Exception
public
# deleteTicketOwner( integer $ticketId, string $owner )

Removes a ticket owner.

Removes a ticket owner.

Parameters

$ticketId
A ticket ID.
$owner
An owner ID.

Throws

Whups_Exception
public
# deleteTicket( integer $id )

Removes a ticket.

Removes a ticket.

Parameters

$id
A ticket ID.

Throws

Whups_Exception
public array
# executeQuery( Whups_Query $query, Horde_Variables $vars, boolean $get_details = true, boolean $munge = true )

Executes a query.

Executes a query.

Parameters

$query
A query object.
$vars
Request variables.
$get_details
Whether to return all ticket details.
$munge
@TODO (?)

Returns

array

List of ticket IDs or ticket details that match the query criteria.

Throws

Whups_Exception
public
# clauseFromQuery( mixed $args, mixed $type, mixed $criterion, mixed $cvalue, mixed $operator, mixed $value )
public array
# getTicketsByProperties( array $info, boolean $munge = true, boolean $perowner = false )

Returns tickets by searching for its properties.

Returns tickets by searching for its properties.

Parameters

$info
An array of properties to search for.
$munge
Munge the query (?)
$perowner
Group the results per owner?

Returns

array
An array of ticket information hashes.

Throws

Whups_Exception
public array
# getTicketDetails( integer $ticket, boolean $checkPerms = true )

Returns ticket details.

Returns ticket details.

Parameters

$ticket
A ticket ID.
$checkPerms
Enforce permissions?

Returns

array
A ticket information hash.

Throws

Horde_Exception_NotFound
Horde_Exception_PermissionDenied
public integer
# getTicketState( integer $ticket_id )

Returns a ticket state.

Returns a ticket state.

Parameters

$ticket_id
A ticket ID.

Returns

integer
A state ID.

Throws

Whups_Exception
public string
# getGuestEmail( string $guest_id )

Returns a guest's email address.

Returns a guest's email address.

Parameters

$guest_id
A guest ID.

Returns

string
The guest's email address.

Throws

Whups_Exception
public
# deleteHistory( integer $transaction )

Deletes all changes of a transaction.

Deletes all changes of a transaction.

Parameters

$transaction
A transaction ID.

Throws

Whups_Exception
public array
# getQueueSummary( array $queue_ids )

Return a list of queues and the number of open tickets in each.

Return a list of queues and the number of open tickets in each.

Parameters

$queue_ids
$queues Array of queue IDs to summarize.

Returns

array
A list of queue hashes.

Throws

Whups_Exception
public array
# getQueueInternal( integer $queueId )

Returns a queue information hash.

Returns a queue information hash.

Parameters

$queueId
A queue ID.

Returns

array
A queue hash.

Throws

Whups_Exception
public array
# getQueueBySlugInternal( string $slug )

Returns a queue information hash.

Returns a queue information hash.

Parameters

$slug
A queue slug.

Returns

array
A queue hash.

Throws

Whups_Exception
public array
# getQueuesInternal( )

Returns a list of available queues.

Returns a list of available queues.

Returns

array
An hash of queue ID => queue name.

Throws

Whups_Exception
public array
# getSlugs( )

Returns a list of all available slugs.

Returns a list of all available slugs.

Returns

array
A hash of queue ID => queue slug.

Throws

Whups_Exception
public
# updateQueue( integer $queueId, string $name, string $description, array $types = array(), integer $versioned = 0, string $slug = '', string $email = '', integer $default = null )

Updates a queue.

Updates a queue.

Parameters

$queueId
A queue ID.
$name
A queue name.
$description
A queue description.
$types
A list of type IDs for this queue.
$versioned
<p>Is this queue versioned? (1 = true, 0 = false)</p>
$slug
A queue slug.
$email
A queue email address.
$default
The default ticket type.

Throws

Whups_Exception
public integer
# getDefaultType( integer $queue )

Returns a queue's default ticket type.

Returns a queue's default ticket type.

Parameters

$queue
A queue ID.

Returns

integer
A ticket type ID.
public
# deleteQueue( integer $queueId )

Deletes an entire queue, and all references to it.

Deletes an entire queue, and all references to it.

Parameters

$queueId
A queue ID.

Throws

Whups_Exception

Overrides

Whups_Driver::deleteQueue()
public
# updateTypesQueues( array $tmPairs )

Update type-queue-associations.

Update type-queue-associations.

Parameters

$tmPairs
array of mappings.

Throws

Whups_Exception
public array
# getQueueUsers( integer $queueId )

Returns a list of responsible users.

Returns a list of responsible users.

Parameters

$queueId
A queue ID.

Returns

array
An array of users responsible for the queue.

Throws

Whups_Execption
public
# addQueueUser( integer $queueId, string $userId )

Adds a responsible user.

Adds a responsible user.

Parameters

$queueId
A queue ID.
$userId
A user ID.

Throws

Whups_Exception
public
# removeQueueUser( integer $queueId, string $userId )

Removes a responsible user.

Removes a responsible user.

Parameters

$queueId
A queue ID.
$userId
A user ID.

Throws

Whups_Exception
public array
# getType( integer $typeId )

Returns a ticket type.

Returns a ticket type.

Parameters

$typeId
A ticket type ID.

Returns

array
The ticket type information.

Throws

Whups_Exception
public array
# getTypes( integer $queueId )

Returns a list of ticket types associated with a queue.

Returns a list of ticket types associated with a queue.

Parameters

$queueId
A queue ID.

Returns

array
A hash of type ID => type name.

Throws

Whups_Exception
public array
# getTypeIds( integer $queueId )

Returns a list of ticket type IDs associated with a queue.

Returns a list of ticket type IDs associated with a queue.

Parameters

$queueId
A queue ID.

Returns

array
A list of type IDs.

Throws

Whups_Exception
public array
# getAllTypes( )

Returns a list of all available ticket types.

Returns a list of all available ticket types.

Returns

array
A hash of type ID => type name.

Throws

Whups_Exception
public array
# getAllTypeInfo( )

Returns a list of all available ticket types.

Returns a list of all available ticket types.

Returns

array
A list of ticket type information hashes.

Throws

Whups_Exception
public string
# getTypeName( integer $type )

Returns a ticket type name.

Returns a ticket type name.

Parameters

$type
A type ID.

Returns

string
The ticket type's name.

Throws

Whups_Exception
public
# updateType( integer $typeId, string $name, string $description )

Updates a ticket type.

Updates a ticket type.

Parameters

$typeId
A ticket type ID.
$name
A ticket type name.
$description
A ticket type description.

Throws

Whups_Exception
public
# deleteType( integer $typeId )

Deletes a ticket type.

Deletes a ticket type.

Parameters

$typeId
A type ID.

Throws

Whups_Exception
public array
# getStates( integer $type = null, string|array $category = '', string|array $notcategory = '' )

Returns available states for a ticket type and state category.

Returns available states for a ticket type and state category.

Parameters

$type
A ticket type ID.
$category
State categories to include.
$notcategory
State categories to not include.

Returns

array
A hash of state ID => state name.

Throws

Whups_Exception
public array
# getState( integer $stateId )

Returns a state information hash.

Returns a state information hash.

Parameters

$stateId
A state ID.

Returns

array
A state definition hash.
public array
# getAllStateInfo( integer $type )

Returns all state information hashes for a ticket type.

Returns all state information hashes for a ticket type.

Parameters

$type
A ticket type ID.

Returns

array
A list of state hashes.

Throws

Whups_Exception
public
# updateState( integer $stateId, string $name, string $description, string $category )

Updates a state.

Updates a state.

Parameters

$stateId
A state ID.
$name
A state name.
$description
A state description.
$category
A state category.

Throws

Whups_Exception
public integer
# getDefaultState( integer $type )

Returns the default state for a ticket type.

Returns the default state for a ticket type.

Parameters

$type
A type ID.

Returns

integer
The default state ID for the specified type.

Throws

Whups_Exception
public
# setDefaultState( integer $type, integer $state )

Sets the default state for a ticket type.

Sets the default state for a ticket type.

Parameters

$type
A type ID.
$state
A state ID.

Throws

Whups_Exception
public
# deleteState( integer $state_id )

Deletes a state.

Deletes a state.

Parameters

$state_id
A state ID.

Throws

Whups_Exception
public array
# getQuery( integer $queryId )

Returns query details.

Returns query details.

Parameters

$queryId
A query ID.

Returns

array
Query information.

Throws

Whups_Exception
public
# saveQuery( Whups_Query $query )

Saves query details.

Saves query details.

If the query doesn't exist yes, it is added, update otherwise.

Parameters

$query
A query.

Throws

Whups_Exception
public
# deleteQuery( integer $queryId )

Deletes a query.

Deletes a query.

Parameters

$queryId
A query ID.

Throws

Whups_Exception
public boolean
# isCategory( string $category, integer $state_id )

Returns whether a state is of a certain category.

Returns whether a state is of a certain category.

Parameters

$category
A state category.
$state_id
A state ID.

Returns

boolean
True if the state is of the given category.

Throws

Whups_Exception
public array
# getAllPriorityInfo( integer $type )

Returns all priority information hashes for a ticket type.

Returns all priority information hashes for a ticket type.

Parameters

$type
A ticket type ID.

Returns

array
A list of priority hashes.

Throws

Whups_Exception
public array
# getPriorities( integer $type = null )

Returns a list of priorities.

Returns a list of priorities.

If the priorities are not limited to a ticket type, the priority names are suffixed with associated ticket type names.

Parameters

$type
Limit result to this ticket type's priorities.

Returns

array
A hash of priority ID => priority name.

Throws

Whups_Exception
public array
# getPriority( integer $priorityId )

Returns a priority information hash.

Returns a priority information hash.

Parameters

$priorityId
A state ID.

Returns

array
A priority definition hash.

Throws

Whups_Exception
public
# updatePriority( integer $priorityId, string $name, string $description )

Updates a priority.

Updates a priority.

Parameters

$priorityId
A priority ID.
$name
A priority name.
$description
A priority description.

Throws

Whups_Exception
public integer
# getDefaultPriority( integer $type )

Returns the default priority for a ticket type.

Returns the default priority for a ticket type.

Parameters

$type
A type ID.

Returns

integer
The default priority ID for the specified type.

Throws

Whups_Exception
public
# setDefaultPriority( integer $type, integer $priority )

Sets the default priority for a ticket type.

Sets the default priority for a ticket type.

Parameters

$type
A type ID.
$priority
A priority ID.

Throws

Whups_Exception
public
# deletePriority( integer $priorityId )

Deletes a priority.

Deletes a priority.

Parameters

$priorityId
A priority ID.

Throws

Whups_Exception
public array
# getVersionInfoInternal( integer $queue )

Returns all versions of a queue.

Returns all versions of a queue.

Parameters

$queue
A queue ID.

Returns

array
A list of version information hashes.

Throws

Whups_Exception
public array
# getVersionInternal( integer $versionId )

Returns a version information hash.

Returns a version information hash.

Parameters

$versionId
A state ID.

Returns

array
A version definition hash.

Throws

Whups_Exception
public
# updateVersion( integer $versionId, string $name, string $description, boolean $active )

Updates a version.

Updates a version.

Parameters

$versionId
A version ID.
$name
A version name.
$description
A version description.
$active
Whether the version is still active.

Throws

Whups_Exception
public
# deleteVersion( integer $versionId )

Deletes a version.

Deletes a version.

Parameters

$versionId
A version ID.

Throws

Whups_Exception
public array
# getReplies( integer $type )

Returns all available form replies for a ticket type.

Returns all available form replies for a ticket type.

Parameters

$type
A type ID.

Returns

array
A hash of reply ID => reply information hash.

Throws

Whups_Exception
public array
# getReply( integer $reply_id )

Returns a form reply.

Returns a form reply.

Parameters

$reply_id
A form reply ID.

Returns

array
A hash with all form reply information.

Throws

Whups_Exception
public
# updateReply( integer $reply, string $name, string $text )

Updates a form reply.

Updates a form reply.

Parameters

$reply
A reply ID.
$name
A reply name.
$text
A reply text.

Throws

Whups_Exception
public
# deleteReply( integer $reply )

Deletes a form reply.

Deletes a form reply.

Parameters

$reply
A reply ID.

Throws

Whups_Exception

Overrides

Whups_Driver::deleteReply()
public
# addListener( integer $ticket, string $user )

Adds a ticket listener.

Adds a ticket listener.

Parameters

$ticket
A ticket ID.
$user
An email address.

Throws

Whups_Exception
public
# deleteListener( integer $ticket, string $user )

Deletes a ticket listener.

Deletes a ticket listener.

Parameters

$ticket
A ticket ID.
$user
An email address.

Throws

Whups_Exception
public array
# getListeners( integer $ticket, boolean $withowners = true, boolean $withrequester = true, boolean $withresponsible = false )

Returns all ticket listeners.

Returns all ticket listeners.

Parameters

$ticket
A ticket ID.
$withowners
Include ticket owners?
$withrequester
Include ticket creators?
$withresponsible
<p>Include users responsible for the ticket queue?</p>

Returns

array
A list of all ticket listeners.

Throws

Whups_Exception
public integer
# addAttributeDesc( integer $type_id, string $name, string $desc, string $type, array $params, boolean $required )

Adds an attribute to a ticket type.

Adds an attribute to a ticket type.

Parameters

$type_id
A ticket type ID.
$name
An attribute name.
$desc
An attribute description.
$type
A form field type.
$params
Additional parameters for the field type.
$required
Whether the attribute is mandatory.

Returns

integer
The new attribute ID.

Throws

Whups_Exception
public
# updateAttributeDesc( integer $attribute_id, string $newname, string $newdesc, string $newtype, array $newparams, boolean $newrequired )

Updates an attribute for a ticket type.

Updates an attribute for a ticket type.

Parameters

$attribute_id
An attribute ID.
$newname
An attribute name.
$newdesc
An attribute description.
$newtype
A form field type.
$newparams
Additional parameters for the field type.
$newrequired
Whether the attribute is mandatory.

Throws

Whups_Exception
public
# deleteAttributeDesc( integer $attribute_id )

Deletes an attribute for a ticket type.

Deletes an attribute for a ticket type.

Parameters

$attribute_id
An attribute ID.

Throws

Whups_Exception
public array
# getAllAttributes( )

Returns all attributes.

Returns all attributes.

Returns

array
A list of attributes hashes.

Throws

Whups_Exception
public array
# getAttributeDesc( integer $attribute_id )

Returns an attribute information hash.

Returns an attribute information hash.

Parameters

$attribute_id
An attribute ID.

Returns

array
The attribute hash.

Throws

Whups_Exception
public string
# getAttributeName( integer $attribute_id )

Returns an attribute name.

Returns an attribute name.

Parameters

$attribute_id
An attribute ID.

Returns

string
The attribute name.

Throws

Whups_Exception
public array
# getAttributeNamesForType( integer $type_id )

Returns available attribute names for a ticket type.

Returns available attribute names for a ticket type.

Parameters

$type_id
A ticket type ID.

Returns

array
A list of attribute names.

Throws

Whups_Exception
public array
# getAttributeInfoForType( integer $type_id )

Returns available attributes for a ticket type.

Returns available attributes for a ticket type.

Parameters

$type_id
A ticket type ID.

Returns

array
A list of attribute information hashes.

Throws

Whups_Exception
public array
# getTicketAttributes( integer|array $ticket_id )

Returns the attribute values of a ticket.

Returns the attribute values of a ticket.

Parameters

$ticket_id
One or more ticket IDs.

Returns

array

If requesting a single ticket, an attribute ID => attribute value hash. If requesting multiple tickets, a list of hashes with ticket ID, attribute ID and attribute value.

Throws

Whups_Exception
public array
# getTicketAttributesWithNames( integer|array $ticket_id )

Returns the attribute values and names of a ticket.

Returns the attribute values and names of a ticket.

Parameters

$ticket_id
One or more ticket IDs.

Returns

array

If requesting a single ticket, an attribute name => attribute value hash. If requesting multiple tickets, a list of hashes with ticket ID, attribute ID, attribute name, and attribute value.

Throws

Whups_Exception
public array
# getOwners( mixed $ticketId )

Returns the owners of a ticket.

Returns the owners of a ticket.

Parameters

$ticketId
$ticketId One or more ticket IDs.

Returns

array
An hash of ticket ID => owner IDs

Throws

Whups_Exception
public integer
# updateLog( integer $ticket_id, string $user, array $changes = array(), integer $transactionId = null )

Adds a new log entry

Adds a new log entry

Parameters

$ticket_id
A ticket ID.
$user
A user updating the ticket.
$changes
A list of changes.
$transactionId
A transaction ID to use.

Returns

integer
A transaction ID.

Throws

Whups_Exception
public integer
# newTransaction( string $creator, string $creator_email = null )

Create a new transaction ID.

Create a new transaction ID.

Parameters

$creator
A transaction creator.
$creator_email
The transaction creator's email address.

Returns

integer
A transaction ID.

Throws

Whups_Exception
Methods inherited from Whups_Driver
__construct(), filterTicketsByState(), formatComments(), getAllTicketAttributesWithNames(), getAttributesForType(), getCategories(), getHistory(), getQueue(), getQueues(), getVersion(), getVersionInfo(), getVersions(), mail(), setAttributes()
API documentation generated by ApiGen