Documentation

GRIS_PROJECT extends GRIS_CLASS_TEMPLATE
in package

Class to manage informations about projects in the database

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

PHP version 7

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

Tags
copyright

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

link

GESIS Leibniz Institute for the Social Sciences

since
1

File available since Release 1.0

version
1.0
author

Holger Heuser holger.heuser@gesis.org

Table of Contents

dbtable  = 'gris_project'
The constant for the database table
settings_group  = "project"
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
__construct()  : mixed
The class constructor
check_projects_permission()  : bool
Checks if the given person has the permission to view this project
debug()  : bool
Output the full dataset without object data (all subobjects are parsed recursively)
delete_project()  : bool
Deletes a project with a given 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_all_projects()  : array<string|int, mixed>
Get the IDs of all projects
get_alpha_nav()  : array<string|int, mixed>
Get an alphabetical navigation structure
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_full_relations()  : bool
Add detailed data for institutes and personnames
get_project_links()  : array<string|int, mixed>
Returns a list of link IDs related to a project
get_project_list()  : array<string|int, mixed>
Returns a list of projects for a given person ID and a project type
get_project_relation_id()  : bool
Get the relation ID by subject table, subject ID and role
get_project_title()  : string
Returns the project title for a given ID
get_project_types()  : array<string|int, mixed>
Returns the project types of a given person or all project types if person ID is empty
get_project_workflow()  : int
Returns the workflow for projects (there is only one at the moment)
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
Persist the object data to the database
project_id_exists()  : bool
Checks if a project with the given ID exists
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
set_project_relation()  : bool
Add a new project relation to the object (no persist)
set_show_project()  : bool
Sets the project show entry
unset_attribute()  : bool
Unsets an attribute
update()  : array<string|int, mixed>
Stores the project data in the object
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_project'

settings_group

The constant for the settings group

public mixed settings_group = "project"

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

Methods

__construct()

The class constructor

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

The project ID

Initializes the objects

Return values
mixed

check_projects_permission()

Checks if the given person has the permission to view this project

public check_projects_permission(mixed $person_id) : bool
Parameters
$person_id : mixed
Return values
bool

Returns true for show and false for hide

debug()

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

public debug() : bool
Return values
bool

true

delete_project()

Deletes a project with a given ID

public delete_project(string $project_id) : bool
Parameters
$project_id : string

The project ID

Return values
bool

Returns true (or false for error)

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_projects()

Get the IDs of all projects

public get_all_projects([string $filter = NULL ], int $active[, bool $filter_show = true ]) : array<string|int, mixed>
Parameters
$filter : string = NULL

The first character of the project or the year

$active : int

Filter active projects (1), finshed projects (-1) or all projects (0)

$filter_show : bool = true

Filter show parameter (return only projects with show = 1)

Return values
array<string|int, mixed>

true

get_alpha_nav()

Get an alphabetical navigation structure

public get_alpha_nav(int $active) : array<string|int, mixed>
Parameters
$active : int

Filter active projects (1), finshed projects (-1) or all projects (0)

Return values
array<string|int, mixed>

The array with the characters

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_full_relations()

Add detailed data for institutes and personnames

public get_full_relations() : bool
Return values
bool

Returns true

Returns a list of link IDs related to a project

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

The array with the projects

get_project_list()

Returns a list of projects for a given person ID and a project type

public get_project_list([string $projecttype = NULL ][, array<string|int, mixed> $person_id = NULL ][, bool $filter_show = false ][, string $order = NULL ][, array<string|int, mixed> $filters = NULL ][, bool $permission = false ]) : array<string|int, mixed>
Parameters
$projecttype : string = NULL

The type of the project

$person_id : array<string|int, mixed> = NULL

The personname ID (string for single ID)

$filter_show : bool = false

Use only items where resource show is set

$order : string = NULL

How to order the list project list

$filters : array<string|int, mixed> = NULL

A list with filter options

$permission : bool = false

Return read only state*

Return values
array<string|int, mixed>

The array with the projects

get_project_relation_id()

Get the relation ID by subject table, subject ID and role

public get_project_relation_id(string $subject_table, string $subject_id, string $role) : bool
Parameters
$subject_table : string

The subject table

$subject_id : string

The subject ID

$role : string

The role in the relation

Return values
bool

Returns true

get_project_title()

Returns the project title for a given ID

public get_project_title(string $project_id) : string
Parameters
$project_id : string

The project ID

Return values
string

The title of the project

get_project_types()

Returns the project types of a given person or all project types if person ID is empty

public get_project_types([string $person_id = NULL ]) : array<string|int, mixed>
Parameters
$person_id : string = NULL

The person ID

Return values
array<string|int, mixed>

The array with the types

get_project_workflow()

Returns the workflow for projects (there is only one at the moment)

public get_project_workflow() : int
Return values
int

Returns the ID for the workflow (or NULL if none assigned)

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

Persist the object data to the database

public persist() : bool
Return values
bool

Returns true for success and false for a database error (which can be found in the error object)

project_id_exists()

Checks if a project with the given ID exists

public project_id_exists(int $project_id) : bool
Parameters
$project_id : int

The resource ID

Return values
bool

Returns false if not and true if project exists

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 project (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_project_relation()

Add a new project relation to the object (no persist)

public set_project_relation(array<string|int, mixed> $data) : bool
Parameters
$data : array<string|int, mixed>

The data for the relation

Return values
bool

Returns true

set_show_project()

Sets the project show entry

public set_show_project(string $id, booelan $show) : bool
Parameters
$id : string

The project 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()

Stores the project data in the object

public update([string $project_id = NULL ]) : array<string|int, mixed>
Parameters
$project_id : string = NULL

The (optional) project ID

Return values
array<string|int, mixed>

The dataset

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