function support_menu in Support Ticketing System 7
Same name and namespace in other branches
- 6 support.module \support_menu()
Implementation of hook_menu().
File
- ./
support.module, line 221 - support.module
Code
function support_menu() {
$items = array();
$items['support'] = array(
'title' => 'Support tickets',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_page_form',
),
'access callback' => 'support_access_clients',
);
$items['admin/support'] = array(
'title' => 'Support ticketing system',
'description' => 'Configure the support ticketing system.',
'position' => 'right',
'weight' => 5,
'page callback' => 'support_admin_menu_block_page',
'access arguments' => array(
'administer support',
),
'file' => 'support.admin.inc',
);
$items['admin/support/clients/list'] = array(
'title' => 'List',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['admin/support/settings'] = array(
'title' => 'Settings',
'description' => 'Configure the support ticketing system.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_admin_settings',
),
'access arguments' => array(
'administer support',
),
'file' => 'support.admin.inc',
);
$items['admin/support/settings/general'] = array(
'title' => 'General settings',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['admin/support/settings/mail'] = array(
'title' => 'Mail text settings',
'type' => MENU_LOCAL_TASK,
'weight' => 2,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_admin_mail_settings',
),
'access arguments' => array(
'administer support',
),
'file' => 'support.admin.inc',
);
$items['support/fetch'] = array(
'type' => MENU_CALLBACK,
'page callback' => 'support_fetch_client_mail',
'access arguments' => array(
'download mail via support/fetch',
),
);
// Autocomplete paths
$items['support/autocomplete/assigned'] = array(
'title' => 'Autocomplete support assigned user',
'page callback' => 'support_autocomplete_assigned',
'access callback' => 'support_access_clients',
'access arguments' => array(),
'type' => MENU_CALLBACK,
);
$items['support/autocomplete/autosubscribe'] = array(
'title' => 'Autocomplete support autosubscribed user',
'page callback' => 'support_autocomplete_autosubscribe',
'access callback' => '_support_autosubscribe_access',
'type' => MENU_CALLBACK,
);
$states = array(
-3 => 'all',
-2 => 'all open',
-1 => 'my open',
) + _support_states();
$result = db_query('SELECT clid, path, name FROM {support_client} WHERE status = :status AND parent = :parent', array(
':status' => 1,
':parent' => 0,
));
foreach ($result as $client) {
$items["support/{$client->path}"] = array(
'title' => check_plain($client->name),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_page_form',
$client->clid,
),
'access callback' => 'support_access_clients',
'access arguments' => array(
$client,
),
);
foreach ($states as $sid => $state) {
$items["support/{$client->path}/{$state}"] = array(
'title' => "{$state}",
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_page_form',
$client->clid,
$state,
),
'access callback' => 'support_access_clients',
'access arguments' => array(
$client,
),
'weight' => $sid,
// -2 is 'all open'
'type' => $sid == -2 ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
);
}
$result2 = db_query('SELECT clid, path, name FROM {support_client} WHERE status = :status AND parent = :parent', array(
':status' => 1,
':parent' => $client->clid,
));
foreach ($result2 as $subclient) {
$items["support/{$client->path}/{$subclient->path}"] = array(
'title' => check_plain($subclient->name),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_page_form',
$subclient->clid,
),
'access callback' => 'support_access_clients',
'access arguments' => array(
$subclient,
),
);
foreach ($states as $sid => $state) {
$items["support/{$client->path}/{$subclient->path}/{$state}"] = array(
'title' => "{$state}",
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_page_form',
$subclient->clid,
$state,
),
'access callback' => 'support_access_clients',
'access arguments' => array(
$subclient,
),
'weight' => $sid,
'type' => $sid == -2 ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
);
}
}
}
$items['support/user/%user'] = array(
'page callback' => 'support_page_user',
'page arguments' => array(
2,
),
'access callback' => 'support_access_user_tickets',
'access arguments' => array(
2,
),
'type' => MENU_CALLBACK,
'file' => 'support.user.inc',
);
$items['support/%user_uid_optional/assigned'] = array(
'title' => 'My tickets',
'page callback' => 'support_page_user',
'page arguments' => array(
1,
TRUE,
),
'access callback' => 'support_page_user_access',
'access arguments' => array(
1,
),
'file' => 'support.user.inc',
);
unset($states['my open']);
foreach ($states as $sid => $state) {
$items["support/%user_uid_optional/assigned/{$state}"] = array(
'title' => "{$state}",
'page callback' => 'support_page_user',
'page arguments' => array(
1,
TRUE,
$state,
),
'access callback' => 'support_access_clients',
'access arguments' => array(),
'file' => 'support.user.inc',
'weight' => $sid,
'type' => $sid == 'all open' ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
);
}
$items['support/%node/unsubscribe/%user/%'] = array(
'page callback' => 'support_unsubscribe_user',
'page arguments' => array(
1,
3,
4,
),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['support/all/unsubscribe/%user/%'] = array(
'page callback' => 'support_unsubscribe_user',
'page arguments' => array(
'all',
3,
4,
),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['admin/support/clients/%support_client/fetch'] = array(
'title' => 'Fetch mail',
'type' => MENU_CALLBACK,
'page callback' => 'support_client_fetch',
'page arguments' => array(
3,
),
'access arguments' => array(
'administer support',
),
'file' => 'support.admin.inc',
);
return $items;
}