You are here

function imce_admin_theme in IMCE 7

Same name and namespace in other branches
  1. 6.2 inc/imce.admin.inc \imce_admin_theme()
  2. 6 inc/admin.inc \imce_admin_theme()

Admin form themed.

1 string reference to 'imce_admin_theme'
imce_theme in ./imce.module
Implements hook_theme().

File

inc/imce.admin.inc, line 177
Serves administration pages of IMCE.

Code

function imce_admin_theme($variables) {
  $form = $variables['form'];
  $profile1 = imce_user1_profile();
  $header = array(
    t('User role'),
  );
  $rows = array(
    array(
      t('Site maintenance account'),
    ),
  );
  $keys = array(
    'name',
  );

  // Add each stream wrapper as a column.
  $swrappers = file_get_stream_wrappers(STREAM_WRAPPERS_VISIBLE);
  foreach ($swrappers as $scheme => $info) {
    $header[] = l($info['name'], 'imce/' . $scheme);
    $rows[0][] = check_plain($profile1['name']);
    $keys[] = $scheme . '_pid';
  }

  // In case we need profile weights.
  $weight_info = '';
  if ($form['#weighted']) {
    $header[] = t('Weight');
    $rows[0][] = t('n/a');
    $keys[] = 'weight';
    $weight_info = t('For users who have <strong>multiple roles</strong>, the <strong>weight</strong> property will determine the assigned profile. Lighter roles that are placed upper will take the precedence. So, an administrator role should be placed over other roles by having a smaller weight, ie. -10.');
  }
  foreach (element_children($form['roles']) as $rid) {
    $cells = array();
    foreach ($keys as $key) {
      $cells[] = drupal_render($form['roles'][$rid][$key]);
    }
    $rows[] = $cells;
  }
  $output = '<h2 class="title">' . t('Role-profile assignments') . '</h2>';
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  $output .= '<div class="form-item"><div class="description">' . t('Assign profiles to user roles for available file systems. Your default file system is %name.', array(
    '%name' => $swrappers[variable_get('file_default_scheme', 'public')]['name'],
  )) . ' ' . $weight_info . '</div></div>';
  $output .= drupal_render($form['common']);
  $output .= drupal_render_children($form);
  return $output;
}