You are here

function password_policy_admin_view in Password Policy 6

Same name and namespace in other branches
  1. 7 password_policy.admin.inc \password_policy_admin_view()

The default view for the password policy.

1 string reference to 'password_policy_admin_view'
password_policy_menu in ./password_policy.module
Implements hook_menu().

File

./password_policy.admin.inc, line 184
Admin page callback file for the password_policy module.

Code

function password_policy_admin_view($policy) {
  $output = check_plain($policy['description']);
  $header = array(
    t('Name'),
    t('Constraint'),
  );
  $rows = array();
  $roles = _password_policy_admin_list_roles($policy['pid']);
  if (!empty($roles)) {
    $rows[] = array(
      t('Roles'),
      theme('item_list', $roles),
    );
  }
  if (!empty($policy['expiration'])) {
    $rows[] = array(
      t('Expiration'),
      $policy['expiration'],
    );
  }
  if (!empty($policy['warning'])) {
    $rows[] = array(
      t('Warning'),
      check_plain($policy['warning']),
    );
  }
  foreach ($policy['policy'] as $key => $val) {
    $desc = _password_policy_constraint_description($key);
    $rows[] = array(
      $desc['name'],
      $val,
    );
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No policies defined.'),
        'colspan' => 2,
      ),
    );
  }
  $output .= theme('table', $header, $rows);
  return $output;
}