Moodle

Time not displayed in event (calendar and upcoming event block)

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9, 2.1, 2.2
  • Fix Version/s: None
  • Component/s: Calendar
  • Labels:
    None
  • Environment:
    Debian 'etch', PHP 5.2, MySQL 5

Description

Since today's 1.9+ cvs update on our server, as shown on the attached pictures, event date doesn't display time anymore in calendar and upcoming event block. That's a big problem for users.

  1. MDL-14837.diff
    15/Mar/11 10:20 PM
    0.9 kB
    Glenn Ansley
  2. MDL-14837-2.diff
    15/Mar/11 10:39 PM
    0.9 kB
    Glenn Ansley
  1. block_calendar.png
    19 kB
    15/May/08 1:09 AM
  2. Image 3.png
    14 kB
    15/May/08 5:38 AM

Activity

Hide
Nicolas added a comment -

I changed line 1515 of file calendar/lib.php (function "calendar_format_event_time") to the two following lines :

$time = calendar_time_representation($event->timestart);
$eventtime = calendar_get_link_tag($day, CALENDAR_URL.'view.php?view=day'.$morehref.'&', $startdate['mday'], $startdate['mon'], $startdate['year']).', '.trim($time);

Now it works as I expected.

Show
Nicolas added a comment - I changed line 1515 of file calendar/lib.php (function "calendar_format_event_time") to the two following lines : $time = calendar_time_representation($event->timestart); $eventtime = calendar_get_link_tag($day, CALENDAR_URL.'view.php?view=day'.$morehref.'&', $startdate['mday'], $startdate['mon'], $startdate['year']).', '.trim($time); Now it works as I expected.
Hide
Stephen Digby added a comment -

hack does not seem to work for me in latest version of moodle.
Alternative hack to force duration entry on all events:

<!-- Removed by Stephen Digby to ensure all events have a duration. As a bug in calendar doe not show start times for events with no duration
<div>
<input type="radio" name="duration" value="0" id="duration_none" <?php if($form->duration == 0) echo 'checked="checked"'; ?>/>
<label for="duration_none"><?php print_string('durationnone', 'calendar'); ?></label>
</div>
-->

<div>
<!-- Add checked at end of radio button to force the option to be checked for all new events -->
<input type="radio" name="duration" value="2" id="duration_minutes" <?php if($form->duration == 2) echo 'checked="checked"'; ?> checked />
<label for="duration_minutes"><?php print_string('durationminutes', 'calendar'); ?></label>
<input type="text" name="minutes" size="3" value="<?php p($form->minutes); ?>"/>
<?php if (isset($err['minutes'])) formerr($err['minutes']); ?>
</div>

<div>
<input type="radio" name="duration" value="1" id="duration_yes" <?php if($form->duration == 1) echo 'checked="checked"'; ?>/>
<label for="duration_yes"><?php print_string('durationuntil', 'calendar'); ?></label>
<?php print_date_selector('endday', 'endmon', 'endyr', $form->timestart + $form->timeduration);?>
<?php print_string('eventtime', 'calendar');?>
<?php print_time_selector('endhr', 'endmin', $form->timestart + $form->timeduration) ?>
<?php if (isset($err['timeduration'])) formerr($err['timeduration']); ?>
</div>

Show
Stephen Digby added a comment - hack does not seem to work for me in latest version of moodle. Alternative hack to force duration entry on all events: <!-- Removed by Stephen Digby to ensure all events have a duration. As a bug in calendar doe not show start times for events with no duration <div> <input type="radio" name="duration" value="0" id="duration_none" <?php if($form->duration == 0) echo 'checked="checked"'; ?>/> <label for="duration_none"><?php print_string('durationnone', 'calendar'); ?></label> </div> --> <div> <!-- Add checked at end of radio button to force the option to be checked for all new events --> <input type="radio" name="duration" value="2" id="duration_minutes" <?php if($form->duration == 2) echo 'checked="checked"'; ?> checked /> <label for="duration_minutes"><?php print_string('durationminutes', 'calendar'); ?></label> <input type="text" name="minutes" size="3" value="<?php p($form->minutes); ?>"/> <?php if (isset($err['minutes'])) formerr($err['minutes']); ?> </div> <div> <input type="radio" name="duration" value="1" id="duration_yes" <?php if($form->duration == 1) echo 'checked="checked"'; ?>/> <label for="duration_yes"><?php print_string('durationuntil', 'calendar'); ?></label> <?php print_date_selector('endday', 'endmon', 'endyr', $form->timestart + $form->timeduration);?> <?php print_string('eventtime', 'calendar');?> <?php print_time_selector('endhr', 'endmin', $form->timestart + $form->timeduration) ?> <?php if (isset($err['timeduration'])) formerr($err['timeduration']); ?> </div>
Hide
Glenn Ansley added a comment -

In the event people are still looking for a resolution to this, I have created a patch for the latest stable of 1.9. The diff is not based on either of the above solutions but I think it solves the problem well. Please let me know if you have any questions or catch any errors in my code. I'll post a Git branch as well shortly.

Show
Glenn Ansley added a comment - In the event people are still looking for a resolution to this, I have created a patch for the latest stable of 1.9. The diff is not based on either of the above solutions but I think it solves the problem well. Please let me know if you have any questions or catch any errors in my code. I'll post a Git branch as well shortly.
Hide
Glenn Ansley added a comment -

MDL-14837-2.diff replaces a rogue tab with the equivalent in spaces for the purists

Show
Glenn Ansley added a comment - MDL-14837-2.diff replaces a rogue tab with the equivalent in spaces for the purists
Hide
Glenn Ansley added a comment -

Ok. Last comment for now. Sorry about all the traffic. Here's the github commit:
https://github.com/glennansley/moodle/commit/0a909e041cd83f59a2c9076ed20169275ca58e11

Show
Glenn Ansley added a comment - Ok. Last comment for now. Sorry about all the traffic. Here's the github commit: https://github.com/glennansley/moodle/commit/0a909e041cd83f59a2c9076ed20169275ca58e11
Hide
Glenn Ansley added a comment -

This small patch displays the time of an event on the calendar items correctly. Currently, if an event has no duration, there is nowhere other than the create / edit event screen to see what time is starts.

I think I did the Git part correctly this round. If not, please let me know.

Show
Glenn Ansley added a comment - This small patch displays the time of an event on the calendar items correctly. Currently, if an event has no duration, there is nowhere other than the create / edit event screen to see what time is starts. I think I did the Git part correctly this round. If not, please let me know.

People

Vote (9)
Watch (9)

Dates

  • Created:
    Updated: