Class Whups_Driver_sql

Description

Whups_Driver_sql class - implements a Whups backend for the PEAR::DB abstraction layer.

$Horde: whups/lib/Driver/sql.php,v 1.306.2.8 2010/04/29 22:53:45 jan Exp $

Copyright 2001-2002 Robert E. Coyle <robertecoyle@hotmail.com> Copyright 2001-2009 The Horde Project (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.

Located in /lib/Driver/sql.php (line 18)

Whups_Driver
   |
   --Whups_Driver_sql
Variable Summary
 DB $_db
 array $_map
Method Summary
 void addAttributeDesc ( $type_id,  $name,  $desc,  $type,  $params,  $required)
 void addComment ( $ticket_id,  $comment,  $creator, [ $creator_email = null])
 void addListener ( $ticket,  $user)
 void addPriority ( $typeId,  $name,  $description)
 mixed addQueue ( $name,  $description, [ $slug = ''], [ $email = ''])
 void addQueueUser ( $queueId,  $userId)
 integer addReply (integer $type, string $name, string $text)
 void addState ( $typeId,  $name,  $description,  $category)
 void addTicket ( &$info,  $requester)
 void addTicketOwner ( $ticketId,  $owner)
 void addType ( $name,  $description)
 mixed addVersion (integer $queueId, string $name, string $description, boolean $active)
 void deleteAttributeDesc ( $attribute_id)
 void deleteHistory (integer $transaction)
 void deleteListener ( $ticket,  $user)
 void deletePriority ( $priorityId)
 void deleteQuery (integer $queryId)
 void deleteQueue ( $queueId)
 void deleteReply (integer $reply)
 void deleteState ( $state_id)
 void deleteTicket ( $info)
 void deleteTicketOwner ( $ticketId,  $owner)
 void deleteType ( $typeId)
 void deleteVersion ( $versionId)
 void executeQuery ( $query,  $vars, [ $get_details = true], [ $munge = true])
 void getAllPriorityInfo ( $type)
 void getAllStateInfo ( $type)
 void getAllTypeInfo ()
 void getAllTypes ()
 void getAttributeDesc ( $attribute_id)
 void getAttributeInfoForType ( $type_id)
 void getAttributeName ( $attribute_id)
 void getAttributeNamesForType ( $type_id)
 void getDb ()
 void getDefaultPriority ( $type)
 void getDefaultState ( $type)
 void getDefaultType ( $queue)
 void getGuestEmail ( $guest_id)
 void getListeners ( $ticket, [ $withowners = true], [ $withrequester = true], [ $withresponsible = false])
 void getOwners ( $ticketId)
 void getPriorities ([ $type = null])
 void getPriority ( $priorityId)
 array getQuery (integer $queryId)
 void getQueueBySlugInternal ( $slug)
 void getQueueInternal ( $queueId)
 void getQueueSummary ( $queue_ids, array $queues)
 void getQueueUsers ( $queueId)
 array getReplies (integer $type)
 array getReply (integer $reply_id)
 void getState ( $stateId)
 void getStates ([ $type = null], [ $category = ''], [ $notcategory = ''])
 void getTicketAttributes ( $ticket_id)
 void getTicketAttributesWithNames ( $ticket_id)
 void getTicketDetails ( $ticket, [ $checkPerms = true])
 void getTicketsByProperties ( $info, [ $munge = true], [ $perowner = false])
 void getTicketState ( $ticket_id)
 void getType ( $typeId)
 void getTypeIds ( $queueId)
 void getTypeName ( $type)
 void getTypes ( $queueId)
 void getVersionInfoInternal ( $queue)
 void getVersionInternal ( $versionId)
 void initialise ()
 void isCategory ( $category,  $state_id)
 integer newTransaction ( $creator, [ $creator_email = null])
 void removeQueueUser ( $queueId,  $userId)
 void saveQuery (Whups_Query $query)
 void setDefaultPriority ( $type,  $priority)
 void setDefaultState ( $type,  $state)
 void updateAttributeDesc ( $attribute_id,  $newname,  $newdesc,  $newtype,  $newparams,  $newrequired)
 void updateLog ( $ticket_id,  $user, [ $changes = array()], [ $transactionId = null])
 void updatePriority ( $priorityId,  $name,  $description)
 void updateQueue ( $queueId,  $name,  $description,  $types,  $versioned, [ $slug = ''], [ $email = ''], [ $default = null])
 void updateQueueUsers ( $queueId,  $users)
 void updateReply (integer $reply, string $name, string $text)
 void updateState ( $stateId,  $name,  $description,  $category)
 boolean|PEAR_Error updateTicket (integer $ticketId, array $attributes)
 void updateType ( $typeId,  $name,  $description)
 void updateTypesQueues ( $tmPairs)
 void updateVersion ( $versionId,  $name,  $description,  $active)
 void _addDateWhere ( $where,  $data,  $type)
 void _addWhere ( $where,  $condition,  $clause, [ $conjunction = 'AND'])
 void _clauseFromQuery ( $args,  $type,  $criterion,  $cvalue,  $operator,  $value)
 void _concatClauses ( $args,  $conjunction)
 void _criterionClause ( $criterion,  $cvalue,  $operator,  $value)
 void _generateWhere ( $table,  $fields,  &$info,  $type)
 void _getAllTicketAttributesWithNames ( $ticket_id)
 void _getAttributesForType ([ $type = null], [ $raw = false])
 void _getHistory ( $ticket_id)
 void _mapFields ( &$info)
 void _notClause ( $args)
 void _prefixTableToColumns ( $table,  $columns)
 void _setAttributeValue ( $ticket_id,  $attribute_id,  $attribute_value)
Variables
DB $_db (line 25)

The database connection object.

array $_map = array('id' => 'ticket_id',
'summary' => 'ticket_summary',
'requester' => 'user_id_requester',
'queue' => 'queue_id',
'version' => 'version_id',
'type' => 'type_id',
'state' => 'state_id',
'priority' => 'priority_id',
'timestamp' => 'ticket_timestamp',
'due' => 'ticket_due',
'date_updated' => 'date_updated',
'date_assigned' => 'date_assigned',
'date_resolved' => 'date_resolved',
)
(line 40)

A mapping of attributes from generic Whups names to DB backend fields.

DB $_write_db (line 33)

Handle for the current database connection, used for writing. Defaults to the same handle as $_db if a separate write database is not required.

Inherited Variables

Inherited from Whups_Driver

Whups_Driver::$_params
Methods
addAttributeDesc (line 2478)
void addAttributeDesc ( $type_id,  $name,  $desc,  $type,  $params,  $required)
  • $type_id
  • $name
  • $desc
  • $type
  • $params
  • $required
addComment (line 402)
void addComment ( $ticket_id,  $comment,  $creator, [ $creator_email = null])
  • $ticket_id
  • $comment
  • $creator
  • $creator_email
addListener (line 2385)
void addListener ( $ticket,  $user)
  • $ticket
  • $user
addPriority (line 168)
void addPriority ( $typeId,  $name,  $description)
  • $typeId
  • $name
  • $description
addQueue (line 65)

Adds a new queue to the backend.

  • return: The new queue_id || PEAR_Error
mixed addQueue ( $name,  $description, [ $slug = ''], [ $email = ''])
  • $name
  • $description
  • $slug
  • $email
addQueueUser (line 1578)
void addQueueUser ( $queueId,  $userId)
  • $queueId
  • $userId
addReply (line 248)

Adds a form reply to the backend.

  • return: The id of the new form reply.
integer addReply (integer $type, string $name, string $text)
  • integer $type: The ticket type id for which to add the new reply.
  • string $name: The reply name.
  • string $text: The reply text.
addState (line 136)
void addState ( $typeId,  $name,  $description,  $category)
  • $typeId
  • $name
  • $description
  • $category
addTicket (line 278)
void addTicket ( &$info,  $requester)
  • &$info
  • $requester
addTicketOwner (line 491)
void addTicketOwner ( $ticketId,  $owner)
  • $ticketId
  • $owner
addType (line 107)
void addType ( $name,  $description)
  • $name
  • $description
addVersion (line 208)

Adds a new version to the specified queue.

  • return: The new version id || PEAR_Error
mixed addVersion (integer $queueId, string $name, string $description, boolean $active)
  • integer $queueId: The queueId to add the version to.
  • string $name: The name of the new version.
  • string $description: The descriptive text for the new version.
  • boolean $active: Whether the version is still active.
deleteAttributeDesc (line 2544)
void deleteAttributeDesc ( $attribute_id)
  • $attribute_id
deleteHistory (line 1200)

Deletes all changes of a transaction.

void deleteHistory (integer $transaction)
  • integer $transaction: A transaction id.
deleteListener (line 2404)
void deleteListener ( $ticket,  $user)
  • $ticket
  • $user
deletePriority (line 2199)
void deletePriority ( $priorityId)
  • $priorityId
deleteQuery (line 2041)

Delete query details.

void deleteQuery (integer $queryId)
  • integer $queryId
deleteQueue (line 1488)
void deleteQueue ( $queueId)
  • $queueId

Redefinition of:
Whups_Driver::deleteQueue()
Deletes a queue.
deleteReply (line 2369)

Deletes a form reply from the backend.

void deleteReply (integer $reply)
  • integer $reply: A reply id.

Redefinition of:
Whups_Driver::deleteReply()
Deletes a form reply.
deleteState (line 1962)
void deleteState ( $state_id)
  • $state_id
deleteTicket (line 503)
void deleteTicket ( $info)
  • $info
deleteTicketOwner (line 497)
void deleteTicketOwner ( $ticketId,  $owner)
  • $ticketId
  • $owner
deleteType (line 1770)
void deleteType ( $typeId)
  • $typeId
deleteVersion (line 2275)
void deleteVersion ( $versionId)
  • $versionId
executeQuery (line 548)
void executeQuery ( $query,  $vars, [ $get_details = true], [ $munge = true])
  • $query
  • $vars
  • $get_details
  • $munge
getAllAttributes (line 2569)
void getAllAttributes ()
getAllPriorityInfo (line 2064)
void getAllPriorityInfo ( $type)
  • $type
getAllStateInfo (line 1890)
void getAllStateInfo ( $type)
  • $type
getAllTypeInfo (line 1719)
void getAllTypeInfo ()
getAllTypes (line 1704)
void getAllTypes ()
getAttributeDesc (line 2587)
void getAttributeDesc ( $attribute_id)
  • $attribute_id
getAttributeInfoForType (line 2714)
void getAttributeInfoForType ( $type_id)
  • $type_id
getAttributeName (line 2621)
void getAttributeName ( $attribute_id)
  • $attribute_id
getAttributeNamesForType (line 2692)
void getAttributeNamesForType ( $type_id)
  • $type_id
getDb (line 3001)

Return the db object we're using.

return DB Database object.

void getDb ()
getDefaultPriority (line 2163)
void getDefaultPriority ( $type)
  • $type
getDefaultState (line 1928)
void getDefaultState ( $type)
  • $type
getDefaultType (line 1471)
void getDefaultType ( $queue)
  • $queue
getGuestEmail (line 1120)
void getGuestEmail ( $guest_id)
  • $guest_id
getListeners (line 2423)
void getListeners ( $ticket, [ $withowners = true], [ $withrequester = true], [ $withresponsible = false])
  • $ticket
  • $withowners
  • $withrequester
  • $withresponsible
getOwners (line 2891)
void getOwners ( $ticketId)
  • $ticketId
getPriorities (line 2083)
void getPriorities ([ $type = null])
  • $type
getPriority (line 2118)
void getPriority ( $priorityId)
  • $priorityId
getQuery (line 1980)

Retrieve query details.

array getQuery (integer $queryId)
  • integer $queryId
getQueueBySlugInternal (line 1348)
void getQueueBySlugInternal ( $slug)
  • $slug
getQueueInternal (line 1312)
void getQueueInternal ( $queueId)
  • $queueId
getQueuesInternal (line 1376)
void getQueuesInternal ()
getQueueSummary (line 1283)

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

void getQueueSummary ( $queue_ids, array $queues)
  • array $queues: Array of queue ids to summarize.
  • $queue_ids
getQueueUsers (line 1560)
void getQueueUsers ( $queueId)
  • $queueId
getReplies (line 2293)

Returns all available form replies for a ticket type.

  • return: A hash with reply ids as keys and reply hashes as values.
array getReplies (integer $type)
  • integer $type: A type id.
getReply (line 2319)

Returns a form reply information hash.

  • return: A hash with all form reply information.
array getReply (integer $reply_id)
  • integer $reply_id: A form reply id.
getState (line 1863)
void getState ( $stateId)
  • $stateId
getStates (line 1803)
void getStates ([ $type = null], [ $category = ''], [ $notcategory = ''])
  • $type
  • $category
  • $notcategory
getTicketAttributes (line 2772)
void getTicketAttributes ( $ticket_id)
  • $ticket_id
getTicketAttributesWithNames (line 2809)
void getTicketAttributesWithNames ( $ticket_id)
  • $ticket_id
getTicketDetails (line 1077)
void getTicketDetails ( $ticket, [ $checkPerms = true])
  • $ticket
  • $checkPerms
getTicketsByProperties (line 815)
void getTicketsByProperties ( $info, [ $munge = true], [ $perowner = false])
  • $info
  • $munge
  • $perowner
getTicketState (line 1102)
void getTicketState ( $ticket_id)
  • $ticket_id
getType (line 1647)
void getType ( $typeId)
  • $typeId
getTypeIds (line 1692)
void getTypeIds ( $queueId)
  • $queueId
getTypeName (line 1736)
void getTypeName ( $type)
  • $type
getTypes (line 1672)
void getTypes ( $queueId)
  • $queueId
getVersionInfoInternal (line 2210)
void getVersionInfoInternal ( $queue)
  • $queue
getVersionInternal (line 2230)
void getVersionInternal ( $versionId)
  • $versionId
initialise (line 3008)
void initialise ()
isCategory (line 2052)
void isCategory ( $category,  $state_id)
  • $category
  • $state_id
newTransaction (line 2970)

Create a new transaction id for associating related entries in the whups_logs table.

  • return: New transaction id.
integer newTransaction ( $creator, [ $creator_email = null])
  • $creator
  • $creator_email
removeQueueUser (line 1600)
void removeQueueUser ( $queueId,  $userId)
  • $queueId
  • $userId
saveQuery (line 2006)

Save query details, inserting a new query row if necessary.

void saveQuery (Whups_Query $query)
setDefaultPriority (line 2175)
void setDefaultPriority ( $type,  $priority)
  • $type
  • $priority
setDefaultState (line 1940)
void setDefaultState ( $type,  $state)
  • $type
  • $state
updateAttributeDesc (line 2519)
void updateAttributeDesc ( $attribute_id,  $newname,  $newdesc,  $newtype,  $newparams,  $newrequired)
  • $attribute_id
  • $newname
  • $newdesc
  • $newtype
  • $newparams
  • $newrequired
updateLog (line 2921)
void updateLog ( $ticket_id,  $user, [ $changes = array()], [ $transactionId = null])
  • $ticket_id
  • $user
  • $changes
  • $transactionId
updatePriority (line 2146)
void updatePriority ( $priorityId,  $name,  $description)
  • $priorityId
  • $name
  • $description
updateQueue (line 1399)
void updateQueue ( $queueId,  $name,  $description,  $types,  $versioned, [ $slug = ''], [ $email = ''], [ $default = null])
  • $queueId
  • $name
  • $description
  • $types
  • $versioned
  • $slug
  • $email
  • $default
updateQueueUsers (line 1612)
void updateQueueUsers ( $queueId,  $users)
  • $queueId
  • $users
updateReply (line 2344)

Updates a form reply in the backend.

void updateReply (integer $reply, string $name, string $text)
  • integer $reply: A reply id.
  • string $name: The new reply name.
  • string $text: The new reply text.
updateState (line 1910)
void updateState ( $stateId,  $name,  $description,  $category)
  • $stateId
  • $name
  • $description
  • $category
updateTicket (line 458)

Update any details of a ticket that are stored in the main

whups_tickets table. 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).

  • return: True or an error object.
