You are here

function regcode_roles_get_list_markup in Registration codes 6

Same name and namespace in other branches
  1. 6.2 regcode_roles/regcode_roles.module \regcode_roles_get_list_markup()
  2. 7.2 regcode_roles/regcode_roles.module \regcode_roles_get_list_markup()
  3. 7 regcode_roles/regcode_roles.module \regcode_roles_get_list_markup()

Return the formatted HTML list

1 call to regcode_roles_get_list_markup()
regcode_roles_admin in regcode_roles/regcode_roles.module
Admin page for role assignment

File

regcode_roles/regcode_roles.module, line 122

Code

function regcode_roles_get_list_markup() {
  $headings = array(
    t('ID'),
    t('Category'),
    t('Role ID'),
    t('Role'),
  );

  // Display expire rules
  if (module_exists('role_expire')) {
    $headings[] = t('Expire date');
    $headings[] = t('Expire duration');
  }
  $headings[] = t('Actions');
  $rows = regcode_roles_get_rules();

  // Add actions
  foreach ($rows as &$row) {
    $row = array_map('check_plain', $row);
    if ($row['expire_date']) {
      $row['expire_date'] = format_date($row['expire_date'], 'small');
    }
    $row['action'] = l('Remove', 'admin/user/regcodes/roles/delete/' . $row['id'], array(
      'query' => array(
        'token' => drupal_get_token($row['id']),
      ),
    ));
  }
  return theme('table', $headings, $rows);
}