Restriction by relative date

Availability restriction ::: availability_relativedate
Maintained by RenaatRenaat Debleu
Restrict module and section access based on a relative date.
Latest release:
1458 sites
665 downloads
52 fans
Current versions available: 6

Relative dates are experimental since Moodle 3.8 but are only implemented in the Assignment activity and the Weekly course format. If you want to use relative dates in other parts of a course, you can use this plugin.

This availability condition makes it easy to show modules or sections only x minutes/hours/days/weeks/months

  • before/after course start date
  • before/after course end date
  • after user enrolment date
  • after enrolment method end date
  • after the completion of an activity

Using Restriction sets, it is easy to make a resource available for a limited relative time.

Check the global documentation about availability conditions : https://docs.moodle.org/en/Conditional_activities_settings

Installation:

  1. Unpack the zip file into the availability/condition/ directory. A new directory will be created called relativedate.
  2. Go to Site administration > Notifications to complete the plugin installation.

github  coverage

 
 
 
 

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2

Contributors

Renaat
Renaat Debleu (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Comments

  • Renaat
    Fri, 20 Nov 2020, 11:05 PM
    Hi Antonio, you can change the 52 in something else, but then you need to rebuild the YUI modules before it will appear in your platform, see https://docs.moodle.org/dev/YUI
  • Antonio Dégas
    Sat, 21 Nov 2020, 2:46 AM
    tks so much
  • Armin Trommer
    Tue, 5 Jan 2021, 11:32 PM
    Hi Renaat. We are using your plugin in some courses where the users are enrolled via 2 enrolment methods. The restriction by date should refer to the original enrolment date, but it seems to take the latest date. Is this the way how it should work from your side or are there any plans to take the original enrolment date in a future version? Thanks a lot!
  • Renaat
    Wed, 6 Jan 2021, 3:05 AM
    Hi Armin,

    The functionality you used was reported as a bug in one of our projects, so the plugin was updated to take the most recent enrollment as a starting point. Luckily this project is Open Source, so you can create a fork and modify line 222 of the classes/condition.php file to "restore" this bug.

    R


  • Jean-Roch Meurisse
    Mon, 22 Feb 2021, 5:31 PM
    Hi Renaat,
    Thanks for your plugin!
    Teachers in my university ask me the following question... Could relative dates be linked to completion of another activity?
    Regards
  • Renaat
    Wed, 24 Feb 2021, 10:49 PM
    Hello Jean-Roch,

    THX for the feedback. You mean something like 3 days after completing quiz 4?
    Technically this seems possible to me. Although a lot of work would be needed to implement a cache for performance reasons.

    But for the moment I do not see a lot of extra value in this link to completion of another activity. Completing an activity would become more a punishment than a achievement....
    Can you provide some samples where this extra restriction could be used in a way students are encouraged instead of discouraged?

    Of course, currently you can already combine restrictions: Quiz 4 is completed AND 4 weeks after course start date.

    R
  • Alessandro Samuel-Rosa
    Fri, 16 July 2021, 11:16 PM
    This is a great plugin and I use it all the time. I am only missing one feature: availability until a relative date. For example, allow students to access a course activity until a given number of days before the course end date. The relative date could be the date of the final exam, when I want the students not to be able to see any of the previous activities. Currently I do this my hiding all previous activities, which is laboriuos and prone to error.
  • Renaat
    Sat, 17 July 2021, 5:16 PM
    Hello Alessandro,

    Did you try to use the "must not" setting? If I have a one year course, and I add an activity with the restriction: Student "must not" match the following "50 weeks after course start date", then students will be able to access the activity for 50 weeks, and the last 2 weeks the module will be restricted.

    R
  • Alessandro Samuel-Rosa
    Sat, 17 July 2021, 11:23 PM
    Hello Renaat,

    I think that the setting that you suggest would work only for fixed duration courses. It may seem odd, but in my university, the course duration varies from semester to semester. It generally is between 15 and 17 weeks. Due to the pandemic, this semester we have only 11 weeks. This is why I am looking for a restriction setting that is relative to the course end date.

    Please let me know if I have not been clear in my explanation.
  • Renaat
    Sun, 18 July 2021, 12:10 AM
    Hello Alessandro,

    This plugin already restricts on course enddate, But there has to be a course enddate, otherwise the module would never be available (0 minus 3 days = ∞ - 3 = ∞). Therefore the enddate condition is not even shown to teachers if the course end date is not set. So when you set a course end date, you can add a "2 days before course end date" condition.

    Is the moodlecourse | courseenddateenabled global configuaration setting enabled in your Moodle?

    R



  • Alessandro Samuel-Rosa
    Thu, 22 July 2021, 4:32 AM
    Hello Renaat,

    I have been able to achieve my goal by following your advice (using the "must not" setting). I initially got confused because of the message that appears below the section heading:

    Not available unless:

    From 5 July 2021, 12:00 (2 weeks after the course start date)
    From 29 August 2021, 11:59 (1 week before the course end date)

    Note that this section is available from the second week on till the penultimate course week. I think that I was expecting a message such as follows:

    Not available unless:

    From 5 July 2021, 12:00 (2 weeks after the course start date)
    Until 29 August 2021, 11:59 (1 week before the course end date)

    I am not sure if there is anything that you could do to improve this.
  • Sam Ben
    Mon, 22 Nov 2021, 3:46 AM
    Hello Renaat,

    Awsome plugin!

    How to add more than "51" in the select field. I need to go beyond 51 days in some cases.

    Thank you
  • Krishan Liyanaarachchi
    Fri, 26 Nov 2021, 11:51 PM
    Great plugin. You just saved my day smile
  • M Resch
    Fri, 10 Dec 2021, 1:30 AM
    Hey there,
    this seams to be exactly what i was looking for!

    I have one question though, is it possible to add the Option
    Make available after X days, since an other activity was availale?

    I wanted to have an option, where I have dependencies not from the Start Date but regarding an activity. As an Example:
    Acitity A is active beginning on the 12.March.
    Activity B is activer 7 days, after activity A.
    Thanks smile
  • Renaat
    Fri, 10 Dec 2021, 4:53 PM
    Hello M Resch,

    Your idea seems nice, but very complex. What do you mean by "is active beginning"? Because of some date setting - the visibility - an availabitlity restriction changed? If you add a user to another group, can also be a reason why someone sees other resources.

    Currently the plugin calculates course level dates, adding a calcullation on module level to pinpoint this 'active' date for every module will do no good for the performanc.

    R
Please login to post comments