Mass showing and hiding of courses within a category

Re: Mass showing and hiding of courses within a category

by nikhil pednekar -
Number of replies: 7

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

In reply to nikhil pednekar

Re: Mass showing and hiding of courses within a category

by James Henestofel -

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.

In reply to James Henestofel

Re: Mass showing and hiding of courses within a category

by nikhil pednekar -

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.

In reply to nikhil pednekar

Re: Mass showing and hiding of courses within a category

by Rosario Carcò -

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

In reply to Rosario Carcò

Re: Mass showing and hiding of courses within a category

by nikhil pednekar -

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.

In reply to nikhil pednekar

Re: Mass showing and hiding of courses within a category

by Rosario Carcò -

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.

In reply to Rosario Carcò

Re: Mass showing and hiding of courses within a category

by James Henestofel -

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.

In reply to James Henestofel

Re: Mass showing and hiding of courses within a category

by Rosario Carcò -

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