function theme_support_substatus_page_user in Support Ticketing System 6
1 string reference to 'theme_support_substatus_page_user'
- support_substatus_theme_registry_alter in support_substatus/
support_substatus.module
File
- support_substatus/
support_substatus.module, line 364 - Support Substatus -- allows per-status sub-status values, so for example a "pending" ticket can be further marked with "needs review", etc. @author Jeremy Andrews <jeremy@tag1consulting.com> @package Support
Code
function theme_support_substatus_page_user($header, $rows) {
if (!user_access('view support substatus')) {
// @todo fix; we likely shouldn't be calling with an empty array
$form = array();
return theme_support_page_form($form);
}
$new_header = array();
$increment = $state_key = 0;
foreach ($header as $key => $value) {
$new_header[$key + $increment] = $value;
if ($value['data'] == t('State')) {
$state_key = $key;
$increment++;
$new_header[$key + $increment] = array(
'data' => t('Status'),
);
}
}
if ($state_key) {
$new_rows = array();
foreach ($rows as $key => $value) {
$new_row = array();
$increment = 0;
$ticket_url = preg_match('/>([0-9]+)</', $rows[$key]['data'][0]['data'], $matches);
$ticket_id = $matches[1];
$substatus = _support_substatus_last_value($ticket_id);
foreach ($rows[$key]['data'] as $subkey => $subvalue) {
$new_row['data'][$subkey + $increment] = $subvalue;
if ($subkey == $state_key) {
$increment++;
$new_row['data'][$subkey + $increment] = array(
'data' => _support_substatus_substatus($substatus),
'class' => 'ticket-substatus',
);
}
}
$new_row['class'] = $rows[$key]['class'];
$new_rows[] = $new_row;
}
}
return theme('table', $new_header, $new_rows, array(
'class' => 'support',
)) . theme('pager');
}