TIP: Adding fast pupils to course

TIP: Adding fast pupils to course

by lasse utti -
Number of replies: 2
Hi there.

I have not found any good way to add group of pupils ( class ) into course. It's difficulty if you have several hundrets of pupils.

We solved this by naming pupil's city field with code v2008a ... year (v2008) when pupil come into school and group ( a ) what is his/hers location. Then we closed this field from changes.

Then I add some code :
path: /admin/ roles/assign.php

Line numbers can change litle but you can find those lines.

about line 245:
if (!$contextusers = get_role_users($roleid, $context, false, 'u.id, u.firstname, u.lastname, u.email, u.city, ra.hidden'
$contextusers = array();
}



about line 259:
$selectsql = " AND ($FULLNAME $LIKE '%$searchtext%' OR email $LIKE '%$searchtext%' OR city $LIKE '%$searchtext') ";
$select .= $selectsql;
} else {
$selectsql = "";
}



about line 299:
$select = " SELECT u.id, u.firstname, u.lastname, u.email, u.city";
$countselect = "SELECT COUNT(u.id)";
$from = " FROM {$CFG->prefix}user u




about line 394:
$roleusers = get_role_users($roleid, $context, false, 'u.id, u.lastname, u.firstname, u.city');
if (!empty($roleusers)) {
$strroleusers = array();




Now when you give roles for pupils you can search those kids with city code.
Voila ! You get fast group of pupils for your course .


....Lasse...
old moodler wink






Average of ratings: -
In reply to lasse utti

Re: TIP: Adding fast pupils to course

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You can bulk-enrol users into courses using Administration ► Users ► Accounts ► Upload users, if you read the docs.
In reply to Tim Hunt

Vast: Re: TIP: Adding fast pupils to course

by lasse utti -
Ok. I found the way to select pupils with city-code. Now I have the list ... but how I can force enroll for them to specifig course. I did not found any simple method ...
Sending pupils to file ? ... import them .. no thanks. I have no clue what to do .... sad

Thats why I changed the code ... to make it simple for admin select pupils into his/hers course. Method is located in place where it is most natural to find... dealing roles for course.

...Lasse...