You are here

function _signup_date_admin_sql in Signup 5.2

Same name and namespace in other branches
  1. 6.2 includes/date.inc \_signup_date_admin_sql()
  2. 6 includes/date.inc \_signup_date_admin_sql()

Return value

Array of SQL clauses for admin overview page query builder.

1 call to _signup_date_admin_sql()
signup_admin_sql in includes/scheduler.inc

File

includes/date.inc, line 14
Shared code required for any site using CCK date fields, regardless of the version of date in use.

Code

function _signup_date_admin_sql($content_type) {

  // Get the date field information for this content type.
  $field = signup_date_field($content_type);

  // In the case where the same CCK date field is being reused on multiple
  // content types, we'll potentially be JOINing on the same tables and
  // columns for different content types.  To defend against duplicate table
  // names or ambiguous columns in the query, use the content type to alias.
  $alias = db_escape_table($content_type);

  // See what fields to SELECT.
  $fields[] = $alias . '.' . $field['database']['columns']['value']['column'];
  if (isset($field['database']['columns']['timezone']['column'])) {
    $fields[] = $alias . '.' . $field['database']['columns']['timezone']['column'];
  }

  // We need to quote the alias in case someone used a reserved word for the
  // machine-readable name of a content type.
  $table = '{' . $field['database']['table'] . '} `' . $alias . '`';
  return array(
    'fields' => $fields,
    'joins' => array(
      "LEFT JOIN {$table} ON {$alias}.vid = n.vid",
    ),
  );
}