function _signup_date_admin_query in Signup 7
Alters the SQL query for the admin overview page.
Parameters
object $query: The database query object.
string $content_type: A string containing the content type of the node.
1 call to _signup_date_admin_query()
- signup_admin_query in includes/
scheduler.inc - Helper function to build the database query for the admin overview page.
File
- includes/
date.inc, line 424 - Code to support using CCK date fields for time-based signup functionality.
Code
function _signup_date_admin_query(&$query, $content_type) {
// Get the date field information for this content type.
$field = signup_date_field($content_type);
// In the case where the same 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.
// Also, prefix it to make sure it's never a reserved word.
$alias = 'signup_alias_' . db_escape_table($content_type);
$table = $field['database']['table'];
$date = $field['field_name'] . '_value';
$query
->leftJoin($table, $alias, $alias . '.revision_id = n.vid');
$query
->addField($alias, $date, $date);
$query
->groupBy($date);
if (isset($field['columns']['timezone'])) {
$timezone = $field['field_name'] . '_timezone';
$query
->addField($alias, $timezone, $timezone);
$query
->groupBy($timezone);
}
}