CoolCMS API

ReportModerationPresenterTrait

Moderation list of reports from visitors (discussion posts, adverts, company profiles): one definition for the three `*ReportPresenter`s.

Reports are not editable; admin only solves, reopens or deletes them. A solved report lets the visitor report the target again. The reported flag of the target is reconciled in the Api model layer (ReportedFlagSyncTrait), not here. The default view is unsolved reports (the state filter is prefilled; "all" shows everything). Reporters are read through $userManager (UserTrait of the admin base presenter).

The host tells what the target of its reports is: the privilege prefix, the report manager, the grid column with the target label and how labels of the targets on a page are loaded.

Table of Contents

Methods

handleReopen()  : void
Reopens a solved report.
handleSolve()  : void
Marks a report as solved.
renderShow()  : void
createComponentGrid()  : DataGrid
reportManager()  : Manager
Admin manager of the reports: the grid data source with `setSolved()`.
reportPrivileges()  : array{edit: string, del: string}
Privileges of solving/reopening and of deleting reports, written out in full in the host (the privilege surface test looks for every key from the database in the code).
reportTargetEditPrivilege()  : string
Privilege of editing the target, which links the target column (`:Admin:...:edit`).
reportTargetField()  : string
Report property with the target id (`messageId`, `advertId`), the link parameter of the target column.
reportTargetIdOf()  : int|null
Target id of a report entity.
reportTargetLabels()  : array<int, string>
Labels of the targets on the current page (one query); a missing id means the target was deleted.
changeReportState()  : void
decorateReportRows()  : void
Grid page decorator, run once over the loaded rows: target labels and reporter names with two queries (no N+1) into the `#[Transient]` fields `gridTarget` and `gridReporter` of the report entity.

Methods

handleReopen()

Reopens a solved report.

public handleReopen(int $id) : void
Parameters
$id : int
Attributes
#[Requires]
$methods: 'POST'

handleSolve()

Marks a report as solved.

public handleSolve(int $id) : void
Parameters
$id : int
Attributes
#[Requires]
$methods: 'POST'

reportPrivileges()

Privileges of solving/reopening and of deleting reports, written out in full in the host (the privilege surface test looks for every key from the database in the code).

protected abstract reportPrivileges() : array{edit: string, del: string}
Return values
array{edit: string, del: string}

reportTargetEditPrivilege()

Privilege of editing the target, which links the target column (`:Admin:...:edit`).

protected abstract reportTargetEditPrivilege() : string
Return values
string

reportTargetField()

Report property with the target id (`messageId`, `advertId`), the link parameter of the target column.

protected abstract reportTargetField() : string
Return values
string

reportTargetIdOf()

Target id of a report entity.

protected abstract reportTargetIdOf(object $report) : int|null
Parameters
$report : object
Return values
int|null

reportTargetLabels()

Labels of the targets on the current page (one query); a missing id means the target was deleted.

protected abstract reportTargetLabels(array<int, int> $targetIds) : array<int, string>
Parameters
$targetIds : array<int, int>
Return values
array<int, string>

decorateReportRows()

Grid page decorator, run once over the loaded rows: target labels and reporter names with two queries (no N+1) into the `#[Transient]` fields `gridTarget` and `gridReporter` of the report entity.

private decorateReportRows(array<int, object> $items) : void
Parameters
$items : array<int, object>

rows of the current page

On this page

Search results