You are here

function regcode_roles_get_list_markup in Registration codes 7

Same name and namespace in other branches
  1. 6.2 regcode_roles/regcode_roles.module \regcode_roles_get_list_markup()
  2. 6 regcode_roles/regcode_roles.module \regcode_roles_get_list_markup()
  3. 7.2 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 124
Main functionality of regcode_role module.

Code

function regcode_roles_get_list_markup() {
  $headings = array(
    t('Rule #'),
    t('Tag #'),
    t('Tag'),
    t('Role'),
  );

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

  // Add actions.
  foreach ($rows as &$row) {
    $row = array_map('check_plain', $row);
    if (!empty($row['expire_date'])) {
      $row['expire_date'] = format_date($row['expire_date'], 'short');
    }
    $row['action'] = l(t('Remove'), 'admin/config/people/regcode/roles/delete/' . $row['id'], array(
      'query' => array(
        'token' => drupal_get_token($row['id']),
      ),
    ));
  }
  return theme('table', array(
    'header' => $headings,
    'rows' => $rows,
  ));
}