GRIS_NOTES
in package
Class for notes
With this class notes can be stored, edited and displayed
PHP version 8
Copyright (c) 2022, Holger Heuser, GESIS Leibniz Institute for the Social Sciences Unter Sachsenhausen 6-8 50667 Cologne, Germany
Tags
Table of Contents
- dbtable = 'gris_notes'
- The constant for the database table where the settings are stored
- settings_group = "notes"
- 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
- $object_id : int
- The object ID
- $object_table : int
- The object table
- $person_id : int
- The person ID
- $settings : object
- The object for settings
- $state : object
- The object for logs
- __construct() : mixed
- The class constructor
- delete_note() : bool
- Delete a note with a given ID
- delete_object_notes() : bool
- Delete all notes of the current object
- get_note() : array<string|int, mixed>
- Get all data of a note for a given ID
- get_note_list() : void
- Get a list of note IDs for an object and the permission
- set() : bool
- Store a new note
- update_field() : booelan
- Undocumented function
- is_owner() : mixed
Constants
dbtable
The constant for the database table where the settings are stored
public
mixed
dbtable
= 'gris_notes'
settings_group
The constant for the settings group
public
mixed
settings_group
= "notes"
Properties
$classname
The name of the class
protected
object
$classname
= NULL
Tags
$dbconnection
The database object for managing the connection
private
object
$dbconnection
= null
Tags
$i18n
The object for translations
private
object
$i18n
Tags
$object_id
The object ID
private
int
$object_id
Tags
$object_table
The object table
private
int
$object_table
Tags
$person_id
The person ID
private
int
$person_id
Tags
$settings
The object for settings
private
object
$settings
= null
Tags
$state
The object for logs
private
object
$state
Tags
Methods
__construct()
The class constructor
public
__construct(mixed $object_table, mixed $object_id[, mixed $person_id = NULL ]) : mixed
string $object_table The object table int $object_id The object ID int $person_id The person ID
Initializes the login state and checks wether the user is already logged in
Parameters
- $object_table : mixed
- $object_id : mixed
- $person_id : mixed = NULL
Return values
mixed —delete_note()
Delete a note with a given ID
public
delete_note(int $id) : bool
Parameters
- $id : int
-
The ID of the note to delete
Return values
bool —Returns true on success and false on error
delete_object_notes()
Delete all notes of the current object
public
delete_object_notes() : bool
Return values
bool —Returns true on success and false on error
get_note()
Get all data of a note for a given ID
public
get_note(int $id) : array<string|int, mixed>
Parameters
- $id : int
-
The note ID
Return values
array<string|int, mixed> —Returns an array with the data of the note
get_note_list()
Get a list of note IDs for an object and the permission
public
get_note_list() : void
Return values
void —set()
Store a new note
public
set(string $title, string $content[, int $group = NULL ][, bool $for_owners = false ]) : bool
Parameters
- $title : string
-
The title
- $content : string
-
The content
- $group : int = NULL
-
The group with permission to read the note(deafult is 0 for all)
- $for_owners : bool = false
-
Grant read permission for owners
Return values
bool —Returns true on success and false on error
update_field()
Undocumented function
public
update_field(string $field, string $content, int $note_id) : booelan
Parameters
- $field : string
- $content : string
- $note_id : int
Return values
booelan —Returns true on success and false on error
is_owner()
private
is_owner() : mixed