Minor cleanup and documentation.
jdarwood007

jdarwood007 commited on 2017-09-03 10:03:11
Showing 4 changed files, with 119 additions and 2 deletions.


Signed-off-by: jdarwood007 <unmonitored+github@sleepycode.com>
... ...
@@ -25,6 +25,14 @@
25 25
 if (!defined('SMF'))
26 26
 	die('Hacking attempt...');
27 27
 
28
+/**
29
+ *	Notification for new tickets
30
+ *
31
+ *	@since 2.0
32
+ *	@param int &$msgOptions The message options, similar to the createPost in Subs-Post.php
33
+ *	@param int &$ticketOptions The ticket options, similar to the createPost topicOptions in Subs-Post.php
34
+ *	@param int &$posterOptions The poster options, similar to the createPost in Subs-Post.php
35
+*/
28 36
 function shd_notifications_notify_newticket(&$msgOptions, &$ticketOptions, &$posterOptions)
29 37
 {
30 38
 	global $smcFunc, $context, $modSettings, $scripturl;
... ...
@@ -99,6 +107,14 @@ function shd_notifications_notify_newticket(&$msgOptions, &$ticketOptions, &$pos
99 107
 	shd_notify_users($notify_data);
100 108
 }
101 109
 
110
+/**
111
+ *	Notifications for new replies
112
+ *
113
+ *	@since 2.0
114
+ *	@param int &$msgOptions The message options, similar to the createPost in Subs-Post.php
115
+ *	@param int &$ticketOptions The ticket options, similar to the createPost topicOptions in Subs-Post.php
116
+ *	@param int &$posterOptions The poster options, similar to the createPost in Subs-Post.php
117
+*/
102 118
 function shd_notifications_notify_newreply(&$msgOptions, &$ticketOptions, &$posterOptions)
103 119
 {
104 120
 	global $smcFunc, $context, $modSettings, $scripturl;
... ...
@@ -270,6 +286,13 @@ function shd_notifications_notify_newreply(&$msgOptions, &$ticketOptions, &$post
270 286
 		shd_notify_users($notify_data);
271 287
 }
272 288
 
289
+/**
290
+ *	Notificaiton for assignments
291
+ *
292
+ *	@since 2.0
293
+ *	@param int &$ticket The ticket id
294
+ *	@param int &$assignment Who the ticket is being assigned to.
295
+*/
273 296
 function shd_notifications_notify_assign(&$ticket, &$assignment)
274 297
 {
275 298
 	global $smcFunc, $context, $modSettings, $scripturl;
... ...
@@ -353,7 +376,7 @@ function shd_notifications_notify_assign(&$ticket, &$assignment)
353 376
  *	Handle email notifications
354 377
  *
355 378
  *	@todo Finish documenting
356
- *	@since 2.0
379
+ *	@param mixed $notify_data Array of data containing notification informationt o be sent out.
357 380
 */
358 381
 function shd_notify_users($notify_data)
359 382
 {
... ...
@@ -595,6 +618,12 @@ function shd_notify_popup()
595 618
 	$context['help_text'] .= '<strong>' . $txt['subject'] . ':</strong> ' . $email_subject . '<br><br>' . $email_body;
596 619
 }
597 620
 
621
+/**
622
+ *	Notification ticket options..
623
+ *
624
+ *	@todo Finish documenting
625
+ *	@since 2.0
626
+*/
598 627
 function shd_notify_ticket_options()
599 628
 {
600 629
 	global $context, $txt, $smcFunc;
... ...
@@ -739,6 +768,12 @@ function shd_notify_ticket_options()
739 768
 	redirectexit('action=helpdesk;sa=ticket;ticket=' . $context['ticket_id']);
740 769
 }
741 770
 
771
+/**
772
+ *	Builds a list of who should be notified or not.
773
+ *
774
+ *	@todo Finish documenting
775
+ *	@since 2.0
776
+*/
742 777
 function shd_query_monitor_list($ticket_id)
743 778
 {
744 779
 	global $smcFunc;
... ...
@@ -31,6 +31,8 @@ if (!defined('SMF'))
31 31
 
32 32
 /**
33 33
  *	Create a new ticket
34
+ *
35
+ *	@since 1.0
34 36
 */
35 37
 function shd_post_ticket()
36 38
 {
... ...
@@ -210,7 +212,11 @@ function shd_post_ticket()
210 212
 	checkSubmitOnce('register');
211 213
 }
212 214
 
213
-// All the magically common posting stuff goes in here
215
+/**
216
+ *	All the magically common posting stuff goes in here
217
+ *
218
+ *	@since 1.0
219
+*/
214 220
 function shd_save_post()
215 221
 {
216 222
 	global $txt, $modSettings, $sourcedir, $context, $scripturl;
... ...
@@ -278,6 +284,11 @@ function shd_save_post()
278 284
 		$actions[$_REQUEST['sa']]();
279 285
 }
280 286
 
287
+/**
288
+ *	Saves the main ticket data.
289
+ *
290
+ *	@since 1.0
291
+*/
281 292
 function shd_save_ticket()
282 293
 {
283 294
 	global $txt, $modSettings, $sourcedir, $context, $scripturl;
... ...
@@ -677,6 +688,12 @@ function shd_save_ticket()
677 688
 	}
678 689
 }
679 690
 
691
+
692
+/**
693
+ *	Loads the Post a reply area
694
+ *
695
+ *	@since 1.0
696
+*/
680 697
 function shd_post_reply()
681 698
 {
682 699
 	global $context, $user_info, $sourcedir, $txt, $scripturl, $smcFunc, $reply_request, $modSettings, $settings, $options, $memberContext;
... ...
@@ -924,6 +941,11 @@ function shd_post_reply()
924 941
 	checkSubmitOnce('register');
925 942
 }
926 943
 
944
+/**
945
+ *	Saves the reply
946
+ *
947
+ *	@since 1.0
948
+*/
927 949
 function shd_save_reply()
928 950
 {
929 951
 	global $txt, $modSettings, $sourcedir, $context, $scripturl;
... ...
@@ -1337,6 +1359,12 @@ function shd_done_posting()
1337 1359
 	}
1338 1360
 }
1339 1361
 
1362
+/**
1363
+ *	Sets up the replies section data
1364
+ *
1365
+ *	@since 1.0
1366
+ *	@param array $first_msg The first message for the ricket
1367
+*/
1340 1368
 function shd_setup_replies($first_msg)
1341 1369
 {
1342 1370
 	global $reply_request, $context, $smcFunc, $sourcedir, $modSettings, $settings;
... ...
@@ -1442,6 +1470,15 @@ function shd_setup_replies($first_msg)
1442 1470
 	}
1443 1471
 }
1444 1472
 
1473
+/**
1474
+ *	Sets up the post box for tuckets
1475
+ *
1476
+ *	@since 1.0
1477
+ *	@param array $id The id of the post box
1478
+ *	@param array $message The message for the post box
1479
+ *	@param array $buttons Buttons on the post box
1480
+ *	@param array $width (optional) The width of the post box
1481
+*/
1445 1482
 function shd_postbox($id, $message, $buttons, $width = '90%')
1446 1483
 {
1447 1484
 	global $context, $txt, $modSettings;
... ...
@@ -1490,6 +1527,11 @@ function shd_postbox($id, $message, $buttons, $width = '90%')
1490 1527
 		$context['attachment_restrictions'][] = sprintf($txt['attach_restrict_attachmentSizeLimit'], $modSettings['attachmentSizeLimit']);
1491 1528
 }
1492 1529
 
1530
+/**
1531
+ *	Prepares a reply section
1532
+ *
1533
+ *	@since 1.0
1534
+*/
1493 1535
 function shd_prepare_reply_context()
1494 1536
 {
1495 1537
 	global $settings, $txt, $modSettings, $scripturl, $options, $user_info, $smcFunc;
... ...
@@ -1547,6 +1589,11 @@ function shd_prepare_reply_context()
1547 1589
 	return $output;
1548 1590
 }
1549 1591
 
1592
+/**
1593
+ *	Load up any and all attachments related to this ticket.
1594
+ *
1595
+ *	@since 1.0
1596
+*/
1550 1597
 function shd_load_attachments()
1551 1598
 {
1552 1599
 	global $smcFunc, $context, $modSettings;
... ...
@@ -1582,6 +1629,11 @@ function shd_load_attachments()
1582 1629
 	$smcFunc['db_free_result']($query);
1583 1630
 }
1584 1631
 
1632
+/**
1633
+ *	Checks attachments are valid and allowed.
1634
+ *
1635
+ *	@since 1.0
1636
+*/
1585 1637
 function shd_check_attachments()
1586 1638
 {
1587 1639
 	global $modSettings, $smcFunc, $context, $user_info, $txt;
... ...
@@ -1777,6 +1829,11 @@ function shd_check_attachments()
1777 1829
 	$context['ticket_form']['num_allowed_attachments'] = empty($modSettings['attachmentNumPerPostLimit']) || $modSettings['shd_attachments_mode'] == 'ticket' ? -1 : $modSettings['attachmentNumPerPostLimit'];
1778 1830
 }
1779 1831
 
1832
+/**
1833
+ *	Handles attachment actions such as adding or removing.
1834
+ *
1835
+ *	@since 1.0
1836
+*/
1780 1837
 function shd_handle_attachments()
1781 1838
 {
1782 1839
 	global $modSettings, $smcFunc, $context, $user_info, $sourcedir, $txt;
... ...
@@ -27,6 +27,11 @@
27 27
 if (!defined('SMF'))
28 28
 	die('Hacking attempt...');
29 29
 
30
+/**
31
+ *	The main search handling for tickets, just sets up stuff.
32
+ *
33
+ *	@since 1.0
34
+*/
30 35
 function shd_search()
31 36
 {
32 37
 	global $context, $smcFunc, $txt, $modSettings, $scripturl;
... ...
@@ -62,6 +67,11 @@ function shd_search()
62 67
 	);
63 68
 }
64 69
 
70
+/**
71
+ *	All the heavy lifting for search is handled here.
72
+ *
73
+ *	@since 1.0
74
+*/
65 75
 function shd_search2()
66 76
 {
67 77
 	global $context, $smcFunc, $txt, $modSettings, $scripturl, $sourcedir;
... ...
@@ -493,6 +503,12 @@ function shd_search2()
493 503
 	}
494 504
 }
