class BasicReportGenerator extends ProjectImageReportGenerator

Traits

Properties

Collection $options

Options for this report.

from  ReportGenerator
string $name

Name of the report for use in text.

string $filename

Name of the report for use as (part of) a filename.

string $extension

File extension of the report file.

from  ProjectReportGenerator
protected mixed $source

Source this report belongs to (e.g. a volume).

from  ReportGenerator
protected array $tmpFiles

Temporary files that are created when generating a report.

from  ReportGenerator
protected Collection $labels

Cache for labels of all label trees that are used for this report.

from  ReportGenerator
protected string $reportClass

The class of the volume report to use for this project report.

Methods

static ReportGenerator
get(string $sourceClass, ReportType $type, array $options = [])

Get the report generator for the given type.

__construct(array $options = [])

Create a report generator instance.

string
generate(mixed $source)

Generate the report.

generateReport(string $path)

Generate the report.

setSource(mixed $source)

Set the source.

string
getName()

Get the report name.

string
getFilename()

Get the report filename.

string
getFullFilename()

Get the filename with extension.

string
expandLabelName(int $id)

Constructs a label name from the names of all parent labels and the label itself.

Collection
getSiblingLabels(int $id)

Get all labels that belong to the label tree of the given label.

bool
shouldSeparateLabelTrees()

Should this report separate the output files for different label trees?

bool
shouldSeparateUsers()

Should this report separate the output files for different user?

array
getOnlyLabels()

Returns the array of label ids to which this report should be restricted.

bool
isRestrictedToLabels()

Determines if this report is restricted to a subset of labels.

makeZip(array $files, string $path)

Create a ZIP archive as a report.

string
sanitizeFilename(string $name, string $extension)

Sanitizes a filename.

mixed
getProjectSources()

Get sources for the sub-reports that should be generated for this project.

getReportGenerator()

Get the report generator.

bool
isRestrictedToNewestLabel()

Determines if this report should take only the newest label for each annotation.

Details

in ReportGenerator at line 75
static ReportGenerator get(string $sourceClass, ReportType $type, array $options = [])

Get the report generator for the given type.

Parameters

string $sourceClass

Class name of the source model

ReportType $type

Type of the report to generate

array $options

Options for the report generator

Return Value

ReportGenerator

in ReportGenerator at line 103
__construct(array $options = [])

Create a report generator instance.

Parameters

array $options

Options for the report

in ReportGenerator at line 116
string generate(mixed $source)

Generate the report.

Parameters

mixed $source

Source to generate the report for (e.g. a volume)

Return Value

string

Path to the generated report file.

generateReport(string $path)

Generate the report.

Parameters

string $path

Path to write the report file to.

in ReportGenerator at line 163
setSource(mixed $source)

Set the source.

Parameters

mixed $source

in ReportGenerator at line 173
string getName()

Get the report name.

Return Value

string

in ReportGenerator at line 183
string getFilename()

Get the report filename.

Return Value

string

in ReportGenerator at line 193
string getFullFilename()

Get the filename with extension.

Return Value

string

in ReportGenerator at line 206
string expandLabelName(int $id)

Constructs a label name from the names of all parent labels and the label itself.

Example: Animalia > Annelida > Polychaeta > Buskiella sp

Parameters

int $id

Label ID

Return Value

string

in ReportGenerator at line 237
protected Collection getSiblingLabels(int $id)

Get all labels that belong to the label tree of the given label.

Parameters

int $id

Label ID

Return Value

Collection

in ReportGenerator at line 253
protected bool shouldSeparateLabelTrees()

Should this report separate the output files for different label trees?

Return Value

bool

in ReportGenerator at line 263
protected bool shouldSeparateUsers()

Should this report separate the output files for different user?

Return Value

bool

in ReportGenerator at line 273
protected array getOnlyLabels()

Returns the array of label ids to which this report should be restricted.

Return Value

array

in ReportGenerator at line 283
protected bool isRestrictedToLabels()

Determines if this report is restricted to a subset of labels.

Return Value

bool

in MakesZipArchives at line 22
protected makeZip(array $files, string $path)

Create a ZIP archive as a report.

This function will create a ZIP archive at $this->availableReport->path.

Parameters

array $files

Array of files, with source path as keys and target filenames (in the ZIP) as values.

string $path

Path to the file to store the generated ZIP to

Exceptions

Exception

in MakesZipArchives at line 48
protected string sanitizeFilename(string $name, string $extension)

Sanitizes a filename.

Parameters

string $name

Filename to sanitize

string $extension

File extension to use (since dots are sanitized, too)

Return Value

string

mixed getProjectSources()

Get sources for the sub-reports that should be generated for this project.

Return Value

mixed

protected ReportGenerator getReportGenerator()

Get the report generator.

Return Value

ReportGenerator

protected bool isRestrictedToNewestLabel()

Determines if this report should take only the newest label for each annotation.

Return Value

bool