Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
ewallah committed Sep 25, 2023
1 parent 1d9fcb4 commit eb19ded
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 18 deletions.
20 changes: 12 additions & 8 deletions classes/reportbuilder/local/systemreports/payments_course.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,16 @@ public static function get_name(): string {
* Adds the columns we want to display in the report
*/
public function add_columns(): void {
$this->add_columns_from_entities([
'payment:accountid',
'payment:gateway',
'user:fullnamewithpicturelink',
'payment:amount',
'payment:currency',
'payment:timecreated']);
$this->add_columns_from_entities(
[
'payment:accountid',
'payment:gateway',
'user:fullnamewithpicturelink',
'payment:amount',
'payment:currency',
'payment:timecreated',
]
);
if ($column = $this->get_column('payment:accountid')) {
$column->set_title(new \lang_string('accountname', 'payment'));
}
Expand All @@ -122,6 +125,7 @@ protected function add_filters(): void {
'payment:gateway',
'payment:amount',
'payment:currency',
'payment:timecreated']);
'payment:timecreated',
]);
}
}
15 changes: 9 additions & 6 deletions classes/reportbuilder/local/systemreports/payments_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,15 @@ public static function get_name(): string {
* Adds the columns we want to display in the report
*/
public function add_columns(): void {
$this->add_columns_from_entities([
'payment:gateway',
'payment:amount',
'payment:currency',
'payment:timecreated',
'course:coursefullnamewithlink']);
$this->add_columns_from_entities(
[
'payment:gateway',
'payment:amount',
'payment:currency',
'payment:timecreated',
'course:coursefullnamewithlink',
]
);
if ($column = $this->get_column('course:coursefullnamewithlink')) {
$column->set_title(new \lang_string('course'));
}
Expand Down
9 changes: 6 additions & 3 deletions db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@
'report/payments:view' => [
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => ['editingteacher' => CAP_ALLOW, 'manager' => CAP_ALLOW]],
'archetypes' => ['editingteacher' => CAP_ALLOW, 'manager' => CAP_ALLOW],
],
'report/payments:userview' => [
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => ['manager' => CAP_ALLOW]],
'archetypes' => ['manager' => CAP_ALLOW],
],
'report/payments:overview' => [
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => ['manager' => CAP_ALLOW]]
'archetypes' => ['manager' => CAP_ALLOW],
],
];
2 changes: 1 addition & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ function report_payments_page_type_list($pagetype, $parentcontext, $currentconte
'report-payments-*' => new \lang_string('page-report-payments-x', 'report_payments'),
'report-payments-index' => new \lang_string('page-report-payments-index', 'report_payments'),
'report-payments-course' => new \lang_string('page-report-payments-course', 'report_payments'),
'report-payments-user' => new \lang_string('page-report-payments-user', 'report_payments')
'report-payments-user' => new \lang_string('page-report-payments-user', 'report_payments'),
];
}

0 comments on commit eb19ded

Please sign in to comment.