function support_pm_admin_project_overview in Support Ticketing System 7
Same name and namespace in other branches
- 6 support_pm/support_pm.admin.inc \support_pm_admin_project_overview()
Overview of client projects.
1 string reference to 'support_pm_admin_project_overview'
- support_pm_menu in support_pm/
support_pm.module - Implements hook_menu(). TODO: Include date in 'view' and 'edit' tabs
File
- support_pm/
support_pm.admin.inc, line 465
Code
function support_pm_admin_project_overview() {
$rows = array();
$header = array(
array(
'data' => t('Project'),
'field' => 'sp.project',
),
array(
'data' => t('Client(s)'),
),
array(
'data' => t('Weight'),
'field' => 'sp.weight',
),
array(
'data' => t('Disabled'),
'field' => 'sp.disabled',
),
array(
'data' => t('Options'),
),
);
$query = db_select('support_project', 'sp')
->extend('TableSort')
->extend('PagerDefault');
$query
->fields('sp', array(
'projid',
'project',
'weight',
'disabled',
));
$query
->orderByHeader($header);
$query
->limit(50);
$result = $query
->execute();
foreach ($result as $project) {
$options = l(t('edit'), "admin/support/project/{$project->projid}/edit");
$clients = array();
$result2 = db_query('SELECT spc.clid, sc.name FROM {support_project_client} spc LEFT JOIN {support_client} sc ON spc.clid = sc.clid WHERE spc.projid = :project AND spc.clid <> 0', array(
':project' => $project->projid,
));
foreach ($result2 as $client) {
$clients[] = check_plain($client->name);
}
if (empty($clients)) {
$clients[] = '<em>' . t('All clients') . '</em>';
}
$rows[] = array(
truncate_utf8(check_plain($project->project), 52, TRUE, TRUE),
implode(', ', $clients),
number_format($project->weight),
$project->disabled ? t('Disabled') : t('Active'),
$options,
);
}
if (empty($rows)) {
drupal_set_message(t('There are currently no projects defined.'));
}
$output = theme('table', array(
'header' => $header,
'rows' => $rows,
));
$output .= theme('pager');
return $output;
}