Creating a report of all grades for tutors

Creating a report of all grades for tutors

by Mike Worth -
Number of replies: 22
I am trying to Create some reports that personal tutors can use to assess their tutee's progress, one of these is a page to view the status of all their homework.

So far I have managed to create something with all the right data on it using:

if ($mycourses = get_my_courses($user->id, null, null, false, 21)) {
foreach ($mycourses as $mycourse) {
$course = get_record('course', 'id', $mycourse->id);
grade_report_user_profilereport($course, $user);
echo '<br><br>';

}
}


The output of which is attached; the problems I have is that the header row is repeated and where the tables are separate the column widths are inconsistent giving a very messy look.

I've had a play with creating a new grade report but always seem to end up with 'class does not exist' errors.

Is there a neater way to do this?

Thanks,
Mike
Attachment current_allgrade.GIF
In reply to Mike Worth

Re: Creating a report of all grades for tutors

by Frederic Nevers -
Hi Mike,

Would you be eager to share your "tutor tab" code? You seem to have worked out a very handy solution to problems which I need to sort out for my school which uses a similar system to your college (tutors who need to see the information you have shown on your tab).

I'd be very happy to help you refine your project smile I've started looking into this issue, to no avail yet.

Cheers,
Fred
In reply to Frederic Nevers

Re: Creating a report of all grades for tutors

by Mike Worth -
Find attached a diff file between my version and a clean version; I had to remove the parts about a bunch of other adaptions I've made but I think I got it all.

Mike
In reply to Mike Worth

Re: Creating a report of all grades for tutors

by Mike Worth -
I've managed to get it all into one table by copying then hacking the user report to put the loop inside the function that is called then an instance of the class is created.

What would be nice would be all the averages displayed at the top, with the averages of nothing (for students enroled on enrichment club courses etc) to not get displayed. I can't see where the average rows are generated- any pointers anyone?

Thanks,
Mike


find attached a copy of my new grade/report/user/lib_allgrade.php- you'll need to change the case stattement in course/user.php to:

case "allgrade":
require_once $CFG->dirroot.'/grade/lib.php';
require_once $CFG->dirroot.'/grade/report/user/lib_allgrade.php;
grade_report_user_profilereport_allgrade($user);

break;

In reply to Mike Worth

Re: Creating a report of all grades for tutors

by Mike Worth -
I've doe a bit more fiddling and now have a version that doesn't show course total rows which are blank- find attached.

I'm still not sure on how to get all the totals to the top

Mike
In reply to Mike Worth

Re: Creating a report of all grades for tutors

by Frederic Nevers -
Thanks Mike,

I haven't forgotten about this but I was swamped last weekend (problem with my main install, sorted now)

I'll look into it ASAP.

Cheers,

Fred
In reply to Frederic Nevers

Re: Creating a report of all grades for tutors

by Frederic Nevers -
Hi Mike,

I've tried to reproduce what you've done but some reason nothing will show. I have managed to create all of the extra needed tabs and so on but I think I'm messing things up when I try and alter the course/user.php file.

I'd really love to be able to help you with this but as things look at the minute I might have to start making a new report from scratch (I don't fancy that smile ) and access it from another place.

Any extra info on what to alter in the course/user.php file? I've been "playing" with this for a few hours and getting nowhere...

Cheers,
Fred
In reply to Frederic Nevers

Re: Creating a report of all grades for tutors

by Mike Worth -
Here is the diff output between my one and a standard one:

73,94d71
< case "allgrade":
< require_once $CFG->dirroot.'/grade/lib.php';
< require_once $CFG->dirroot.'/grade/report/allgrade/lib.php';
< grade_report_user_profilereport_allgrade($user);
< break;
<
<
< case "allatt":
<
< echo "<h4 align=center>Technical difficulties are being experienced- if you think these marks are wrong you are probably right</h4>";
< // echo "<h4 align=center>Please bear in mind that these marks are only updated once a day so may contain errors</h4>";
< require_once $CFG->dirroot.'/mod/attforblock/locallib.php';
<
<
< if ($mycourses = get_my_courses($user->id, null, null, false, 21)) {
< foreach ($mycourses as $mycourse) {
< $cm = get_record("course_modules", "id", $mycourse->id);
< print_user_attendaces($user, $cm, $mycourse,TRUE);
< }
< }
< break;


If you don't know what this is /how to use it let me know

Mike
In reply to Mike Worth

Re: Creating a report of all grades for tutors

by Frederic Nevers -
Hi Mike,

thanks for this, I was trying with the older Diff output that you gave me last week.

I think I know where the problem lies. I've installed a clean version of 1.9.2, followed all instructions given in Diff files and posts with amendments and it still did not work. I was really starting to wonder until I (just - blush) realised something: I am calling something that doesn't exist on my server.

