File/helpdesk.php

Description

Customer Support module.

Customer Support module.

  • filesource: Source Code for this file
  • version: $Id 20051005
    • Completed _helpdesk_user and affiliated functions
    20050920
    • Added _helpdesk_block_view_CUSTOMEROPENTICKETS
    20050919
    • Added _helpdesk_block_view_MYOPENTICKETS
    • Added access control to _helpdesk_block_view
    20050918
    • Added _helpdek_block_view_ALLOPENTICKETS
  • todo: make it work first
  • author: Frederic G. MARAND <fgm@osinet.fr> Copyright OSI 2005. All rights reserved. It is expected that version 1.0 will be GPLed, but this interim work is kept closed until 1.0 is ready.
Includes
 require_once ("customer.php") (line 29)
 require_once ("timeinfo.php") (line 31)
 require_once ("event.php") (line 30)
 require_once ("contract.php") (line 28)
 require_once ("misc.php") (line 27)

Import helpdesk-related classes and functions

Import helpdesk-related classes and functions

Constants
HELPDESKBLOCKALLOPENTICKETS = 4 (line 61)
HELPDESKBLOCKCUSTOMERBALANCE = 3 (line 60)
HELPDESKBLOCKCUSTOMEROPENTICKETS = 2 (line 59)
HELPDESKBLOCKMAX = HELPDESKBLOCKALLOPENTICKETS (line 62)
HELPDESKBLOCKMYLATESTTICKETS = 1 (line 58)
HELPDESKBLOCKMYOPENTICKETS = (line 57)

Constants for HELPDESK block deltas

Constants for HELPDESK block deltas

HELPDESKDEBUGALLFUNCTIONS = TRUE (line 33)
HELPDESKHOOKACCESSCREATE = "create" (line 74)

Constants for hook_access

Constants for hook_access

HELPDESKHOOKACCESSDELETE = "delete" (line 75)
HELPDESKHOOKACCESSUPDATE = "update" (line 76)
HELPDESKHOOKACCESSVIEW = "view" (line 77)
HELPDESKNODECONTRACT = 'helpdesk-contra' (line 38)

Constants for helpdesk node types

Constants for helpdesk node types

HELPDESKNODEFOLLOWUP = 'helpdesk-follow' (line 40)
HELPDESKNODETICKET = 'helpdesk-ticket' (line 39)
HELPDESKPERMCUSTOMER = 'Helpdesk > Customer' (line 50)
HELPDESKPERMMAX = HELPDESKPERMTECH (line 52)
HELPDESKPERMTECH = 'Helpdesk > Tech' (line 51)
HELPDESKPERMUSER = 'Helpdesk > User' (line 49)

Constants for HELPDESK perms

Constants for HELPDESK perms

HELPDESKTITLECONTRACT = 'Helpdesk > Contract' (line 42)
HELPDESKTITLEFOLLOWUP = 'Helpdesk > Followup' (line 44)
HELPDESKTITLETICKET = 'Helpdesk > Ticket' (line 43)
HELPDESKVARSHOWROLES = 'helpdesk_show_roles' (line 67)

Constants for Drupal variables

Constants for Drupal variables

HELPDESKVARTICKETOFFSET = 'helpdesk_ticket_base' (line 69)
HELPDESKVARTICKETPREFIX = 'helpdesk_ticket_prefix' (line 68)
Functions
helpdesk_access (line 89)

Helpdesk access control

Helpdesk access control User may create an issue, read and close his own issues, add followups to his issues Customer has User rights, extended to all users bound to him, and can perform some actions on his contracts Tech can do anything HELPDESK-related

mixed helpdesk_access (string $op, object $node)
  • string $op: create | delete | update | view
  • object $node: the node on which "op" is to be performed
helpdesk_block (line 183)

Implementation of hook_help : provides and manages the helpdesk blocks.

Implementation of hook_help : provides and manages the helpdesk blocks.

mixed helpdesk_block ([op $op = 'list'], [delta $delta = 0])
  • op $op: the operation from the URL (Drupal: list, view, configure, save. ?)
    • 'list': A list of all blocks defined by the module
    • 'configure': A configuration form
    • 'view': Save the configuration options
    • save': Information about a particular block
  • delta $delta: offset
helpdesk_delete (line 205)

HELPDESK actions to be performed when a HELPDESK node is deleted

HELPDESK actions to be performed when a HELPDESK node is deleted

void helpdesk_delete (object $node)
  • object $node: the node to be deleted after this function
helpdesk_form (line 236)

Helpdesk data entry form.

Helpdesk data entry form. Used for both node add and edit testing for $node->nid allows the code to define whether the node is to be created of modified

  • return: HTML
string helpdesk_form (object &$node)
  • object $node: the node to be entered
helpdesk_help (line 282)

Display help and module information

Display help and module information Documented values as of 4.6.3 and HEAD on 2005/08/21

  • return: text for section
