Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-36568

calendar: allow export of more than 60 days (for ex. one full school year)

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.2.6, 2.3.3
    • Calendar
    • None
    • MOODLE_22_STABLE, MOODLE_23_STABLE

      The export function of the calendar in limited to 60 days.
      I would be nice to extend this limitation to one full year at least.

      See https://moodle.org/mod/forum/discuss.php?d=119125 for how to do this:

      I was requested to do this too, so I decided to figure out properly how to do it. So here's what I did:

      ./lang/en_utf8/calendar.php
      $string['recentforever'] = 'Forever';

      Added into the language strings, I put it just above recentupcoming (the 60 day one) just to maintain the alphabetical nature.

      ./calendar/export_basic.php
      LINE22: <input type="radio" name="preset_time" id="pt_recfvr" value="recentforever" /><label for="pt_recupc"><?php print_string('recentforever', 'calendar'); ?></label><br />

      This is added, the new radio that's going to let us select "forever" as an option.
      LINE47: } else if (document.getElementById("pt_recupc").checked)

      { preset_time = "recentupcoming"; }

      else

      { preset_time = "recentforever"; }

      Line 47 is edited from being an "else" to an "else if" and our new "forever" option is added as being the else. This is the portion of the code that generates the export url.

      ./calendar/export_execute.php
      LINE32: $allowed_time = array('weeknow', 'weeknext', 'monthnow', 'monthnext', 'recentupcoming', 'recentforever');

      Add our "forever" to the allowed times to export array- otherwise it will fail.
      LINE110: case 'recentforever': //Events in the last 365 or next 365 days $timestart = time() - 31536000; $timeend = time() + 31536000; break;

      And finally, we define the length of "forever", which for my purposes is the previous 365 or next 365 days. This should be a sufficient length as even in a year round school this will outlast the duration of any full school year. Now students/teachers can look back on the full school year's worth of work on the last day of school, or forward to the end of the year from the first day of class.

            ankit_frenz Ankit Agarwal
            fvendrell Francis Vendrell
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.