SimpleDesk API
Procedural File: SimpleDesk.php
Source Location: /source/SimpleDesk.phpThis file serves as the entry point for SimpleDesk generally, as well as the home of the ticket listing code, for open, closed and deleted tickets.
Tags:
- since
- 1.0
Contains the following functions:
shd_closed_tickets [line 430]
void shd_closed_tickets (
)
Set up the paginated lists of closed tickets.
Much like the main helpdesk, this function prepares a list of all the closed/resolved tickets, with a more specific list of columns that is better suited to resolved tickets.
Tags:
- see
- shd_main_helpdesk()
- since
- 1.0
Return value
This function has no return value.shd_get_block_columns [line 867]
array shd_get_block_columns (
string $block )
Return the list of columns that is applicable to a given block.
In order to centralise the list of actions to be displayed in a block, and in its counterpart that displays all the values, the lists of columns per block is kept here.
Tags:
- see
- shd_recycle_bin()
- see
- shd_closed_tickets()
- see
- shd_main_helpdesk()
- since
- 1.0
Parameters
- string $block
- The block we are calling from:
- assigned: assigned to me
- new: new tickets
- staff: pending staff
- user_staff: pending with user (staff view)
- user_user: pending with user (user view)
- closed: resolved tickets
- recycled: deleted tickets
- withdeleted: tickets with deleted replies
Return value
Returns a type array. An indexed array of the columns in the order they should be displayed.shd_helpdesk_listing [line 536]
void shd_helpdesk_listing (
)
Gather the data and prepare to display the ticket blocks.
Actually performs the queries to get data for each block, subject to the parameters specified by the calling functions.
It also sets up per-block pagination links, collects a variety of data (enough to populate all the columns as listed in shd_main_helpdesk, even if not entirely applicable, and populates it all into $context['ticket_blocks']['tickets'], extending the array that was already there.
Tags:
- see
- shd_recycle_bin()
- see
- shd_closed_tickets()
- see
- shd_main_helpdesk()
- since
- 1.0
Return value
This function has no return value.shd_main [line 46]
void shd_main (
)
Begins SimpleDesk general processing.
Several things are done here, the results of which are unilaterally assumed by all other SimpleDesk functions.
- define standard constants for ticket status and urgency
- set up general navigation
- see if the URL or POST data contains a ticket, if so sanitise and store that value
- see if a msg was specified in the URL, if so identify the relevant ticket
- add in the helpdesk CSS file
- identify the sub action to direct them to, then send them on their way.
Tags:
- since
- 1.0
Return value
This function has no return value.shd_main_helpdesk [line 287]
void shd_main_helpdesk (
)
Display the main front page, showing tickets waiting for staff, waiting for user feedback and so on.
This function sets up multiple blocks to be shown to users, defines what columns these blocks should have and states the rules to be used in getting the data.
Each block has multiple parameters, and is stated in $context['ticket_blocks']:
- block_icon: which image to use in Themes/default/images/simpledesk for denoting the type of block; filename plus extension
- title: the text string to use as the block's heading
- where: an SQL clause denoting the rule for obtaining the items in this block
- display: whether the block should be processed and prepared for display
- count: the number of items in this block, for pagination; generally should be a call to shd_count_helpdesk_tickets()
- columns: an array of columns to display in this block, in the order they should be displayed, using the following options, derived from shd_get_block_columns():
- ticket_id: the ticket's read status, privacy icon, and id
- ticket_name: name/link to the ticket
- starting_user: profile link to the user who opened the ticket
- replies: number of (visible) replies in the ticket
- allreplies: number of (all) replies in the ticket (includes deleted replies, which 'replies' does not)
- last_reply: the user who last replied
- status: the current ticket's status
- assigned: link to the profile of the user the ticket is assigned to, or 'Unassigned' if not assigned
- urgency: the current ticket's urgency
- updated: time of the last reply in the ticket; states Never if no replies
- actions: icons that may or may not relate to a given ticket; buttons for recycle, delete, unresolve live in this column
- required: whether the block is required to be displayed even if empty
- collapsed: whether the block should be compressed to a header with count of tickets or not (mostly for shd_view_block()'s benefit)
This function declares the following blocks:
- Assigned to me (staff only)
- New tickets (staff only)
- Pending with staff (for staff, this is just tickets with that status, for regular users this is both pending staff and new unreplied to tickets)
- Pending with user (both)
Tags:
- see
- shd_count_helpdesk_tickets()
- since
- 1.0
Return value
This function has no return value.shd_recycle_bin [line 478]
void shd_recycle_bin (
)
Set up the paginated lists of deleted/recyclebin tickets.
Much like the main helpdesk, this function prepares a list of all the deleted tickets, with a more specific list of columns that is better suited to recyclable or permadeletable tickets.
Tags:
- see
- shd_main_helpdesk()
- since
- 1.0
Return value
This function has no return value.shd_view_block [line 352]
void shd_view_block (
)
Sets up viewing of a single block without any pagination.
This provides the ability to see all of a given type of ticket at once without paging through them, which are all sortable.
Tags:
- see
- shd_main_helpdesk()
- since
- 1.0



