function theme_skinr_ui_admin_skins in Skinr 6.2
Theme function for Skinr UI's list form.
Parameters
$form: An associative array containing the structure of the form.
File
- ./
skinr_ui.admin.inc, line 838 - Admin page callbacks for the skinr module.
Code
function theme_skinr_ui_admin_skins($form) {
$output = '';
$has_skins = isset($form['rows']['#value']) && is_array($form['rows']['#value']);
$select_header = $has_skins ? theme('table_select_header_cell') : '';
$headers = array(
$select_header,
array(
'data' => t('Theme'),
'field' => 'theme',
),
array(
'data' => t('Type'),
'field' => 'type',
),
array(
'data' => t('Skinr ID'),
'field' => 'sid',
),
t('Operations'),
);
$output .= drupal_render($form['options']);
if ($has_skins) {
$ts = tablesort_init($headers);
$sort = SORT_DESC;
if ($ts['sort'] == 'asc') {
$sort = SORT_ASC;
}
switch ($ts['sql']) {
case 'type':
$sortby = 2;
break;
case 'sid':
$sortby = 3;
break;
case 'theme':
default:
$sortby = 1;
break;
}
$rows = array();
$sorts = array();
foreach ($form['rows']['#value'] as $key => $value) {
$row = array();
$row[] = drupal_render($form['skinr_settings'][$key]);
$row[] = $value['theme'];
$row[] = $value['type'];
$row[] = $value['sid'];
$row[] = $value['operations'];
$rows[$key] = $row;
$sorts[] = strip_tags($rows[$key][$sortby]);
}
// Sort table.
array_multisort($sorts, $sort, $rows);
}
else {
$rows[] = array(
array(
'data' => t('No skinr settings available.'),
'colspan' => '5',
),
);
}
// Output table.
$output .= theme('table', $headers, $rows);
$output .= drupal_render($form);
return $output;
}