You are here

function cas_attributes_list in CAS Attributes 6.3

Same name and namespace in other branches
  1. 7 cas_attributes.admin.inc \cas_attributes_list()

Lists available CAS Attributes.

1 string reference to 'cas_attributes_list'
cas_attributes_menu in ./cas_attributes.module
Implements hook_menu().

File

./cas_attributes.admin.inc, line 133
Provides settings pages for the CAS Attributes module.

Code

function cas_attributes_list() {
  cas_phpcas_load();
  cas_phpcas_init();
  phpCAS::forceAuthentication();
  $attributes = phpCAS::getAttributes();
  $header = array(
    'Token',
    'Value',
  );
  $rows = array();
  foreach ($attributes as $attribute => $value) {
    if (is_array($value)) {
      $value = $value[0];
    }
    $rows[] = array(
      t('[cas-attribute-@attribute]', array(
        '@attribute' => drupal_strtolower($attribute),
      )),
      check_plain($value),
    );
  }
  if (empty($rows)) {
    $rows[] = array(
      'data' => array(
        array(
          'data' => t('No CAS attributes were returned by the CAS server.'),
          'colspan' => 2,
        ),
      ),
    );
  }
  return theme('table', $header, $rows);
}