View source
<?php
function theme_smtp_table(&$vars) {
$table_element =& $vars['element'];
$rows = array();
foreach (element_children($table_element, TRUE) as $row_name) {
$row_element =& $table_element[$row_name];
$row = !empty($row_element['#attributes']) ? $row_element['#attributes'] : array();
$row_data = array();
foreach (element_children($row_element, TRUE) as $col_name) {
$row_data[] = render($row_element[$col_name]);
}
$row['data'] = $row_data;
$rows[] = $row;
unset($table_element[$row_name]);
}
$table_element['#rows'] = $rows;
$table_element['#theme'] = 'table';
return render($table_element);
}
function theme_smtp_selection_criteria(&$vars) {
$element =& $vars['element'];
$criteria =& $element['#criteria'];
$output = '';
if (!empty($criteria['message_module'])) {
$expression = t('Module') . '=' . $criteria['message_module'];
$output = '<em>' . check_plain($expression) . '</em>';
}
if (!empty($criteria['message_key'])) {
$expression2 = t('Key', array(), array(
'context' => 'identifier',
)) . '=' . $criteria['message_key'];
if ($output) {
$t_args = array(
'!expression1' => $output,
'%expression2' => $expression2,
);
$output = t('!expression1 AND %expression2', $t_args);
}
else {
$output = '<em>' . check_plain($expression2) . '</em>';
}
}
if (!empty($criteria['message_language'])) {
$languages = language_list();
$language_code = $criteria['message_language'];
$expression2 = t('Language') . '=' . $languages[$language_code]->name;
if ($output) {
$t_args = array(
'!expression1' => $output,
'%expression2' => $expression2,
);
$output = t('!expression1 AND %expression2', $t_args);
}
else {
$output = '<em>' . check_plain($expression2) . '</em>';
}
}
if (empty($output)) {
$output = '*';
}
return $output;
}