Documentation

GRIS_PUBLICATION extends GRIS_CLASS_TEMPLATE
in package

Class to manage informations about publications in the database

With this class all resource information can be initially set or edited in the database

PHP version 7

Copyright (c) 2017, Holger Heuser Sportplatzweg 7 56357 Oelsberg, Germany

Tags
copyright

Copyright (c) 2017, Holger Heuser

link
https://git.gesis.org/hr/gris-2.git
since
2

File available since Release 2.0

version
2.0
author

Holger Heuser holger.heuser@gesis.org

Table of Contents

dbtable  = 'gris_publication'
The constant for the database table
settings_group  = "publication"
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
$person  : object
The object for person
$post  : array<string|int, mixed>
The $_POST data
$publication  : array<string|int, mixed>
The dataset of the publication information (if available)
$template  : object
The object for templates
__construct()  : mixed
The class constructor
debug()  : bool
Output the full dataset without object data (all subobjects are parsed recursively)
delete()  : bool
Delete publication with a given id or resource id
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_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
id()  : int
Set a new ID or return the current ID if $id is NULL. The numeric value 0 is also set to NULL.
persist()  : bool
Update a publication entry
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)
reset()  : bool
Reset the whole object (ID = NULL, full_data is empty)
set()  : bool
Set data in the object
unset_attribute()  : bool
Unsets an attribute
update()  : bool
Updates the object by filling all arrays with data
initialize()  : bool
Initializes the object by filling the array with data
array_to_xml()  : bool
Convert an array into an xml representation
out()  : bool
Preformatted output of the variable (for development)

Constants

dbtable

The constant for the database table

public mixed dbtable = 'gris_publication'

settings_group

The constant for the settings group

public mixed settings_group = "publication"

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

$full_data

The dataset of the resource information

protected array<string|int, mixed> $full_data = array()
Tags
access

private

$settings

The object for settings

protected object $settings = null
Tags
access

private

$xml_data

The data as xml string

protected string $xml_data = NULL
Tags
access

private

$auth

The object for authentication

private object $auth
Tags
access

private

$person

The object for person

private object $person
Tags
access

private

$post

The $_POST data

private array<string|int, mixed> $post = NULL
Tags
access

private

$publication

The dataset of the publication information (if available)

private array<string|int, mixed> $publication
Tags
access

private

$template

The object for templates

private object $template
Tags
access

private

Methods

__construct()

The class constructor

public __construct([string $id = NULL ]) : mixed
Parameters
$id : string = NULL

The ID of the resource

Initializes the objects

Return values
mixed

debug()

Output the full dataset without object data (all subobjects are parsed recursively)

public debug() : bool
Return values
bool

true

delete()

Delete publication with a given id or resource id

public delete(int $id[, bool $is_resource = false ]) : bool
Parameters
$id : int

The id

$is_resource : bool = false

True if the id is a resource id. Otherwise the id is an publication id.

Return values
bool

Returns true for success and false if no id is given

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_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

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

persist()

Update a publication entry

public persist() : bool

Possible fields for $data:

Field Type Null Default

gris_publication_id bigint(20) Nein gris_journal_id bigint(20) Ja NULL gris_publishing_house_id bigint(20) Ja NULL gris_resource_id bigint(20) Nein gris_publication_online tinyint(1) Ja NULL gris_publication_collection text Ja NULL gris_publication_edition varchar(255) Ja NULL gris_publication_series varchar(255) Ja NULL gris_publication_volume varchar(255) Ja NULL gris_publication_referred tinyint(1) Ja NULL gris_publication_issue varchar(255) Ja NULL gris_publication_pages varchar(255) Ja NULL gris_publication_collection_subtitle text Ja NULL

Return values
bool

True

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)

reset()

Reset the whole object (ID = NULL, full_data is empty)

public reset() : bool
Return values
bool

Returns true

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 publication (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

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 $id) : bool
Parameters
$id : string

The current resourceID

Return values
bool

true (or false on 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)

out()

Preformatted output of the variable (for development)

private out([mixed $mixed = NULL ]) : bool
Parameters
$mixed : mixed = NULL

The variable

Return values
bool

true

Search results