Moodle
  1. Moodle
  2. MDL-14837

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9, 2.1.4, 2.2.1, 2.3
    • Fix Version/s: 2.1.5, 2.2.2
    • Component/s: Calendar
    • Labels:
    • Environment:
      Debian 'etch', PHP 5.2, MySQL 5
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      1) Login with permissions to create an event
      2) Add a new event to the calendar with a start time greater than your current datetime
      3) Ensure that the option of no duration is selected
      4) Create the event
      5) Click the date of the event you created in the mini calendar to arrive at the daily agenda view for the calendar
      6) Note that the header area of the single event (the area with the title of the event) does not display the time on the right-hand side.
      7) Apply patch
      8) Repeat steps 1-5
      9) Note the existence of the start time in the right-hand side of the header section for the single event.

      Show
      1) Login with permissions to create an event 2) Add a new event to the calendar with a start time greater than your current datetime 3) Ensure that the option of no duration is selected 4) Create the event 5) Click the date of the event you created in the mini calendar to arrive at the daily agenda view for the calendar 6) Note that the header area of the single event (the area with the title of the event) does not display the time on the right-hand side. 7) Apply patch 8) Repeat steps 1-5 9) Note the existence of the start time in the right-hand side of the header section for the single event.
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-14837_show-time-on-no-duration-events

      Description

      When a calendar event is set as having no duration, the start time is not displayed on the day view.

        Gliffy Diagrams

        1. MDL-14837.diff
          0.9 kB
          Glenn Ansley
        2. MDL-14837-2.diff
          0.9 kB
          Glenn Ansley
        1. block_calendar.png
          19 kB
        2. Image 3.png
          14 kB

          Issue Links

            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.
            Hide
            Glenn Ansley added a comment -

            Changed pull repo, removed 1.9, 2.0 branches, updated 2.1, 2.2, master branches. Added testing instructions

            Show
            Glenn Ansley added a comment - Changed pull repo, removed 1.9, 2.0 branches, updated 2.1, 2.2, master branches. Added testing instructions
            Hide
            Dan Poltawski added a comment -

            Looks good to me thanks a lot - submitting for integration!

            Show
            Dan Poltawski added a comment - Looks good to me thanks a lot - submitting for integration!
            Hide
            Aparup Banerjee added a comment -

            Thanks , thats been integrated and is ready for testing.

            Show
            Aparup Banerjee added a comment - Thanks , thats been integrated and is ready for testing.
            Hide
            Ankit Agarwal added a comment -

            Looks good.
            Passing.
            Thanks

            Show
            Ankit Agarwal added a comment - Looks good. Passing. Thanks
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Well,

            I wish I said it every time
            you do the things you do.
            You always lend a helping hand,
            and I'm filled with gratitude.

            You are strong and generous
            for each and everyone one of us.
            I am eternally grateful,
            I cannot say thanks enough.

            Sorry for the (un)cool bit above, lol. Closing this as fixed. Ciao

            Show
            Eloy Lafuente (stronk7) added a comment - Well, I wish I said it every time you do the things you do. You always lend a helping hand, and I'm filled with gratitude. You are strong and generous for each and everyone one of us. I am eternally grateful, I cannot say thanks enough. Sorry for the (un)cool bit above, lol. Closing this as fixed. Ciao

              People

              • Votes:
                9 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: