You are here

function theme_uc_roles_expiration in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_roles/uc_roles.admin.inc \theme_uc_roles_expiration()
  2. 7.3 uc_roles/uc_roles.admin.inc \theme_uc_roles_expiration()

Theme user role expiration page

File

uc_roles/uc_roles.module, line 506
Grants roles upon accepted payment of products

Code

function theme_uc_roles_expiration($form) {
  $header = array(
    array(
      'data' => t('Username'),
      'field' => 'u.name',
    ),
    array(
      'data' => t('Role'),
      'field' => 'e.rid',
    ),
    array(
      'data' => t('Expiration date'),
      'field' => 'e.expiration',
      'sort' => 'asc',
    ),
    t('Operations'),
  );
  if (isset($form['name']) && is_array($form['name'])) {
    foreach (element_children($form['name']) as $key) {
      $rows[] = array(
        drupal_render($form['name'][$key]),
        drupal_render($form['role'][$key]),
        drupal_render($form['expiration'][$key]),
        drupal_render($form['operations'][$key]),
      );
    }
  }
  else {
    $rows[] = array(
      array(
        'data' => t('No expirations set to occur'),
        'colspan' => '4',
      ),
    );
  }
  $output .= theme('table', $header, $rows);
  if ($form['pager']['#value']) {
    $output .= drupal_render($form['pager']);
  }
  $output .= drupal_render($form);
  return $output;
}