You are here

commerce_registration.admin.inc in Commerce Registration 7.3

Commerce Registration admin page functions.

File

includes/commerce_registration.admin.inc
View source
<?php

/**
 * @file
 * Commerce Registration admin page functions.
 */

/**
 * Page callback that embeds the admin registrations view showing registrations
 * with a given status, or 'all'.
 */
function commerce_registration_admin_overview($status = 'all') {
  $view = views_get_view('commerce_registration_admin_registrations');
  if ($status != 'all') {

    // The view default is to show all registrations, so we need to set the
    // specific state filter to only show those registrations.
    $view->display['default']->display_options['filters']['state']['value'] = array(
      $status,
    );
  }
  return $view
    ->preview();
}
function commerce_registration_registration_settings_tab($entity_type, $entity) {
  $output = '';
  $fields = field_read_fields(array(
    'type' => 'commerce_product_reference',
  ));
  foreach ($fields as $field) {
    if (isset($entity->{$field['field_name']})) {
      foreach ($entity->{$field['field_name']} as $product) {
        $product = commerce_product_load($product[0]['product_id']);
        if ($type = registration_get_entity_registration_type('commerce_product', $product)) {
          if (user_access('administer registration') || user_access("administer {$type} registration")) {
            $output .= registration_registrations_page('commerce_product', $product);
          }
        }
      }
    }
  }
  if (commerce_registration_registration_field_instance($entity_type, $entity) && ($type = registration_get_entity_registration_type($entity_type, $entity))) {
    if (user_access('administer registration') || user_access("administer {$type} registration")) {
      $output .= registration_registrations_page($entity_type, $entity);
    }
  }
  return $output;
}

Functions

Namesort descending Description
commerce_registration_admin_overview Page callback that embeds the admin registrations view showing registrations with a given status, or 'all'.
commerce_registration_registration_settings_tab