boolean|PEAR_Error updateTicket (integer $ticketId, array $attributes)
  • integer $ticketId: The id of the ticket to update.
  • array $attributes: The array of attributes (key => value) to change.
updateType (line 1754)
void updateType ( $typeId,  $name,  $description)
  • $typeId
  • $name
  • $description
updateTypesQueues (line 1513)
void updateTypesQueues ( $tmPairs)
  • $tmPairs
updateVersion (line 2257)
void updateVersion ( $versionId,  $name,  $description,  $active)
  • $versionId
  • $name
  • $description
  • $active
_addDateWhere (line 3144)
void _addDateWhere ( $where,  $data,  $type)
  • $where
  • $data
  • $type
_addWhere (line 3131)
void _addWhere ( $where,  $condition,  $clause, [ $conjunction = 'AND'])
  • $where
  • $condition
  • $clause
  • $conjunction
_clauseFromQuery (line 590)
void _clauseFromQuery ( $args,  $type,  $criterion,  $cvalue,  $operator,  $value)
  • $args
  • $type
  • $criterion
  • $cvalue
  • $operator
  • $value
_concatClauses (line 607)
void _concatClauses ( $args,  $conjunction)
  • $args
  • $conjunction
_criterionClause (line 639)
void _criterionClause ( $criterion,  $cvalue,  $operator,  $value)
  • $criterion
  • $cvalue
  • $operator
  • $value
