Hi everyone,
Just found this thread and wanted to add a tool that one of our student programmers (Ashley Gooding) wrote that is similar. It downloads a list of users for a given role in a course. It lets the user with has_capability('moodle/course:update') for the course download a CSV of users for any given role (example student, teacher,...). It also lets the user pick what variables to include in the CSV (example username, city, email,....) and the order that they are placed in the file. The file roledownload.php has a hard coded array of excluded fields from user table at line 43 so that the admin can shorten the list of variables the teacher sees. To install place the roledownload.php file in the 'moodle_dir\course' folder. Next change the block_admin.php in the 'moodle_dir\blocks\admin' folder at/around line 64 ( /// Assign roles to the course) to include
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/roledownload.php?id='.$course->id.'">Download Roles</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/roles.gif" class="icon" alt="" />';
It should look something like this.
/// Assign roles to the course
if ($course->id !== SITEID and has_capability('moodle/role:assign', $context)) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id.'">'.get_string('assignroles', 'role').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/roles.gif" class="icon" alt="" />';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/roledownload.php?id='.$course->id.'">Download Roles</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/roles.gif" class="icon" alt="" />';
}
We have tested this on 1.9 and it is working so far. I will try to get this in the Moodle Tracker as soon as I can. Hope this helps someone.
Jeff
Jeff Church
Beiträge von Jeff Church
Hi Noemi,
Sorry I'm new to posting code and didn't put very good (lol any) instructions in.
The file deletecourses.php goes in root/admin/
To access the file use root/admin/deletecourses.php There is not a GUI to access it yet. So you have to navigate directly to the file in the browser.
Sorry I'm new to posting code and didn't put very good (lol any) instructions in.
The file deletecourses.php goes in root/admin/
To access the file use root/admin/deletecourses.php There is not a GUI to access it yet. So you have to navigate directly to the file in the browser.
Here is the delete course that works in 1.7 and 1.8. It takes a txt file with course short name. Be careful I have found with large list > 500 course that it times out the script run time. So if it hangs try upping your script run time or doing the delete in smaller batches.
I have not tested this or the course upload in 1.9 yet. It is on my list to do as we are moving to in in a month.
Good luck
I have not tested this or the course upload in 1.9 yet. It is on my list to do as we are moving to in in a month.
Good luck
Marc thanks for the summary I think you got everything right on. Our programmers created a bulk course creation and a bulk course deletion tool. I will post the zip files for these with this post.
The bulk upload tool has a 1.7 and 1.8 version. To use it you have to create the teacher accounts before creating to courses. The role for the teacher in the csv is the role short name. So for teacher use 'editingteacher' and Non-editing teachers use 'teacher' and so on.
The bulk course delete tool uses a txt file with the course short names. One course per line.
I hope to post 1.9 versions of these soon and I hope they have helped.
On a related note our programmers have produced several add ons for Appalachian State University and we (the Instructional Technology Consultants at ASU that manage the student programers. Greg Simmons, Mary Beth McKee, and me) would like to share them. What is the best place and method to do this? These were posted by me just because someone had a problem that I happen to see.
The bulk upload tool has a 1.7 and 1.8 version. To use it you have to create the teacher accounts before creating to courses. The role for the teacher in the csv is the role short name. So for teacher use 'editingteacher' and Non-editing teachers use 'teacher' and so on.
The bulk course delete tool uses a txt file with the course short names. One course per line.
I hope to post 1.9 versions of these soon and I hope they have helped.
On a related note our programmers have produced several add ons for Appalachian State University and we (the Instructional Technology Consultants at ASU that manage the student programers. Greg Simmons, Mary Beth McKee, and me) would like to share them. What is the best place and method to do this? These were posted by me just because someone had a problem that I happen to see.