Documentation

GRIS_IDA
in package

Class for IDA connection

With this class the IDA connection can be managed.

PHP version 7

Copyright (c) 2022, Nico Wende

Tags
copyright

Copyright (c) 2022, Nico Wende

link
http://git.gesis.org/gris-leibniz
since
1

File available since Release 3.3.3

version
1.0
author

Nico Wende nico.wende@leiza.de

Table of Contents

settings_group  = "gris_ida"
The constant for the settings group
$base_url  : string
The base url to IDA API
$dbconnection  : object
The database object for managing the connection
$dbreader  : object
The database object for reading access only
$error_data  : array<string|int, mixed>
Information variables for possible errors
$error_message  : string
Information variables for possible errors
$error_url  : string
Information variables for possible errors
$i18n  : object
The i18n object
$settings  : object
The object for settings
$state  : object
The object for logs
$template  : object
The object for templates
__construct()  : mixed
The class constructor
basic_ida_requests()  : array<string|int, mixed>
Performs basic requests for ida formulars and returns the necessary data
dashboard_formulars()  : array<string|int, mixed>
Requests and returns the formular ids and short titles from the institutions dashboard items (default) or a given dashboard item, optionally filtered by formular names
dataset_formulars()  : array<string|int, mixed>
Requests and returns the formular ids and short titles from the institutions datasets, optionally filtered by formular names
delete_custom_config_item()  : array<string|int, mixed>|null
Delete a custom ida configuration item
get_config_data()  : array<string|int, mixed>|null
Get the ida configuration data (custom over default)
get_config_item()  : array<string|int, mixed>|null
Get the ida configuration item for an attribute (custom over default)
get_error()  : mixed
get_ida_attribute_table()  : string
Returns the ida attributes and its labels as a table
get_ida_config_table()  : string
Returns the ida configurations as a table
get_ida_exchange_table()  : string
Returns the ida attribute data and GRIS values as a table
get_references()  : array<string|int, mixed>
Performs a database query for the gris references based on the given configuration item
get_value()  : array<string|int, mixed>|null
Performs a database query for the gris value based on the given configuration item
has_config_data()  : bool
Check if an ida attribute has its gris configuration
http_request()  : array<string|int, mixed>|bool
Execute a HTTP request
ida_label()  : array<string|int, mixed>
Find the label of an attribute
login()  : array<string|int, mixed>|bool
Performs the login to IDA
save_config_item()  : array<string|int, mixed>
Save an ida configuration item

Constants

settings_group

The constant for the settings group

public mixed settings_group = "gris_ida"

Properties

$base_url

The base url to IDA API

private string $base_url = "https://ida.api.aptecloud.valucon.de"
Tags
access

private

$dbconnection

The database object for managing the connection

private object $dbconnection = null
Tags
access

private

$dbreader

The database object for reading access only

private object $dbreader = null
Tags
access

private

$error_data

Information variables for possible errors

private array<string|int, mixed> $error_data = null
Tags
access

private

$error_message

Information variables for possible errors

private string $error_message = null
Tags
access

private

$error_url

Information variables for possible errors

private string $error_url = null
Tags
access

private

$i18n

The i18n object

private object $i18n
Tags
access

private

$settings

The object for settings

private object $settings = null
Tags
access

private

$state

The object for logs

private object $state
Tags
access

private

$template

The object for templates

private object $template
Tags
access

private

Methods

__construct()

The class constructor

public __construct() : mixed

Initializes the objects

Return values
mixed

basic_ida_requests()

Performs basic requests for ida formulars and returns the necessary data

public basic_ida_requests(string $formular_id, string $auth_header, string $current) : array<string|int, mixed>
Parameters
$formular_id : string

The formular id

$auth_header : string

The authentification headers

$current : string

Indicates whether current or past datasets are requested

Return values
array<string|int, mixed>

Returns the necessary data for following requests

dashboard_formulars()

Requests and returns the formular ids and short titles from the institutions dashboard items (default) or a given dashboard item, optionally filtered by formular names

public dashboard_formulars([array<string|int, mixed> $filter_year = true ][, array<string|int, mixed> $formular_names = null ][, array<string|int, mixed> $dashboard_item_id = null ]) : array<string|int, mixed>
Parameters
$filter_year : array<string|int, mixed> = true

Optional filter for selected reporting year

$formular_names : array<string|int, mixed> = null

Optional formular names as a filter

$dashboard_item_id : array<string|int, mixed> = null

Optional dashboard item id to search for instead of using the institutions dashboard items (overwrites filter_year? TODO)

Return values
array<string|int, mixed>

Returns an array with form ids, short titles and a flag whether the respective form is active or inactive

dataset_formulars()

Requests and returns the formular ids and short titles from the institutions datasets, optionally filtered by formular names

public dataset_formulars([array<string|int, mixed> $filter_year = true ][, array<string|int, mixed> $formular_names = null ]) : array<string|int, mixed>
Parameters
$filter_year : array<string|int, mixed> = true

