I created a view that displays the start time of events together. The start time seems to ignore the time zone of the event (all times are 2 hours too early since we're in the +2 h time zone Europe/Berlin). Any hints? I'm using the latest version of the event views module from the CVS (1.1.2.3).

There are also error messages in the error log that came up while creating the view

‚You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT(node.nid) = event.nid WHERE (node.status = '1') AND (n query: SELECT count(DISTINCT(MONTH(from_UNIXTIME(event.event_start)))) FROM node node LEFT JOIN event event ON DISTINCT(node.nid) = event.nid WHERE (node.status = '1') AND (node.type IN ('content-veranstaltung')) AND (YEAR(from_UNIXTIME(event.event_start)) = 2006) ‘ in ‚/pathtoserver/public_html/drupal/includes/database.mysql.inc‘ in Zeile 120.

and

‚Unknown table 'event_views' in order clause query: SELECT DISTINCT(node.nid), event.event_start AS event_event_start, node.title AS node_title, node.changed AS node_changed, event.event_start AS calendar_start FROM node node LEFT JOIN event event ON node.nid = event.nid WHERE (node.type IN ('content-veranstaltung')) ORDER BY event_views.calendar_start ASC LIMIT 0, 30‘ in ‚/pathtoserver/public_html/drupal/includes/database.mysql.inc‘ in Zeile 120.

I don't use any active access control.

Comments

KarenS’s picture

The calendar start and calendar end filters are for displaying non-events in a calendar view. Are you maybe trying to put it in some other kind of view? I didn't add in any code to prevent you from doing that (might not even be possible), but I put info on the filter to explain it. Anyway it might be that combo that is causing the problem. If so, I may need to find a better way to either prevent that from happening or get something useful to display if it does.

Can you export your view and paste it here?

markusH’s picture

I created a new content type using cck (content-veranstaltung) that is displayed in the event calendar. The view is planned to display a flat list of date/time and event title from there (table view). At the moment the view just accesses the event_start field. The "calendar start" just gives me a 1970 date for all (content-veranstaltung) events.

Here's the view:

$view = new stdClass();
  $view->name = 'Veranstaltungen';
  $view->description = 'Liste der Veranstaltungen';
  $view->access = array (
  0 => '1',
  1 => '2',
);
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = 'Veranstaltungen';
  $view->page_header = 'Diese Ansicht bietet  eine alphabetische Liste der Veranstaltungen. Eine kalendarische Ansicht erhalten Sie rechts in der Navigation unter \"Nächste Veranstaltungen\" bzw. dem \"Weiter\"-Link.';
  $view->page_header_format = '4';
  $view->page_footer = '';
  $view->page_footer_format = '4';
  $view->page_empty = '';
  $view->page_empty_format = '4';
  $view->page_type = 'table';
  $view->url = 'Veranstaltungen';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '30';
  $view->sort = array (
  );
  $view->argument = array (
  );
  $view->field = array (
    array (
      'tablename' => 'event',
      'field' => 'event_start',
      'label' => 'Datum',
      'handler' => 'views_handler_field_date_small',
      'sortable' => '1',
      'defaultsort' => 'DESC',
    ),
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => 'Titel der Veranstaltung',
      'handler' => 'views_handler_field_nodelink_with_mark',
      'sortable' => '1',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'content-veranstaltung',
),
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(event, node);
  $views[$view->name] = $view;

Hope this helps...

merlinofchaos’s picture

Damn, this is Yet Another case of the node_access screwing things up. You can always tell by looking at the query. If you see LEFT JOIN DISTINCT(node.nid) = ... then node_access has rewritten the query wrong. Sigh.

Makes...me...crazy.

mgrant’s picture

I would like to try to make a work-around handler that gives me the raw date and I will call the php date function myself and create the output string. Can someone please help me get started?

mgrant’s picture

After some trial and error, I managed to figure out a work around.

1) create a function like this in your themes/whatever/template.php:

function phptemplate_views_handle_field_event_event_start($fields, $field, $data) {
  // get the timezone list so you can turn the timezone number into text
  include_once(EVENT_PATH .'/event_timezones.inc');
  $zones = event_zonelist();

  // turn timezone into text
  $timezone = $data->event_timezone;
  $text_timezone = $zones[$timezone];

  // return the start date formatted with the php date function
  // followed by the text representation of the timezone
  return (date("M j, Y, g:i a", $data->event_event_start)." ".$text_timezone);
}

2) now, if you want the timezone above like I wanted, you also need to add the timezone field to the view. Edit your view, in the Fields list, find Event:Timezone and click Add Field and save your view.

3) you may notice now that the timezone displays as a number in your list view along with the date and textual timezone you printed above. You now need to turn off or hide that field you made your view display. You can either find the css associated with this field and add display:none to it to turn it off, or you can use the theme wizard to create a theme for your view, then simply edit out the timezone field from the output.

shanefjordan’s picture

Version: » 5.x-2.x-dev

This does not fix the time displaying, it only adds the timezone. My dates/times are still displaying off by the timezone amount. How can I calculate the amount of time and add it to the date so that way I display the correct date/time?

wintervanilla’s picture

@ merlinofchaos

Do you recommend abandoning hope that event-views is going to be able to handle outputting times based on site timezones for d6? I've seen elsewhere a migration script for moving from Event to the Date/Time module with CCK date fields: http://pingvision.com/blog/alasda/2008/drupal-upgrade-tip-converting-eve...

Alternatively, is there a simple way to ask views to add 2 hours to the output of the event_start field? I'm happy to keep limping along with the event module for as long as possible.

Thanks in advance!