GRIS_RESOURCE
extends GRIS_CLASS_TEMPLATE
in package
Class to manage informations about resources in the database 2
With this class all resource information can be initially set or edited in the database
PHP version 7
Copyright (c) 2012, Holger Heuser Unter Sachsenhausen 6-8 50667 Cologne, Germany
Tags
Table of Contents
- dbtable = 'gris_resource'
- The constant for the database table
- settings_group = "resource"
- The constant for the settings group
- $classname : object
- The name of the class
- $dbconnection : object
- The database object for managing the connection
- $full_data : array<string|int, mixed>
- The dataset of the resource information
- $i18n : object
- The object for translations
- $id : object
- The current object ID
- $settings : object
- The object for settings
- $state : object
- The object for state
- $xml_data : string
- The data as xml string
- $auth : object
- The object for authentication
- $citation : object
- The citation object
- $is_admin : bool
- The admin state
- $permissions : object
- The object for permissions
- $person : object
- The object for person
- $person_id : string
- The ID of the person
- __construct() : mixed
- The class constructor
- change_resourcetype() : int
- Change the resource type
- check_citation_scheme() : bool
- Checks if the resourcetype ID is part of a given citation scheme
- check_resource_permission() : bool
- Checks if the given person has the permission to view this resource
- count_resource_personname() : int
- Counts the own personname entries of a person for a given resource ID and optional role (if no person ID is given it counts all entries, not only the own ones)
- debug() : bool
- Output the full dataset without object data (all subobjects are parsed recursively)
- delete_all_publication_institutes() : bool
- Delete all resource publication institutes for the current publication ID
- delete_all_resource_persons() : bool
- Delete all resource persons for the current ID
- delete_resource() : bool
- Delete a resource entry
- edit_resourcetype_citation_scheme() : bool
- Changes the citation scheme of a resourcetype
- edit_resourcetype_workflow() : bool
- Changes the default workflow of a resourcetype
- get() : array<string|int, mixed>|object|string
- Returns an array of the full data or (if given) only certain attributes (separated by "|" for a subattribute)
- get_all_resources() : array<string|int, mixed>
- Returns a list of all resources for a given year (or all, if no year is given)
- get_citation() : string
- Returns a citation
- get_citations_by_id_list() : array<string|int, mixed>
- Returns a list of resources with the given IDs from the parameter (array)
- get_export_list() : array<string|int, mixed>
- Returns a list of publications for a given person ID and a resourcetype ID
- get_flat_data() : array<string|int, mixed>
- Get the data in a flat format. From subarrays only the first entry is merged
- get_flat_data_old() : array<string|int, mixed>
- Get the data in a flat format. From subarrays only the first entry is merged
- get_max_publication_institutes_order() : int
- Get the highest order number for a given publication ID in the table gris_publication_institutes
- get_max_resource_persons_order() : int
- Get the highest order number for a given resource ID in the table gris_resource_persons
- get_max_resourcetype_order() : int
- Returns the highest order number of a resourcetype inside a group
- get_orphaned_resources() : array<string|int, mixed>
- Returns a list of orphaned resources (without internal authors or with a combination of internal authors or publishers that are not listed due to the respective citation scheme)
- get_person_ids() : array<string|int, mixed>
- Returns a list of person IDs for a given resource ID
- get_persons() : array<string|int, mixed>
- Returns a list of persons for a given resource ID and role (e. g. authors or editors)
- get_publication_institutes() : array<string|int, mixed>
- Returns a list of publication institutes for a given publication ID
- get_referenced_resourcetype_groups() : array<string|int, mixed>
- Returns all referenced resourcetype groups
- get_referenced_resourcetypes() : array<string|int, mixed>
- Returns all referenced resourcetypes
- get_resource_all_show() : array<string|int, mixed>
- Returns all show entries for this resource
- get_resource_dump() : array<string|int, mixed>
- Returns a list of all resource IDs
- get_resource_id_list() : array<string|int, mixed>
- Returns a list of resource ids for a given person ID and a resourcetype ID
- get_resource_list() : array<string|int, mixed>
- Returns a list of publications for a given person ID and a resourcetype ID
- get_resource_list_by_attribute() : array<string|int, mixed>
- Returns all resource IDs that have a given attribute value
- get_resource_list_by_id() : array<string|int, mixed>
- Returns all resource IDs that are referenced by this object
- get_resource_show() : bool
- Returns if the resource is shown or hidden for this person
- get_resources_by_units() : array<string|int, mixed>
- Returns a list of resources for a given (list) of unit IDs
- get_resourcetype_by_id() : string
- Returns the name of a resourcetype according to a given ID
- get_resourcetype_citation_scheme() : bool
- Get the citation scheme of the current resourcetype
- get_resourcetype_groups() : array<string|int, mixed>
- Returns all resourcetype groups
- get_resourcetype_workflow() : int
- Returns the workflow for a given resourcetype ID
- get_resourcetypes() : array<string|int, mixed>
- Returns all resourcetypes or only types for a given person_id
- get_resourcetypes_from_groups() : array<string|int, mixed>
- Returns all resourcetypes of a given group
- get_workflow_step() : array<string|int, mixed>
- Returns a workflow step
- id() : int
- Set a new ID or return the current ID if $id is NULL. The numeric value 0 is also set to NULL.
- pull_json() : string
- Returns the object data as JSON
- pull_xml() : string
- Returns the object data as XML
- push_xml() : bool
- Push an xml into the object (experimental, not finished yet)
- renew_cache() : void
- Calls the renew cache method for this in GRIS_CITE
- reset() : bool
- Reset the whole object (ID = NULL, full_data is empty)
- resource_exists() : array<string|int, mixed>
- Checks if a resource already exists with this title, year and type
- resource_id_exists() : bool
- Checks if a resource with the given ID exists
- resource_persons_exists() : int
- Check if the entry already exists in the table gris_resource_persons
- save_resource() : bool
- Save the full publication data
- search_resource() : array<string|int, mixed>
- Returns a list of publications for a given query (term, year, resourcetype ID)
- set() : bool
- Set data in the object
- set_publication_institute() : int
- Create a new publication institute entry
- set_resource_person() : int
- Create a new resource person entry with given ID
- set_resourcetype_default_show() : bool
- Set the the resourcetype to be shown or not in the internet as default
- set_resourcetype_group() : bool
- Changes the group of a resourcetype and set the type to the highest order
- set_resourcetype_hidden() : bool
- Updates the hidden state of a resourcetype
- set_show_resource() : bool
- Sets the resource show entry for a person
- unset_attribute() : bool
- Unsets an attribute
- update() : bool
- Updates the object by filling all arrays with data
- update_publication_institutes_order() : int
- Update the order of a publication institute entry
- update_resource_person_order() : int
- Update the order of a resource person entry
- initialize() : bool
- Initializes the object by filling the array with data
- array_to_xml() : bool
- Convert an array into an xml representation
- get_resourcetype_default_show() : int
- Returns the default for showing a given resourcetype
- out() : bool
- Preformatted output of the variable (for development)
- persist() : bool
- Update a resource entry
- publication_institute_exists() : int
- Check if the entry already exists in the table gris_publication_institutes
Constants
dbtable
The constant for the database table
public
mixed
dbtable
= 'gris_resource'
settings_group
The constant for the settings group
public
mixed
settings_group
= "resource"
Properties
$classname
The name of the class
protected
object
$classname
= NULL
Tags
$dbconnection
The database object for managing the connection
protected
object
$dbconnection
= NULL
Tags
$full_data
The dataset of the resource information
protected
array<string|int, mixed>
$full_data
= array()
Tags
$i18n
The object for translations
protected
object
$i18n
Tags
$id
The current object ID
protected
object
$id
Tags
$settings
The object for settings
protected
object
$settings
= null
Tags
$state
The object for state
protected
object
$state
Tags
$xml_data
The data as xml string
protected
string
$xml_data
= NULL
Tags
$auth
The object for authentication
private
object
$auth
Tags
$citation
The citation object
private
object
$citation
Tags
$is_admin
The admin state
private
bool
$is_admin
Tags
$permissions
The object for permissions
private
object
$permissions
Tags
$person
The object for person
private
object
$person
Tags
$person_id
The ID of the person
private
string
$person_id
Tags
Methods
__construct()
The class constructor
public
__construct([string $person_id = -1 ][, string $id = NULL ]) : mixed
Parameters
- $person_id : string = -1
-
The ID of the person
- $id : string = NULL
-
The ID of the resource
Initializes the objects
Return values
mixed —change_resourcetype()
Change the resource type
public
change_resourcetype(string $id, string $resource_type_id) : int
Parameters
- $id : string
-
The ID of the resource (should also work with an int param)
- $resource_type_id : string
-
The ID of the resource type (should also work with an int param)
Return values
int —Returns true for success, false for an error
check_citation_scheme()
Checks if the resourcetype ID is part of a given citation scheme
public
check_citation_scheme(string $id, string $citation_scheme) : bool
Parameters
- $id : string
-
Resourcetype ID
- $citation_scheme : string
-
The citation scheme
Return values
bool —Returns true for resourcetype ID is part or false if not
check_resource_permission()
Checks if the given person has the permission to view this resource
public
check_resource_permission() : bool
Return values
bool —Returns true for show and false for hide
count_resource_personname()
Counts the own personname entries of a person for a given resource ID and optional role (if no person ID is given it counts all entries, not only the own ones)
public
count_resource_personname([string $role = NULL ]) : int
Parameters
- $role : string = NULL
-
The role of the person (as set in the database)
Return values
int —The count of entries (returns 0 if personname doesn't belong to person ID)
debug()
Output the full dataset without object data (all subobjects are parsed recursively)
public
debug() : bool
Return values
bool —true
delete_all_publication_institutes()
Delete all resource publication institutes for the current publication ID
public
delete_all_publication_institutes(int $gris_publication_id) : bool
Parameters
- $gris_publication_id : int
-
The publication ID
Return values
bool —Returns true for success and false if no id is given
delete_all_resource_persons()
Delete all resource persons for the current ID
public
delete_all_resource_persons() : bool
Return values
bool —Returns true for success and false if no id is given
delete_resource()
Delete a resource entry
public
delete_resource(string $id) : bool
Parameters
- $id : string
-
The ID for the resource entry (should also work with an int param)
Return values
bool —Returns true for success or false for an error (details are stored in state object)
edit_resourcetype_citation_scheme()
Changes the citation scheme of a resourcetype
public
edit_resourcetype_citation_scheme(string $id, string $citation_scheme) : bool
Parameters
- $id : string
-
Resourcetype ID
- $citation_scheme : string
-
The citation scheme
Return values
bool —Returns true for success or false if not
edit_resourcetype_workflow()
Changes the default workflow of a resourcetype
public
edit_resourcetype_workflow(string $resourcetype_id, mixed $workflow_id) : bool
Parameters
- $resourcetype_id : string
-
Resourcetype ID
- $workflow_id : mixed
Return values
bool —Returns true for success or false if not
get()
Returns an array of the full data or (if given) only certain attributes (separated by "|" for a subattribute)
public
get([string $attribute = NULL ]) : array<string|int, mixed>|object|string
Parameters
- $attribute : string = NULL
-
The attributes separated by [parent|child]
Return values
array<string|int, mixed>|object|string —The dataset or NULL
get_all_resources()
Returns a list of all resources for a given year (or all, if no year is given)
public
get_all_resources(int $year[, bool $show = true ][, bool $resourcetype_id = NULL ]) : array<string|int, mixed>
Parameters
- $year : int
-
The given year
- $show : bool = true
-
Only resources with show flag
- $resourcetype_id : bool = NULL
-
The resourcetype ID
Return values
array<string|int, mixed> —The array with IDs
get_citation()
Returns a citation
public
get_citation([string $id = NULL ][, mixed $link = false ][, bool $internal = true ]) : string
Parameters
- $id : string = NULL
-
The resource ID
- $link : mixed = false
- $internal : bool = true
-
Show internal list with more information in scheme (e. g. referred)
Return values
string —Returns the citation of a given ID
get_citations_by_id_list()
Returns a list of resources with the given IDs from the parameter (array)
public
get_citations_by_id_list(mixed $id_list) : array<string|int, mixed>
Parameters
- $id_list : mixed
Return values
array<string|int, mixed> —The html code for the table
get_export_list()
Returns a list of publications for a given person ID and a resourcetype ID
public
get_export_list(string $resourcetype_id[, bool $filter_person_id = true ][, bool $filter_show = false ]) : array<string|int, mixed>
Parameters
- $resourcetype_id : string
-
The resourcetype ID
- $filter_person_id : bool = true
-
Use only resources of a given person
- $filter_show : bool = false
-
Use only items where resource show is set
Return values
array<string|int, mixed> —The array with the resource objects
get_flat_data()
Get the data in a flat format. From subarrays only the first entry is merged
public
get_flat_data([bool $hierarchy = false ][, mixed $data = NULL ]) : array<string|int, mixed>
Parameters
- $hierarchy : bool = false
-
Return full flat (standard) or array hierarchy (if true)
- $data : mixed = NULL
-
Use other data than $this->full_data
Return values
array<string|int, mixed> —The flat data
get_flat_data_old()
Get the data in a flat format. From subarrays only the first entry is merged
public
get_flat_data_old([bool $hierarchy = false ][, mixed $data = NULL ]) : array<string|int, mixed>
Parameters
- $hierarchy : bool = false
-
Return full flat (standard) or array hierarchy (if true)
- $data : mixed = NULL
-
Use other data than $this->full_data
Return values
array<string|int, mixed> —The flat data
get_max_publication_institutes_order()
Get the highest order number for a given publication ID in the table gris_publication_institutes
public
get_max_publication_institutes_order(string $publication_id) : int
Parameters
- $publication_id : string
-
The ID of the publication (should also work with an int param)
Return values
int —The highest order number (returns 0 if no number was found)
get_max_resource_persons_order()
Get the highest order number for a given resource ID in the table gris_resource_persons
public
get_max_resource_persons_order(string $id, string $role) : int
Parameters
- $id : string
-
The ID of the resource dataset (should also work with an int param)
- $role : string
-
The role of the person
Return values
int —The highest order number (returns 0 if no number was found)
get_max_resourcetype_order()
Returns the highest order number of a resourcetype inside a group
public
get_max_resourcetype_order(string $group_id) : int
Parameters
- $group_id : string
-
Resourcetype group ID
Return values
int —The highest order number for a resourcetype group
get_orphaned_resources()
Returns a list of orphaned resources (without internal authors or with a combination of internal authors or publishers that are not listed due to the respective citation scheme)
public
get_orphaned_resources() : array<string|int, mixed>
Return values
array<string|int, mixed> —The resource list with resource id, resourcetype id and year
get_person_ids()
Returns a list of person IDs for a given resource ID
public
get_person_ids() : array<string|int, mixed>
Return values
array<string|int, mixed> —The array with the list of IDs
get_persons()
Returns a list of persons for a given resource ID and role (e. g. authors or editors)
public
get_persons(string $id, string $role[, bool $complete_array = false ][, mixed $complete_name = false ]) : array<string|int, mixed>
Parameters
- $id : string
-
The resource ID
- $role : string
-
The role of the persons
- $complete_array : bool = false
-
The type of the return value (false = only names and firstnames in a single row, true = complete array)
- $complete_name : mixed = false
Return values
array<string|int, mixed> —The array with the list entries
get_publication_institutes()
Returns a list of publication institutes for a given publication ID
public
get_publication_institutes(string $publication_id[, string $gris_publication_institutes_id = NULL ]) : array<string|int, mixed>
Parameters
- $publication_id : string
-
The publication ID
- $gris_publication_institutes_id : string = NULL
-
The publication institutes ID
Return values
array<string|int, mixed> —The array with the publication institutes ID as a key and the object of the publication institutes as value
get_referenced_resourcetype_groups()
Returns all referenced resourcetype groups
public
get_referenced_resourcetype_groups() : array<string|int, mixed>
Return values
array<string|int, mixed> —Sorted array with all IDs of referenced resourcetype groups
get_referenced_resourcetypes()
Returns all referenced resourcetypes
public
get_referenced_resourcetypes() : array<string|int, mixed>
Return values
array<string|int, mixed> —Sorted array with all IDs of referenced resourcetypes
get_resource_all_show()
Returns all show entries for this resource
public
get_resource_all_show([string $id = NULL ]) : array<string|int, mixed>
Parameters
- $id : string = NULL
-
The resource ID
Return values
array<string|int, mixed> —Returns an array with show(not show entries)
get_resource_dump()
Returns a list of all resource IDs
public
get_resource_dump([bool $show = true ]) : array<string|int, mixed>
Parameters
- $show : bool = true
-
Only resources with show flag
Return values
array<string|int, mixed> —The array with IDs
get_resource_id_list()
Returns a list of resource ids for a given person ID and a resourcetype ID
public
get_resource_id_list(string $resourcetype_id[, bool $filter_person_id = true ][, bool $filter_show = false ]) : array<string|int, mixed>
Parameters
- $resourcetype_id : string
-
The resourcetype ID
- $filter_person_id : bool = true
-
Use only resources of a given person
- $filter_show : bool = false
-
Use only items where resource show is set
Return values
array<string|int, mixed> —An array with ressource IDs as key and the year as value
get_resource_list()
Returns a list of publications for a given person ID and a resourcetype ID
public
get_resource_list(string $resourcetype_id[, bool $filter_person_id = true ][, string $link = false ][, bool $internal = true ][, bool $permission = false ]) : array<string|int, mixed>
Parameters
- $resourcetype_id : string
-
The resourcetype ID
- $filter_person_id : bool = true
-
Use only resources of a given person
- $link : string = false
-
Create links for DOI, URN od URL inside the citation (forwarded to get_citation)
- $internal : bool = true
-
Return internal list (ignore if resource show is set)
- $permission : bool = false
-
Return read only state
Return values
array<string|int, mixed> —The html code for the table
get_resource_list_by_attribute()
Returns all resource IDs that have a given attribute value
public
get_resource_list_by_attribute(string $dbtable, string $attribute, string $value) : array<string|int, mixed>
Parameters
- $dbtable : string
-
The table to search in
- $attribute : string
-
The attribute to search in
- $value : string
-
The value for the attribute
Return values
array<string|int, mixed> —The html code for the table
get_resource_list_by_id()
Returns all resource IDs that are referenced by this object
public
get_resource_list_by_id(string $id, string $type[, bool $ref_count = false ]) : array<string|int, mixed>
Parameters
- $id : string
-
The ID of the object
- $type : string
-
The ID type for searching references
- $ref_count : bool = false
-
Return only the count of references
Return values
array<string|int, mixed> —The html code for the table
get_resource_show()
Returns if the resource is shown or hidden for this person
public
get_resource_show(string $id, string $person_id) : bool
Parameters
- $id : string
-
The resource ID
- $person_id : string
-
The person ID
Return values
bool —Returns true for show and false for hide
get_resources_by_units()
Returns a list of resources for a given (list) of unit IDs
public
get_resources_by_units(array<string|int, mixed> $ids[, int $year = NULL ][, bool $show = true ]) : array<string|int, mixed>
Parameters
- $ids : array<string|int, mixed>
-
The unit ID list
- $year : int = NULL
-
The year to filter (all years is empty)
- $show : bool = true
-
Only resources with show flag
Return values
array<string|int, mixed> —The array with IDs
get_resourcetype_by_id()
Returns the name of a resourcetype according to a given ID
public
get_resourcetype_by_id(string $ids) : string
Parameters
- $ids : string
-
The ID of the resourcetype (optional an array of IDs)
Return values
string —The name of the matching resourcetype (or an arry of names)
get_resourcetype_citation_scheme()
Get the citation scheme of the current resourcetype
public
get_resourcetype_citation_scheme([string $resourcetype_id = NULL ]) : bool
Parameters
- $resourcetype_id : string = NULL
-
Resourcetype ID
Return values
bool —Returns the citation scheme as a string
get_resourcetype_groups()
Returns all resourcetype groups
public
get_resourcetype_groups() : array<string|int, mixed>
Return values
array<string|int, mixed> —Sorted array with all resourcetype groups
get_resourcetype_workflow()
Returns the workflow for a given resourcetype ID
public
get_resourcetype_workflow(string $resourcetype_id) : int
Parameters
- $resourcetype_id : string
-
The ID of the resourcetype
Return values
int —Returns the ID for the workflow (or NULL if none assigned)
get_resourcetypes()
Returns all resourcetypes or only types for a given person_id
public
get_resourcetypes([string $person_id = NULL ], int $grouping[, bool $sort = false ][, bool $filter_show = false ][, bool $show_hidden = false ]) : array<string|int, mixed>
Parameters
- $person_id : string = NULL
-
The person ID for returning only referenced resourcetypes (return all resource types, if person ID is NULL)
- $grouping : int
-
The return format (0 for plain list, 1 sorted by groups as a list, 2 tree with groups
- $sort : bool = false
-
Return a sorted array (by order asc)
- $filter_show : bool = false
-
Use only resource types of items where resource show is set
- $show_hidden : bool = false
-
Do not return hidden resourcetypes (if false)
Return values
array<string|int, mixed> —The array with the resourcetypes
get_resourcetypes_from_groups()
Returns all resourcetypes of a given group
public
get_resourcetypes_from_groups(int $group_id[, int $person_id = NULL ][, bool $sort = false ][, bool $filter_show = false ][, bool $show_hidden = false ]) : array<string|int, mixed>
Parameters
- $group_id : int
-
The resourcetype group ID
- $person_id : int = NULL
-
The person ID for returning only referenced resourcetypes (return all resource types, if person ID is NULL)
- $sort : bool = false
-
Return a sorted array (by order asc)
- $filter_show : bool = false
-
Use only resource types of items where resource show is set (works only in combination with a valid person ID)
- $show_hidden : bool = false
-
Do not return hidden resourcetypes (if true)
Return values
array<string|int, mixed> —Returns data with resourcetypes or null
get_workflow_step()
Returns a workflow step
public
get_workflow_step(string $workflow_id, string $workflow_step_order) : array<string|int, mixed>
Parameters
- $workflow_id : string
-
The ID of the workflow
- $workflow_step_order : string
-
The order of the workflow step
Return values
array<string|int, mixed> —The array with the data of the publication entry
id()
Set a new ID or return the current ID if $id is NULL. The numeric value 0 is also set to NULL.
public
id([string $id = NULL ]) : int
Parameters
- $id : string = NULL
-
The current ID
Return values
int —The ID
pull_json()
Returns the object data as JSON
public
pull_json() : string
Return values
string —The json string
pull_xml()
Returns the object data as XML
public
pull_xml([bool $head = false ]) : string
Parameters
- $head : bool = false
-
Return XML with head (as default, just a node is returned)
Return values
string —The xml string
push_xml()
Push an xml into the object (experimental, not finished yet)
public
push_xml(string $xml) : bool
Parameters
- $xml : string
-
The xml with the object data
Return values
bool —true (or false on error)
renew_cache()
Calls the renew cache method for this in GRIS_CITE
public
renew_cache() : void
Return values
void —reset()
Reset the whole object (ID = NULL, full_data is empty)
public
reset() : bool
Return values
bool —Returns true
resource_exists()
Checks if a resource already exists with this title, year and type
public
resource_exists(string $resource_title, string $resource_year[, int $resourcetype_id = NULL ]) : array<string|int, mixed>
Parameters
- $resource_title : string
-
The resource title
- $resource_year : string
-
The resource year
- $resourcetype_id : int = NULL
-
The resourcetype ID (optional)
Return values
array<string|int, mixed> —Returns an array with the IDs of existing resources
resource_id_exists()
Checks if a resource with the given ID exists
public
resource_id_exists(int $resource_id) : bool
Parameters
- $resource_id : int
-
The resource ID
Return values
bool —Returns false if not and true if resource exists
resource_persons_exists()
Check if the entry already exists in the table gris_resource_persons
public
resource_persons_exists(array<string|int, mixed> $data) : int
Parameters
- $data : array<string|int, mixed>
-
The associative array with the attributes (key and value) for the search. Order is not used for search.
Return values
int —The ID of the dataset (returns 0 if no entry was found and -1 if no attributes were given)
save_resource()
Save the full publication data
public
save_resource() : bool
Return values
bool —Returns true
search_resource()
Returns a list of publications for a given query (term, year, resourcetype ID)
public
search_resource(string $term, string $year, string $name, string $resourcetype_id, string $hits_per_page, int $offset) : array<string|int, mixed>
Parameters
- $term : string
-
The search term
- $year : string
-
The year
- $name : string
-
The person name
- $resourcetype_id : string
-
The resourcetype ID or an array of ids
- $hits_per_page : string
-
The hits per page
- $offset : int
-
The offset of the pagebrowser
Return values
array<string|int, mixed> —The html code for the table
set()
Set data in the object
public
set(array<string|int, mixed> $data[, bool $writethrough = false ]) : bool
Parameters
- $data : array<string|int, mixed>
-
One or more new key/values for the resource (data will be merged, same attributes will be overwritten)
- $writethrough : bool = false
-
Write the object to the database immediately
Return values
bool —Returns true for success and false for no data given
set_publication_institute()
Create a new publication institute entry
public
set_publication_institute(int $gris_publication_id, int $gris_institute_id, int $gris_publication_institutes_order) : int
Parameters
- $gris_publication_id : int
-
The ID of the publication
- $gris_institute_id : int
-
The ID of the publication institute entry
- $gris_publication_institutes_order : int
-
The order of the publication institute entry
Return values
int —Returns the ID of the publication institute (0 for duplicate, -1 if institute_id is 0)
set_resource_person()
Create a new resource person entry with given ID
public
set_resource_person(array<string|int, mixed> $data) : int
Parameters
- $data : array<string|int, mixed>
-
The data for the resource person entry
Return values
int —The ID of the resource_person entry (returns 0 if identifier already exists or -1 for errors during the query)
set_resourcetype_default_show()
Set the the resourcetype to be shown or not in the internet as default
public
set_resourcetype_default_show(string $id, bool $show) : bool
Parameters
- $id : string
-
Resourcetype ID
- $show : bool
-
The default for show
Return values
bool —Returns true for success or false if not
set_resourcetype_group()
Changes the group of a resourcetype and set the type to the highest order
public
set_resourcetype_group(int $resourcetype_id, int $group_id) : bool
Parameters
- $resourcetype_id : int
-
Resourcetype ID
- $group_id : int
-
Resourcetype group ID
Return values
bool —Returns true for success or false if not
set_resourcetype_hidden()
Updates the hidden state of a resourcetype
public
set_resourcetype_hidden(string $id, bool $hidden) : bool
Parameters
- $id : string
-
Resourcetype ID
- $hidden : bool
-
The hidden state
Return values
bool —Returns true for success or false if not
set_show_resource()
Sets the resource show entry for a person
public
set_show_resource(string $id, string $person_id, booelan $show) : bool
Parameters
- $id : string
-
The resource ID
- $person_id : string
-
The person ID
- $show : booelan
-
Show or hide the resource
Return values
bool —Returns true for show and false for hide
unset_attribute()
Unsets an attribute
public
unset_attribute(string $attribute) : bool
Parameters
- $attribute : string
-
The attributes
Return values
bool —Returns true
update()
Updates the object by filling all arrays with data
public
update([string $resource_id = NULL ]) : bool
Parameters
- $resource_id : string = NULL
-
The current resource ID
Return values
bool —true (or false on error)
update_publication_institutes_order()
Update the order of a publication institute entry
public
update_publication_institutes_order(string $id, array<string|int, mixed> $order) : int
Parameters
- $id : string
-
The ID of the institute (should also work with an int param)
- $order : array<string|int, mixed>
-
The order number (should also work with an int param)
Return values
int —Returns true for success, false for an error
update_resource_person_order()
Update the order of a resource person entry
public
update_resource_person_order(string $personname_id, string $id, string $role, array<string|int, mixed> $order) : int
Parameters
- $personname_id : string
-
The ID of the person (should also work with an int param)
- $id : string
-
The ID of the resource (should also work with an int param)
- $role : string
-
The role of the person
- $order : array<string|int, mixed>
-
The order number (should also work with an int param)
Return values
int —Returns true for success, false for an error
initialize()
Initializes the object by filling the array with data
protected
initialize() : bool
Return values
bool —true (or false on error)
array_to_xml()
Convert an array into an xml representation
private
array_to_xml(array<string|int, mixed> $data, Pointer &$xml) : bool
Parameters
- $data : array<string|int, mixed>
-
The array with the data
- $xml : Pointer
-
A pointer to the xml
Return values
bool —true (or NULL if empty)
get_resourcetype_default_show()
Returns the default for showing a given resourcetype
private
get_resourcetype_default_show(string $resourcetype_id) : int
Parameters
- $resourcetype_id : string
-
The ID of the resourcetype
Return values
int —Returns 1 for show, 0 for not
out()
Preformatted output of the variable (for development)
private
out([mixed $mixed = NULL ]) : bool
Parameters
- $mixed : mixed = NULL
-
The variable
Return values
bool —true
persist()
Update a resource entry
private
persist() : bool
Possible fields for $data:
Field Type Null Default
gris_resource_id bigint(20) Nein gris_resourcetype_id bigint(20) Nein gris_resource_year int(4) Nein gris_resource_appears tinyint(1) Ja NULL gris_resource_title text Nein gris_resource_subtitle varchar(255) Ja NULL gris_resource_country varchar(255) Ja NULL gris_workflow_id bigint(20) Ja NULL gris_workflow_step_order smallint(6) Ja NULL gris_resource_time_create date Ja NULL gris_resource_time_cchange date Ja NULL
Return values
bool —True
publication_institute_exists()
Check if the entry already exists in the table gris_publication_institutes
private
publication_institute_exists(array<string|int, mixed> $data) : int
Parameters
- $data : array<string|int, mixed>
-
The associative array with the attributes (key and value) for the search. Order is not used for search.
Return values
int —The ID of the dataset (returns 0 if no entry was found and -1 if no attributes were given)