function theme_support_pm_user_week in Support Ticketing System 7
Same name and namespace in other branches
- 6 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 727 - Support Project Management. @author Jeremy Andrews <jeremy@tag1consulting.com> @package Support
Code
function theme_support_pm_user_week($variables) {
$form = $variables['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'),
)), PASS_THROUGH);
$dates = _support_pm_dates($week);
$dates['totals'] = t('Totals');
$dates['comment'] = t('Comments');
$rows = array();
foreach (element_children($form['client']) as $key) {
// Don't take form control structures
if (isset($form['client'][$key]) && is_array($form['client'][$key])) {
$row = array();
$row[] = array(
'data' => drupal_render($form['client'][$key]),
'class' => 'support-client',
'id' => drupal_clean_css_identifier('client-' . $form['client'][$key]['#markup']),
);
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 (is_numeric($date) && $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', array(
'text' => t('‹ previous'),
'op' => '<',
));
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'permissions',
),
));
$output .= drupal_render_children($form);
$output .= theme('support_pm_pager', array(
'text' => t('next ›'),
'op' => '>',
));
return $output;
}