Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Implementation of hook_date_views_fields().
- function civicrm_date_views_fields($field) {
- $values = array(
- // The type of date: DATE_UNIX, DATE_ISO, DATE_DATETIME.
- 'sql_type' => DATE_DATETIME,
- // Timezone handling options: 'none', 'site', 'date', 'utc'.
- 'tz_handling' => 'site',
- // Needed only for dates that use 'date' tz_handling.
- 'timezone_field' => '',
- // Needed only for dates that use 'date' tz_handling.
- 'offset_field' => '',
- // Array of "table.field" values for related fields that should be
- // loaded automatically in the Views SQL.
- 'related_fields' => array(),
- // Granularity of this date field's db data.
- 'granularity' => array('year', 'month', 'day', 'hour', 'minute', 'second'),
- );
- switch ($field) {
- case 'civicrm_event.start_date':
- case 'civicrm_event.end_date':
- case 'civicrm_event.registration_start_date':
- case 'civicrm_event.registration_end_date':
- case 'civicrm_mailing_job.scheduled_date':
- case 'civicrm_mailing_job.start_date':
- case 'civicrm_mailing_job.end_date':
- case 'civicrm_activity.activity_date_time':
- case 'civicrm_campaign.start_date':
- case 'civicrm_campaign.end_date':
- return $values;
- }
- }
- /**
- * Implement hook_date_api_tables().
- */
- function civicrm_date_views_tables() {
- return array('civicrm_mailing_job',
- 'civicrm_event',
- 'civicrm_activity',
- 'civicrm_campaign',);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement