General developer forum

Mass showing and hiding of courses within a category

 
 
Picture of James Henestofel
Mass showing and hiding of courses within a category
 

On our installation each term we have around 1500 courses that we cannot open to students until the day the term starts but needs to be open for instructors well before to prepare content.

I know that when you show and hide categories it can also show and hide courses within it but that doesn't always seem to work as some courses could be opened and closed by instructors and no longer be affected by the showing and hiding of courses.

I've built out the ability to accomplish showing or hiding all courses within a specific category.  See here http://tracker.moodle.org/browse/MDL-33781

I've added two more icons on the Add/Edit courses page that will allow showing or hiding all courses within that category.

Does anyone think this is useful.  If so please vote and maybe this could be added to core.

 
Average of ratings: -
Picture of Arnold Worsley
Re: Mass showing and hiding of courses within a category
 

This would be useful to me since we have hundreds of courses that need to be hidden from students until the first day of class.

What I really wish for though is something that Blackboard has always had. Immediately after midnight when a course's start date arrives, the course automatically becomes available to its students. An instructor could manually override this if their course wasn't going to be ready by then.

It is my belief that students should not be allowed to see a course they are enrolled in until the first day of class arrives. My only choice since we switched to Moodle has been to wait until the morning of the first day of class and then upload them all in a csv file.

 
Average of ratings: -
Picture of James Henestofel
Re: Mass showing and hiding of courses within a category
 

We also had Blackboard before going to Moodle and really liked being able to set the start dates for classes.  This really helps us out being able to hide from students.

Please visit the tracker and vote and maybe they can add this or something to accomplish this to the moodle core.

 
Average of ratings: -
Picture of Arnold Worsley
Re: Mass showing and hiding of courses within a category
 

Here's how I wish it could be done.

In "Edit course settings," under "Availability" a third choice would be added, "This course is not available to students until the course start date."

 
Average of ratings: -
Picture of sam marshall
Re: Mass showing and hiding of courses within a category
Group DevelopersGroup Particularly helpful MoodlersGroup Testers

Moodle supports dated enrolments - when you enrol somebody in a course you can set a start date for the enrolment. I think there is then something in cron which automatically makes an enrolment 'active' at the right time, or something like that - exactly like what you're saying Blackboard does.

We have this automated here, so I can't remember if it's possible/easy in the normal user interface, but anyhow, this is more flexible than dates for courses (for example we have different dates for tutors, who get to see the website a week or so early, and students; you couldn't do that with only one 'course' date; other institutions might have multiple cohorts using the same website and coming on/off at different times) and less tedious than showing/hiding things manually.

Or is there some problem with this that I have forgotten?

--sam

 
Average of ratings: -
Picture of James Henestofel
Re: Mass showing and hiding of courses within a category
 

Sam,

I know about how to set the start date by manually enrolling someone.  But at our institution we have around 1500 courses a term so our only option is to mass upload users.  As far as I understand there is no way to set the start date through that, but only the duration.  So our options are to only upload the day it starts or make all the courses available on the start date with my tool or by doing it one by one.

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Mass showing and hiding of courses within a category
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

If it is not supported, then it should be easy to add it.

Batch import code tends to be quite simple: Loop through the lines of data in the file, and call the applicable Moodle API to make the corresponding change.

The Moodle enrolement API supports start and end dates for enrolments, so it should not be too hard to add support to the file parsing code, if it is not there already. I am not familar with this part of the code, so I cannot say more.

 
Average of ratings: -
Picture of James Henestofel
Re: Mass showing and hiding of courses within a category
 

Tim,

I'm assuming you are talking about the Web Services API.  The main issue with that system by default is that everything is done by the items ID.  Unfortunately I don't have access to our installation or database and to accomplish using the ID's of users, courses, etc...  I would have to store all that in a local database when I create it, which my institution will not allow me to do.

I have created some API functions that will get items by the shortname or usernames but as above I can't add it to my installation or else this wouldn't be that big of a deal.

My only hope right now is for what I have proposed to be added to the core until I can ever get access.

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Mass showing and hiding of courses within a category
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

I was talking about "mass upload users", which is what your post that I was replying to was talking about.

 
Average of ratings: -
Picture of James Henestofel
Re: Mass showing and hiding of courses within a category
 

Tim,

Yea, your option is possible if I had access to the code but unfortunately I do not.

 
Average of ratings: -
Picture of nikhil pednekar
Re: Mass showing and hiding of courses within a category
 

Hi,

This would be helpful but i want it for category also means...is there der any solution or u built any ability for showing and hiding of Categories???

Please revert if any solution.

Thanks

 
Average of ratings: -
Picture of James Henestofel
Re: Mass showing and hiding of courses within a category
 

Nikhil,

If you aren't looking for showing and hiding courses at all.  Just change the code to change the visibility of the categories instead of the courses.

 
Average of ratings: -
Picture of nikhil pednekar
Re: Mass showing and hiding of courses within a category
 

Hi James,

I m very new to Moodle and I have been given task to hide categories to students for which they are not enrolled.

Means 'When a user is assigned to one or several cohort, he can see only course/categories of his cohorts'

Is this possible???

Please let me know.

 
Average of ratings: -
Rosario playing soccer
Re: Mass showing and hiding of courses within a category
 

I reengeneered my uploadusersandcourses.php and uploadusersandcourses_silently.php to be used in Moodle 2.3 last juliy/august and we are using it in production since then. (you may sarch for it in these forums)

It should be easy to downgrade my code to simply HIDE/SHOW courses and/or categories with the according Moodle API functions.

Unfortunaltely I am busy with reengeneering my sitenavigation block for Moodle 2 after having finished mycourses last week.

Rosario

 
Average of ratings: -
Picture of nikhil pednekar
Re: Mass showing and hiding of courses within a category
 

Thanks Rosario,

I will search for both u mentioned. Have you shown show/hide functionality in ur code???

First need to search.If any problem will let you know.

Thanks again.

 
Average of ratings: -
Rosario playing soccer
Re: Mass showing and hiding of courses within a category
 

It depends on what criterion you want to show/hide a category. Perhaps you have a look first at my sitenavigation block just finished for Moodle 2.3

If you are bothering about NAVIGATION matter, then you simply need a good block showing what ever you want to show/hide and you could take my sitenavigation code to do so.


But the original post here was to completely disable access either to courses you list in a CSV file or the categories they are in.

So the last is a completely different pair of shoes and needs a completely other approach. Whereas my sitenavigation block does only sort of fata morgana, simply not displaying things to users. If users know the urls, they could still access the objects in the database. E.g. in my block you can show/hide active, inactive and "old" courses you did not visit for a given number of days. But if you click on the SHOW ALL COURSES link in my block or you simply call the url yourmoodle.com/course/index.php, then everybody can still see/access every category and every course in it.

So if you really want to prevent the users from accessing anything in the database either you really remove it from the database (and insert it just in time you need it) or you need other bits/criterions you can save/set in the database to prevent users from accessing courses/categories/etc. either by setting up given dates or show/hide flags.

 
Average of ratings: -
Picture of James Henestofel
Re: Mass showing and hiding of courses within a category
 

Rosario,

The original post for this thread was for an improvement to the Add/Edit courses page that allows the Hiding and Showing of courses by changing their availability.  My improvement does nothing with CSV's.

 
Average of ratings: -
Rosario playing soccer
Re: Mass showing and hiding of courses within a category
 

James, I understand that and apologize for having interfered here. If core functionality can be improved it will be the best solution. (But I wonder, if you would like to set such options through the GUI on 1'500 courses)

My own programmatical approach is only meant to help in case such an improvement demands a longer time period to be implemented.

I have another idea on how to solve this with my code:

  • create the courses manually or using my uploadusersandcourses.php (or the silent/batch version)
  • do register only the TEACHERs in the courses either manually or using my script, so that they can access the courses normally and prepare them
  • register the students as soon as the term allows to do so, using my uploadusersandcourses_silently.php script which can be scheduled to run as batch/cron job
  • alternatively you can register the students and teachers at the same time using my script and adding the option to set the courses to NOT AVAILABLE TO STUDENTS until you run the script again with the option to make them available on the scheduled and desired term

And as Sam already said, it is possible to set the enrolment dates for such purposes. Again my script could be used to set them in an automated fashion in a large scale scenario, talking about 1'500 courses...

HTH, Rosario

 
Average of ratings: -