GRIS_STATISTICS
in package
Class for statistics
With this class statistics can be created.
PHP 7
Copyright (c) 2020, Holger Heuser, GESIS Leibniz Institute for the Social Sciences Unter Sachsenhausen 6-8 50667 Cologne, Germany
Tags
Table of Contents
- settings_group = "statistics"
- The constant for the settings group
- $dbconnection : object
- The database object for managing the connection
- $i18n : object
- The object for translations
- $settings : object
- The object for settings
- $state : object
- The object for logs
- __construct() : mixed
- The class constructor
- count_referred() : int
- Counts the number of referred publication in a list of resource IDs
- get_cat_resource_list() : array<string|int, mixed>
- Returns all resources (DISTINCT) for given categories
- get_cpt_resource_list() : array<string|int, mixed>
- Returns a list of resources according to "current potential" method (optional grouped)
- get_wda_resource_list() : array<string|int, mixed>
- Returns a list of resources according to "work done at" method (optional grouped)
- unit_persons_from_history() : array<string|int, mixed>
- Returns all units (optional) and the corresponding persons with start and end date
- unit_persons_from_organigram() : array<string|int, mixed>
- Returns all units (optional) and the corresponding persons (current date)
- get_person_resources() : array<string|int, mixed>
- Returns all resources (DISTINCT) of a group of persons
- is_in_range() : bool
- Checks if a given date is in a range. If start or end ist missing, the entry is replace by a date in the past (for end) or today (for start). If both are missing, false is returned
Constants
settings_group
The constant for the settings group
public
mixed
settings_group
= "statistics"
Properties
$dbconnection
The database object for managing the connection
private
object
$dbconnection
= NULL
Tags
$i18n
The object for translations
private
object
$i18n
Tags
$settings
The object for settings
private
object
$settings
= null
Tags
$state
The object for logs
private
object
$state
Tags
Methods
__construct()
The class constructor
public
__construct() : mixed
Initializes the objects
Return values
mixed —count_referred()
Counts the number of referred publication in a list of resource IDs
public
count_referred(array<string|int, mixed> $list) : int
Parameters
- $list : array<string|int, mixed>
-
The list of resource IDs
Return values
int —Returns the count of referred resources
get_cat_resource_list()
Returns all resources (DISTINCT) for given categories
public
get_cat_resource_list([array<string|int, mixed> $categories = NULL ][, array<string|int, mixed> $resourcetypes = NULL ][, bool $group = false ][, array<string|int, mixed> $filter = NULL ]) : array<string|int, mixed>
Parameters
- $categories : array<string|int, mixed> = NULL
-
The category IDs to filter as an array
- $resourcetypes : array<string|int, mixed> = NULL
-
The resourcetype IDs to filter as an array (No filter if NULL)
- $group : bool = false
-
Group list by resourcetypes
- $filter : array<string|int, mixed> = NULL
-
Additional filters as an array of attributes and values ($filter["title"] = "xyz")
Return values
array<string|int, mixed> —Returns all resource IDs as a list
get_cpt_resource_list()
Returns a list of resources according to "current potential" method (optional grouped)
public
get_cpt_resource_list(array<string|int, mixed> $unit_personlist[, array<string|int, mixed> $resourcetypes = NULL ][, bool $group_resourcetypes = false ][, bool $group_units = false ][, array<string|int, mixed> $filter = NULL ]) : array<string|int, mixed>
Parameters
- $unit_personlist : array<string|int, mixed>
-
The person IDs to filter as an array grouped by unit names
- $resourcetypes : array<string|int, mixed> = NULL
-
The resourcetype IDs to filter as an array (No filter if NULL)
- $group_resourcetypes : bool = false
-
Group list by resourcetypes
- $group_units : bool = false
-
Group list by units
- $filter : array<string|int, mixed> = NULL
-
Additional filters as an array of attributes and values ($filter["title"] = "xyz")
Return values
array<string|int, mixed> —Returns alls resource IDs as a list
get_wda_resource_list()
Returns a list of resources according to "work done at" method (optional grouped)
public
get_wda_resource_list(array<string|int, mixed> $unit_personlist[, bool $resourcetypes = NULL ][, bool $group_resourcetypes = false ][, bool $group_units = true ][, bool $filter = NULL ]) : array<string|int, mixed>
Parameters
- $unit_personlist : array<string|int, mixed>
-
A list of persons ordered by units (Output of $this->unit_persons_from_history)
- $resourcetypes : bool = NULL
-
The resourcetypes to filter as an array of IDs (No filter if NULL)
- $group_resourcetypes : bool = false
-
Group list by resourcetype
- $group_units : bool = true
-
Group list by units
- $filter : bool = NULL
-
Additional filters
Return values
array<string|int, mixed> —A list of resource IDs (optional grouped by units and resourcetype)
unit_persons_from_history()
Returns all units (optional) and the corresponding persons with start and end date
public
unit_persons_from_history(array<string|int, mixed> $units[, bool $sort = true ][, bool $group_headunits = false ]) : array<string|int, mixed>
Parameters
- $units : array<string|int, mixed>
-
Filter units (list of unit IDs)
- $sort : bool = true
-
Sort by units (otherwise only person IDs are returned as a list)
- $group_headunits : bool = false
-
Group by headunits
Return values
array<string|int, mixed> —Returns an array sorted by units (optional) and person IDs (unit => person_id => state => date) or (person_id => state => date)
unit_persons_from_organigram()
Returns all units (optional) and the corresponding persons (current date)
public
unit_persons_from_organigram(array<string|int, mixed> $units[, bool $group_headunits = false ][, bool $sort = true ]) : array<string|int, mixed>
Parameters
- $units : array<string|int, mixed>
-
Filter units (list of unit IDs)
- $group_headunits : bool = false
-
Use subunits (not only first level)
- $sort : bool = true
-
Sort by units (otherwise only person IDs are returned as a list)
Return values
array<string|int, mixed> —Returns an array sorted by units (optional) and person IDs (array(unit) => array(person_id) or array(person_id))
get_person_resources()
Returns all resources (DISTINCT) of a group of persons
private
get_person_resources(array<string|int, mixed> $persons[, array<string|int, mixed> $resourcetypes = NULL ][, bool $group_resourcetypes = true ][, bool $publisher = false ][, array<string|int, mixed> $filter = NULL ]) : array<string|int, mixed>
Parameters
- $persons : array<string|int, mixed>
-
The person IDs to filter as an array
- $resourcetypes : array<string|int, mixed> = NULL
-
The resourcetype IDs to filter as an array (No filter if NULL)
- $group_resourcetypes : bool = true
-
Group list by resourcetypes
- $publisher : bool = false
-
Exclude publisher as role (or include on true)
- $filter : array<string|int, mixed> = NULL
-
Additional filters as an array of attributes and values ($filter["date"] or $filter["begin"] and $filter["end"] (yyyy-mm-dd) have to be given, $filter["title"] = "xyz" and categories are optional)
Return values
array<string|int, mixed> —Returns alls resource IDs as a list (optional grouped by resourcetype ID)
is_in_range()
Checks if a given date is in a range. If start or end ist missing, the entry is replace by a date in the past (for end) or today (for start). If both are missing, false is returned
private
is_in_range(string $date, array<string|int, mixed> $range) : bool
Parameters
- $date : string
-
The date to check
- $range : array<string|int, mixed>
-
The range (with valid keys "Beginn" and "Ende")
Return values
bool —Returns true or false