_generateWhere (line 3066)
void _generateWhere ( $table,  $fields,  &$info,  $type)
  • $table
  • $fields
  • &$info
  • $type
_getAllTicketAttributesWithNames (line 2851)
void _getAllTicketAttributesWithNames ( $ticket_id)
  • $ticket_id
_getAttributesForType (line 2640)
void _getAttributesForType ([ $type = null], [ $raw = false])
  • $type
  • $raw
_getHistory (line 1141)
void _getHistory ( $ticket_id)
  • $ticket_id
_mapFields (line 3112)
void _mapFields ( &$info)
  • &$info
_notClause (line 628)
void _notClause ( $args)
  • $args
_prefixTableToColumns (line 3161)
void _prefixTableToColumns ( $table,  $columns)
  • $table
  • $columns
_setAttributeValue (line 2734)
void _setAttributeValue ( $ticket_id,  $attribute_id,  $attribute_value)
  • $ticket_id
  • $attribute_id
  • $attribute_value

Inherited Methods

Inherited From Whups_Driver

 Whups_Driver::Whups_Driver()
 Whups_Driver::deleteQueue()
 Whups_Driver::deleteReply()
 Whups_Driver::factory()
 Whups_Driver::filterTicketsByState()
 Whups_Driver::formatComments()
 Whups_Driver::getAllTicketAttributesWithNames()
 Whups_Driver::getAttributesForType()
 Whups_Driver::getCategories()
 Whups_Driver::getHistory()
 Whups_Driver::getQueue()
 Whups_Driver::getQueues()
 Whups_Driver::getVersion()
 Whups_Driver::getVersionInfo()
 Whups_Driver::getVersions()
 Whups_Driver::mail()
 Whups_Driver::setAttributes()

Documentation generated on Sun, 30 Jan 2011 05:41:44 +0000 by phpDocumentor 1.4.3