help helpdesk_help ([string $section = ''])
  • string $section: Drupal URL path (or: menu item) the help is being requested for, e.g. admin/node or user/edit. Recognizes special descriptors after a "#" sign
helpdesk_insert (line 332)

Upon creation of a helpdesk-related node, perform insertions on our private tables

Upon creation of a helpdesk-related node, perform insertions on our private tables We're not supposed to test for access here, as it's already been done earlier in node_add (?)

void helpdesk_insert (object $node)
  • object $node: the node being inserted
helpdesk_link (line 367)

This hook enables modules to add links to many parts of Drupal.

This hook enables modules to add links to many parts of Drupal. Links may be added in nodes or in the navigation block, for example. In our case, this will allow followups to be added to either issues or followups (threading)

array helpdesk_link (string $type, [int $node = NULL], [int $teaser = FALSE])
  • string $type: An identifier declaring what kind of link is being requested. Possible values:
    • node: Links to be placed below a node being viewed.
    • comment: Links to be placed below a comment being viewed.
  • int $node: A node object passed in case of node links.
  • int $teaser: In case of node link: a 0/1 flag depending on whether the node is displayed with its teaser or its full form (on a node/nid page)
helpdesk_load (line 410)

load auxiliary data for HD nodes. other modules and drupal core.

load auxiliary data for HD nodes. We wrap the returned object in an array to prevent mixing with other modules and drupal core.

  • return: properties to be added to the passed node object
  • link: Drupal API
object the helpdesk_load (object $node)
  • object $node: the node being loaded
helpdesk_menu (line 443)

HELPDESK menu is enabled for all users with HELPDESK

HELPDESK menu is enabled for all users with HELPDESK

  • return: of menu definitions
array helpdesk_menu (mixed $may_cache)
helpdesk_nodeapi (line 478)

Implementation of hook_nodeapi, for tracing purposes only

Implementation of hook_nodeapi, for tracing purposes only

void helpdesk_nodeapi (object &$node, string $op, [boolean $teaser = NULL], [boolean $page = NULL])
  • object $node
  • string $op
  • boolean $teaser
  • boolean $page
helpdesk_node_name (line 489)

Name our node names.

Name our node names. See also helpdesk_node_types

  • return: the human-readable node name
string helpdesk_node_name (mixed $node)
  • mixed $node: node either a string (node type ) or node object
helpdesk_node_types (line 515)

Define our node types

Define our node types

  • return: the array of our node types
array helpdesk_node_types ()
helpdesk_perm (line 529)

Valid permissions for this module

Valid permissions for this module

  • return: An array of valid permissions for the helpdesk module
array helpdesk_perm ()
helpdesk_settings (line 544)

Module configuration settings

Module configuration settings

  • return: settings HTML or deny access
string helpdesk_settings ()
helpdesk_update (line 600)

Specs: Respond to node updating.

Specs: Respond to node updating. This is a hook used by node modules. It is called to allow the module to take action when an edited node is being updated in the database by, for example, updating information in related tables.

  • todo: see source
void helpdesk_update (object $node)
  • object $node: The node being updated
helpdesk_user (line 688)

Act on user account actions.

Act on user account actions. This hook allows modules to react when operations are performed on user accounts. Sequence of calls for high-level functions:

  • creation: validate, load, insert, load. We don't care, yet.
  • prepare update: categories, load, form
  • perform update: load, validate, update, load
  • prepare deletion: categories, load
  • perform deletion: categories, load, delete(confirm=1). We should do something about tickets/issues.

mixed helpdesk_user (string $op, array $edit, object $account, [string $category = NULL])
  • string $op: Operation to be performed on user
  • array $edit: array of form values submitted by the user
  • object $account: The user object on which the operation is being performed.
  • string $category: The active category of user information being edited.
helpdesk_validate (line 755)

Verify a node editing form.

Verify a node editing form. This is a hook used by node modules. It is called to allow the module to verify that the node is in a format valid to post to the site. It can also be used to make changes to the node before submission, such as node-type-specific formatting. Errors should be set with form_set_error().

void helpdesk_validate (object &$node)
  • object $node: The node to be validated.
helpdesk_view (line 619)

Per the docs: This is a hook used by node modules.

Per the docs: This is a hook used by node modules. It allows a module to define a custom method of displaying its nodes, usually by displaying extra information particular to that node type.

void helpdesk_view (object &$node, [string $teaser = FALSE], [int $page = FALSE])
  • object $node
  • string $teaser
  • int $page
_helpdesk_block_configure (line 798)

Subroutine for helpdesk_block/configure

Subroutine for helpdesk_block/configure

string _helpdesk_block_configure (int $delta)
  • int $delta
_helpdesk_block_list (line 772)

Defines the name of the blocks attached to a delta

Defines the name of the blocks attached to a delta

string _helpdesk_block_list (int $delta)
  • int $delta: the block number
