Contents

Dashboard\Classes\DashManager

Overview

DashManager manages dashboards, report data sources and widgets.


Protected Properties

protected string $configPath

configPath specifies a path to the config directory.

protected array $dataSources

dataSources registered with registerDataSourceClass, keyed by class name


Public Methods

public getConfigPath()

public getConfigPath(
    string $fileName,
    mixed $configPath = null
): string 

getConfigPath locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path.

public getDataSource()

public getDataSource(string $className): ?ReportDataSourceBase 

getDataSource returns a data source instance by its class name.

public getDefaultWidgetConfigs()

public getDefaultWidgetConfigs(): array 

getDefaultWidgetConfigs returns the default widget configuration for data source dimensions that have a defined type.

public getVueReportWidget()

public getVueReportWidget(
    string $className,
    Controller $controller
): ?VueReportWidgetBase 

getWidget returns a dashboard widget instance by its class name.

public guessConfigPath()

public guessConfigPath(string $suffix = ''): string 

guessConfigPath guesses the package path for the called class.

public guessConfigPathFrom()

public guessConfigPathFrom(string $class, string $suffix = ''): string 

guessConfigPathFrom guesses the package path from a specified class.

public hasDashboardAccess()

public hasDashboardAccess($code, $user = null): bool 

hasDashboardAccess returns false when a registered dashboard requires permissions the user does not have

public static instance()

public static instance(): static 

instance creates a new instance of this singleton

public isVueReportWidget()

public isVueReportWidget($widgetCodeOrClass): bool 

public listAllReportWidgetGroups()

public listAllReportWidgetGroups(): void

public listDashboardDefinitions()

public listDashboardDefinitions(): array 

listDashboardDefinitions returns registered dashboard definitions keyed by code, loading those supplied as a YAML file path

public listDataSourceClasses()

public listDataSourceClasses(): array 

listDataSourceClasses returns class and display names of the data sources available to the current user.

public listRegistrations()

public listRegistrations($group): array 

listRegistrations returns the items registered with the registerDashboards method for the dashboards, widgets or dataSources group, where a plain array registers dashboards only

public listVueReportWidgetClasses()

public listVueReportWidgetClasses(): array 

listVueReportWidgetClasses returns class names and registration parameters of registered dashboard widgets.

public listVueReportWidgets()

public listVueReportWidgets(): array 

listVueReportWidgets returns the Vue report widgets available to the current user, keyed by class name.

public makeConfig()

public makeConfig(
    mixed $configFile = [],
    array $requiredConfig = []
): object 

makeConfig reads the contents of the supplied file and applies it to this object.

public makeConfigFromArray()

public makeConfigFromArray(array $configArray = []): stdClass 

makeConfigFromArray makes a config object from an array, making the first level keys properties of a new object.

public mergeConfig()

public mergeConfig(mixed $configA, mixed $configB): stdClass 

mergeConfig merges two configuration sources, either prepared or not, and returns them as a single configuration object.

public registerDataSourceClass()

public registerDataSourceClass(
    string $className,
    string $displayName,
    array $permissions = []
): void 

registerDataSourceClass registers a report data source.

public resolveReportWidget()

public resolveReportWidget(string $name): string 

resolveReportWidget returns a class name from a report widget code Normalizes a class name or converts an code to its class name. Returns the class name resolved, or the original name.

Protected Methods

protected getConfigValueFrom()

protected getConfigValueFrom($configObj, $name = null, $default = null): void

getConfigValueFrom will apply the config getter convention

protected hasDataSourcePermissions()

protected hasDataSourcePermissions($permissions): bool 

hasDataSourcePermissions checks the current user on every call, since the manager is shared between requests.

protected resolveVueComponentName()

protected resolveVueComponentName($className): string 

resolveVueComponentName reads the $componentName property from a Vue widget class without instantiating it. Falls back to deriving the name from the class name.