Limit access to a week in a course

Limit access to a week in a course

Matt Stocum -
回帖数:9
Is there a way to have Moodle block access to a week in a course until that week opens?

Ie, say there are 3 weeks

Week 1 runs from Feb 1 - Feb 7
Week 2 runs from Feb 8 - Feb 14
Week 3 runs from Feb 14 - Feb 21

On Feb 9th I want the students to be able to see everything from Week 1 and 2, but not anything in Week 3.  Is this possible?

Thanks
回复Matt Stocum

Re: Limit access to a week in a course

Art Lader -

Hi, Matt,

You could hide whatever you don't want the students to see. Turn on editing and click on the eye icon to hide a resource or a section.

Hope this helps,
Art

回复Art Lader

Re: Limit access to a week in a course

Matt Stocum -
Is there anyway to automate this?  It's hard enough getting our professors to make their own changes to a course.
回复Matt Stocum

Re: Limit access to a week in a course

Bernard Boucher -
Hi Matt and Art,

                       if you want to automate that process then Michael and his group has developped a block to do that here.

I hope it may help,

Bernard

回复Bernard Boucher

Re: Limit access to a week in a course

Matt Stocum -
Awesome.  I think that is exactly what I need.  Thank you.
回复Matt Stocum

Re: Limit access to a week in a course

Chardelle Busch -
Core developers的头像

Bonjour Bernard,

Ca va?  I have a question for you.  Michael's code looks like something I would really like to have, but, he says it makes the "eye" ineffective.  So, does that mean I wouldn't be able to use it in a course with your activity linking (since, of course, your code uses the eye to hide the linked activity)?  Have you tried his code?

Merci,

Chardelle

回复Chardelle Busch

Re: Limit access to a week in a course

Timothy Takemoto -

Bonjour Chardelle

If Michael's wonderful block does interfere with activity linking, and you only want to display up to the current week, rather than for any time period as is made possible by that block, then

then try changing the line

while ($weekdate < $course->enddate) {

to

while (($weekdate < $course->enddate) &&  (($weekdate <= $timenow) or  isadmin())) {

if you want administrators, but not teachers not to be able to see the end of the course, or

while (($weekdate < $course->enddate) &&  (($weekdate <= $timenow) or  isteacher($course->id))) {

if you want teachers but not students to be able to see to the end of the course.

in /course/format/weeks/format.php

The line seems to be on line 129 these days.

Original forum disucssion, to which you contributed and Michael announced his module:
http://moodle.org/mod/forum/discuss.php?d=11380

Please hack with caution.

Timothy

回复Chardelle Busch

Re: Limit access to a week in a course

Michael Penney -
We plan to find a way to make the eye work normally in a course with the course program block installed. Right now it disables the eye tool, however we'd like to get it working so that clicking the eye would reset the hide or show time for the topic/week or item.

I'm not sure how it would work with activity linking--trying to think how a course would work with both gets me a bit confused anywaythoughtful.
回复Chardelle Busch

Re: Limit access to a week in a course

Bernard Boucher -
Bonjour Chardelle, Timothy, Michael et les autres,

Michael block and activities linking share 2 files:

moodle/course/format/weeks/format.php

moodle/course/format/topics/format.php

I didn't try itblush but if you replace print_section by print_section_link in Michael files then it should works.

The use of the eye is not supposed to affect activities linking if it is done at the topic or week level: currently if you hide an entire section or week you should not loose your activities linking.

For those, like you Chardelle, who use activities linking, you have an other option to block access to a week in a course until that week opens:
the last version of activities linking incorporate regulate rights which do exactly that using Jon calendar instead of a new block. You even have control at the group level and at the minute precision if you desire!

I hope it may help,

Bernard

回复Bernard Boucher

Re: Limit access to a week in a course

Chardelle Busch -
Core developers的头像

Thanks for the replies guys, you are so greatkiss.

I think I'll hold off on experimenting until 1.5 beta, then I'm planning on doing a lot of testing of old code hacks, etc.  When you post your updated block for 1.5, I'd love to try it out, Michael.  Then, maybe we can see if we can get it to work with Bernard's activity linking.

Chardelle