Use a userid parameter in an activity to view another user's submission or feedback or any result page of an activity

Use a userid parameter in an activity to view another user's submission or feedback or any result page of an activity

by Delvon Forrester -
Number of replies: 4

Good day,

I am developing a plugin to display reports for a user in Moodle 2.8.7. If I log in as the user's tutor or even as admin I am not able to access any of the user's result page (for instance with the assignment activity, I cannot see the individual user submission/feedback page).

I realize that it's the same for workshops and quiz. Is this the design of Moodle so that you cannot view another user's individual submission page as in the case of the assign activity. 

For eg. I constructed the following link but there is no userid parameter that I can use to get the specific user in these activities:

$submission = "<a href=\"" . $CFG->wwwroot . "/mod/" . $record->assessmenttype . "/view.php?id=" .       $record->assignmentid . "&action=view\">" . get_string('submission', 'report_myreport') . "</a>";

In my testing I found that in turnitintooltwo it has the ability to add the userid so I can get to the related user's submission page and this is what I would like to do for other activities such as assignment, quiz and workshop. The contruction of the turnitintooltwo link is like this:

$textlink = "<a href=\"" . $CFG->wwwroot . "/mod/" . $record->assessmenttype . "/view.php?id=" .              $record->assignmentid . "&jumppage=grade&userid=" . $userid .  "\" target=\"_blank\">" . get_string('feedback', 'report_myreport') . "</a>";

Is there anyone who has found a way to add the the userid parameter or is there another parameter that is used to access the related user's activity result pages as mentioned above?

Your help is highly appreciated.

Kind regards,

Japs,

Average of ratings: -
In reply to Delvon Forrester

Re: Use a userid parameter in an activity to view another user's submission or feedback or any result page of an activity

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

I don't think such a general URL exists. Every activity module has its own ways how to display users' work, and each of them implements its own access rules.

In case of the workshop module, it is something like /mod/workshop/submission.php?cmid=X&id=Y and you must have the mod/workshop:viewallsubmissions capability.

In reply to David Mudrák

Re: Use a userid parameter in an activity to view another user's submission or feedback or any result page of an activity

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The nearest you can get is the 'grade.php' file included in some modules - if this is present, then it expects an 'id' param (the cmid for the activity) and, optionally, a userid (the user to view). It then displays/redirects to the most appropriate representation of the grade the user was given (e.g. for the quiz it shows the report for the attempt that most closely matches the grade method).

This is not available for all modules (I've got a grade.php for mod_assign I developed for a client, that takes you the relevant 'grading' page for that user's assignment, but not to their submission page).


In reply to Davo Smith

Re: Use a userid parameter in an activity to view another user's submission or feedback or any result page of an activity

by Delvon Forrester -

Thanks Davo.

Will make an update once I decide the direction to go.

In reply to David Mudrák

Re: Use a userid parameter in an activity to view another user's submission or feedback or any result page of an activity

by Delvon Forrester -

Thanks David,

I will try to implement this with the workshop module and see what I find for the others.