You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/apis/core/reportbuilder/index.md
+22-6Lines changed: 22 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,11 +42,12 @@ To create a new column, just create a new instance of [`reportbuilder/classes/lo
42
42
43
43
And use:
44
44
45
-
-**add_joins()** to add any extra SQL joins the column might need
46
-
-**set_type()** to add the column type (All constant types are defined within the same column class)
47
-
-**set_is_sortable()** to define if column can be sorted (For example we don't want to sort if the column shows just a picture)
48
-
-**add_callback()** to format the output of the column
49
-
-**add_field()** to add any db fields format callback might need
45
+
-`add_joins()` to add any extra SQL joins the column might need
46
+
-`set_type()` to add the column type (All constant types are defined within the same column class)
47
+
-`set_is_sortable()` to define if column can be sorted (For example we don't want to sort if the column shows just a picture)
48
+
-`add_callback()` to format the output of the column
49
+
-`add_field()` to add any db fields format callback might need
50
+
-`set_is_deprecated()` used to mark a column as deprecated, indicating it will be removed in the future. This is required in core Moodle columns if you want delete or remove one from an entity because plugins may be using the fields.
50
51
51
52
```php title="Example of code for creating a column"
52
53
$columns[] = (new column(
@@ -386,6 +387,21 @@ Next you need to add the columns, filters and conditions that a user can add to
386
387
$this->add_all_from_entities();
387
388
```
388
389
390
+
### Setup report name
391
+
392
+
You will need to specify the name that is displayed to the end user for the data source.
393
+
394
+
```php
395
+
/**
396
+
* Return user friendly name of the report source
397
+
*
398
+
* @return string
399
+
*/
400
+
public static function get_name(): string {
401
+
return get_string('tasklogs', 'core_admin');
402
+
}
403
+
```
404
+
389
405
### Setup default columns
390
406
391
407
Once all entities have been added you need to define which columns it will show by default **they will be displayed in the order you define them**, by implementing the `get_default_columns()` method:
@@ -590,7 +606,7 @@ This would cause the report to return results for users with the first name of _
590
606
591
607
The stress test uses helper methods which:
592
608
593
-
- Add and remove every colum individually from a report and ensures that is still returns data without error.
609
+
- Add and remove every colum individually from a report and ensures that is still returns data without error, it also tests the column can be sorted if that has been enabled.
Copy file name to clipboardExpand all lines: versioned_docs/version-4.3/apis/core/reportbuilder/index.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,11 +42,12 @@ To create a new column, just create a new instance of [`reportbuilder/classes/lo
42
42
43
43
And use:
44
44
45
-
-**add_joins()** to add any extra SQL joins the column might need
46
-
-**set_type()** to add the column type (All constant types are defined within the same column class)
47
-
-**set_is_sortable()** to define if column can be sorted (For example we don't want to sort if the column shows just a picture)
48
-
-**add_callback()** to format the output of the column
49
-
-**add_field()** to add any db fields format callback might need
45
+
-`add_joins()` to add any extra SQL joins the column might need
46
+
-`set_type()` to add the column type (All constant types are defined within the same column class)
47
+
-`set_is_sortable()` to define if column can be sorted (For example we don't want to sort if the column shows just a picture)
48
+
-`add_callback()` to format the output of the column
49
+
-`add_field()` to add any db fields format callback might need
50
+
-`set_is_deprecated()` used to mark a column as deprecated, indicating it will be removed in the future. This is required in core Moodle columns if you want delete or remove one from an entity because plugins may be using the fields.
50
51
51
52
```php title="Example of code for creating a column"
Copy file name to clipboardExpand all lines: versioned_docs/version-4.4/apis/core/reportbuilder/index.md
+22-6Lines changed: 22 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,11 +42,12 @@ To create a new column, just create a new instance of [`reportbuilder/classes/lo
42
42
43
43
And use:
44
44
45
-
-**add_joins()** to add any extra SQL joins the column might need
46
-
-**set_type()** to add the column type (All constant types are defined within the same column class)
47
-
-**set_is_sortable()** to define if column can be sorted (For example we don't want to sort if the column shows just a picture)
48
-
-**add_callback()** to format the output of the column
49
-
-**add_field()** to add any db fields format callback might need
45
+
-`add_joins()` to add any extra SQL joins the column might need
46
+
-`set_type()` to add the column type (All constant types are defined within the same column class)
47
+
-`set_is_sortable()` to define if column can be sorted (For example we don't want to sort if the column shows just a picture)
48
+
-`add_callback()` to format the output of the column
49
+
-`add_field()` to add any db fields format callback might need
50
+
-`set_is_deprecated()` used to mark a column as deprecated, indicating it will be removed in the future. This is required in core Moodle columns if you want delete or remove one from an entity because plugins may be using the fields.
50
51
51
52
```php title="Example of code for creating a column"
52
53
$columns[] = (new column(
@@ -391,6 +392,21 @@ Next you need to add the columns, filters and conditions that a user can add to
391
392
$this->add_all_from_entities();
392
393
```
393
394
395
+
### Setup report name
396
+
397
+
You will need to specify the name that is displayed to the end user for the data source.
398
+
399
+
```php
400
+
/**
401
+
* Return user friendly name of the report source
402
+
*
403
+
* @return string
404
+
*/
405
+
public static function get_name(): string {
406
+
return get_string('tasklogs', 'core_admin');
407
+
}
408
+
```
409
+
394
410
### Setup default columns
395
411
396
412
Once all entities have been added you need to define which columns it will show by default **they will be displayed in the order you define them**, by implementing the `get_default_columns()` method:
@@ -595,7 +611,7 @@ This would cause the report to return results for users with the first name of _
595
611
596
612
The stress test uses helper methods which:
597
613
598
-
- Add and remove every colum individually from a report and ensures that is still returns data without error.
614
+
- Add and remove every colum individually from a report and ensures that is still returns data without error, it also tests the column can be sorted if that has been enabled.
Copy file name to clipboardExpand all lines: versioned_docs/version-4.5/apis/core/reportbuilder/index.md
+22-6Lines changed: 22 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,11 +42,12 @@ To create a new column, just create a new instance of [`reportbuilder/classes/lo
42
42
43
43
And use:
44
44
45
-
-**add_joins()** to add any extra SQL joins the column might need
46
-
-**set_type()** to add the column type (All constant types are defined within the same column class)
47
-
-**set_is_sortable()** to define if column can be sorted (For example we don't want to sort if the column shows just a picture)
48
-
-**add_callback()** to format the output of the column
49
-
-**add_field()** to add any db fields format callback might need
45
+
-`add_joins()` to add any extra SQL joins the column might need
46
+
-`set_type()` to add the column type (All constant types are defined within the same column class)
47
+
-`set_is_sortable()` to define if column can be sorted (For example we don't want to sort if the column shows just a picture)
48
+
-`add_callback()` to format the output of the column
49
+
-`add_field()` to add any db fields format callback might need
50
+
-`set_is_deprecated()` used to mark a column as deprecated, indicating it will be removed in the future. This is required in core Moodle columns if you want delete or remove one from an entity because plugins may be using the fields.
50
51
51
52
```php title="Example of code for creating a column"
52
53
$columns[] = (new column(
@@ -374,6 +375,21 @@ Next you need to add the columns, filters and conditions that a user can add to
374
375
$this->add_all_from_entities();
375
376
```
376
377
378
+
### Setup report name
379
+
380
+
You will need to specify the name that is displayed to the end user for the data source.
381
+
382
+
```php
383
+
/**
384
+
* Return user friendly name of the report source
385
+
*
386
+
* @return string
387
+
*/
388
+
public static function get_name(): string {
389
+
return get_string('tasklogs', 'core_admin');
390
+
}
391
+
```
392
+
377
393
### Setup default columns
378
394
379
395
Once all entities have been added you need to define which columns it will show by default **they will be displayed in the order you define them**, by implementing the `get_default_columns()` method:
@@ -578,7 +594,7 @@ This would cause the report to return results for users with the first name of _
578
594
579
595
The stress test uses helper methods which:
580
596
581
-
- Add and remove every colum individually from a report and ensures that is still returns data without error.
597
+
- Add and remove every colum individually from a report and ensures that is still returns data without error, it also tests the column can be sorted if that has been enabled.
0 commit comments