Skip to content

Commit 40c63cf

Browse files
committed
Document things that have changed with time
1 parent 41feece commit 40c63cf

4 files changed

Lines changed: 72 additions & 23 deletions

File tree

  • docs/apis/core/reportbuilder
  • versioned_docs
    • version-4.3/apis/core/reportbuilder
    • version-4.4/apis/core/reportbuilder
    • version-4.5/apis/core/reportbuilder

docs/apis/core/reportbuilder/index.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ To create a new column, just create a new instance of [`reportbuilder/classes/lo
4242

4343
And use:
4444

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.
5051

5152
```php title="Example of code for creating a column"
5253
$columns[] = (new column(
@@ -386,6 +387,21 @@ Next you need to add the columns, filters and conditions that a user can add to
386387
$this->add_all_from_entities();
387388
```
388389

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+
389405
### Setup default columns
390406

391407
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 _
590606

591607
The stress test uses helper methods which:
592608

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.
594610
- Individually aggregates a report on each column
595611
- Individually applies each filter
596612

versioned_docs/version-4.3/apis/core/reportbuilder/index.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ To create a new column, just create a new instance of [`reportbuilder/classes/lo
4242

4343
And use:
4444

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.
5051

5152
```php title="Example of code for creating a column"
5253
$columns[] = (new column(

versioned_docs/version-4.4/apis/core/reportbuilder/index.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ To create a new column, just create a new instance of [`reportbuilder/classes/lo
4242

4343
And use:
4444

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.
5051

5152
```php title="Example of code for creating a column"
5253
$columns[] = (new column(
@@ -391,6 +392,21 @@ Next you need to add the columns, filters and conditions that a user can add to
391392
$this->add_all_from_entities();
392393
```
393394

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+
394410
### Setup default columns
395411

396412
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 _
595611

596612
The stress test uses helper methods which:
597613

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.
599615
- Individually aggregates a report on each column
600616
- Individually applies each filter
601617

versioned_docs/version-4.5/apis/core/reportbuilder/index.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ To create a new column, just create a new instance of [`reportbuilder/classes/lo
4242

4343
And use:
4444

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.
5051

5152
```php title="Example of code for creating a column"
5253
$columns[] = (new column(
@@ -374,6 +375,21 @@ Next you need to add the columns, filters and conditions that a user can add to
374375
$this->add_all_from_entities();
375376
```
376377

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+
377393
### Setup default columns
378394

379395
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 _
578594

579595
The stress test uses helper methods which:
580596

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.
582598
- Individually aggregates a report on each column
583599
- Individually applies each filter
584600

0 commit comments

Comments
 (0)