In the course/user.php file, line 75, I am requiring /grade/report/allgrade/lib.php which I simply don't have.
I cannot believe I did not notice it up until now!

Is there any chance to get a copy of the actual report folder that you created, as I don't have grade_report_user_profilereport_allgrade or anything that goes with it.

If the zip file is too big, feel free to email me it.

Cheers,
Fred
In reply to Frederic Nevers

Re: Creating a report of all grades for tutors

by Mike Worth -
Was attached up there ^, but here is a direct link.

Hope you find it useful,
Mike
In reply to Mike Worth

Re: Creating a report of all grades for tutors

by Steven van de Graaf -

Mike, would you happen to have some sort of installation package / instructions for this tutor module that you created? I've tried getting it to work with the instructions posted in this forum topic, but am having a hard time getting it to work. (Mainly because of my lack of experience in PHP - I'm more of an object-oriented kind of guy.)

More importantly; which files should go where and what files should be changed in what way? With those instructions, I'm pretty certain I could get this puppy to work. And that would mean more feedback for you... ;) (Yes, I know, the incentive offered by me might not be the most fascinating one, but I'm trying, here... :p)

In reply to Steven van de Graaf

Re: Creating a report of all grades for tutors

by Mike Worth -
  1. Create moodle/grade/report/allgrade/ and put lib.php in it.
  2. Apply this patch to moodle/course/user.php
  3. Apply this patch to moodle/lang/en_utf8/moodle.php
  4. Apply this patch to moodle/user/tabs.php
If you can't get it to work let me know
Mike
In reply to Mike Worth

Re: Creating a report of all grades for tutors

by Steven van de Graaf -

Excellent! With those instructions I've gotten it to work! I still get a few notices / warnings / errors*, but, quite frankly, I don't mind those that much, since now I have this functionality! smile

About the errors; since I'm using Moodle 1.8.2, it's perfectly possible that they're related to that. I'll still look into them, of course, and will let you know of my progress.

Personally, I'm all to happy with this functionality, since it was a must-have for getting Moodle implemented at my workplace. Thanks, Mike! ^_^

*) Errors:

All grades:

Notice: Undefined variable: user in C:\xampp\htdocs\moodle\grade\report\allgrade\lib.php on line 95

Notice: Trying to get property of non-object in C:\xampp\htdocs\moodle\grade\report\allgrade\lib.php on line 95

All attendance:

Warning: require_once(C:\xampp\htdocs\moodle/mod/attforblock/locallib.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\moodle\course\user.php on line 89

Fatal error: require_once() [function.require]: Failed opening required 'C:\xampp\htdocs\moodle/mod/attforblock/locallib.php' (include_path='C:\xampp\htdocs\moodle/lib/pear;.;C:\xampp\php\pear\') in C:\xampp\htdocs\moodle\course\user.php on line 89

In reply to Steven van de Graaf

Re: Creating a report of all grades for tutors

by Mike Worth -
The attendance errors look to be down to lask of attendance block, am I right?

The grade ones are possibly down to me not understanding the reports 100% and bodging it together until it worked. I'll have a look and let you know how I get on

Mike
In reply to Mike Worth

Re: Creating a report of all grades for tutors

by Steven van de Graaf -

Sorry for the late reply, I had a day off; Yes, the attendance block isn't in use. I should've known that, but I didn't pay much attention to the errors yet, since I was still dancing about the tutor tab. ;) (And I fixed some other non-related stuff.) 

Edit: I looked at the other two errors and fixed those as well. It turned out that those also used a function (grade tracking object?), not used in my company's version of Moodle. So I modified the code in allgrade/lib.php so that the used variable is now replaced with an empty value. (Code below, modified stuff in bold.) Not ideal, but since we're not using it, I don't see the harm. But would you have an idea what it does? (I'm sure that you are, actually... ;))

/// return tracking object

///$gpr = new grade_plugin_return(array('type'=>'report', 'plugin'=>'user', 'courseid'=>$course->id, 'userid'=>$user->id));

$gpr = "";

global $CFG;

parent::grade_report($courseid, $gpr, $context);

In reply to Steven van de Graaf

Re: Creating a report of all grades for tutors

by Mike Worth -
I vaguely remember playing with that variable- no idea what it does off the top of my head. I'm training today but will have a look on monday

Mike
In reply to Steven van de Graaf

Re: Creating a report of all grades for tutors

by Mike Worth -
I've had a quick play and that variable seems to do a grand total of bugger all. I suspect it's throwing errors for you not me because I tried to make a full AllGrade report so still have bits and pieces lying about.

Mike
In reply to Mike Worth

Re: Creating a report of all grades for tutors

by Mike Worth -
I've done some more work on the attendance side of this, and will have a new set of patches.

See attached what the all attendance tab looks like.

I'll upload a set of patches probably tomorrow

Mike
Attachment allatt_tab.PNG