shd_view_ticket()
shd_view_ticket()
Loads all the data and sets all the options for displaying a ticket.
This function does a lot of work in setting up a ticket to be displayed:
- Invokes shd_load_ticket() to get the principle data
- Creates $context['ticket'] to hold the data block, some of which is derived from the return of shd_load_ticket():
- id: regular numeric ticket id
- display_id: zero padded ticket id (e.g. 00001)
- subject: censored version of the subject
- first_msg: id of the opening post that forms the ticket body
- body: formatted (parsed for smileys and bbcode) version of the ticket post
- id_member: user id of the ticket's poster
- id_member_assigned: user id of the ticket's assigned user
- member: hash array of the ticket poster's details:
- id: their user id
- name: the name stated in the ticket post for that use
- link: link to the profile of the user
- assigned: hash array of the assignee of the ticket:
- id: their user id
- name: name of the assignee, or 'Unassigned'
- link: a full HTML link to their profile, or 'Unassigned' in red text
- assigned_self: boolean, whether the ticket is assigned to the current user or not
- ticket_opener: boolean, whether the current user is the user who opened this ticket
- urgency: hash array
- level: numeric identifier of current ticket urgency
- label: the HTML label of the urgency, including being in red for "Very High" or above
- increase: Boolean, whether the current ticket urgency can be increased given the current ticket state and user permissions
- decrease: Boolean, whether the current ticket urgency can be increased given the current ticket state and user permissions
- status: hash array
- level: numeric, current status identifier
- label: string representing the current status
- num_replies: the number of replies to the ticket so far
- deleted_replies: how many deleted replies in this ticket
- poster_time: formatted string containing the time the ticket was opened
- privacy: hash array
- label: current label to be used with the privacy item
- can_change: Boolean, whether the user's permission with this ticket allows us to edit the ticket privacy
- closed: Boolean, represents whether this ticket is closed (used a lot with the navigation menu)
- deleted: Boolean, represents whether this ticket is deleted (used a lot with the navigation menu)
- ip_address: IP address logged at the time the ticket was opened; if moderate_forum_members permission is available, this will be a link to the track IP area
- modified: if the ticket has been modified, also get the modified details:
- id: user id who edited the ticket (not always available)
- time: formatted string of the time the post was edited
- timestamp: raw timestamp of the time the post was edited
- name: user name of the editing user; if we have a definite user id, this should contain the current name, falling back to the previously stored name
- link: if we have a known, valid user id for the post's editor, this will contain a link to their profile, with the link text using their current display name; alternatively it will contain a regular string which is the username stored with the edit.
- display_recycle: Either holds the $txt identifier of the message to apply as a warning, or false if displaying of recycling stuff in this ticket isn't appropriate (either for permissions or just because of no deleted replies, or we're just in regular ticket view)
- define the page index with SMF's constructPageIndex
- query for all the ids of messages we might display, followed by querying for the message details themselves, pushing that query resource to $reply_request so we can use it in shd_view_replies() later
- load details of all the users applicable for posts in this page
- request all the visible attachments from [shd_display_load_attachments()](namespaces/default.html#function_shd_display_load_attachments)
- since we are viewing this ticket, mark it read
- set up the breadcrumb trail
- set up the ticket navigation menu
- call in the editor component from SimpleDesk-Post.php and friends, ready for Quick Reply
- invoke the different Javascript objects that are applicable on the page:
- privacy changer
- urgency changer
- quick reply / quote / go advanced