495 505
 
506
+/**
507
+ *	Finds all members specified in a input field and returns their id_member.
508
+ *
509
+ *	@since 1.0
510
+ *	@param array $field The input field containing the names from a SMF autocomplete member box
511
+*/
496 512
 function shd_get_named_people($field)
497 513
 {
498 514
 	global $smcFunc, $sourcedir, $context, $user_profile;
... ...
@@ -860,6 +860,9 @@ function shd_format_text($text, $smileys = true, $cache = '')
860 860
  *	Processes the incoming message for wiki-links.
861 861
  *
862 862
  *	@param string &$message The message to be parsed.
863
+ *	@param string &$smileys The Smileys sets.
864
+ *	@param array $cache_id Cache ids used by messages, currently not used.
865
+ *	@param array $parse_tags Tags to parse, currently not used.
863 866
  *	@since 2.0
864 867
 */
865 868
 function shd_parse_wikilinks(&$message, &$smileys = array(), &$cache_id = array(), &$parse_tags = array())
... ...
@@ -1978,6 +1981,12 @@ function shd_main_menu(&$menu_buttons)
1978 1981
 	call_integration_hook('shd_hook_mainmenu', array(&$menu_buttons));
1979 1982
 }
1980 1983
 
1984
+/**
1985
+ *	Adds to the Admin Center menu the helpdesk section buttons.
1986
+ *
1987
+ *	@since 2.1
1988
+ *  @param bool $helpdesk_admin If they are a helpdesk admin or not.
1989
+*/
1981 1990
 function shd_main_menu_admin($helpdesk_admin)
1982 1991
 {
1983 1992
 	global $txt, $scripturl;
1984 1993