You are here

class cas_handler_field_cas_name in CAS 6.3

Same name and namespace in other branches
  1. 7 includes/views/handlers/cas_handler_field_cas_name.inc \cas_handler_field_cas_name

Field handler to provide a list of CAS user names.

Hierarchy

Expanded class hierarchy of cas_handler_field_cas_name

1 string reference to 'cas_handler_field_cas_name'
cas_views_data in includes/views/cas.views.inc
@file Expose CAS user name to views.

File

includes/views/handlers/cas_handler_field_cas_name.inc, line 11
Field handler to provide a list of CAS user names.

View source
class cas_handler_field_cas_name extends views_handler_field_prerender_list {
  function construct() {
    parent::construct();
    $this->additional_fields['uid'] = array(
      'table' => 'users',
      'field' => 'uid',
    );
  }
  function query() {
    $this
      ->add_additional_fields();
    $this->field_alias = $this->aliases['uid'];
  }
  function pre_render($values) {
    $uids = array();
    $this->items = array();
    foreach ($values as $result) {
      $uids[] = $result->{$this->aliases['uid']};
    }
    if ($uids) {
      $result = db_query("SELECT aid, uid, cas_name FROM {cas_user} WHERE uid IN (" . implode(', ', $uids) . ")");
      while ($cas_user = db_fetch_object($result)) {
        $this->items[$cas_user->uid][$cas_user->aid]['cas_name'] = check_plain($cas_user->cas_name);
      }
    }
  }
  function render_item($count, $item) {
    return $item['cas_name'];
  }

}

Members