_helpdesk_block_save (line 823)

Subroutine for helpdesk_block/save

Subroutine for helpdesk_block/save

void _helpdesk_block_save (int $delta)
  • int $delta
_helpdesk_block_view (line 872)

Subroutine for helpdesk_block/view

Subroutine for helpdesk_block/view

array _helpdesk_block_view (int $delta)
  • int $delta
_helpdesk_block_view_ALLOPENTICKETS (line 951)

Build a block returning a list of all open tickets.

Build a block returning a list of all open tickets.

  • Open tickets are those for which tidstatus matches the first entry in the helpdesk_status vocabulary.
  • SECURITY: relies on _helpdesk_block_view to filter requests. Does not implement security on its own. User is assumed to have HELPDESKPERMTECH perm checked by the caller

string _helpdesk_block_view_ALLOPENTICKETS ()
_helpdesk_block_view_CUSTOMEROPENTICKETS (line 996)

Build a block returning a list of all open tickets for the users linked to this customer.

Build a block returning a list of all open tickets for the users linked to this customer.

  • Open tickets are those for which tidstatus matches the first entry in the helpdesk_status vocabulary.
  • SECURITY: relies on _helpdesk_block_view to filter requests. Does not implement security on its own. User is assumed to have HELPDESKPERMCUSTOMER perm checked by caller

string _helpdesk_block_view_CUSTOMEROPENTICKETS ()
_helpdesk_block_view_MYLATESTTICKETS (line 972)

Build a block returning a list of the latest tickets for the current user, be they open or not

Build a block returning a list of the latest tickets for the current user, be they open or not

  • SECURITY: relies on _helpdesk_block_view to filter requests. Does not implement security on its own. User is assumed to have HELPDESKPERMCUSTOMER perm checked by caller

string _helpdesk_block_view_MYLATESTTICKETS ()
_helpdesk_block_view_MYOPENTICKETS (line 927)

Build a block returning a list of the current user's open tickets.

Build a block returning a list of the current user's open tickets.

  • Open tickets are those for which tidstatus matches the first entry in the helpdesk_status vocabulary.
  • SECURITY: relies on _helpdesk_block_view to filter requests. Does not implement security on its own.

string _helpdesk_block_view_MYOPENTICKETS ()
_helpdesk_decode_nid (line 1036)

Extract the actual $node->nid from the public form of the ticket number

Extract the actual $node->nid from the public form of the ticket number

int _helpdesk_decode_nid (string $ticketnumber)
  • string $ticketnumber: The public form of the ticket number
_helpdesk_encode_nid (line 1020)

Build the public form of the node number from the actual nid

Build the public form of the node number from the actual nid

string _helpdesk_encode_nid (int $nid)
  • int $nid: The internal node number for the ticket
_helpdesk_getnidcontracts (line 847)

Returns the contracts owned by a customer

Returns the contracts owned by a customer

  • return: NULL in case an error (presumably access limitation) happens, array of contracts otherwise, possibly empty
mixed _helpdesk_getnidcontracts (int $uidcustomer)
  • int $uidcustomer: The UID of the customer being examined. Not necessarily the current user
_helpdesk_iscustomer (line 835)

Checks whether or not the current user is a customer

Checks whether or not the current user is a customer Does not depend on bound users or contracts

boolean _helpdesk_iscustomer ()
_helpdesk_user_categories (line 1104)

auxiliary function for helpdesk_user('categorie').

auxiliary function for helpdesk_user('categorie'). Currently, this displays the user roles and admin status if the module has been set up to do so.

array _helpdesk_user_categories ()
_helpdesk_user_form (line 1127)

auxiliary function for helpdeks_user('form'), to be displayed when user tries to display/edit his own data:

auxiliary function for helpdeks_user('form'), to be displayed when user tries to display/edit his own data:

array _helpdesk_user_form (array $edit, string $category)
  • array $edit: array of form values submitted by the user
  • string $category: The category of personal information to be displayed/edited
_helpdesk_user_load (line 1162)

implements helpdesk_user('load') : load customer/hd user data upon user load

implements helpdesk_user('load') : load customer/hd user data upon user load do not load list of bound users for customers: this could be too heavy for something rarely (?) used

void _helpdesk_user_load (object &$user, int $uid)
  • object &$user: already loaded core user object
  • int $uid: user id
_helpdesk_user_view (line 1056)

auxiliary function for helpdesk_user('view')

auxiliary function for helpdesk_user('view')

  • return: An associative array of strings to display, keyed by category name
  • todo: display global account balance, pointer to the list of contracts (for customers),
  • todo: display global ticket starts, pointer to the list of tickets, followups (for users)
  • see: helpdesk_user()
array _helpdesk_user_view (object $user)
  • object $user

Documentation generated on Tue, 01 Nov 2005 23:15:00 +0100 by phpDocumentor 1.3.0RC3