Can I add a column to the grade report?

Can I add a column to the grade report?

by Jared Seeders -
Number of replies: 15
Hi, im trying to add a column to the grade report that displays the student's 'Enrollment Code'. This basically would just make it easier for professors to see which section/group a student is in. I'd like this column to be included when the professor exports the grades as a spreadsheet as well.

Does this involve adding a user preference? If so, how do i do that? If not, what do i have to do?
In reply to Jared Seeders

Re: Can I add a column to the grade report?

by Elena Ivanova -
Hi Jared,
From where this "enrollment code" will be grabbed? Is it something in the user profile?

Overall, if you have groups inside the Moodle course site, then go to the course settings (Administration block > Settings link), and put the Group mode to: Visible groups.
This will give you the group interface in the gradebook. One can also export group-by-group in such case.

I agree, however, that having a simple column with Group1, Group2, etc, would be beneficial.
How about adding a manual item to the gradebook and creating custom non-gradable scale for it? (scale can say: Group 1, Group 2, etc.
Put it at the begging of your gradebook and quickly "grade" you students with it.
In reply to Elena Ivanova

Re: Can I add a column to the grade report?

by Jared Seeders -
Thanks for the reply Elena.

The enrollment code comes from an external student database. I was considering actually editing the moodle grader code to query the database and grab the enrollment codes.

As for the manual items, I've tried it, but its not quite what we're looking for.

Does anyone have a link to where i can find information on the structure of the grader class, and/or related classes?
In reply to Elena Ivanova

Re: Can I add a column to the grade report?

by Islam Ali -
what if the column i want to add to the grade book is obtained from the user profile, i already prepared the field in the user profile, but i don't know how to show it in the grade book??
In reply to Islam Ali

Re: Can I add a column to the grade report?

by Ron Olienyk -

Islam,

Did you figure out your column issue, I'm having the same problem?  I have an entry in the user profile that I would like to display with the students grades but can't figure out how to make it work.

In reply to Islam Ali

Re: Can I add a column to the grade report?

by Bob Puffer -
If you're not looking for the column to be "gradeable" (would be like the student id or picture, etc.) then you're looking for three functions, essentially, all contained in grade/report/grader/lib.php:
  1. editing load_users will allow you to pull the additional field from the users table to be used later
  2. get_headerhtml() will allow you to create a column header for the extra column
  3. get_studentshtml() will allow you to fill the column with the values for each student
In reply to Bob Puffer

Re: Can I add a column to the grade report?

by Marinda Faasen -

Hi Bob

I tried to add the username (the student numbers of the students) to the Grader Report by editing the load_users() function and the get_headerhtml(), but it doesn't work.

 It isn't necessary for the students to see their usernames. It is only the lecturer who wants it(apparently the lists should stay as anonymous as possible).

I'm going to try some more, but I want to make sure: I only need to make changes in these two functions? 

In reply to Marinda Faasen

Re: Can I add a column to the grade report?

by Bob Puffer -
get_headerhtml() prints the header of the column and get_studentshtml() prints the content cells in the column. The Grader report (or any of its substitutions) are not visible to students by default. Those are just the names of the functions used to do what you've described.
In reply to Bob Puffer

Re: Can I add a column to the grade report?

by Marinda Faasen -

Thank you for the information. Yes, I found that out after reading the code in detail. (which I should have done from the start)

I managed to change it and it works perfectly. I also changed the XLS export so that it includes the usernames.

In reply to Marinda Faasen

Re: Can I add a column to the grade report?

by humberto moreno -

i need help i want to add columns i read this post i know a little about php and i ad this for example in get_headerhtml()

$sql = "SELECT u.id, u.firstname, u.lastname, u.imagealt, u.picture, u.idnumber, u.institution, u.department, u.username

and in  get_studentshtml()

something like this

$strinstitution  = $this->get_lang_string('Institution'); $strdepartment  = $this->get_lang_string('department'); $strusername  = $this->get_lang_string('username'); $showuseridnumber = $this->get_pref('showuseridnumber');

 

but in the third one how? can you help me?

In reply to Bob Puffer

Re: Can I add a column to the grade report?

by Claudio Carvalho -

I tried to add the username (the student numbers of the students) to the Grader Report. Do you know if this is possible (only with interface) with Moodle 2.3?


(few words because my poor english language) sad


Thanks


Cláudio

In reply to Claudio Carvalho

Re: Can I add a column to the grade report?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

This is not possible just using the admin interface in Moodle 2.3, but it is possible if you force the setting in the config.php file. Just add a line like

$CFG->showuseridentity = 'username,email';

just before the require_once... line.

In reply to Tim Hunt

Re: Can I add a column to the grade report?

by Claudio Carvalho -

Thank you my friend!   But which config.php I need to edit? I found several configs php in folders like install, lib etc.

In reply to Claudio Carvalho

Re: Can I add a column to the grade report?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The main one in the top-level folder.

In reply to Tim Hunt

Re: Can I add a column to the grade report?

by Claudio Carvalho -

It is hidding a column in list of users ( grade report shows a horizontal scroll bar).

Do you know if you can prevent columns are hidden? I wonder if in some other situation columns can also be hidden.