Optional filter for selected reporting year

$formular_names : array<string|int, mixed> = null

Optional formular names as a filter

Return values
array<string|int, mixed>

Returns an array with form ids, short titles and a flag whether the respective form is active or inactive

delete_custom_config_item()

Delete a custom ida configuration item

public delete_custom_config_item(string $attribute_name) : array<string|int, mixed>|null
Parameters
$attribute_name : string

The name of the attribute

Return values
array<string|int, mixed>|null

Returns the remaining default configuration item or NULL

get_config_data()

Get the ida configuration data (custom over default)

public get_config_data([string $formular_name = null ]) : array<string|int, mixed>|null
Parameters
$formular_name : string = null

Optional formular filter

Return values
array<string|int, mixed>|null

Returns all or filtered configuration data or NULL

get_config_item()

Get the ida configuration item for an attribute (custom over default)

public get_config_item(string $attribute_name) : array<string|int, mixed>|null
Parameters
$attribute_name : string

The name of the attribute

Return values
array<string|int, mixed>|null

Returns the configuration item or NULL

get_error()

public get_error() : mixed
Return values
mixed

get_ida_attribute_table()

Returns the ida attributes and its labels as a table

public get_ida_attribute_table(string $formular_id[, bool $current = true ][, bool $subtable = false ]) : string
Parameters
$formular_id : string

IDA formular id

$current : bool = true

Indicates if current or former data is requested

$subtable : bool = false

Indicates if it is a nested table

Return values
string

Returns a html table with available IDA attribute data

get_ida_config_table()

Returns the ida configurations as a table

public get_ida_config_table(string $formular_name) : string
Parameters
$formular_name : string

The formular name

Return values
string

Returns a html table with available configurations

get_ida_exchange_table()

Returns the ida attribute data and GRIS values as a table

public get_ida_exchange_table(string $formular_id, string $formular_name[, bool $current = true ]) : string
Parameters
$formular_id : string

IDA formular id

$formular_name : string

Name of the IDA formular

$current : bool = true

Indicates if current or former data is requested

Return values
string

Returns a html table with available IDA and GRIS data

get_references()

Performs a database query for the gris references based on the given configuration item

public get_references(array<string|int, mixed> $config_item) : array<string|int, mixed>
Parameters
$config_item : array<string|int, mixed>

The configuration item

Return values
array<string|int, mixed>

Returns the query result

get_value()

Performs a database query for the gris value based on the given configuration item

public get_value(array<string|int, mixed> $config_item) : array<string|int, mixed>|null
Parameters
$config_item : array<string|int, mixed>

The configuration item

Return values
array<string|int, mixed>|null

If the query is unsuccessful, null is returned, otherwise the array {a, b} with the query result (a) and a boolean indicator for existing references (b)

has_config_data()

Check if an ida attribute has its gris configuration

public has_config_data(string $attribute_name) : bool
Parameters
$attribute_name : string

The name of the attribute

Return values
bool

Returns a boolean

http_request()

Execute a HTTP request

public http_request(string $url, string $method[, string $header = "" ][, array<string|int, mixed> $data = array() ]) : array<string|int, mixed>|bool
Parameters
$url : string

The target URL

$method : string

The HTTP Method

$header : string = ""

Additional headers

$data : array<string|int, mixed> = array()

Optional request data

Return values
array<string|int, mixed>|bool

Returns the response content or FALSE for failure

ida_label()

Find the label of an attribute

public ida_label(array<string|int, mixed> $custom_field, array<string|int, mixed> $step_tile[, array<string|int, mixed> $step = null ]) : array<string|int, mixed>
Parameters
$custom_field : array<string|int, mixed>

Custom field data

$step_tile : array<string|int, mixed>

Step tile data

$step : array<string|int, mixed> = null

Optional step data

Return values
array<string|int, mixed>

Returns the possible label of the attribute

login()

Performs the login to IDA

public login(string $email, string $password) : array<string|int, mixed>|bool
Parameters
$email : string

The IDA email

$password : string

The IDA password

Return values
array<string|int, mixed>|bool

Returns the authentication data or FALSE for failure

save_config_item()

Save an ida configuration item

public save_config_item(string $formular, string $attribute_name, string $sql_value, string $sql_value_aggregation, string $sql_reference, string $sql_reference_group, string $sql_from, string $sql_join, string $sql_where) : array<string|int, mixed>
Parameters
$formular : string

The name of the ida formular

$attribute_name : string

The name of the attribute

$sql_value : string

The column with values for ida to be returned

$sql_value_aggregation : string

The aggregation method for values

$sql_reference : string

The reference column to be returned

$sql_reference_group : string

The group column for optional grouping of references

$sql_from : string

The FROM clause (for the table which contains the references)

$sql_join : string

The JOIN subclauses

$sql_where : string

The WHERE clause

Return values
array<string|int, mixed>

Returns the matching configuration item (custom over default)

Search results