function theme_support_pm_user_week in Support Ticketing System 6
Same name and namespace in other branches
- 7 support_pm/support_pm.module \theme_support_pm_user_week()
TODO: Auto-calculate totals whenever a field is updated.
File
- support_pm/
support_pm.module, line 674 - Support Project Management. @author Jeremy Andrews <jeremy@tag1consulting.com> @package Support
Code
function theme_support_pm_user_week($form) {
$week = isset($_GET['week']) ? _support_pm_first_day((int) $_GET['week']) : _support_pm_first_day(time());
drupal_set_title(t('@start - @end', array(
'@start' => format_date($week, 'medium'),
'@end' => format_date($week + 86400 * 6, 'medium'),
)));
$dates = _support_pm_dates($week);
$dates['totals'] = t('Totals');
$dates['comment'] = t('Comments');
foreach (element_children($form['client']) as $key) {
// Don't take form control structures
if (is_array($form['client'][$key])) {
$row = array();
$row[] = array(
'data' => drupal_render($form['client'][$key]),
'class' => 'support-client',
'id' => 'client-' . $form['client'][$key]['#value'],
);
if (is_array($form['textfields'][$key])) {
foreach ($dates as $date => $name) {
$row[] = array(
'data' => drupal_render($form['textfields'][$key]["{$key}:{$date}"]),
'class' => 'textfield',
'title' => $name,
);
}
}
}
$rows[] = $row;
}
$header[] = t('Client');
foreach ($dates as $date => $name) {
if ($name == format_date($date, 'custom', 'l')) {
$header[] = t('!day<br />!date', array(
'!day' => format_date($date, 'custom', 'l'),
'!date' => format_date($date, 'custom', 'M d'),
));
}
else {
$header[] = $name;
}
}
$output = theme('support_pm_pager', t('‹ previous'), '<');
$output .= theme('table', $header, $rows, array(
'id' => 'permissions',
));
$output .= drupal_render($form);
$output .= theme('support_pm_pager', t('next ›'), '>');
return $output;
}