You are here

function regcode_get_fields in Registration codes 5.3

Same name and namespace in other branches
  1. 6.2 regcode.module \regcode_get_fields()
  2. 6 regcode.api.php \regcode_get_fields()
  3. 7.2 regcode.module \regcode_get_fields()
  4. 7 regcode.module \regcode_get_fields()

Get the list of regcode db fields as key/title pairs

Parameters

$include_related: Whether to include foreign key field from related tables used by regcode queries

$translated: Whether to return translated titles

Return value

An array list of field name/title pairs

5 calls to regcode_get_fields()
regcode_admin_import_submit in ./regcode_admin.inc.php
Handle the processing of a submitted import form
regcode_admin_list in ./regcode_admin.inc.php
Return the code list page content with(in) the according filter form
regcode_form_add_codetemplate in ./regcode_admin.inc.php
Add the fieldset for code template to a given form
regcode_get_codes in ./regcode_api.inc.php
Return the database query result for the given options to list codes
regcode_get_field_key in ./regcode_api.inc.php
Get the key of a given field name (redundant) or title This function is quite stupid, but is necessary to compensate a bug in Drupal for correctly retrieving a column key from table sorting querystring-argument "order", which is wrongfully…

File

./regcode_api.inc.php, line 234
regcode_api.inc.php contains general low-level functions for the registration-code module, for tasks like

Code

function regcode_get_fields($include_related = FALSE, $translated = FALSE) {
  $fields = array(
    'c.code' => 'Code',
    'c.available' => 'Available',
    'c.reuse' => 'Reuse',
    'c.uid' => 'User ID',
    'c.rid' => 'Role ID',
    'c.created' => 'Created',
    'c.used' => 'Used',
    'c.expire' => 'Expire',
    'c.revoke' => 'Revoke',
    'c.info' => 'Info',
  );

  // optionally include related fields from other tables for db filtering etc.
  if ($include_related) {
    $fields['r.name'] = 'Role';
    $fields['u.name'] = 'User';
  }
  if ($translated) {
    foreach ($fields as $field_name => $field_title) {
      $fields[$field_name] = t($field_title);
    }
  }
  return $fields;
}