function support_pm_menu in Support Ticketing System 7
Same name and namespace in other branches
- 6 support_pm/support_pm.module \support_pm_menu()
Implements hook_menu(). TODO: Include date in 'view' and 'edit' tabs
File
- support_pm/
support_pm.module, line 40 - Support Project Management. @author Jeremy Andrews <jeremy@tag1consulting.com> @package Support
Code
function support_pm_menu() {
$items = array();
$items['user/%user/support_plan'] = array(
'title' => 'Support plan',
'description' => 'Support planning',
'page callback' => 'support_pm_plan_overview_weekly',
'page arguments' => array(
1,
),
'access arguments' => array(
'create plans',
),
'type' => MENU_LOCAL_TASK,
);
$items['user/%user/support_plan/view'] = array(
'title' => 'Show plan',
'description' => 'Create support plans',
'page callback' => 'support_pm_plan_overview_weekly',
'page arguments' => array(
1,
),
'access arguments' => array(
'create plans',
),
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['user/%user/support_plan/edit'] = array(
'title' => 'Edit plan',
'description' => 'Create support plans',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_pm_user_week',
1,
),
'access arguments' => array(
'create plans',
),
'weight' => 2,
'type' => MENU_LOCAL_TASK,
);
$items['admin/support/plan_report'] = array(
'title' => 'Plan reports',
'description' => 'Generate support plan reports',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_pm_admin_reports',
),
'access arguments' => array(
'administer support',
),
'file' => 'support_pm.admin.inc',
);
$items['admin/support/plan_settings'] = array(
'title' => 'Plan report settings',
'description' => 'Configure support plans.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_pm_admin_settings',
),
'access arguments' => array(
'administer support',
),
'file' => 'support_pm.admin.inc',
);
$items['admin/support/project'] = array(
'title' => 'Projects',
'description' => 'Configure support projects.',
'page callback' => 'support_pm_admin_project_overview',
'access arguments' => array(
'administer support projects',
),
'file' => 'support_pm.admin.inc',
);
$items['admin/support/project/list'] = array(
'title' => 'List',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['admin/support/project/add'] = array(
'title' => 'Add project',
'type' => MENU_LOCAL_TASK,
'weight' => 2,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_pm_admin_project_form',
),
'access arguments' => array(
'administer support projects',
),
'file' => 'support_pm.admin.inc',
);
$items['admin/support/project/%support_pm_project/edit'] = array(
'title' => 'Edit',
'type' => MENU_CALLBACK,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_pm_admin_project_form',
3,
),
'access arguments' => array(
'administer support projects',
),
'file' => 'support_pm.admin.inc',
);
$items['admin/support/project/%support_pm_project/delete'] = array(
'title' => 'Delete',
'type' => MENU_CALLBACK,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_pm_admin_project_delete_form',
3,
),
'access arguments' => array(
'administer support projects',
),
'file' => 'support_pm.admin.inc',
);
$items['support_pm/image/%'] = array(
'page callback' => 'support_pm_display_swatch',
'page arguments' => array(
2,
),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
// Add project sub-menu
$states = array(
-3 => 'all',
-2 => 'all open',
-1 => 'my open',
) + _support_states();
$result = db_query('SELECT sp.projid, sp.project, sp.path, sp.weight, spc.clid FROM {support_project} sp LEFT JOIN {support_project_client} spc ON sp.projid = spc.projid WHERE disabled = 0 ORDER BY spc.clid, sp.weight ASC, sp.project');
foreach ($result as $project) {
if ($client = support_client_load($project->clid)) {
$clients = array(
$client,
);
}
else {
$clients = array();
$result2 = db_query('SELECT clid FROM {support_client} WHERE status = 1');
foreach ($result2 as $client) {
$clients[] = support_client_load($client->clid);
}
}
foreach ($clients as $client) {
foreach ($states as $sid => $state) {
if ($client->parent == 0) {
$items["support/{$client->path}/{$state}/{$project->path}"] = array(
'title' => check_plain($project->project),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_page_form',
$client->clid,
$state,
),
'access callback' => 'support_access_clients',
'access arguments' => array(
$client,
),
'weight' => $project->weight,
'type' => MENU_LOCAL_TASK,
);
}
else {
$parent = support_client_load($client->parent);
$items["support/{$parent->path}/{$client->path}/{$state}/{$project->path}"] = array(
'title' => check_plain($project->project),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'support_page_form',
$client->clid,
$state,
),
'access callback' => 'support_access_clients',
'access arguments' => array(
$client,
),
'weight' => $project->weight,
'type' => MENU_LOCAL_TASK,
);
}
}
}
}
return $items;
}