You are here

function role_expire_handler_field_rid::pre_render in Role Expire 7

Run before any fields are rendered.

This gives the handlers some time to set up before any handler has been rendered.

Parameters

array $values: An array of all objects returned from the query.

Overrides views_handler_field::pre_render

File

./role_expire.views.inc, line 425
Role Expire Views hooks

Class

role_expire_handler_field_rid
Class role_expire_handler_field_rid.

Code

function pre_render(&$values) {
  $uids = array();
  $this->items = array();
  foreach ($values as $result) {
    $uids[] = $this
      ->get_value($result, NULL, TRUE);
  }
  if ($uids) {
    $result = db_query("SELECT e.uid, e.rid, e.expiry_timestamp, r.name FROM {role_expire} e INNER JOIN {role} r ON r.rid = e.rid WHERE e.uid IN (:uids) ORDER BY r.name", array(
      ':uids' => $uids,
    ));
    foreach ($result as $role) {
      $this->items[$role->uid][$role->rid]['role'] = check_plain($role->name);
      $this->items[$role->uid][$role->rid]['rid'] = $role->rid;
    }
  }
}