Skip to content

Commit

Permalink
MDL-75362 gradereport_user: CiBot
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocolate-lightning committed Oct 20, 2022
1 parent fdeda7f commit 547bf73
Show file tree
Hide file tree
Showing 15 changed files with 554 additions and 289 deletions.
4 changes: 2 additions & 2 deletions grade/lib.php
Expand Up @@ -2959,12 +2959,12 @@ public static function get_plugins_reports($courseid) {
}

$pluginstr = get_string('pluginname', 'gradereport_'.$plugin);
$url = new moodle_url('/grade/report/'.$plugin.'/index.php', array('id'=>$courseid));
$url = new moodle_url('/grade/report/'.$plugin.'/index.php', array('id' => $courseid));
$gradereports[$plugin] = new grade_plugin_info($plugin, $url, $pluginstr);

// Add link to preferences tab if such a page exists
if (file_exists($plugindir.'/preferences.php')) {
$url = new moodle_url('/grade/report/'.$plugin.'/preferences.php', array('id'=>$courseid));
$url = new moodle_url('/grade/report/'.$plugin.'/preferences.php', array('id' => $courseid));
$gradepreferences[$plugin] = new grade_plugin_info($plugin, $url,
get_string('preferences', 'grades') . ': ' . $pluginstr);
}
Expand Down
4 changes: 2 additions & 2 deletions grade/report/user/classes/event/grade_report_viewed.php
Expand Up @@ -40,7 +40,7 @@ class grade_report_viewed extends \core\event\grade_report_viewed {
* Initialise the event data.
* @return void
*/
protected function init() {
protected function init(): void {
parent::init();
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
Expand All @@ -50,7 +50,7 @@ protected function init() {
*
* @return string
*/
public static function get_name() {
public static function get_name(): string {
return get_string('eventgradereportviewed', 'gradereport_user');
}

Expand Down
14 changes: 8 additions & 6 deletions grade/report/user/classes/external/user.php
Expand Up @@ -20,6 +20,7 @@
use context_course;
use core_user;
use external_description;
use external_format_value;
use external_function_parameters;
use external_multiple_structure;
use external_single_structure;
Expand All @@ -29,6 +30,7 @@
use graded_users_iterator;
use moodle_exception;
use stdClass;
use gradereport_user\report\user as user_report;

defined('MOODLE_INTERNAL') || die;

Expand Down Expand Up @@ -132,7 +134,7 @@ protected static function check_report_access(int $courseid, int $userid, int $g
* Get the report data
* @param stdClass $course course object
* @param stdClass $context context object
* @param stdClass $user user object (it can be null for all the users)
* @param null|stdClass $user user object (it can be null for all the users)
* @param int $userid the user to retrieve data from, 0 for all
* @param int $groupid the group id to filter
* @param bool $tabledata whether to get the table data (true) or the gradeitemdata
Expand All @@ -142,7 +144,7 @@ protected static function check_report_access(int $courseid, int $userid, int $g
protected static function get_report_data(
stdClass $course,
stdClass $context,
stdClass $user,
?stdClass $user,
int $userid,
int $groupid,
bool $tabledata = true
Expand Down Expand Up @@ -173,7 +175,7 @@ protected static function get_report_data(

// Just one user.
if ($user) {
$report = new gradereport_user\report\user($course->id, $gpr, $context, $userid);
$report = new user_report($course->id, $gpr, $context, $userid);
$report->fill_table();

$gradeuserdata = [
Expand Down Expand Up @@ -201,7 +203,7 @@ protected static function get_report_data(

while ($userdata = $gui->next_user()) {
$currentuser = $userdata->user;
$report = new gradereport_user\report\user($course->id, $gpr, $context, $currentuser->id);
$report = new user_report($course->id, $gpr, $context, $currentuser->id);
$report->fill_table();

$gradeuserdata = [
Expand Down Expand Up @@ -415,7 +417,7 @@ public static function view_grade_report(int $courseid, int $userid = 0): array
}

// Create a report instance. We don't need the gpr second parameter.
$report = new gradereport_user\report\user($course->id, null, $context, $userid);
$report = new user_report($course->id, null, $context, $userid);
$report->viewed();

return [
Expand All @@ -430,7 +432,7 @@ public static function view_grade_report(int $courseid, int $userid = 0): array
* @return external_description
* @since Moodle 2.9
*/
public static function view_grade_report_returns() {
public static function view_grade_report_returns(): external_description {
return new external_single_structure(
[
'status' => new external_value(PARAM_BOOL, 'status: true if success'),
Expand Down
2 changes: 1 addition & 1 deletion grade/report/user/classes/privacy/provider.php
Expand Up @@ -59,7 +59,7 @@ public static function get_metadata(collection $items) : collection {
/**
* Store all user preferences for the plugin.
*
* @param int $userid The userid of the user whose data is to be exported.
* @param int $userid The userid of the user whose data is to be exported.
*/
public static function export_user_preferences(int $userid) {
$prefvalue = get_user_preferences('gradereport_user_view_user', null, $userid);
Expand Down

0 comments on commit 547bf73

Please sign in to comment.