Hi

My table rows in the day View display start with a cell which should contain the time start for that agenda slot. This is generated by these lines in the calendar-day.tpl.php template file :

      <td class="calendar-agenda-hour">
        <span class="calendar-hour"><?php print $hour['hour']; ?></span>
        <span class="calendar-ampm"><?php print $hour['ampm']; ?></span>
      </td>

Unfortunately the $hour['hour'] and $hour['ampm'] strings are empty on every line ( checked by dumping the variable ) so the cell remains defiantly empty too.

I have tried setting the Custom time grouping option. This successfully displays a row for empty time slots but again no time in the initial cell.

The top cell in the left hand column does correctly contain the words "All day".

Any pointers appreciated.

Cheers for a great module.

Comments

El Bandito’s picture

In fact there is no output in this column for the week view either and the function that seems to be responsible for creting these variables is 'theme_calendar_time_row_heading' in theme.inc.

As a PHP novice this looks complicated ......

El Bandito’s picture

In the function ''theme_calendar_time_row_heading' there is a line to setup the date format :

$format = variable_get('date_format_short', 'm/d/Y - H:i');

The code subsequently discards the non hour and minute parts of the date format. Problem is that on my site I have ( not unreasonably ) set the short date format to exclude the hours and minutes with the result that this function never manages to return anything.

Obviously an edge case but still a bug I guess.

nicl’s picture

I am encountering this bug for the week view (the hours on the left-hand-side are not displaying) for the same reason.

I see two possible solutions here:

1. Just implement a standard behaviour in the theme function (i.e. without trying to borrow from the site's existing date formats) - just use H:i, for example). It's a theme function so people can override it quite easily if the default is not to their liking.

2. Expose a config option in the views style plugin to control this. And then use this setting in the function.

In any case, trying to parse an unknown date function string to extract just the hour and time is not (in my opinion) a good idea.

Lastly, if we really do want to keep the current approach, we should just do:

3. After applying date_limit_format() in line 779 we should just do a quick check if it is empty. If so, we then default to H:i.

Thoughts ?

ps. if you encounter this problem, the simplest/quickest solution is to provide your own implementation of the theme function in your theme's template.php file.

bschnell’s picture

I had this happen to me as well. I had made a new date format in admin/config/regional/date-time this new 'Short date' type is what caused the left hand time column to go screwy. My new date type did not include a time formatter. Maybe this will help someone.

carolalind’s picture

Issue summary: View changes

#4 helped me! :)

I had set the short date to a format without a time formatter.

apaderno’s picture

Version: 6.x-2.4 » 6.x-2.x-dev
Status: Active » Closed (outdated)

I am closing this issue, since it's for a Drupal version no longer supported.