You are here

function redhen_registration_page in RedHen CRM 7

Return a list of registrations for a given contact.

Parameters

RedhenContact $contact:

Return value

array

1 string reference to 'redhen_registration_page'
redhen_registration_menu in modules/redhen_registration/redhen_registration.module
Implements hook_menu().

File

modules/redhen_registration/redhen_registration.module, line 35
Module file for RedHen Registration.

Code

function redhen_registration_page(RedhenContact $contact) {
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'registration');
  $query
    ->propertyCondition('registrant_id', $contact
    ->identifier(), '=');
  $result = $query
    ->execute();

  // Setup the header for both the query and table:
  $header = array(
    'type' => array(
      'field' => 'type',
      'type' => 'property',
      'data' => 'Type',
      'specifier' => 'type',
    ),
    'entity' => array(
      'data' => 'Parent Entity',
    ),
    'author' => array(
      'data' => 'Author',
    ),
    'count' => array(
      'field' => 'count',
      'type' => 'property',
      'data' => 'Count',
      'specifier' => 'count',
    ),
    'updated' => array(
      'field' => 'updated',
      'type' => 'property',
      'data' => 'Updated',
      'sort' => 'desc',
      'specifier' => 'updated',
    ),
    'Actions',
  );
  $registrations = array();
  if ($result) {
    $registrations = registration_load_multiple(array_keys($result['registration']));
  }
  return array(
    '#theme' => 'redhen_registration_list',
    '#registrations' => $registrations,
    '#header' => $header,
    '#contact' => $contact,
  );
}