function tinybrowser_admin_theme in TinyBrowser 7
1 string reference to 'tinybrowser_admin_theme'
- tinybrowser_theme in ./tinybrowser.module
- Implements hook_theme
File
- ./tinybrowser.module, line 608
Code
function tinybrowser_admin_theme($variables) {
$form = $variables['form'];
$rows = array();
$header = array(
t('User role'),
t('Assigned profile'),
);
$attributes = array(
'style' => 'width:100%',
'id' => 'tinybrowser-table',
);
$adminp = tinybrowser_admin_profile();
$keys = array(
'name',
'pid',
);
$rows[0] = array(
t('Admin'),
$adminp['name'],
);
$info = '';
if ($form['#weighted']) {
$header[] = t('Weight');
$keys[] = 'weight';
$rows[0][] = t('n/a');
$info = t('For users who have <strong>multiple roles</strong>, the higher role with assigned profile in the list will take the precedence. Amin user role is always the top of the list and authenticated user role is the bottom of the list. The role that does not have any profile assigned can not use the TinyBrowser.');
}
foreach (element_children($form['roles']) as $rid) {
$cells = array();
$draggable = 1;
foreach ($keys as $key) {
$cells[] = drupal_render($form['roles'][$rid][$key]);
if ($key == 'weight' && $form['roles'][$rid][$key]['#value'] == 11) {
$draggable = 0;
}
}
$rows[] = $draggable ? array(
'data' => $cells,
'class' => array(
'draggable',
),
) : $cells;
}
$output = '<h2 class="title">' . t('Role-profile assignments') . '</h2>';
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => $attributes,
));
drupal_add_tabledrag('tinybrowser-table', 'order', 'sibling', 'tinybrowser-weight');
$output .= '<div class="form-item"><div class="description">' . t('Assign profiles to user roles.') . ' ' . $info . '</div></div>';
$output .= drupal_render($form['common']);
$output .= drupal_render_children($form);
return $output;
}