Example #1
0
/**
 *	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.
 *
 *	@see shd_main_helpdesk()
 *	@since 1.0
*/
function shd_recycle_bin()
{
    global $context, $txt, $smcFunc, $user_profile, $scripturl, $settings, $user_info;
    // Stuff we need to add to $context, the permission we want to use, page title etc etc
    $context += array('shd_permission' => 'shd_access_recyclebin', 'page_title' => $txt['shd_helpdesk'], 'sub_template' => 'recyclebin', 'ticket_blocks' => array('recycle' => array('block_icon' => 'recycle.png', 'title' => $txt['shd_status_' . TICKET_STATUS_DELETED . '_heading'], 'tickets' => array(), 'where' => 'hdt.status = ' . TICKET_STATUS_DELETED, 'display' => true, 'count' => shd_count_helpdesk_tickets('recycled'), 'columns' => shd_get_block_columns('recycled'), 'required' => true, 'collapsed' => false), 'withdeleted' => array('block_icon' => 'recycle.png', 'title' => $txt['shd_status_withdeleted_heading'], 'tickets' => array(), 'where' => 'hdt.status != ' . TICKET_STATUS_DELETED . ' AND hdt.deleted_replies > 0', 'display' => true, 'count' => shd_count_helpdesk_tickets('withdeleted'), 'columns' => shd_get_block_columns('withdeleted'), 'required' => true, 'collapsed' => false)));
    // Build the link tree.
    if (!empty($context['shd_dept_name']) && $context['shd_multi_dept']) {
        $context['linktree'][] = array('url' => $scripturl . '?' . $context['shd_home'] . $context['shd_dept_link'], 'name' => $context['shd_dept_name']);
    }
    $context['linktree'][] = array('url' => $scripturl . '?action=helpdesk;sa=recyclebin' . $context['shd_dept_link'], 'name' => $txt['shd_recycle_bin']);
    shd_helpdesk_listing();
}
Example #2
0
/**
 *	Loads the main SimpleDesk information page for forum administrators.
 *
 *	This function is the main focus point for information about SimpleDesk in the admin panel, primarily it collects the following for the template:
 *	<ul>
 *	<li>list of helpdesk staff</li>
 *	<li>totals of tickets in the system (open/closed/deleted)</li>
 *	<li>credits</li>
 *	<li>also, in the template, whether this is a current or outdated version of SimpleDesk</li>
 *	</ul>
 *
 *	Since 1.1, it also receives the requests for subactions for action log and support page (since these are sub menu items) but simply directs them onward.
 *
 *	@see shd_admin_action_log()
 *	@see shd_admin_support()
 *
 *	@since 1.0
*/
function shd_admin_info()
{
    global $context, $settings, $scripturl, $txt, $sourcedir, $smcFunc;
    $subactions = array('main' => array('function' => false, 'icon' => 'simpledesk.png', 'title' => $txt['shd_admin_info']), 'actionlog' => array('function' => 'shd_admin_action_log', 'icon' => 'log.png', 'title' => $txt['shd_admin_actionlog_title']), 'support' => array('function' => 'shd_admin_support', 'icon' => 'support.png', 'title' => $txt['shd_admin_support']));
    $context[$context['admin_menu_name']]['tab_data'] = array('description' => $txt['shd_admin_options_desc'], 'tabs' => array('main' => array('description' => '<strong>' . $txt['hello_guest'] . ' ' . $context['user']['name'] . '!</strong><br />' . $txt['shd_admin_info_desc']), 'actionlog' => array('description' => $txt['shd_admin_actionlog_desc'] . '<br />' . (!empty($modSettings['shd_disable_action_log']) ? '<span class="smalltext">' . $txt['shd_action_log_disabled'] . '</span>' : '')), 'support' => array('description' => $txt['shd_admin_support_desc'])));
    call_integration_hook('shd_hook_hdadmininfo', array(&$subactions));
    $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subactions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'main';
    // Now that we have validated the subaction.
    $context[$context['admin_menu_name']]['tab_data']['title'] = '<img src="' . $settings['images_url'] . '/admin/shd/' . $subactions[$_REQUEST['sa']]['icon'] . '" class="icon" alt="*" />' . $subactions[$_REQUEST['sa']]['title'];
    // Are we doing the main page, or leaving here?
    if (!empty($subactions[$_REQUEST['sa']]['function'])) {
        $subactions[$_REQUEST['sa']]['function']();
        return;
    }
    // Get a list of the staff members of the helpdesk.
    $members = shd_members_allowed_to('shd_staff');
    $query = shd_db_query('', '
		SELECT id_member, real_name
		FROM {db_prefix}members
		WHERE id_member IN ({array_int:members})
		ORDER BY real_name', array('members' => $members));
    // Note this just gets everyone, doesn't worry about limiting it - IMO that's something for the template to decide.
    $context['staff'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($query)) {
        $context['staff'][] = shd_profile_link($row['real_name'], $row['id_member']);
    }
    $smcFunc['db_free_result']($query);
    // Make we sure give these slackers some credit. After all, they made sumfin fer ya!
    shd_credits();
    $context['total_tickets'] = shd_count_helpdesk_tickets();
    $context['open_tickets'] = shd_count_helpdesk_tickets('open');
    $context['closed_tickets'] = shd_count_helpdesk_tickets('closed');
    $context['recycled_tickets'] = shd_count_helpdesk_tickets('recycled');
    // Final stuff before we go.
    $context['page_title'] = $txt['shd_admin_title'];
    $context['sub_template'] = 'shd_admin';
}