Documentation

GRIS_SHOW
in package

Class to manage the visibility of attributes and form fields

With this the class the visibility of attributes and form fields can be configured individually

PHP version 7

Copyright (c) 2021, Holger Heuser, GESIS Leibniz Institute for the Social Sciences Unter Sachsenhausen 6-8 50667 Cologne, Germany

Tags
copyright

Copyright (c) 2021, Holger Heuser, GESIS Leibniz Institute for the Social Sciences

link

GESIS Leibniz Institute for the Social Sciences

since
3

File available since Release 3.0

version
1.0
author

Holger Heuser holger.heuser@gesis.org

Table of Contents

dbtable  = "gris_show"
The constant for the database table
settings_group  = "show"
The constant for the settings group
$classname  : object
The name of the class
$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 state
$base_path  : string
The base path of the object (for file operations)
$logger  : object
The object for logs
__construct()  : mixed
The class constructor
check_attribute()  : array<string|int, mixed>
Check if an attribute class is available for an object (and optional its ID)
check_attribute_by_id()  : array<string|int, mixed>
Check if an attribute ID is available for an object (and optional its ID)
delete_attribute()  : array<string|int, mixed>
Deletes an entry
get_attribute_id_by_class()  : int
Get the name of an attribute by its ID
get_attribute_list()  : array<string|int, mixed>
Get a list of all attributes (from table gris_attributes)
get_attribute_name()  : string
Get the (readable) name of an attributes (not the variable name)
get_attribute_search_list()  : array<string|int, mixed>
Get a list of all search_lists (from table gris_vocabulary!)
get_attributes()  : array<string|int, mixed>
Get a list of all attributes for a given object and ID (optional with all attribute data (when $list is submitted) or just a list of IDs)
get_id()  : int
Returns the show ID for a given attibute ID, object type and object ID
get_mandatory_attribute_list()  : array<string|int, mixed>
Get a list with gris_attribute_class of all mandatory attributes and hidden items are filtered (from table gris_attributes)
get_objects_by_attribute()  : array<string|int, mixed>
Get a list of all object IDs of a type for a given attribute
get_search_attributes()  : array<string|int, mixed>
Get a list of all attributes for a given object and ID (optional with all attribute data (when $list is submitted) or just a list of IDs)
set_attribute()  : array<string|int, mixed>
Sets a new entry with attribute, object type and object ID
set_search_attribute()  : array<string|int, mixed>
Sets a new entry with attribute, object type and object ID

Constants

dbtable

The constant for the database table

public mixed dbtable = "gris_show"

settings_group

The constant for the settings group

public mixed settings_group = "show"

Properties

$classname

The name of the class

protected object $classname = NULL
Tags
access

private

$dbconnection

The database object for managing the connection

protected object $dbconnection = NULL
Tags
access

private

$i18n

The object for translations

protected object $i18n
Tags
access

private

$settings

The object for settings

protected object $settings = null
Tags
access

private

$state

The object for state

protected object $state
Tags
access

private

$base_path

The base path of the object (for file operations)

private string $base_path
Tags
access

private

$logger

The object for logs

private object $logger
Tags
access

private

Methods

__construct()

The class constructor

public __construct() : mixed

Initializes the objects

Return values
mixed

check_attribute()

Check if an attribute class is available for an object (and optional its ID)

public check_attribute(string $attribute_class, string $object_type[, string $object_id = NULL ]) : array<string|int, mixed>
Parameters
$attribute_class : string

The class of the attribute

$object_type : string

The type of the object (e.g. gris_project, gris_resource)

$object_id : string = NULL

The ID of the object (optional)

Return values
array<string|int, mixed>

Returns an array of IDs

check_attribute_by_id()

Check if an attribute ID is available for an object (and optional its ID)

public check_attribute_by_id(string $attribute_id, string $object_type[, string $object_id = NULL ]) : array<string|int, mixed>
Parameters
$attribute_id : string

The ID of the attribute

$object_type : string

The type of the object (e.g. gris_project, gris_resource)

$object_id : string = NULL

The ID of the object (optional)

Return values
array<string|int, mixed>

Returns an array of IDs (Primary key of table gris_show) or 0 (int) if not found or -1 (int) on error

delete_attribute()

Deletes an entry

public delete_attribute(string $show_id) : array<string|int, mixed>
Parameters
$show_id : string

The ID (Primary key of table gris_show) of the entry

Return values
array<string|int, mixed>

Returns true on success and false on error

get_attribute_id_by_class()

Get the name of an attribute by its ID

public get_attribute_id_by_class(string $attribute_class, string $object_type) : int
Parameters
$attribute_class : string

The class of the attribute

$object_type : string

The type of the object (e.g. gris_project, gris_resource)

Return values
int

Returns the ID of the attribute or 0 (int) if not found

get_attribute_list()

Get a list of all attributes (from table gris_attributes)

public get_attribute_list(string $object[, string $group = NULL ][, bool $hidden = true ][, bool $import = false ]) : array<string|int, mixed>
Parameters
$object : string

The type of the object (e.g. gris_project, gris_resource)

$group : string = NULL

The group (optional)

$hidden : bool = true

Filter hidden entries

$import : bool = false

Use this attribute for import

Return values
array<string|int, mixed>

Returns an array with all attributes

get_attribute_name()

Get the (readable) name of an attributes (not the variable name)

public get_attribute_name(string $variable_name, string $object_name) : string
Parameters
$variable_name : string

The name of the variable

$object_name : string

The name of the object (an array is optional, to search multiple objects)

Return values
string

Returns the readable name of the attributes

get_attribute_search_list()

Get a list of all search_lists (from table gris_vocabulary!)

public get_attribute_search_list() : array<string|int, mixed>
Return values
array<string|int, mixed>

Returns an array with all attributes

get_attributes()

Get a list of all attributes for a given object and ID (optional with all attribute data (when $list is submitted) or just a list of IDs)

public get_attributes(string $object_type, int $object_id[, string $list = NULL ]) : array<string|int, mixed>
Parameters
$object_type : string

The type of the object (e.g. gris_project, gris_resource)

$object_id : int

The ID of the object

$list : string = NULL

The list of attributes (from $this->get_attribute_list)

Return values
array<string|int, mixed>

Returns an array with the IDs or the complete attribute data if $list is given

get_id()

Returns the show ID for a given attibute ID, object type and object ID

public get_id(string $attribute_id, string $object_type, string $object_id) : int
Parameters
$attribute_id : string

The ID of the attribute

$object_type : string

The type of the object (e.g. gris_project, gris_resource)

$object_id : string

The ID of the object (optional)

Return values
int

Returns the show ID

get_mandatory_attribute_list()

Get a list with gris_attribute_class of all mandatory attributes and hidden items are filtered (from table gris_attributes)

public get_mandatory_attribute_list(string $object) : array<string|int, mixed>
Parameters
$object : string

The type of the object (e.g. gris_project, gris_resource)

Return values
array<string|int, mixed>

Returns an array with all mandatory attributes

get_objects_by_attribute()

Get a list of all object IDs of a type for a given attribute

public get_objects_by_attribute(string $object_type, string $attribute_id) : array<string|int, mixed>
Parameters
$object_type : string

The type of the object (e.g. gris_project, gris_resource)

$attribute_id : string

The ID of the attribute

Return values
array<string|int, mixed>

Returns an array of object IDs or an empty array if not found

get_search_attributes()

Get a list of all attributes for a given object and ID (optional with all attribute data (when $list is submitted) or just a list of IDs)

public get_search_attributes(mixed $resourcetype_id) : array<string|int, mixed>
Parameters
$resourcetype_id : mixed
Return values
array<string|int, mixed>

Returns an array with the IDs or the complete attribute data if $list is given

set_attribute()

Sets a new entry with attribute, object type and object ID

public set_attribute(string $attribute_id, string $object_type, string $object_id) : array<string|int, mixed>
Parameters
$attribute_id : string

The ID of the attribute

$object_type : string

The type of the object (e.g. gris_project, gris_resource)

$object_id : string

The ID of the object (optional)

Return values
array<string|int, mixed>

Returns true on success and false on error

set_search_attribute()

Sets a new entry with attribute, object type and object ID

public set_search_attribute(string $attribute_id, mixed $typ_id, mixed $what) : array<string|int, mixed>
Parameters
$attribute_id : string

The ID of the attribute

$typ_id : mixed
$what : mixed
Return values
array<string|int, mixed>

Returns true on success and false on error

Search results