You are here

function theme_mb_user_admin in More Buttons 7

Display the MB User settings form page.

Return value

The complete HTML formatted administer page.

File

mb_user/mb_user.admin.inc, line 60

Code

function theme_mb_user_admin($variables) {
  _mb_load_css('admin');
  $module = 'mb_user';
  $mappings = array();
  $output = '';
  $extra_info = '';
  $rows = array();
  $form = drupal_get_form($module . '_admin');
  $mappings = $form['#mappings'];
  $output = '<h3>' . t('User settings') . '</h3>';
  $output .= '<p>' . t('Which %module functions are used by different user pages.', array(
    '%module' => t('More Buttons User'),
  )) . '</p>';
  $header = array(
    t('Cancel'),
    t('Save and continue'),
    t('Save and create new'),
  );
  $i = 1;
  foreach ($mappings as $type => $maps) {

    // Provide own odd/even functionality.
    $evenodd = $i % 2 ? 'odd-mb' : 'even-mb';
    $evenodd = $i & 1 ? 'odd-mb' : 'even-mb';
    $rows[] = array(
      'data' => array(
        $maps['name'],
        array(
          'colspan' => 2,
        ),
      ),
      'class' => array(
        $evenodd . ' ' . $evenodd . '-type',
      ),
    );

    // The row contains the form elements.
    $rows[] = array(
      'data' => array(
        drupal_render($form[$module][$type][$module . '_cancel_' . $type]),
        drupal_render($form[$module][$type][$module . '_sac_' . $type]),
        drupal_render($form[$module][$type][$module . '_sacn_' . $type]),
      ),
      'class' => array(
        $evenodd . ' ' . $evenodd . '-elements',
      ),
    );
    unset($form[$module][$type]);
    ++$i;
  }
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'class' => array(
        'mb-admin-table',
        $module . '-admin-table',
      ),
    ),
  ));

  // Display additional informations.
  if ($extra_info != '') {
    $output .= $extra_info;
  }
  $output .= drupal_render($output);
  $output .= drupal_render_children($form);
  $output .= '<p style="text-align: right">' . t('Module development by <a href="@development-url">Quiptime Group</a>.', array(
    '@development-url' => url('http://www.quiptime.com'),
  )) . '</p>';
  return $output;
}