Wie schon im Namen des Webframeworks enthalten, folgt forestPHP dem Paradigma des Waldes. Jede Homepage kann als eine reine Baumstruktur betrachtet werden. Eine komplette Instanz von forestPHP wird als Trunk bezeichnet. Alle wiederverwendbaren Kernfunktionalitäten befinden sich in den Roots. Eine einzelne Webseite entspringt aus dem Trunk als Branch und ist wahlweise einer Datenbanktabelle zugeordnet. Jeder Datensatz dieser Tabelle ist ein Twig, wobei die Darstellung von Datensätzen mit unterschiedlichen Leafs durchgeführt werden können. All diese Begriffe finden sich im Quelltext des forestPHP Frameworks wieder und dienen als Orientierungspunkte bei der Entwicklung.
Nach dem Download der aktuellen Version oder einer Kopie von GitHub kopiert man das forestPHP-Verzeichnis in einen Ordner des Webservers bzw. lädt diesen hoch.
Auf dem Datenbanksystem MariaDB/MySQL muss man für den Einsatz von forestPHP eine neue Datenbank erstellen (z.B. forestphp). Im forestPHP-Verzeichnis befindet sich im Ordner install die SQL-Datei forestPHP_Vanilla_SQL_MariaDB.sql. Diese Datei enthält alle SQL-Queries für die initiale Anwendung von forestPHP, welche in der zuvor erstellen Datenbank ausgeführt werden müssen. Anschließend kann forestPHP auf dem Webserver aufgerufen und verwendet werden.
In der Datei forestPHP.php müssen Sie im Konstruktor des Klasse noch die Verbindung zur Datenbank einstellen, indem Sie Datenbank, Benutzer und Kennwort angeben:$o_glob->Base->Add(new forestBase(forestBase::MariaSQL, 'host_ip', 'database', 'db_user', 'db_pw'), 'forestPHPMariaSQLBase');
Dabei ist darauf zu achten, dass Sie den Schlüssel der neuen Verbindung als aktives Base-Gateway angeben: $o_glob->ActiveBase = 'forestPHPMariaSQLBase';
Generell ist es möglich mehrere Verbindungen zu verschiedenen Datenbanken mit forestPHP herzustellen.
Im forestPHP-Verzeichnins selbst befindet sich die index.php welche eine Instanz von forestPHP aufruft und debug-spezifische Einstellungen bereit hält. Weiterhin gibt es folgende Verzeichnisse, welche nicht verschoben oder umbenannt werden dürfen:
Wie bei vielen Webframeworks gelten eine Reihe von Konventionen, um die Entwicklung nicht zu sehr programmatisch einschränken zu müssen. Damit das forestPHP Framework funktioniert müssen diese Konventionen eingehalten werden. Ansonsten kann es zu unvorhergesehenen Fehlern kommen und im schlimmsten Fall sogar zum Datenverlust.
public function readAction() {};
Variablen in PHP können jeden Typ von Daten beinhalten. In Zusammenarbeit mir relationalen Datenbanken ist dies nicht immer hilfreich und führt oft zu Konflikten bei der Erstellung oder Bearbeitung von Datensätzen. Um dies zu verbessern hat forestPHP eigene Datentyp-Klassen erstellt die jede PHP-Klasse verwenden muss.
Mit der Einbindung von use forestData;
in einer Klasse können Eigenschaften im Konstruktor der Klasse mit den Datentyp-Klassen instanziiert werden:
class foo {
use forestData;
private Test;
public function __construct() {
$this->Test = new forestString;
}
public function DoSomething() {
$this->Test->value = 'Hello World!';
echo $this->Test->value;
$this->Test->value = 123; // will result in an exception
$this->Test->value = 12.34; // will result in an exception
$this->Test->value = array(1, 2, 3); // will result in an exception
}
}
$o_foo = new foo;
$o_foo->Test = 'Hello World!';
echo $o_foo->Test;
$o_foo->Test = 123; // will result in an exception
$o_foo->Test = 12.34; // will result in an exception
$o_foo->Test = array(1, 2, 3); // will result in an exception
Zuerst muss ein neuer Datensatz in der Tabelle sys_fphp_branch erstellt werden. Dies geht z.B. mit folgendem SQL-Statement:INSERT INTO `sys_fphp_branch` (`Name`, `ParentBranch`, `Title`, `Navigation`, `NavigationOrder`, `Filename`, `Table`, `StandardView`, `Filter`, `KeepFilter`)
VALUES ('test', '1', 'First Test', '1', '1', NULL, NULL, '1', 1, 0);
Der Name des Branch sollte nur Kleinbuchstaben und keine Leerzeichen enthalten, da dies gleichzeitig auch der Ordnername des Branch sein wird. Mit ParentBranch gibt man an welches der Vater-Branch des Branch in der forestPHP-Baumstruktur ist. Der einfachste Fall ist die Id 1, dem Wurzel-Branch von forestPHP. Der Title ist der in der Webanwendung sichtbare Name des Branch. Navigation und NavigationOrder gibt an, ob der Branch in der Navigation angezeigt werden soll, und bei mehreren Branches auf einer Ebene, an welcher Position dieser angezeigt werden soll. Filename kann benutzt werden, um auf eine Datei auf dem Webserver zu verweisen (z.B. ein Download-Link in der Navigation). Table gibt die UUID der Tabelle an, mit welche der Branch verknüpft ist (optional). StandardView legt fest, ob der Branch standardmäßig im LIST- oder DETAIL-View angezeigt werden soll (default: LIST). Filter gibt an, ob Filtermöglichkeiten auf den angezeigten Datensätzen erlaubt ist. KeepFilter behält die Filtereingaben, auch wenn eine andere Action oder sogar Branch vom Benutzer ausgewählt wurden.
Dann muss im trunk-Verzeichnis im Unterordner index ein Ordner für den Branch angelegt werden (in diesem Fall test). Danach erstellt man die Datei testBranch.php mit der Klassendefinition und der Einbindung von forestData.
Innerhalb eines Branch können Actions definiert werden. Diese Actions entsprechen dann Funktionen bzw. Anwendungsfälle die explizit für diesen Branch programmiert sind. Die Anzahl der Actions ist beliebig. Bei wiederverwendbaren Actions können diese im Controller forestBranch programmiert werden. Wahlweise können Actions auch je Branch programmiert werden. Eine Funktion für eine Action muss immer den Namen der Action in Kleinbuchstaben beinhalten und mit 'Action' enden. Beispiel: public function readAction() {};
Als Standard-Aktions muss jeder Branch die Funktionen init() und initBranch() implementiert haben. In initBranch() können generelle Eigenschaften des Branch, wie Standard-View, Filter usw. geändert werden. init() ist die Standard-Aktion die beim Aufruf eines Branch ausgeführt wird.
Beispiel:
indexBranch.php
class indexBranch extends forestBranch {
use forestData;
/* Fields */
/* Properties */
/* Methods */
protected function initBranch() {
}
protected function init() {
/* generates a landing page with links to other branch children or an empty page */
$this->GenerateLandingPage();
}
}
Für einen neuen Twig muss zuerst eine neue Tabelle erstellt werden. Zu der Tabelle wird dann eine Twig-Klasse erstellt als Twig-Datei. Sowohl der Name für die Tabelle, als auch der Name der Datei müssen die gleiche Bezeichnung haben. Systemtabellen beginnen mit dem Präfix sys_fphp_ und dürfen nicht verändert werden. Alle weiteren Tabellen sollen mit dem Präfix fphp_ versehen werden. Alle Twig-Dateien zur Modellierung der Datenbanktabellen werden im Verzeichnis twigs abgelegt. Jeder Twig muss als Klasse definiert werden und als Basisklasse forestTwig implementieren. Dateinamen enden immer mit Twig.php.
Anschließend muss in der Twig-Datei jedes Tabellenfeld mit gleichem Namen aufgelistet werden. In der Funktion init wird jedem Datenfeld einem forestPHP Datentyp zugewiesen. Dabei ist darauf zu achten das ein forestPHP Datentyp mit dem SQL-Datentyp kompatibel ist.
Beispiel:
actionTwig.php
class actionTwig extends forestTwig {
use forestData;
/* Fields */
private $Id;
private $BranchId;
private $Name;
/* Properties */
/* Methods */
protected function init() {
$this->Id = new forestNumericString(1);
$this->BranchId = new forestInt;
$this->Name = new forestString;
/* forestTwig system fields */
$this->fphp_Table->value = 'sys_fphp_action';
$this->fphp_Primary->value = array('Id');
$this->fphp_Unique->value = array('BranchId;Name');
$this->fphp_SortOrder->value->Add(true, 'Id');
$this->fphp_Interval->value = 50;
$this->fphp_View->value = array('Name');
$this->fphp_FillMapping(get_object_vars($this));
}
}
Ein Twig hat verschieden system fields als Eigenschaften:
;
getrennttrue
aufsteigend, false
absteigendWie jede Webanwendung, gibt es auch bei forestPHP einen Bereich für zentrale Einstellungen die für alle Bereiche der Webanwendung gültig sind. Diese zentralen Einstellungen können jederzeit und mit jeder Version erweitert und auch wieder eingeschränkt werden. Es gibt folgende Einstellungsmöglichkeiten:
forestPHP hat sich als Ziel gesetzt alle administrativen Einstellungen in der gleichen Webanwendung zur Verfügung zu stellen. Dazu gehört auch das Anlegen von Tabellen und dessen Spalten bzw. Tabellenfelder. Die Speicherung dieser Information in der Datenbank, anstatt in forestTwig-Dateien, erlaubt den flexiblen und dynamischen Einsatz von Tabellenfeldern, sowie einfache Erweiterungen von Funktionalitäten in der Zukunft bei bestehenden Konfigurationen. Trotzdem ist die grundlegende Definition eines Tabellenfeldes in einer forestTwig-Datei weiterhin zwingend notwendig.
Im Kapitel Neuen Twig(Tabelle) erstellen wurde bereits erläutert, wie eine Tabelle erstellt wird. Um nun die automatische Formular-Generierung in forestPHP vollständig unterstützen zu können, müssen auch Tabellenfelder und ihre Informationen für forestPHP einsehbar sein. Daher werden folgende Informationen zu Tabellenfelder in der Tabelle sys_fphp_tablefields gespeichert:
CRUD(Create, Read, Update and Delete) ist ein Akronym für die vier fundamentalen Operationen des Datenmanagement. Da diese fundamentalen Operationen in jeder Webnanwendung notwendig sind hat forestPHP generische Funktionen erstellt, um diese Operationen für jede Art von Datensatz zu ermöglichen.
Für die Implementierung dieser Funktionen ist einfach nur ein Verweis auf diese in der Branch-Deklaration notwendig. Es ist für den Entwickler aber auch möglich diese generischen Funktionen je Branch anders zu definieren und damit komplett neu zu erstellen. Man ist also nicht auf die Anwendung dieser Funktionen strikt gebunden. Insgesamt gibt es vier Standard-Aktionen die forestPHP unterstützt:
Die folgende Branch-Deklaration zum sessionBranch zeigt die Implementierung der Operationsmöglichkeiten. Es gibt noch Zusatzfunktionen(z.B. beforeNewAction() oder afterDeleteAction()) um ggf. einen Datensatz vor oder nach der Erstellung/Bearbeitung/Löschung zu benutzen oder die Daten auf irgendeine Art und Weise noch zu verwenden. Dies funktioniert allerdings nur, wenn auch die generischen Funktionen für die Operationen benutzt werden. Damit dies möglich ist kann man diese Zusatzfunktionen in der Branch-Deklarationen verwenden. In forestBranch gibt es für die Zusatzfunktionen keine standardmäßigen Funktionen.
class sessionBranch extends forestBranch {
use forestData;
/* Fields */
/* Properties */
/* Methods */
protected function initBranch() {
$this->Filter->value = true;
$this->StandardView = forestBranch::LIST;
$this->KeepFilter->value = false;
$this->Twig = new sessionTwig();
}
protected function init() {
$o_glob = forestGlobals::init();
if ($this->StandardView == forestBranch::DETAIL) {
$this->GenerateView();
} else if ($this->StandardView == forestBranch::LIST) {
$this->GenerateListView();
}
}
protected function beforeViewAction() {
/* $this->Twig holds current record */
}
protected function viewAction() {
$this->ViewRecord();
}
protected function afterViewAction() {
/* $this->Twig holds current record */
}
protected function beforeNewAction() {
/* $this->Twig holds current record */
}
protected function newAction() {
$this->NewRecord();
}
protected function afterNewAction() {
/* $this->Twig holds current record */
}
protected function beforeEditAction() {
/* $this->Twig holds current record */
}
protected function editAction() {
$this->EditRecord();
}
protected function afterEditAction() {
/* $this->Twig holds current record */
}
protected function beforeDeleteAction() {
/* $this->Twig holds current record */
}
protected function deleteAction() {
$this->DeleteRecord();
}
protected function afterDeleteAction() {
/* $this->Twig holds current record */
}
}
Für die Dateihandhabung hat forestPHP ein sehr stark generisches Konzept implementiert. Ziel ist es das Dateien sehr einfach an Datensätze angehängt aber auch wieder entfernt oder ersetzt werden können. Somit war es ausgeschlossen das allgemeine Dateifelder wie Dateiname, -pfad in jeder Tabelle mitaufgenommen werden sollen. Letztendlich werden alle Dateien von allen Datensätzen innerhalb des forestPHP Frameworks in einer Tabelle(sys_fphp_files) verwaltet. Lediglich der Primärschlüssel wird in dem Hauptdatensatz hinterlegt. Damit ist ein flexibler Einsatz von Dateien in der Zukunft sichergestellt.
forestPHP hat sich entschlossen Dateien und deren Inhalt nicht in relationalen Datenbanken zu speichern. Andere Ansätze wie z.B. MongoDB können hier eine bessere Funktionalität garantieren. Stattdessen speichert forestPHP alle Dateien in einer Unterordnerstrutkur(fphp_files) des Branch zu dem der Datensatz gehört. Jeder Unterordner hat eine hexadezimale Bezeichnung mit 2 Stellen - von 00, 01, 02, 03, ... bis ..., FC, FD, FE, FF. Alle hochgeladenene Dateien bekommen auch eine hexadezimale Bezeichnung aus 8 zufälligen Zeichen (z.B. A5E12C33). Die letzten beiden Stellen geben dabei den Ordner an worin die Datei gespeichert wird: Also A5E12C33 in Ordner 33. Somit ist es zwingend notwendig das die Benutzerinstanz des Webservers die Berechtigung bekommt, Ordner zu erstellen und zu löschen sowie auch Dateien in Ordner kopieren und löschen zu können. Wie das Sicherheitskonzept für die Zugriffe auf die Dateien im Detail aussieht ist jedem Betreiber selbst überlassen.
Bei der Versionierung, die je Twig mit oder ohne Checkout eingestellt werden kann, werden neu hochgeladene Dateien, die vorher sonst die alte Datei ersetzt haben, als neue Version gespeichert und alte Dateien an die neue Datei angehängt(Historie). Mit diesem Konzept ist es dann auch möglich alte Versionen von Dateien wiederherzustellen. Als Versionszähler gibt es einen Major- und einen Minor-Zähler. Der Major-Zähler wird immer erhöht wenn eine Datei normal überschrieben bzw. ersetzt wird. Der Minor-Zähler wird erhöht wenn eine ausgecheckte Datei überschrieben/ersetzt wird. Sobald eine ausgecheckte Datei eingecheckt wird, wird der Major-Zähler um den nächsten Wert erhöht und der Minor-Zähler zurückgesetzt.
Es ist ein sehr häufiger Anwendungsfall bei der Verwaltung von Daten das man einem Datensatz auch mehrere Unterdatensätze zuordnen will. Oft spricht man auch von einer Aufteilung von Kopfdaten und Zeilendaten. Dafür hat forestPHP das Konzept mit Sub Constraints & Sub Records entwickelt.
Sub Constraints bezeichnet die Konfiguration die definiert welche Tabellen zueinander in Beziehung stehen. Es gibt einmal die Head Table welches der Tabelle entspricht welche die Datensätze für die Kopfdaten bereitstellt. Die Sub Table ist die Angabe der Tabelle wo die Datensätze für die Zeilendaten bereitgestellt werden. Die Beziehung von Kopfdaten und Zeilendaten ist immer 1 .. n. Das bedeutet das eine Tabelle beliebig viele Beziehungen zu anderen Tabellen erstellen kann, um Zeilen bzw. Unterdatensätze zu erstellen. In dieser Konfiguration wird auch definiert welche vorhanden Tabellenfelder der Sub Table standardmäßig im Sub Records mit angezeigt werden. Es ist also auch immer notwendig bei der Erstellung eines Sub Records auch einen Datensatz der Sub Table vorher auszuwählen und dann ggf. Tabellenfelder auszufüllen die weitere Informationen enthalten.
Sub Records bestehen also aus Tabellenfelder der konfigurierten Beziehung der Tabellen untereinander wie auch aus neu definierten Tabellenfeldern. Hier benutzt forestPHP das Prinzip der dynamischen Tabellenfelder: Anstatt nun Tabellenfelder einer Tabelle zuzuordnen ist es nun auch möglich Tabellenfelder einem Sub Constraint zuzuordnen. Durch die festgelegte Konfiguration von Sub Constraints ist diese Beziehung auch immer eindeutig wie bei einer echten Tabelle. Dafür gibt es dann bei der Erstellung von Tabellenfelder das Feld SubRecordField, um festzulegen in welcher SQL-Spalte der Wert für das Tabellenfeld gespeichert werden soll.
Zum Schluss stellt sich die Frage wie nun diese Unterdatensätze in der Datenbank gespeichert werden sollen. forestPHP hat sich für das Konzept entschieden sämtliche Unterdatensätze in eine SQL-Tabelle(sys_fphp_subrecords) zu speichern. Diese Tabelle wird dann mit genug unterschiedlichen Spalten und Typen erstellt, welche so gut wie alle Anwendungsfälle abdecken. Dieses Konzept hat den Vorteil das alle Unterdatensätze zentral gespeichert werden und es nicht zu einer unübersichtlichen Anzahl von Unterdatensatztabellen kommt. Bei einer intensiven Nutzung von Unterdatensätzen sollte der Einsatz einer optimalen Indexierung der Tabelle sys_fphp_subrecords im Datenbanksystem genügen, um die Zugriffszeiten zufriedenstellend zu gewährleisten. Bei Bedarf ist es dann immer noch möglich in Einzelfällen vom forestPHP Standard abzuweichen und extra Unterdatensatztabellen zu erstellen und dies auch im Quellcode anzupassen.
Die Benutzerverwaltung ermöglicht eine sichere Zugriffskontrolle auf die Inhalte der Branches des forestPHP Frameworks. Es gilt das Zugriffsprinzip Deny wenn keine Berechtigungen gefunden werden können. Neue Benutzer können von einem Administrator angelegt werden, oder über die Navigationsleiste, indem man sich als neuer Benutzer registriert. Neue Registrationen werden standardmäßig als gesperrte Benutzer erstellt und müssen zuerst durch einen Administrator freigeschaltet werden. Es gibt dann noch die Möglichkeit bei einem Benutzer das Root-Flag zu aktivieren: Das bedeutet das dieser Benutzer sämtliche Rechte im forestPHP Framework besitzt. Es versteht sich von selbst, dass diese Einstellung nur einem einzigen Administrator zustehen darf und nicht mehreren Benutzern.
Berechtigungen bestehen aus einer Kombination aus Branch und Aktion bzw. Aktion-Id. Z.B. Branch = session & Action = new
ist eine Berechtigung die das Erstellen von neuen Datensätzen im Branch session erlaubt.
Rollen sind eine Gruppierung von Berechtigungen die man dann einer Benutzergruppe zuweisen kann. Z.B. kann man alle Berechtigung zum Branch translation der Rolle Translation zuordnen. Dies funktioniert, indem man eine neue Rolle mit dem Namen Translation erstellt. Danach in die Detailansicht geht und die Berechtigungen in der verfügbaren Sektion auswählt und hinzufügt. Dabei können mehrere Berechtigungen ausgewählt werden, indem Strg bei der Auswahl gedrückt gehalten wird.
In Benutzergruppen stellt man schließlich die Verbindung von Benutzern und Rollen her. Alle Benutzer die in einer Benutzergruppe sind haben somit die Berechtigungen der Rollen die ebenfalls dieser Benutzergruppe zugewiesen sind. Ein Benutzer kann auch in mehreren Benutzergruppen vorhanden sein. Maßgeblich ist das sobald ein Benutzer in einer Benutzergruppe die Berechtigung von einer Rolle bekommen hat, darf dieser Benutzer die Aktion mit dieser Berechtigung ausführen. Auch wenn dies in einer anderen Benutzergruppe nicht so eingestellt ist in der der Benutzer Mitglied ist. Diese Art der Benutzerverwaltung ist zugegebenermaßen aufwendig, jedoch die effektivste wenn es darum geht den Zugriff auf Daten sicher zu bewerkstelligen.
In den Einstellungen für einen Branch kann die Berechtigungsvererbung aktiviert werden. Dies bedeutet das dieser Branch die Berechtigungen des übergeordneten Branch benutzt und dies entsprechend hoch kaskadiert bis ein Branch mit Berechtigungen gefunden wurde.
Berechtigungen für einen Zugriff oder eine Aktion eines Branch werden bei jedem Aufruf überprüft, bevor überhaupt diese Daten von der Datenbank abgefragt werden. Auch werden die Zugriffe auf Branches bei der autom. Generierung der Navigationsleiste berücksichtigt. Hat ein Benutzer keinen Zugriff auf einen Branch, so kann der Benutzer diesen Branch auch nicht in der Navigationsleiste sehen und auswählen.
Jede SQL-Abfrage kann eigentlich als normaler String an das Datenbanksystem übergeben werden. Jedoch können SQL-Abfragen auch sehr schnell kompliziert werden und damit steigt die Fehleranfälligkeit. Hinzu kommt die Komplikation, das nicht jedes Datenbanksystem den gleichen Syntax von SQL verwendet. forestPHP hat deshalb für SQL-Abfragen einen objektorientierten Ansatz erstellt. SQL-Abfragen werden aus einem Zusammenspiel von mehreren Klassen und Objekten erstellt. So kann auch an zentraler Stelle Maßnahmen gegen SQL-Injection-Angriffe durchgeführt werden. Erwähnenswert ist, dass bei der Erstellung eines neuen Objektes für eine SQL-Abfrage auch immer das Base-Gateway angegeben werden muss. Dies dient zur Unterscheidung der einzelnen Datenbanksysteme, so dass man nur einmal objektorientiert eine SQL-Abfrage erstellen muss und man durch Anpassung der forestSQLQuery Klasse hinterher Syntax-Änderungen für neue Datenbanksysteme hinzufügen kann.
Mit dem Hinzufügen der DDL besteht nun auch die Möglichkeit Abfragen zum erstellen und ändern von Tabellen durchzuführen.
Weiter unten sind Beispiele für SQL-Abfragen als Klassenobjekte aufgelistet. Dabei werden auch Werte wie Aggregationen, Operatoren und Vergleichsoperatoren überprüft und ggf. eine Fehlermeldung erzeugt, wenn diese gar nicht verfügbar sind.
// +-----------------------------+
// | |
// | forestSQLQuery Select |
// | |
// +-----------------------------+
$querySelect = new forestSQLQuery($o_glob->Base->{$o_glob->ActiveBase}->BaseGateway, forestSQLQuery::SELECT, 'tableA');
#### Columns ##########################################################################
$column_A = new forestSQLColumn($querySelect);
$column_A->Column = 'columnA';
$column_B = new forestSQLColumn($querySelect);
$column_B->Column = 'columnB';
$column_B->SqlAggregation = 'MIN';
$column_C = new forestSQLColumn($querySelect);
$column_C->Column = 'columnC';
$column_C->Name = 'Spalte C';
$querySelect->Query->Columns->Add($column_A);
$querySelect->Query->Columns->Add($column_B);
$querySelect->Query->Columns->Add($column_C);
#### Joins ############################################################################
$join_A = new forestSQLJoin($querySelect);
$join_A->JoinType = 'INNER JOIN';
$join_A->Table = 'tableB';
$relation_A = new forestSQLRelation($querySelect);
$column_D = new forestSQLColumn($querySelect);
$column_D->Table = $join_A->Table;
$column_D->Column = 'columnD';
$relation_A->BracketStart = true;
$relation_A->ColumnLeft = $column_D;
$relation_A->ColumnRight = $column_A;
$relation_A->Operator = '=';
$relation_B = new forestSQLRelation($querySelect);
$column_E = new forestSQLColumn($querySelect);
$column_E->Table = $join_A->Table;
$column_E->Column = 'columnE';
$column_E->SqlAggregation = 'SUM';
$relation_B->BracketEnd = true;
$relation_B->ColumnLeft = $column_E;
$relation_B->ColumnRight = $column_B;
$relation_B->Operator = '<=';
$relation_B->FilterOperator = 'AND';
$join_A->Relations->Add($relation_A);
$join_A->Relations->Add($relation_B);
$querySelect->Query->Joins->Add($join_A);
##### Where ############################################################################
$where_A = new forestSQLWhere($querySelect);
$where_A->Column = $column_A;
$where_A->Value = $where_A->ParseValue('Wert');
$where_A->Operator = '<>';
$where_B = new forestSQLWhere($querySelect);
$where_B->Column = $column_D;
$where_B->Value = $where_B->ParseValue(123);
$where_B->Operator = '>=';
$where_B->FilterOperator = 'XOR';
$querySelect->Query->Where->Add($where_A);
$querySelect->Query->Where->Add($where_B);
#### GroupBy ##########################################################################
$querySelect->Query->GroupBy->Add($column_A);
$querySelect->Query->GroupBy->Add($column_D);
#### Having ###########################################################################
$where_C = new forestSQLWhere($querySelect);
$where_C->BracketStart = true;
$where_C->Column = $column_B;
$where_C->Value = $where_C->ParseValue(456);
$where_C->Operator = '<=';
$where_D = new forestSQLWhere($querySelect);
$where_D->BracketEnd = true;
$where_D->Column = $column_A;
$where_D->Value = $where_D->ParseValue('Trew');
$where_D->Operator = '=';
$where_D->FilterOperator = 'AND';
$querySelect->Query->Having->Add($where_C);
$querySelect->Query->Having->Add($where_D);
#### OrderBy ##########################################################################
$querySelect->Query->OrderBy->AddColumn($column_D, true);
$querySelect->Query->OrderBy->AddColumn($column_A, false);
#### Limit ############################################################################
$querySelect->Query->Limit->Start = 0;
$querySelect->Query->Limit->Interval = 10;
echo $querySelect;
// +-----------------------------+
// | |
// | forestSQLQuery Insert |
// | |
// +-----------------------------+
$queryInsert = new forestSQLQuery($o_glob->Base->{$o_glob->ActiveBase}->BaseGateway, forestSQLQuery::INSERT, 'tableA');
#### Columns ##########################################################################
$column_A = new forestSQLColumnValue($queryInsert);
$column_A->Column = 'columnA';
$column_A->Value = $column_A->ParseValue('Wert');
$column_B = new forestSQLColumnValue($queryInsert);
$column_B->Column = 'columnB';
$column_B->Value = $column_B->ParseValue(123);
$column_C = new forestSQLColumnValue($queryInsert);
$column_C->Column = 'columnC';
$column_C->Value = $column_C->ParseValue('Wert2');
$queryInsert->Query->ColumnValues->Add($column_A);
$queryInsert->Query->ColumnValues->Add($column_B);
$queryInsert->Query->ColumnValues->Add($column_C);
echo $queryInsert;
// +-----------------------------+
// | |
// | forestSQLQuery Update |
// | |
// +-----------------------------+
$queryUpdate = new forestSQLQuery($o_glob->Base->{$o_glob->ActiveBase}->BaseGateway, forestSQLQuery::UPDATE, 'tableA');
#### Columns ##########################################################################
$column_A = new forestSQLColumnValue($queryUpdate);
$column_A->Column = 'columnA';
$column_A->Value = $column_A->ParseValue('Wert');
$column_B = new forestSQLColumnValue($queryUpdate);
$column_B->Column = 'columnB';
$column_B->Value = $column_B->ParseValue(123);
$column_C = new forestSQLColumnValue($queryUpdate);
$column_C->Column = 'columnC';
$column_C->Value = $column_C->ParseValue('Wert2');
$queryUpdate->Query->ColumnValues->Add($column_A);
$queryUpdate->Query->ColumnValues->Add($column_B);
$queryUpdate->Query->ColumnValues->Add($column_C);
##### Where ############################################################################
$column_A = new forestSQLColumn($queryUpdate);
$column_A->Column = 'columnA';
$column_B = new forestSQLColumn($queryUpdate);
$column_B->Column = 'columnB';
$where_A = new forestSQLWhere($queryUpdate);
$where_A->Column = $column_A;
$where_A->Value = $where_A->ParseValue('Wert1');
$where_A->Operator = '<>';
$where_B = new forestSQLWhere($queryUpdate);
$where_B->Column = $column_B;
$where_B->Value = $where_B->ParseValue('Wert2');
$where_B->Operator = '=';
$where_B->FilterOperator = 'OR';
$queryUpdate->Query->Where->Add($where_A);
$queryUpdate->Query->Where->Add($where_B);
echo $queryUpdate;
// +-----------------------------+
// | |
// | forestSQLQuery Delete |
// | |
// +-----------------------------+
$queryDelete = new forestSQLQuery($o_glob->Base->{$o_glob->ActiveBase}->BaseGateway, forestSQLQuery::DELETE, 'tableA');
##### Where ############################################################################
$column_A = new forestSQLColumn($queryDelete);
$column_A->Column = 'columnA';
$column_B = new forestSQLColumn($queryDelete);
$column_B->Column = 'columnB';
$where_A = new forestSQLWhere($queryDelete);
$where_A->Column = $column_A;
$where_A->Value = $where_A->ParseValue('Wert1');
$where_A->Operator = '<>';
$where_B = new forestSQLWhere($queryDelete);
$where_B->Column = $column_B;
$where_B->Value = $where_B->ParseValue('Wert2');
$where_B->Operator = '=';
$where_B->FilterOperator = 'OR';
$queryDelete->Query->Where->Add($where_A);
$queryDelete->Query->Where->Add($where_B);
echo $queryDelete;
// +-----------------------------+
// | |
// | forestSQLQuery Create |
// | |
// +-----------------------------+
$o_queryCreate = new forestSQLQuery($o_glob->Base->{$o_glob->ActiveBase}->BaseGateway, forestSQLQuery::CREATE, 'test');
$o_columnA = new forestSQLColumnStructure($o_queryCreate);
$o_columnA->Name = 'Id';
$o_columnA->ColumnType = 'INT';
$o_columnA->ConstraintList->Add('NOT NULL');
$o_columnA->ConstraintList->Add('PRIMARY KEY');
$o_columnA->ConstraintList->Add('AUTO_INCREMENT');
$o_columnB = new forestSQLColumnStructure($o_queryCreate);
$o_columnB->Name = 'UUID';
$o_columnB->ColumnType = 'VARCHAR';
$o_columnB->ColumnTypeLength = 36;
$o_columnB->ConstraintList->Add('NOT NULL');
$o_columnB->ConstraintList->Add('UNIQUE');
$o_columnC = new forestSQLColumnStructure($o_queryCreate);
$o_columnC->Name = 'Text';
$o_columnC->ColumnType = 'VARCHAR';
$o_columnC->ColumnTypeLength = 255;
$o_columnD = new forestSQLColumnStructure($o_queryCreate);
$o_columnD->Name = 'LocalTime';
$o_columnD->ColumnType = 'TIMESTAMP';
$o_columnD->ConstraintList->Add('NULL');
$o_queryCreate->Query->Columns->Add($o_columnA);
$o_queryCreate->Query->Columns->Add($o_columnB);
$o_queryCreate->Query->Columns->Add($o_columnC);
$o_queryCreate->Query->Columns->Add($o_columnD);
echo $o_queryCreate;
// +-----------------------------+
// | |
// | forestSQLQuery Alter |
// | |
// +-----------------------------+
$o_queryAlter = new forestSQLQuery($o_glob->Base->{$o_glob->ActiveBase}->BaseGateway, forestSQLQuery::ALTER, 'test');
$o_columnA = new forestSQLColumnStructure($o_queryAlter);
$o_columnA->Name = 'AMOUNT';
$o_columnA->ColumnType = 'DECIMAL';
$o_columnA->AlterOperation = 'ADD';
$o_columnA->ConstraintList->Add('NOT NULL');
$o_columnB = new forestSQLColumnStructure($o_queryAlter);
$o_columnB->Name = 'Text';
$o_columnB->ColumnType = 'TEXT';
$o_columnB->AlterOperation = 'CHANGE';
$o_columnB->ConstraintList->Add('NOT NULL');
$o_columnC = new forestSQLColumnStructure($o_queryAlter);
$o_columnC->Name = 'UUID';
$o_columnC->ColumnType = 'VARCHAR';
$o_columnC->ColumnTypeLength = 36;
$o_columnC->AlterOperation = 'DROP';
$o_columnC->ConstraintList->Add('NOT NULL');
$o_columnC->ConstraintList->Add('UNIQUE');
$o_queryAlter->Query->Columns->Add($o_columnA);
$o_queryAlter->Query->Columns->Add($o_columnB);
$o_queryAlter->Query->Columns->Add($o_columnC);
echo $o_queryAlter;
// +-----------------------------+
// | |
// | forestSQLQuery Drop |
// | |
// +-----------------------------+
$o_queryDrop = new forestSQLQuery($o_glob->Base->{$o_glob->ActiveBase}->BaseGateway, forestSQLQuery::DROP, 'test');
echo $o_queryDrop;
SQL-Abfragen mit Hilfe der Klasse forestSQLQuery können dann bei einem forestTwig angewendet werden. Um nicht extra für jede Tabelle SQL-Abfrage-Objekte erzeugen zu müssen, hat forestPHP für die Klasse forestTwig Methoden entwickelt, um grundlegende Abfragen wie CREATE, UPDATE, SELECT oder DELETE für jedes forestTwig-Objekt zur Verfügung zu stellen. Anhand der Informationen von forestTwig-Dateien sind alle Spalten, Primärschlüssel, Unique-Schlüssel, Sortierreihenfolge usw. bereits bekannt. Mit diesen Informationen können dann automatisch CRUD-Abfragen generiert werden. Dies erleichtert die Arbeit mit Tabellen im forestPHP Framework enorm und ist beliebig einsetzbar. Dabei besteht weiterhin die Freiheit trotzdem eigene SQL-Abfragen zu erstellen und auszuführen.
Die folgenden Beispiele demonstrieren, wie mit Twig-Objekten Datenbankoperationen ausgeführt und Ergebnisse aufgerufen werden.
$o_actionTwig = new actionTwig;
$o_actionTwig->GetRecord(array(1));
echo $o_actionTwig->Name;
$o_branchTwig = new branchTwig;
$o_records = $o_branchTwig->GetAllRecords();
foreach($o_records->Twigs as $o_record) {
echo $o_record->Name;
$o_record->Name += '_Change';
$o_record->Update();
}
if ($o_branchTwig->GetRecord(array(42))) {
$o_branchTwig->DeleteRecord();
}
$o_querySelect = new forestSQLQuery($o_glob->Base->{$o_glob->ActiveBase}->BaseGateway, forestSQLQuery::SELECT, 'sys_fphp_action');
$column_A = new forestSQLColumn($o_querySelect);
$column_A->Column = 'BranchId';
$column_B = new forestSQLColumn($o_querySelect);
$column_B->Column = 'Name';
$o_querySelect->Query->Columns->Add($column_A);
$o_querySelect->Query->Columns->Add($column_B);
$column_C = new forestSQLColumn($o_querySelect);
$column_C->Column = 'Id';
$where_A = new forestSQLWhere($o_querySelect);
$where_A->Column = $column_C;
$where_A->Value = $where_A->ParseValue(5);
$where_A->Operator = '>';
$o_querySelect->Query->Where->Add($where_A);
$o_result = $o_glob->Base->{$o_glob->ActiveBase}->FetchQuery($o_querySelect);
foreach($o_result->Twigs as $o_record) {
echo $o_record->ShowFields(false, true); // print every field of the record with field's value
}
PHP Arrays können je Element einen anderen Datentyp aufnehmen. Dies ist gut für einen flexiblen Einsatz in der Programmierung. Jedoch benötigt man öfters einen Array, wo man sich darauf verlassen kann das jedes Element vom gleichen Typ ist. Zum Beispiel gibt es in forestPHP einige Listen von Objekten die auf forestPHP-Klassen basieren, eine Liste von Datensätzen in Form von forestTwig-Objekten. Um dies zu ermöglichen hat das forestPHP Framework das Konstrukt der object list erstellt. Bei der Erstellung einer object list gibt man an, welche Klassen die Liste als Elemente akzeptiert. So kann man seine Daten entsprechend in Klassen kapseln und einheitlich in PHP Arrays ablegen und wieder z.B. mit einer foreach-Schleife abrufen.
Der folgende Quelltext zeigt, wie einfach eine object list erstellt und benutzt werden kann.
// create three objects of actionTwig
$o_actionTwigOne = new actionTwig;
$o_actionTwigOne->BranchId = 42;
$o_actionTwigOne->Name = 'Action One';
$o_actionTwigTwo = new actionTwig;
$o_actionTwigTwo->BranchId = 42;
$o_actionTwigTwo->Name = 'Action Two';
$o_actionTwigThree = new actionTwig;
$o_actionTwigThree->BranchId = 42;
$o_actionTwigThree->Name = 'Action Three';
$ol_list = new forestObject(new forestObjectList('actionTwig'), false); // object list only allows objects with class 'actionTwig'; false mean this object can not be overwritten
$ol_list->Add($o_actionTwigOne, 'one'); // string-key is optional, default is numeration keys starting with 0
$ol_list->Add($o_actionTwigTwo, 'two');
$ol_list->Add($o_actionTwigThree, 'three');
foreach ($ol_list as $s_key => $o_action) {
// listing each action object with key and name
echo $s_key . ': ' . $o_action->Name . '<br>' . "\n";
}
Formulare in Webanwendungen sind heute nicht mehr wegzudenken. Ohne eine einheitliche Linie können Formulare auf einer Webseite aber auch sehr schnell chaotisch und unübersichtlich werden. Aus diesem Grund unterstützt forestPHP mit den beiden Klassen forestForm und forestFormElement die automatische Generierung von Formularen um Datensätze zu erstellen, ändern und zu löschen mit einer einheitlichen und übersichtlichen Darstellung.
Es gibt folgende Form-Elemente in der forestFormElement Klasse:
Grundlegend werden alle Formulare in forestPHP als Modal-Formular angezeigt. Ein grafisches Steuerelement, das dem Hauptfenster einer Anwendung untergeordnet ist. Es wird ein Modus erstellt, der das Hauptfenster deaktiviert, aber sichtbar hält, wobei das modale Fenster als untergeordnetes Fenster davor angezeigt wird. Innerhalb des Modal-Formulars ist es möglich die einzelnen Elemente des Formulars in einer beliebigen Anzahl von Tabs anzuordnen und Labels hinzuzufügen.
Um nicht für jeden Anwendungsfall ein Formular immer und immer wieder neu zu programmieren, unterstützt forestPHP die automatische Formular-Generierung. Mit den Informationen der Tabelle und Tabellenfelder aus der Datenbank und mit der Zuweisung eines forestTwig-Datensatz bei der Erstellung des Formulars, kann so ein Formular zur Erstellung oder Bearbeitung eines Datensatzes vollständig generiert werden. forestPHP Formulare sind somit direkt von den Datensätzen der Tabellenfelder abhängig und bekommen damit die gleichen Vorteile der dynamischen Verwaltung und Flexiblität: Sobald ein neues Tabellenfeld administrativ der Tabelle hinzugefügt wird, wird dieses auch automatisch dem Formular hinzugefügt. Wo man früher an zwei Stellen programmatische Änderungen machen musste ist dies mit forestPHP nun nicht mehr notwendig.
Da aber auch die Validierung von Formulareingaben eine immer wichtigere Rolle annimmt, bedient sich forestPHP hier der Funktionalität von jQuery Validate, um einzelene Formular-Elementen mit Validierungsregeln zu koppeln welche die Eingabe der Daten überprüfen bevor der Benutzer das Formular abschicken kann. Auch diese Möglichkeit wird innerhalb der forestPHP-Datenbank konfiguriert, indem man Validation-Datensätze mit Tabellenfelder verbinden kann.
Es gibt folgende Validierungsregeln:
Um die Sicherheit von Formular-Operationen in forestPHP zu erhöhen wurden folgende Maßnahmen realisiert:
Die Administration und Anpassung der Auswahlfelder für neue Tabellenfelder ist im Bereich Root unterhalb von forestPHP möglich. So kann man neue Form-Elemente oder Validierungsregeln hinzufügen. Weiterhin gibt es hierbei die Möglichkeit der Konfiguration, welche Form-Elemente welche Kombinationen aus SQL-Type, ForestData und Validierungsregeln überhaupt zugelassen werden. Dies ist in der Detail-Ansicht von Form-Elementen möglich.
Aber auch mit diesen praktischen Features ist es möglich Formulare manuell innerhalb von forestPHP zu erstellen und zu benutzen wie folgende Quelltextbeispiele zeigen:
/****************************************/
/*********Modal Tab Form Example*********/
/****************************************/
$o_glob->PostModalForm = new forestForm($this->Twig);
$o_glob->PostModalForm->FormTabConfiguration->Tab = true;
$o_glob->PostModalForm->FormTabConfiguration->TabMenuClass = 'nav nav-tabs';
$o_glob->PostModalForm->FormTabConfiguration->TabActiveClass = 'active';
$o_glob->PostModalForm->FormTabConfiguration->TabToggle = 'tab';
$o_glob->PostModalForm->FormTabConfiguration->TabContentClass = 'tab-content';
$o_glob->PostModalForm->FormTabConfiguration->TabFooterClass = 'tab-footer';
$o_glob->PostModalForm->FormTabConfiguration->TabElementClass = 'tab-pane fade';
$o_glob->PostModalForm->FormTabConfiguration->TabElementActiveClass = 'tab-pane fade in active';
$o_glob->PostModalForm->FormModalConfiguration->Modal = true;
$o_glob->PostModalForm->FormModalConfiguration->ModalClass = 'modal fade';
$o_glob->PostModalForm->FormModalConfiguration->ModalId = 'myModal';
$o_glob->PostModalForm->FormModalConfiguration->ModalTitle = '<h4>Modal Form</h4>';
$o_glob->PostModalForm->FormModalConfiguration->ModalRole = 'dialog';
$o_glob->PostModalForm->FormModalConfiguration->ModalDialogClass = 'modal-dialog modal-lg';
$o_glob->PostModalForm->FormModalConfiguration->ModalDialogContentClass = 'modal-content';
$o_glob->PostModalForm->FormModalConfiguration->ModalHeaderClass = 'modal-header';
$o_glob->PostModalForm->FormModalConfiguration->ModalHeaderCloseClass = 'close';
$o_glob->PostModalForm->FormModalConfiguration->ModalHeaderDismissClass = 'modal';
$o_glob->PostModalForm->FormModalConfiguration->ModalHeaderCloseContent = '×';
$o_glob->PostModalForm->FormModalConfiguration->ModalBodyClass = 'modal-body';
$o_glob->PostModalForm->FormModalConfiguration->ModalFooterClass = 'modal-footer';
$o_glob->PostModalForm->FormObject->Class = 'form-horizontal';
$o_glob->PostModalForm->FormObject->FormGroupClass = 'form-group';
$o_glob->PostModalForm->FormObject->LabelClass = 'col-sm-3 control-label';
$o_glob->PostModalForm->FormObject->FormElementClass = 'col-sm-9';
$o_glob->PostModalForm->FormObject->ClassAll = 'form-control';
$o_glob->PostModalForm->FormObject->RadioClass = 'radio';
$o_glob->PostModalForm->FormObject->CheckboxClass = 'checkbox';
$o_text = new forestFormElement(forestFormElement::TEXT);
$o_text->Label = 'Text:';
$o_text->Id = 'text01';
$o_text->Placeholder = 'Enter a text...';
$o_text->ValMessage = 'Please enter a text';
$o_password = new forestFormElement(forestFormElement::PASSWORD);
$o_password->Label = 'Password:';
$o_password->Id = 'password01';
$o_password->Placeholder = 'Enter a password...';
$o_password->ValMessage = 'Please enter a password';
$o_password->Description = 'Mind. 1 Groß-, 1 Kleinbuchstabe, 1 Sonderzeichen und 1 Zahl.';
$o_password->DescriptionClass = 'text-right text-info';
$o_hidden = new forestFormElement(forestFormElement::HIDDEN);
$o_hidden->Id = 'hidden01';
$o_hidden->Value = 'hiddenValue';
$o_list = new forestFormElement(forestFormElement::LIST);
$o_list->Label = 'List:';
$o_list->Id = 'list01';
$o_list->List = 'browsers';
$o_list->Placeholder = 'Enter a browser...';
$o_list->ValMessage = 'Please enter a browser';
$o_list->Options = array('Internet Explorer' => 'ie', 'Firefox' => 'ff', 'Chrome' => 'ch', 'Opera' => 'op', 'Safari' => 'sf');
$o_file = new forestFormElement(forestFormElement::FILE);
$o_file->Label = 'File:';
$o_file->Id = 'file01';
$o_file->ValMessage = 'Please choose a file';
$o_file->Multiple = true;
$o_fileCamera = new forestFormElement(forestFormElement::FILE);
$o_fileCamera->Label = 'Picture:';
$o_fileCamera->Id = 'file02';
$o_fileCamera->ValMessage = 'Please take a picture';
$o_fileCamera->Accept = 'image/*';
$o_fileCamera->Capture = 'camera';
$o_radio = new forestFormElement(forestFormElement::RADIO);
$o_radio->Label = 'Radios:';
$o_radio->Id = 'radio01';
$o_radio->ValMessage = 'Please choose an option';
$o_radio->Options = array('Deutschland' => 'de', 'Österreich' => 'au', 'Schweiz' => 'ch');
$o_radioInline = new forestFormElement(forestFormElement::RADIO);
$o_radioInline->Label = 'Radio-Inline:';
$o_radioInline->Id = 'radio02';
$o_radioInline->RadioClass = 'radio-inline';
$o_radioInline->Break = false;
$o_radioInline->ValMessage = 'Please choose an option';
$o_radioInline->Value = 'eu';
$o_radioInline->Options = array('Europa' => 'eu', 'USA' => 'us', 'Asien' => 'as');
$o_checkbox = new forestFormElement(forestFormElement::CHECKBOX);
$o_checkbox->Id = 'checkbox01';
$o_checkbox->ValMessage = 'Please choose an option';
$o_checkbox->Options = array('AGB' => 'agb');
$o_checkbox->Description = 'Single-Checkbox without Label.';
$o_checkbox->DescriptionClass = 'text-right text-info';
$o_checkbox02 = new forestFormElement(forestFormElement::CHECKBOX);
$o_checkbox02->Label = 'Checkboxes:';
$o_checkbox02->Id = 'checkbox02[]';
$o_checkbox02->ValMessage = 'Please choose an option';
$o_checkbox02->Options = array('Option 1' => 'opt1', 'Option 2' => 'opt2', 'Option 3' => 'opt3', 'Option 4' => 'opt4');
$o_checkbox03 = new forestFormElement(forestFormElement::CHECKBOX);
$o_checkbox03->Label = 'Checkboxes-Inline:';
$o_checkbox03->Id = 'checkbox03[]';
$o_checkbox03->ValMessage = 'Please choose an option';
$o_checkbox03->CheckboxClass = 'checkbox-inline';
$o_checkbox03->Break = false;
$o_checkbox03->Options = array('Option 1', 'Option 2', 'Option 3');
$o_textarea = new forestFormElement(forestFormElement::TEXTAREA);
$o_textarea->Label = 'Textarea:';
$o_textarea->Id = 'textarea01';
$o_textarea->Rows = 5;
$o_textarea->Placeholder = 'Enter a text in this textarea...';
$o_textarea->ValMessage = 'Please enter a text';
$o_select = new forestFormElement(forestFormElement::SELECT);
$o_select->Label = 'Select:';
$o_select->Id = 'select01';
$o_select->ValMessage = 'Please choose an option';
$o_select->Options = array('Option 1' => 'opt1', 'Option 2' => 'opt2', 'Option 3' => 'opt3', 'Option 4' => 'opt4');
$o_selectOpt = new forestFormElement(forestFormElement::SELECT);
$o_selectOpt->Label = 'Select-Optgroup:';
$o_selectOpt->Id = 'select02';
$o_selectOpt->Size = 3;
$o_selectOpt->Multiple = false;
$o_selectOpt->ValMessage = 'Please choose an option';
$o_selectOpt->Options = array(
'Swedish Cars' => array('Volvo' => 'volvo', 'Saab' => 'saab'),
'German Cars' => array('Mercedes' => 'mercedes', 'Audi' => 'audi'),
'Asian Cars' => array('Toyota' => 'toyota', 'Mitsubishi' => 'mitsubishi', 'Kia' => 'kia')
);
$o_description = new forestFormElement(forestFormElement::DESCRIPTION);
$o_description->Description = 'Dies ist eine kurze Beschreibung, um zwischendurch einige Elemente einfach zu erklären. :)';
$o_button = new forestFormElement(forestFormElement::BUTTON);
$o_button->ButtonType = 'submit';
$o_button->Class = 'btn btn-success btn-default pull-right';
$o_button->Id = 'submit01';
$o_button->ButtonText = '<span class="fas fa-check"></span> Submit';
$o_button->NoFormGroup = true;
$o_cancel = new forestFormElement(forestFormElement::BUTTON);
$o_cancel->ButtonType = 'submit';
$o_cancel->Class = 'btn btn-danger btn-default pull-right';
$o_cancel->Data = 'dismiss="modal"';
$o_cancel->Id = 'cancel01';
$o_cancel->Style = 'margin-left: 10px;';
$o_cancel->ButtonText = '<span class="fas fa-times"></span> Cancel';
$o_cancel->NoFormGroup = true;
$o_color = new forestFormElement(forestFormElement::COLOR);
$o_color->Label = 'Color:';
$o_color->Id = 'color01';
$o_color->ValMessage = 'Please choose a color';
$o_email = new forestFormElement(forestFormElement::EMAIL);
$o_email->Label = 'Email:';
$o_email->Id = 'email01';
$o_email->ValMessage = 'Please enter an email address';
$o_url = new forestFormElement(forestFormElement::URL);
$o_url->Label = 'URL:';
$o_url->Id = 'url01';
$o_url->ValMessage = 'Please enter an URL address';
$o_date = new forestFormElement(forestFormElement::DATE);
$o_date->Label = 'Date:';
$o_date->Id = 'date01';
$o_date->ValMessage = 'Please enter a date';
$o_date->Min = '2018-01-01';
$o_date->Step = 10;
$o_datetimelocal = new forestFormElement(forestFormElement::DATETIMELOCAL);
$o_datetimelocal->Label = 'Datetime:';
$o_datetimelocal->Id = 'datetime01';
$o_datetimelocal->ValMessage = 'Please enter a datetime';
$o_datetimelocal->Min = '2018-01-01T12:00:00';
$o_datetimelocal->Step = 20;
$o_month = new forestFormElement(forestFormElement::MONTH);
$o_month->Label = 'Month:';
$o_month->Id = 'month01';
$o_month->ValMessage = 'Please enter a month';
$o_month->Max = '2019-06';
$o_month->Step = 2;
$o_number = new forestFormElement(forestFormElement::NUMBER);
$o_number->Label = 'Number:';
$o_number->Id = 'number01';
$o_number->ValMessage = 'Please enter a number';
$o_number->Min = '-100';
$o_number->Max = '100';
$o_number->Step = 10;
$o_range = new forestFormElement(forestFormElement::RANGE);
$o_range->Label = 'Range:';
$o_range->Id = 'range01';
$o_range->ValMessage = 'Please enter a range';
$o_range->Min = '0';
$o_range->Max = '12';
$o_range->Step = 2;
$o_search = new forestFormElement(forestFormElement::SEARCH);
$o_search->Label = 'Search:';
$o_search->Id = 'search01';
$o_search->ValMessage = 'Please enter a search';
$o_phone = new forestFormElement(forestFormElement::PHONE);
$o_phone->Label = 'Phone:';
$o_phone->Id = 'phone01';
$o_phone->ValMessage = 'Please enter a phone number';
$o_time = new forestFormElement(forestFormElement::TIME);
$o_time->Label = 'Time:';
$o_time->Id = 'time01';
$o_time->ValMessage = 'Please enter a time';
$o_time->Min = '08:00:00';
$o_time->Max = '20:00:00';
$o_time->Step = 15;
$o_week = new forestFormElement(forestFormElement::WEEK);
$o_week->Label = 'Week:';
$o_week->Id = 'week01';
$o_week->ValMessage = 'Please enter a week';
$o_week->Max = '2018-W01';
$o_week->Step = 5;
$o_pattern = new forestFormElement(forestFormElement::TEXT);
$o_pattern->Label = 'Pattern:';
$o_pattern->Id = 'pattern01';
$o_pattern->ValMessage = 'Please enter a three letter country code';
$o_pattern->Pattern = '[A-Za-z]{3}';
$o_pattern->PatternTitle = 'three letter country code';
$o_tabA = new forestFormTab('menu1', 'Menu 1');
$o_tabA->FormElements->Add($o_text);
$o_tabA->FormElements->Add($o_password);
$o_tabA->FormElements->Add($o_hidden);
$o_tabA->FormElements->Add($o_list);
$o_tabA->FormElements->Add($o_file);
$o_tabA->FormElements->Add($o_fileCamera);
$o_tabB = new forestFormTab('optionen', 'Options');
$o_tabB->FormElements->Add($o_radio);
$o_tabB->FormElements->Add($o_radioInline);
$o_tabB->FormElements->Add($o_checkbox);
$o_tabB->FormElements->Add($o_checkbox02);
$o_tabB->FormElements->Add($o_checkbox03);
$o_tabB->FormElements->Add($o_textarea);
$o_tabB->FormElements->Add($o_select);
$o_tabB->FormElements->Add($o_selectOpt);
$o_tabC = new forestFormTab('other', 'Other');
$o_tabC->FormElements->Add($o_description);
$o_tabC->FormElements->Add($o_color);
$o_tabC->FormElements->Add($o_email);
$o_tabC->FormElements->Add($o_url);
$o_tabC->FormElements->Add($o_date);
$o_tabC->FormElements->Add($o_datetimelocal);
$o_tabD = new forestFormTab('settings', 'Settings');
$o_tabD->FormElements->Add($o_month);
$o_tabD->FormElements->Add($o_number);
$o_tabD->FormElements->Add($o_range);
$o_tabD->FormElements->Add($o_search);
$o_tabD->FormElements->Add($o_phone);
$o_tabD->FormElements->Add($o_time);
$o_tabD->FormElements->Add($o_week);
$o_tabD->FormElements->Add($o_pattern);
$o_glob->PostModalForm->FormFooterElements->Add($o_cancel);
$o_glob->PostModalForm->FormFooterElements->Add($o_button);
$o_glob->PostModalForm->FormTabs->Add($o_tabA);
$o_glob->PostModalForm->FormTabs->Add($o_tabB);
$o_glob->PostModalForm->FormTabs->Add($o_tabC);
$o_glob->PostModalForm->FormTabs->Add($o_tabD);
/************************************************/
/*********adding jQuery Validation Rules*********/
/************************************************/
$o_glob->PostModalForm->FormObject->ValRequiredMessage = 'Bitte geben Sie einen Wert an';
$o_glob->PostModalForm->FormObject->ValRules->Add(new forestFormValidationRule('text01', 'required', 'true'));
$o_glob->PostModalForm->FormObject->ValRules->Add(new forestFormValidationRule('password01', 'required', 'true'));
$o_glob->PostModalForm->FormObject->ValRules->Add(new forestFormValidationRule('list01', 'required', 'true'));
$o_glob->PostModalForm->FormObject->ValRules->Add(new forestFormValidationRule('checkbox01', 'required', 'true'));
$o_glob->PostModalForm->FormObject->ValRules->Add(new forestFormValidationRule('select01', 'required', 'true'));
$o_glob->PostModalForm->FormObject->ValRules->Add(new forestFormValidationRule('email01', 'email', 'true'));
$o_glob->PostModalForm->FormObject->ValRules->Add(new forestFormValidationRule('url01', 'url', 'true'));
$o_glob->PostModalForm->FormObject->ValRules->Add(new forestFormValidationRule('search01', 'rangelength', '5', '10'));
Zur Wiederverwendung sind Vorlagen unentbehrlich und seit jeher in Webanwendungen fester Benstandteil. Mit der Klasse forestTemplates unterstützt forestPHP den Einsatz von Vorlagen(Templates). Die einfache Handhabung soll das Beispiel der Landing Page demonstrieren:
// following steps are necessary to add a new template
// 1. create a new constant in forestTemplates.php
const LANDINGPAGE = 'landingpage';
// 2. create another constant with the raw html part of the template with exact name of first constant ending with 'TXT'
// in this case we just have just one substituion variable starting with 0 -> %0
const LANDINGPAGETXT = <<< EOF
%0
EOF;
// 3. adding constant to switch clause in forestTemplates.php constructor
switch ($this->Type->value) {
.
.
.
case self::LANDINGPAGE:
$this->Type->value = self::LANDINGPAGE;
break;
.
.
.
}
.
.
.
// how to create and use the template
$o_glob->Templates->Add(new forestTemplates(forestTemplates::LANDINGPAGE, array('This string value will replace %0 in the template', 'if exists, this string value will replace %1 in the template', ... and so on ... )), 'myLandingPage');
// template can be rendered with access $o_glob->Templates and the known key
echo $o_glob->Templates->{'myLandingPage'};
Um forestCombination zu benutzen muss ein neues Tabellenfeld mit Form-Element "text", SQL-Type-Element "leer" und ForestData-Element "forestCombination" erstellt werden. In JSONSettings gibt es dann denn Einstellungswert forestCombination welcher automatisch ausgewertet wird.
Beispiele:
"forestCombination":"Number-Double.# #.TestLookup.# @ #.TestLookup2"
- Number, Double, TestLookup und TestLookup2 sind genauso Tabellenfelder der aktuellen Tabelle wie auch das Feld das man mit forestCombination deklariert. Bei diesem Beispiel sehen wir das es den Verkettungs-Operator .
gibt um Zeichenketten miteinander zu verbinden. Um feste Zeichenketten in einer forestCombination einzubinden muss die Zeichenkette von #
umschlossen sein. Weiterhin sind die grundlegenden Rechenarten möglich: + - * /
. Man ist jedoch selbst dafür verantwortlich das Operationen auf Tabellenfeldern ausgeführt werden die dafür auch vorgesehen sind. Eine Typkontrolle wird nicht durchgeführt."forestCombination":"IntValue+INT(42)"
- Es gibt außerdem die beiden Aggregationen INT() und DBL(). Damit können festgelegte Werte in dem Einstellungswert von forestCombination in eine Integer- oder Gleitkommazahl umgewandelt werden."forestCombination":"SUM(fphp_subtable$LinePrice)"
- Mit der Aggregation SUM() und der Angabe der Sub Table und eines Tabellenfeldes wird eine Summe für das Tabellenfeld über alle Unterdatensätze zu diesem Datensatz gebildet. Man ist jedoch selbst dafür verantwortlich das Operationen auf Tabellenfeldern ausgeführt werden die dafür auch vorgesehen sind. Eine Typkontrolle wird nicht durchgeführt."forestCombination":"CNT(fphp_subtable)"
- Mit der Aggregation CNT() kann man die Anzahl der existierenden Sub Records zum Datensatz ermitteln lassen."forestCombination":"fphp_article$Price*Amount"
- Hier ist noch ein Beispiel wie man bei einem Sub Record ein Feld aus dem definierten Sub Constraint aus der Unterdatensatztabelle nimmt (fphp_article$Price) und mit dem Tabellenfeld (Amount) des Sub Record multipliziert, um den Zeilenpreis je nach Mengenangabe bei Abfrage zu berechnen."forestCombination":"FILENAME(File)"
- Anzeige des gespeicherten Dateinamens der Datei die mit dem Datensatz verknüpft ist."forestCombination":"FILEVERSION(File)"
- Anzeige der aktuellen Version der Datei, welche unabhängig von der Version des Datensatzes ist, da dieser mit seinen Daten separat ausgecheckt und versioniert werden kann.Das Prinzip von forestLookup ist denkbar einfach. Es gibt bereits eine Tabelle mit Datensätzen, z.B. Tabelle Auswahl(fphp_auswahl). Nun erstellt man in Tabelle Daten(fphp_daten) ein neues Tabellenfeld mit Form-Element "lookup", SQL-Type-Element "text[255]" und ForestData-Element "forestLookup". In JSONSettings kann man dann folgende Angaben machen:
"forestLookupDataTable":"fphp_auswahl"
- Die Tabelle von welcher das Lookup-Element die Daten beziehen soll."forestLookupDataPrimary":["UUID"]
- Der eindeutige Schlüssel zu einenm Datensatz der Lookup-Tabelle."forestLookupDataLabel":["Name","Name2"]
- Welche Tabellenfelder bei der Auswahl eines Lookup-Datensatzes angezeigt werden sollen. diese Felder werden auch angezeigt wenn eine Lookup für einen Datensatz ausgewählt wurde und im List-View angezeigt wird.Mit dem Konzept fPHP Flex stellt forestPHP Framework ein neues Konzept der Darstellung von Daten zur Verfügung. Bislang werden Daten und Datensätze mit Hilfe von Tabellen oder Formularen mit Tabs dargestellt. Mit fPHP Flex hat man nun die Möglichkeit anhand eines Datensatzes, dies vorhandenen Darstellungen der Tabellenfelder frei anzuordnen, zu verschieben und deren Größe zu skalieren.
Es muss also mindestens ein Datensatz im Twig existieren. Dann kann man die Aktion Flex bearbeiten (Alpha) im Root Menu auswählen, um die Felder anzuordnen und dies abzuspeichern. Zum Abschluss wählt man in den Branch Einstellungen die Standard-Ansicht fPHP-Flex (alpha) aus. Es ist weiterhin möglich die Datensätze mit View und List-View anzusehen. Dafür wird diese Aktion entsprechend im fPHP-Flex-View angezeigt. Alle Aktionen zu fPHP-Flex haben noch die Bezeichnung alpha da es noch keine ausreichenden Tests und Einsatzmöglichkeiten gab um die Stabilität dieses Features sicherstellen zu können.
Mit fPHP Flex wird damit ein Grundstein gelegt, um vollig neue Möglichkeiten der Darstellung von Datensätzen zu bieten. So könnten noch weitere Einstellungen wie die Anordnung von Feldern in Tabs oder Collapses, zusätzliche Konfiguration der Darstellung von Unterdatensätzen oder die Möglichkeit von verschachtelten fPHP Flexes zur Verfügung zu stellen.
In diesem Kapitel werden von allen forestPHP-Root-Klassen die öffentlichen Funktionen dokumentiert. Um den Aufwand für die Dokumentation gering zu halten ist dieser Teil der Dokumentation nur auf Englisch.
global function __autoload uses this class to create object of classes who were not included before
/**
* constructor of forestAutoLoad class, to load class file
*
* @param string $p_s_name class name
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct($p_s_name)
/**
* static helper function to check if a file is readable or exists
*
* @param string $p_s_filename path of filename + filename
*
* @return bool true - file is readable and exists, false - file does not exists
*
* @access public
* @static yes
*/
public static function IsReadable($p_s_filename)
gathering class for all database interfaces an gateways who can be used by the script collection
whole database connectivity goes over this class
on initialization the developer can decide which gateway he wants to use
/**
* constructor of forestBase class, set connection parameters to destination database
*
* @param string $p_s_baseGateway base-gateway constant
* @param string $p_s_host host value of database server
* @param string $p_s_datasource database name
* @param string $p_s_user database user
* @param string $p_s_password database user's password
* @param bool $p_b_persistentConnection standard true, optional
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct($p_s_baseGateway = '', $p_s_host = '', $p_s_datasource = '', $p_s_user = '', $p_s_password = '', $p_b_persistentConnection = true)
/**
* destructor of forestBase class, closes current connection
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __destruct()
/**
* function to send a query to the database and get a result set/answer/value
*
* @param forestSQLQuery $p_o_sqlQuery sql query
* @param bool $p_b_transaction use query in transaction mode
* @param bool $p_b_resultTwigList convert result set into twig list
* @param bool $p_b_freeResult free result memory
* @param integer $p_i_resultType standard ASSOC - ASSOC, NUM, BOTH, OBJ, LAZY
*
* @return object result set/twig list/row count
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function FetchQuery(\fPHP\Base\forestSQLQuery $p_o_sqlQuery, $p_b_transaction = false, $p_b_resultTwigList = true, $p_b_freeResult = false, $p_i_resultType = \fPHP\Base\forestBase::ASSOC)
/**
* function to start transaction mode
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function ManualTransaction()
/**
* function to roll back all transactions
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function ManualRollBack()
/**
* function to end transaction mode
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function ManualCommit()
/**
* function to get id of last insert with this connection
*
* @return integer id of last inserted record
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function LastInsertId()
abstract class for all branches
core functionality for rendering and editing records which are managed in the twig object
sub record editing support as well
all functions can be overwritten for user specific use case
/**
* constructor of forestBranch class
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct()
/**
* individual branch-classes are calling this method to set next action
*
* @param string $p_s_nextAction name of action
* @param string $p_s_nextActionAfterReload name of action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function SetNextAction($p_s_nextAction, $p_s_nextActionAfterReload = null)
/**
* inits global filter mask for all branches and actions
*
* @return null
*
* @access protected
* @static no
*/
protected function InitFilter()
/**
* clean up temp files and file records
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function CleanUpTempFiles()
/**
* handle form key functionality
*
* @param string $p_s_formId id of form element
* @param bool $p_b_postChain true - init form key again for multiple step forms, false - normal behavior
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function HandleFormKey($p_s_formId = 'NULL', $p_b_postChain = false)
/**
* handle honeypot fields functionality
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function HandleHoneypotFields()
/**
* help function to create a new entry in the log
*
* @param string $p_s_message message for log entry
* @param forestTwig $p_o_twig record data which can be added to the log message
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function CreateLogEntry($p_s_message = null, \fPHP\Twigs\forestTwig $p_o_twig = null)
/**
* generates landing page
*
* @return null
*
* @access protected
* @static no
*/
protected function GenerateLandingPage()
/**
* handle login action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function loginAction()
/**
* handle logout action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function logoutAction()
/**
* handle sign up action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function signUpAction()
/**
* generates list view
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function GenerateListView()
/**
* render column value for list view
*
* @param string $p_s_value value which should be set, passed by reference
* @param string $p_s_formElement forestFormElement type
* @param string $p_s_column name of column/field
* @param forestTwig $p_o_record record of type forestTwig
* @param string $p_s_dictionaryKey name of dictionary key, syntax: fulltablename_fieldname
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function ListViewRenderColumnValue(&$p_s_value, $p_s_formElement, $p_s_column, $p_o_record, $p_s_dictionaryKey)
/**
* create modal form for selecting hidden columns
*
* @param forestForm $p_o_form form object where form elements will be added to add additonal columns to the view
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function GenerateHiddenColumnsModal(\fPHP\Forms\forestForm $p_o_form)
/**
* render search form
*
* @param string $p_s_searchForm form object of the search form
* @param string $p_s_searchTerms string container to list all search terms as badges
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function RenderSearchForm(&$p_s_searchForm, &$p_s_searchTerms)
/**
* generates flex view
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function GenerateFlexView()
/**
* handle edit flex view action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function EditFlexView()
/**
* generates detail view
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function GenerateView()
/**
* handle sub records display in detail view
*
* @param forestTwig $p_o_twig head record where sub records will be queried from
* @param bool $p_b_readonly true - show sub records without manipulation actions, false - normal view of all sub records
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function ListSubRecords(\fPHP\Twigs\forestTwig $p_o_twig, $p_b_readonly = false)
/**
* handle view record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function ViewRecord()
/**
* handle new record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function NewRecord()
/**
* render modal form for new sub record
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function RenderNewSubRecordForm()
/**
* add additional sub record field form elements to global post modal form
*
* @param subconstraintTwig $p_o_subconstraintTwig sub constraint object where a lookup and form elements will be build dynamically
* @param subrecordsTwig $p_o_subrecordsTwig record data of sub record to give values to form elements
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function AddAdditionalSubRecordFormElements(\fPHP\Twigs\subconstraintTwig $p_o_subconstraintTwig, \fPHP\Twigs\subrecordsTwig $p_o_subrecordsTwig = null)
/**
* handle edit record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function EditRecord()
/**
* render modal form for editing sub record
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function RenderEditSubRecordForm()
/**
* write POST data into twig property fields
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function TransferPOST_Twig()
/**
* handle FILES data
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function TransferFILES_Twig()
/**
* undo created file records if there are any exceptions for new records or editing records
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function UndoFilesEntries()
/**
* get validation rules of form element
*
* @param string $p_s_tableFieldUUID uuid of tablefield which is part of validation rule primary key
* @param array $p_a_validationRules array object where found validation rules will be inserted, passed by reference
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function GetValidationRules($p_s_tableFieldUUID, &$p_a_validationRules)
/**
* handle replace file record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function replaceFileAction()
/**
* handle restore file record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function restoreFileAction()
/**
* handle checkout record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function checkoutAction()
/**
* handle checkin record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function checkinAction()
/**
* re-usable checkin function
*
* @param string $p_s_recordUUID uuid of record we want ot checkin
* @param integer $p_i_checkinDone amount of checkin'S which have been done, passed by reference
* @param forestTwig $p_o_headTwig if record is a sub record or file record, we adding head record to the function as parameter
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function executeCheckin($p_s_recordUUID, &$p_i_checkinDone, $p_o_headTwig = null)
/**
* handle delete record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function DeleteRecord()
/**
* check twigfield relation to other elements
*
* @param forestTwig $p_o_twig
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function CheckandCleanupRecordBeforeDeletion(\fPHP\Twigs\forestTwig $p_o_twig)
/**
* re-usable delete record function
*
* @param forestTwig $p_o_record record which will be deleted
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function executeDeleteRecord(\fPHP\Twigs\forestTwig $p_o_record)
/**
* re-usable delete sub record function
*
* @param subrecordsTwig $p_o_subrecord sub record which will be deleted
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function executeDeleteSubRecord(\fPHP\Twigs\subrecordsTwig $p_o_subrecord)
/**
* re-usable delete file record function with history files option
*
* @param filesTwig $p_o_file file record which will be deleted
* @param bool $p_b_deleteRecord true - delete file record as well, false - only delete stored file
* @param bool $p_b_deleteHistoryFiles true - check and delete all history file records as well, false - do not look for history file records
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function executeDeleteFileRecord(\fPHP\Twigs\filesTwig $p_o_file, $p_b_deleteRecord = true, $p_b_deleteHistoryFiles = false)
/**
* handle action to change order of records, moving one record up
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function MoveUpRecord()
/**
* handle action to change order of records, moving one record down
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function MoveDownRecord()
/**
* handle upload actions from dropzone
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function fphp_uploadAction()
/**
* handle upload delete actions from dropzone
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function fphp_upload_deleteAction()
/**
* function to create and render a captcha picture
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function fphp_captchaAction()
/**
* function to create a thumbnail of an stored image
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function fphp_imageThumbnailAction()
/**
* function to update flex settings for a record element or general container
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function fphp_updateFlexAction()
forestData trait declaring general types of data and for reuse in all fphp classes and mods
trait forestData {
/**
* write access to value, calling further __set method
*
* @param string $p_s_name name of the property
* @param object $p_o_value value which should be set
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __set($p_s_name, $p_o_value)
/**
* read access to value, calling further __get method
*
* @param string $p_s_name name of the property
*
* @return object object value which is stored with the property
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function &__get($p_s_name)
/**
* unset access to value, calling further __unset method
*
* @param string $p_s_name name of the property
*
* @return null
*
* @access public
* @static no
*/
public function __unset($p_s_name)
}
/**
* string data container
*
* @throws forestException if error occurs
* @access public
* @static no
*/
class forestString
/**
* list data container
*
* @throws forestException if error occurs
* @access public
* @static no
*/
class forestList
/**
* numericstring data container
*
* @throws forestException if error occurs
* @access public
* @static no
*/
class forestNumericString
/**
* integer data container
*
* @throws forestException if error occurs
* @access public
* @static no
*/
class forestInt
/**
* float data container
*
* @throws forestException if error occurs
* @access public
* @static no
*/
class forestFloat
/**
* bool data container
*
* @throws forestException if error occurs
* @access public
* @static no
*/
class forestBool
/**
* array data container
*
* @throws forestException if error occurs
* @access public
* @static no
*/
class forestArray
/**
* object data container
*
* @throws forestException if error occurs
* @access public
* @static no
*/
class forestObject
/**
* lookup data container
*
* @throws forestException if error occurs
* @access public
* @static no
*/
class forestLookup
date interval class with match validation of date interval strings
/**
* constructor of forestDateInterval class
*
* @param string $p_s_dateinterval date interval string, e.g. P2D, P1Y3M18DT5H16M33S, PT3H30S, ...
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct($p_s_dateinterval = null)
/**
* set date interval values with PHP DateInterval object
*
* @param DateInterval $p_o_dateInterval
*
* @return null
*
* @access public
* @static no
*/
public function SetDateInterval(\DateInterval $p_o_dateInterval)
/**
* returns date interval string with translation
*
* @return string
*
* @access public
* @static no
*/
public function __toString()
capsule class for creating DateTime-objects with own rules and easy uses
/**
* constructor of forestDateTime class
*
* @param string $p_s_format format string for DateTime
* @param integer $p_i_year
* @param integer $p_i_month
* @param integer $p_i_day
* @param integer $p_i_hour
* @param integer $p_i_minute
* @param integer $p_i_second
* @param string $p_o_timezone timezone object
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct($p_s_format = null, $p_i_year = 0, $p_i_month = 0 , $p_i_day = 0, $p_i_hour = 0, $p_i_minute = 0, $p_i_second = 0, $p_o_timezone = null)
/**
* returns DateTime as string with format setting or DateTime::ATOM
*
* @return string DateTime as string
*
* @access public
* @static no
*/
public function __toString()
/**
* manual ToString-method for returning DateTime in another format than was set on creation of the object or DateTime::ATOM
*
* @param string $p_s_format format string for DateTime
*
* @return string DateTime as string
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function ToString($p_s_format = null)
/**
* add interval to DateTime value
*
* @param integer $p_i_years
* @param integer $p_i_months
* @param integer $p_i_days
* @param integer $p_i_hours
* @param integer $p_i_minutes
* @param integer $p_i_seconds
*
* @return null
*
* @access public
* @static no
*/
public function AddDateInterval($p_i_years = 0, $p_i_months = 0 , $p_i_days = 0, $p_i_hours = 0, $p_i_minutes = 0, $p_i_seconds = 0)
/**
* sub interval from DateTime value
*
* @param integer $p_i_years
* @param integer $p_i_months
* @param integer $p_i_days
* @param integer $p_i_hours
* @param integer $p_i_minutes
* @param integer $p_i_seconds
*
* @return null
*
* @access public
* @static no
*/
public function SubDateInterval($p_i_years = 0, $p_i_months = 0 , $p_i_days = 0, $p_i_hours = 0, $p_i_minutes = 0, $p_i_seconds = 0)
/**
* convert integer seconds to DateTime value
*
* @param integer $p_i_seconds
*
* @return forestDateTime
*
* @access public
* @static yes
*/
public static function SecondsToDateTime($p_i_seconds = 0)
/**
* convert unix timestamp to DateTime value
*
* @param integer $p_i_unixTimestmp
*
* @return forestDateTime
*
* @access public
* @static yes
*/
public static function UnixTimestampToDateTime($p_i_unixTimestmp = 0)
/**
* get amount of days of a month, considering leap year too
*
* @param integer $p_i_month
* @param integer $p_i_year
*
* @return integer
*
* @access public
* @static yes
*/
public static function AmountDaysMonth($p_i_month = 0, $p_i_year = 0)
/**
* check if year is a leap year
*
* @param integer $p_i_year
*
* @return bool true - is leap year, false - is not leap year
*
* @access public
* @static yes
*/
public static function LeapYear($p_i_year = 0)
class for own exceptions getting exception-description from database table
distinguish between three exception types: error, warnung, message - all three types have their own ToString-behaviour
/**
* constructor of forestException class, set exception content, dynamic values and error trigger flag
*
* @param object $p_o_content exception content message
* @param array $p_a_values array of values which should be inserted into exception message by sprintf2 helper function, usually dynamic values
* @param bool $p_b_triggerError flag to use trigger_error php function
*
* @return object of type Exception
*
* @access public
* @static no
*/
public function __construct($p_o_content = null, $p_a_values = array(), $p_b_triggerError = false)
/**
* __toString function returning created exception as string value, well formated
*
* @return string
*
* @access public
* @static no
*/
public function __toString()
file class for creating and editing files on your own webspace
/**
* access to amount of file lines
*
* @return integer amount of file lines
*
* @access public
* @static no
*/
public function FileLines()
/**
* constructor of forestFile class to read or create a file
*
* @param string $p_s_fullfilename filename with full path
* @param bool $p_b_new true - create new file, false - read file
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct($p_s_fullfilename, $p_b_new = false)
/**
* delete file which was opened by creating forestFile
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function DeleteFile()
/**
* read a line from the file
*
* @param integer $p_i_line file line number
*
* @return string file line as string
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function ReadLine($p_i_line = 0)
/**
* wrote a line to the file
*
* @param string $p_s_value new file line as string
* @param integer $p_i_line file line number
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function WriteLine($p_s_value, $p_i_line = 0)
/**
* replace a line in the file
*
* @param string $p_s_value new file line as string
* @param integer $p_i_line file line number
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function ReplaceLine($p_s_value, $p_i_line)
/**
* delete a line from the file
*
* @param integer $p_i_line file line number
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function DeleteLine($p_i_line)
/**
* replace full content of the file
*
* @param string $p_s_value file content as string
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function ReplaceContent($p_s_value)
/**
* truncate full content of the file
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function TruncateContent()
/**
* create csv file in temporary directory with file name and random name suffix
*
* @param string $p_s_name name of file which should be created
*
* @return string filename of generate csv file
*
* @throws forestException if error occurs
* @access public
* @static yes
*/
public static function CreateTempFileCSV($p_s_name)
/**
* create forestPHP file folder structure
*
* @param string $p_s_branch name of branch where folder structure should be created
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static yes
*/
public static function CreateFileFolderStructure($p_s_branch)
/**
* remove a directory and all its sub-directories and files
*
* @param string $p_s_directory path to directory
*
* @return null
*
* @access public
* @static yes
*/
public static function RemoveDirectoryRecursive($p_s_directory)
/**
* copy a directory and all its sub-directories and files to a destination directory
*
* @param string $p_s_srcDirectory path to source directory
* @param string $p_s_dstDirectory path to destination directory
*
* @return null
*
* @access public
* @static yes
*/
public static function CopyRecursive($p_s_srcDirectory, $p_s_dstDirectory)
class-collection for all necessary form data and settings
multiple tabs are possible for rendering, also modal form view is supported
most settings are based on json encoded strings stored in configuration files or in database records
class forestForm {
/**
* constructor of forestForm class
*
* @param forestTwig $p_o_twig forestTwig object to get tablefields and information to render the form for each tablefield
* @param bool $p_b_automatic true - create a new forestForm object and generate form elements by twig object automtically, false - only create a new forestForm object
* @param bool $p_b_readonly true - indicates that the form is in readonly mode, false - normal form
* @param bool $p_b_printFooter true - indicates that the form has a footer, false - form has no footer
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct(\fPHP\Twigs\forestTwig $p_o_twig, $p_b_automatic = false, $p_b_readonly = false, $p_b_printFooter = true)
/**
* render the complete form with all its settings
*
* @return string
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __toString()
/**
* create standard modal form elements, by loading standard form formElement, submit and cancel button
*
* @param forestTwig $p_o_twig
* @param string $p_s_title title of form
* @param bool $p_b_showSubmit true - create submit button, false - do not create submit button
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function CreateModalForm(\fPHP\Twigs\forestTwig $p_o_twig, $p_s_title, $p_b_showSubmit = true)
/**
* create standard delete modal form elements, by loading standard form formElement, submit and cancel button
*
* @param forestTwig $p_o_twig
* @param string $p_s_title title of form
* @param string $p_s_description description for delete form
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function CreateDeleteModalForm(\fPHP\Twigs\forestTwig $p_o_twig, $p_s_title, $p_s_description)
/**
* add hidden form key field to form footer elements
*
* @return null
*
* @access public
* @static no
*/
public function AddFormKey()
/**
* add hidden honeypot fields to form footer elements
*
* @param forestTwig $p_o_twig
*
* @return null
*
* @access public
* @static no
*/
public function AddHoneypotFields(\fPHP\Twigs\forestTwig $p_o_twig)
/**
* get form element by form element id
*
* @param string $p_s_formId
*
* @return forestFormElement
*
* @access public
* @static no
*/
public function GetFormElementByFormId($p_s_formId)
/**
* delete form element by form element id
*
* @param string $p_s_formId
*
* @return bool true - form element has been deleted, false - form element has been not found
*
* @access public
* @static no
*/
public function DeleteFormElementByFormId($p_s_formId)
/**
* add form element to form
*
* @param forestFormElement $p_o_formElement
* @param string $p_s_tabId indicated on which tab the form element should be added
* @param bool $p_b_first true - add as first element, false - just add to form element list
*
* @return bool true - form element has been added, false - form element has been not added
*
* @access public
* @static no
*/
public function AddFormElement(\fPHP\Forms\forestFormElement $p_o_formElement, $p_s_tabId = 'general', $p_b_first = false)
}
class forestFormTab {
/**
* constructor of forestFormTab class
*
* @param string $p_s_tabId tab id for html tab element
* @param string $p_s_tabTitle tab title for html tab element
* @param string $p_s_tabClass tab class for html tab element
* @param string $p_b_printFooter tab active class for html tab element
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct($p_s_tabId = null, $p_s_tabTitle = null, $p_s_tabClass = null, $p_s_tabActiveClass = null)
/**
* render the complete form tab with all its settings
*
* @return string
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __toString()
/**
* load forestFormTab class with settings from json object
*
* @param string $p_s_jsonDataSettings json settings
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function loadJSON($p_s_jsonDataSettings)
/**
* check if all necessary settings for forestFormTab are set
*
* @param boool $p_b_extended true - check tab class and tab active class, false - check only tab id and tab title
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function CheckIsset($p_b_extended = false)
/**
* get form element by form element id
*
* @param string $p_s_formId
*
* @return forestFormElement
*
* @access public
* @static no
*/
public function GetFormElementByFormId($p_s_formId)
/**
* delete form element by form element id
*
* @param string $p_s_formId
*
* @return bool true - form element has been deleted, false - form element has been not found
*
* @access public
* @static no
*/
public function DeleteFormElementByFormId($p_s_formId)
/**
* add form element to form
*
* @param forestFormElement $p_o_formElement
* @param bool $p_b_first true - add as first element, false - just add to form element list
*
* @return bool true - form element has been added, false - form element has been not added
*
* @access public
* @static no
*/
public function AddFormElement(\fPHP\Forms\forestFormElement $p_o_formElement, $p_b_first = false)
}
class collection for rendering all usable html form elements
all necessary properties can be changed and will be considered in the __toString-methods
its a full collection of these properties
class forestFormElement {
/**
* access to forestFormElement type value
*
* @return string forestFormElement type
*
* @access public
* @static no
*/
public function getType()
/**
* access to forestFormElement formelement value
*
* @return forestFormElement
*
* @access public
* @static no
*/
public function getFormElement()
/**
* constructor of forestFormElement class
*
* @param string $p_s_type string value as constant pointer to desired form elements
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct($p_s_type)
/**
* render form element
*
* @return string
*
* @access public
* @static no
*/
public function __toString()
/**
* bridge function to access form element properties
*
* @param string $p_s_name name of property
*
* @return forestFormElement Property
*
* @access public
* @static no
*/
public function __get($p_s_name)
/**
* bridge function to set form element properties
*
* @param string $p_s_name name of property
* @param object $p_o_value property value
*
* @return null
*
* @access public
* @static no
*/
public function __set($p_s_name, $p_o_value)
/**
* load forestFormElement class with settings from json object
*
* @param string $p_s_jsonDataSettings json settings
* @param integer $p_i_branchId deviating branch id
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function loadJSON($p_s_jsonDataSettings, $p_i_branchId = null)
/**
* replace forestFormElement json settings text placeholders with translation values
*
* @param string $p_s_jsonDataSettings json settings, passed by reference
* @param integer $p_i_branchId deviating branch id
*
* @return null
*
* @access public
* @static yes
*/
public static function JSONSettingsMultilanguage(&$p_s_jsonDataSettings, $p_i_branchId = null)
}
abstract class forestFormGeneralAttributes
abstract class forestFormInputAttributes extends forestFormGeneralAttributes
class forestFormValidationRule
class forestFormObject extends forestFormGeneralAttributes
class forestFormElementText extends forestFormInputAttributes
class forestFormElementList extends forestFormInputAttributes
class forestFormElementHidden extends forestFormInputAttributes
class forestFormElementPassword extends forestFormInputAttributes
class forestFormElementFile extends forestFormInputAttributes
class forestFormElementRadio extends forestFormInputAttributes
class forestFormElementCheckbox extends forestFormInputAttributes
class forestFormElementColor extends forestFormInputAttributes
class forestFormElementEmail extends forestFormInputAttributes
class forestFormElementUrl extends forestFormInputAttributes
class forestFormElementDate extends forestFormInputAttributes
class forestFormElementDateTimeLocal extends forestFormInputAttributes
class forestFormElementMonth extends forestFormInputAttributes
class forestFormElementNumber extends forestFormInputAttributes
class forestFormElementRange extends forestFormInputAttributes
class forestFormElementSearch extends forestFormInputAttributes
class forestFormElementPhone extends forestFormInputAttributes
class forestFormElementTime extends forestFormInputAttributes
class forestFormElementWeek extends forestFormInputAttributes
class forestFormElementTextArea extends forestFormGeneralAttributes
class forestFormElementSelect extends forestFormGeneralAttributes
class forestFormElementDescription extends forestFormGeneralAttributes
class forestFormElementButton extends forestFormInputAttributes
class forestFormElementDropzone extends forestFormGeneralAttributes
class forestFormElementRichtext extends forestFormGeneralAttributes
class forestFormElementCaptcha extends forestFormInputAttributes
singleton class for temporary values and communication
between different classes and build-steps in the script collection
/**
* constructor of forestGlobals class
*
* @return null
*
* @access public
* @static no
*/
public function __construct()
/**
* method to create singleton object
*
* @return null
*
* @access public
* @static yes
*/
public static function init()
/**
* prevent cloning singleton object
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __clone()
/**
* get forestSort object stored in global list by key
*
* @param string $p_s_key index of forestSort object
*
* @return forestSort
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function GetSort($p_s_key)
/**
* backup forestSort object list
*
* @return null
*
* @access public
* @static no
*/
public function BackupSorts()
/**
* restore forestSort object list
*
* @return null
*
* @access public
* @static no
*/
public function RestoreSorts()
/**
* backup forestLimit object list
*
* @return null
*
* @access public
* @static no
*/
public function BackupLimit()
/**
* restore forestLimit object list
*
* @return null
*
* @access public
* @static no
*/
public function RestoreLimit()
/**
* backup stdclass object list
*
* @return null
*
* @access public
* @static no
*/
public function BackupTemp()
/**
* restore stdclass object list
*
* @return null
*
* @access public
* @static no
*/
public function RestoreTemp()
/**
* build a tree of the branch-structure which is often used by functions and navigation processes
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function BuildBranchTree()
/**
* this method is very important to get access to other classes which are not in the current url directory
* after this method has been called you can try to call a class which is in the parameter's branch url directory
*
* @param string $p_s_branch name of branch
* @param string $p_s_action name of action
* @param array $p_a_parameters parameters array object
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function SetVirtualTarget($p_s_branch, $p_s_action = null, $p_a_parameters = null)
/**
* load all translations from database
* thus it is not necessary to query always the database for each label, text, etc.
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function ListTranslations()
/**
* get a translation by name
*
* @param string $p_s_name key name of translation
* @param integer $p_i_branch_id id of branch
*
* @return string translation string or NO_CAPTION
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function GetTranslation($p_s_name, $p_i_branch_id = null)
/**
* load all table records from database
* load all table records with tablefields from database
* query all sub-constraints from database
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function ListTables()
/**
* fast access to a tablefield entry in global dictionary by tablefield uuid
*
* @return forestTAbleFieldProperties fPHP-class with many information to a tablefield
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function GetTablefieldsDictionaryByUUID($p_s_uuid)
/**
* load all user names from database, after that user names can be called by uuid with function GetUserNameByUUID
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function ListUserNames()
/**
* fast access to a user name in global dictionary by user uuid
*
* @return string user name or empty '-' string
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function GetUserNameByUUID($p_s_uuid)
iterator class for forestObjectList-class
necessary for iteration of a list-objects in a foreach-loop
/**
* constructor of forestIterator class
*
* @param array $p_a_value array object
*
* @return null
*
* @access public
* @static no
*/
public function __construct($p_a_value)
/**
* set index back to zero
*
* @return null
*
* @access public
* @static no
*/
public function rewind()
/**
* get current array object based on internal index value using keys of array
*
* @return object
*
* @access public
* @static no
*/
public function current()
/**
* get current key based on internal index value
*
* @return object key value
*
* @access public
* @static no
*/
public function key()
/**
* get next array object based on internal index value using keys of array
*
* @return object object value if there is a next object, false if there is no next object in list
*
* @access public
* @static no
*/
public function next()
/**
* check if there is a valid object behind a key
*
* @return bool true - object set behind key, false - no object set behind key
*
* @access public
* @static no
*/
public function valid()
class for holding information about page limit of current page view
/**
* constructor of forestLimit class
*
* @return null
*
* @access public
* @static no
*/
public function __construct()
/**
* returns limit pagination
*
* @return string html limit pagination element
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __toString()
class generate link-element out of array-parameters with static functions
/**
* static method to create a url for html a link value
*
* @param string $p_s_branch name of branch
* @param string $p_s_action name of action
* @param string $p_a_parameters parameters, syntax: 'key' => 'value', 'key' => 'value', ...
* @param string $p_s_anchor value for html anchor
*
* @return string valid url string
*
* @throws forestException if error occurs
* @access public
* @static yes
*/
public static function Link($p_s_branch = null, $p_s_action = null, array $p_a_parameters = null, $p_s_anchor = null)
class to capsulate lookup result data
storing these objects in a global dictionary will reduce database record access for one session
/**
* constructor of forestLookupData class
*
* @param string $p_s_table name of table
* @param array $p_a_primary primary key fields
* @param array $p_a_label tablefields which will be shown if lookup will be read an isset
* @param array $p_a_filter filter commands - syntax: 'FieldName' => 'FieldValue' or '!1FieldName' => 'FieldValue', '!2FieldName' => 'FieldValue', '!3FieldName' => 'FieldValue'
* @param string $p_s_concat conat string how the label fields will be glued together
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct($p_s_table, array $p_a_primary, array $p_a_label, array $p_a_filter = array(), $p_s_concat = ' - ')
/**
* function call to overwrite lookup data
*
* @param string $p_s_functionName name of function
* @param array $p_a_arguments argument object which must be of type forestLookupData
*
* @return null
*
* @access public
* @static no
*/
public function __call($p_s_functionName, $p_a_arguments)
/**
* return field values of label fields in settings with concat string setting
* result wiill be stored in global dictionary, so that it must not be queried again
*
* @return string
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __toString()
/**
* this function is important to use lookup data with web select control or other option based controls
*
* @return array options array with syntax array('label fields with concat string setting' => 'primary key'
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function CreateOptionsArray()
maintenance routine if any main exception occurs during runtime
simple class for using collections
creating lists of objects with array, index can be of any type
/**
* property function count
*
* @return integer amount of objects in list
*
* @access public
* @static no
*/
public function Count()
/**
* property function firstkey to get the first element by sorting keys with array_keys
*
* @return object first object in list
*
* @access public
* @static no
*/
public function FirstKey()
/**
* property function lastkey to get the last element by sorting keys with array_keys
*
* @return object last object in list
*
* @access public
* @static no
*/
public function LastKey()
/**
* on initializing the object-list, we need the class-name of the object
* so we can be sure in our list are only objects of the same type/class later
*
* @param string $p_s_objectClassName class name of objects which will be accepted to be added to the list
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct($p_s_objectClassName)
/**
* add an object to array list
* controlling the class-name to be sure in array list are only objects of the same type/class
*
* @param object $p_o_object object which will be stored in list
* @param string $p_s_key key name for index, optional
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function Add($p_o_object, $p_s_key = null)
/**
* add an object to array list as first element
* controlling the class-name to be sure in array list are only objects of the same type/class
*
* @param object $p_o_object object which will be stored in list
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function AddFirst($p_o_object)
/**
* delete an object in the list
* controlling that the element exists in array list
*
* @param string $p_s_key key name for index, optional
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function Del($p_s_key = null)
/**
* using magic method to get array list object or for iteration in a foreach-loop
*
* @param string $p_s_key key name for index, optional
*
* @return object object in list found by index key
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __get($p_s_key = null)
/**
* method to find out if object exists by key
*
* @param string $p_s_key key name for index
*
* @return bool true - object exists in list, false - object does not exists in list
*
* @access public
* @static no
*/
public function Exists($p_s_key)
/**
* method to find out if array has element equal to parameter value
*
* @param object $p_o_value object for comparsion
*
* @return bool true - object exists in list, false - object does not exists in list
*
* @access public
* @static no
*/
public function Has($p_o_value)
/**
* abstract necessary method from IteratorAggregate-Interface to create an external Iterator
*
* @return forestIterator instance of forestIterator to loop through list
*
* @access public
* @static no
*/
public function getIterator()
/**
* method to sort objects in the list, by using an individual function named CompareObjects
*
* @return null
*
* @access public
* @static no
*/
public function SortObjects()
central control class of forestPHP framework for fetch-content and render-content
/**
* constructor of forestPHP framework
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct()
/**
* init function to separate fetching content and rendering output of forestPHP framework
*
* @return null
*
* @access public
* @static no
*/
public function init()
adminisration class for handling all adminstrative use cases for forestBranch and forestTwig objects
/**
* render root menu for root actions for every branch
*
* @return string string value with root menu part for navigation
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function RenderRootMenu()
/**
* handle view identifier action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function viewIdentifierAction()
/**
* handle new identifier record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function newIdentifierAction()
/**
* handle edit identifier record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function editIdentifierAction()
/**
* handle delete identifier record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function deleteIdentifierAction()
/**
* handle new branch record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function newBranchAction()
/**
* handle edit branch record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function editBranchAction()
/**
* handle view branch record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function viewBranchAction()
/**
* handle action to change order of branch record in navigation, moving one record up
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function moveUpBranchAction()
/**
* handle action to change order of branch record in navigation, moving one record down
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function moveDownBranchAction()
/**
* handle delete branch record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function deleteBranchAction()
/**
* handle new action record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function newActionAction()
/**
* handle edit action record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function editActionAction()
/**
* handle delete action record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function deleteActionAction()
/**
* handle new twig record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function newTwigAction()
/**
* handle edit twig record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function editTwigAction()
/**
* handle view twig record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function viewTwigAction()
/**
* handle transfer twig recorrd action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function transferTwigAction()
/**
* handle truncate twig record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function truncateTwigAction()
/**
* truncate execution of a twig
*
* @param tableTwig $p_o_table table record of table sys_fphp_table which will be truncated
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function executeTruncateTwig(\fPHP\Twigs\tableTwig $p_o_table)
/**
* handle delete twig record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function deleteTwigAction()
/**
* handle sub records display in detail view
*
* @param tableTwig $p_o_table table record of table sys_fphp_table where all properties will be queried and shown within a modal form
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function ListTwigProperties(\fPHP\Twigs\tableTwig $p_o_twig)
/**
* function to update twig file of current branch with current tablefields and twig settings
*
* @param tableTwig $p_o_table table record of table sys_fphp_table to update the twig file in ./twigs/
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function doTwigFile(\fPHP\Twigs\tableTwig $p_o_tableTwig)
/**
* handle new twig tablefield record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function newTwigFieldAction()
/**
* handle edit twig tabelfield record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function editTwigFieldAction()
/**
* handle delete twig tabelfield record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function deleteTwigFieldAction()
/**
* check twigfield relation to other elements
*
* @param tableTwig $p_o_table table record of table sys_fphp_table
* @param tablefieldTwig $p_o_tablefield tablefield record of table sys_fphp_tablefield
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function checkTwigFieldBeforeDeletion(\fPHP\Twigs\tableTwig $p_o_table, \fPHP\Twigs\tablefieldTwig $p_o_tablefield)
/**
* check twigfield relation to other elements
*
* @param tableTwig $p_o_table table record of table sys_fphp_table, passed by reference
* @param tablefieldTwig $p_o_tablefield tablefield record of table sys_fphp_tablefield
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function cleanupTwigFieldAfterDeletion(\fPHP\Twigs\tableTwig &$p_o_table, \fPHP\Twigs\tablefieldTwig $p_o_tablefield)
/**
* handle action to change order of twig tablefield records, moving one record up
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function moveUpTwigFieldAction()
/**
* handle action to change order of twig tablefield records, moving one record down
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function moveDownTwigFieldAction()
/**
* handle view twig tablefield record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function viewTwigFieldAction()
/**
* handle new translation record action for twig
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function newTranslationAction()
/**
* handle edit translation record action for twig
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function editTranslationAction()
/**
* handle delete translation record action for twig
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function deleteTranslationAction()
/**
* handle new unique record action for twig
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function newUniqueAction()
/**
* handle edit unique record action for twig
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function editUniqueAction()
/**
* handle delete unique record action for twig
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function deleteUniqueAction()
/**
* handle new sort order record action for twig
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function newSortAction()
/**
* handle edit sort order record action for twig
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function editSortAction()
/**
* handle delete sort order record action for twig
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function deleteSortAction()
/**
* handle new twig sub constraint record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function newSubConstraintAction()
/**
* handle edit twig sub constraint record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function editSubConstraintAction()
/**
* handle action to change order of sub constraint records, moving one record up
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function moveUpSubConstraintAction()
/**
* handle action to change order of sub constraint records, moving one record down
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function moveDownSubConstraintAction()
/**
* handle delete twig sub constraint record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function deleteSubConstraintAction()
/**
* check twigfield relation to other elements
*
* @param tableTwig $p_o_table table record of table sys_fphp_table
* @param subconstraintTwig $p_o_subconstraint sub contraint record of table sys_fphp_subcontraint
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function checkSubConstraintBeforeDeletion(\fPHP\Twigs\tableTwig $p_o_table, \fPHP\Twigs\subconstraintTwig $p_o_subconstraint)
/**
* handle new twig validation rule record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function newValidationRuleAction()
/**
* handle edit twig validation rule record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function editValidationRuleAction()
/**
* handle delete twig validation rule record action
*
* @return null
*
* @throws forestException if error occurs
* @access protected
* @static no
*/
protected function deleteValidationRuleAction()
main class for security information
holding session values, user information, user rights and static functions for fphp framework security
/**
* constructor of forestSecurity class
*
* @param bool $p_b_debug flag to show debug information
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct($p_b_debug = false)
/**
* init function of forestSecurity class, handling session records, guest and user access
*
* @param bool $p_b_debug flag to show debug information
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function init($p_b_debug = false)
/**
* synchronize data in object list with $_SESSION array
*
* @param bool $p_b_debug flag to show debug information
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function SyncSessionData($p_b_debug = false)
/**
* list permission records for user and save them in internal object twig list
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function ListUserPermissions()
/**
* check if permission records for current branch/action access are available for guest or user
*
* @param string $p_s_branch name of branch
* @param string $p_s_action name of action
*
* @return bool true - user/guest has permission, false - user/guest has no permission
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function CheckUserPermission($p_s_branch = null, $p_s_action = null)
/**
* logout function and cleanup
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function Logout()
/**
* delete expired guest and user session records
*
* @param bool $p_b_debug flag to show debug information
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function DeleteExpiredSessions($p_b_debug = false)
/**
* generates uuid with php-function uniqid and '-'-delimiter
*
* @return string uuid as string value
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function GenUUID()
/**
* generates random hash string
*
* @return string random hash string
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function GenRandomHash()
/**
* generates hash string with sha512-algorithm
*
* @return string random hash string
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function HashString(&$p_s_value, $p_s_salt, $p_i_loop)
/**
* generates random character for captcha image
*
* @param integer $p_i_strength how many times a random character should be generated with mt_rand function
*
* @return char random character
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function GenerateCaptchaCharacter($p_i_strength = 10)
class for holding information about sorting columns of current page view
/**
* constructor of forestSort class
*
* @param string $p_s_column name of sql column/field
* @param bool $p_b_direction true - ascending, false - descending
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct($p_s_column, $p_b_direction)
/**
* returns sort link button
*
* @return string html sort link button
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __toString()
/**
* alternative call of returning sort link with title parameter
*
* @return string html sort link button
*
* @access public
* @static no
*/
public function ToString($p_s_columnName)
class collection for generating one SQL-Query in an object-oriented way
this helps for object-oriented access on database-tables
for more information please read the documentation
class forestSQLQuery
/**
* constructor of forestSQLQuery class, set query parameters like base-gateway, type and table
*
* @param string $p_s_baseGateway base-gateway constant
* @param string $p_s_type type of sql query - SELECT, INSERT, UPDATE, DELETE, TRUNCATE, CREATE, DROP, ALTER
* @param string $p_s_table table name
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct($p_s_baseGateway, $p_s_type, $p_s_table)
/**
* __toString function returning created sql query as string value
*
* @return string
*
* @access public
* @static no
*/
public function __toString()
/**
* function to get sql query object
*
* @return forestSQLQueryAbstract or forestString
*
* @access public
* @static no
*/
public function GetQuery()
/**
* function to set sql query as string value manually
*
* @return string
*
* @access public
* @static no
*/
public function SetQuery($p_s_queryString)
/**
* transpose general column type to base-gateway defined column type and further information for query execution
*
* @param string $p_s_baseGateway base-gateway constant
* @param string $p_s_sqlType type of sql column, based on values in table sys_fphp_sqltype
* @param string $p_s_columnType transposed column type, passed by reference
* @param integer $p_i_columnLength transposed column length, passed by reference
* @param integer $p_i_columnDecimalLength transposed column decimal length, passed by reference
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static yes
*/
public static function ColumnTypeAllocation($p_s_baseGateway, $p_s_sqlType, &$p_s_columnType, &$p_i_columnLength, &$p_i_columnDecimalLength)
/**
* transpose general constraint type to base-gateway defined constraint type and further information for query execution
*
* @param string $p_s_baseGateway base-gateway constant
* @param string $p_s_constraintType constraint type of sql column
* @param string $p_s_outConstraintType transposed constraint type, passed by reference
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static yes
*/
public static function ConstraintTypeAllocation($p_s_baseGateway, $p_s_constraintType, &$p_s_outConstraintType)
abstract class forestSQLQueryAbstract
/**
* important parsing function, preventing SQL-Injection, formatting date values, etc
*
* @param string $p_s_value value of a sql field/column
*
* @return string returning checked and edited sql field/column value
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function ParseValue($p_s_value)
class forestSQLSelect
class forestSQLInsert
class forestSQLUpdate
class forestSQLDelete
class forestSQLTruncate
class forestSQLCreate
class forestSQLDrop
class forestSQLAlter
class forestSQLColumn
class forestSQLJoin
class forestSQLRelation
class forestSQLWhere
class forestSQLOrderBy
class forestSQLLimit
class forestSQLColumnValue
class forestSQLColumnStructure
class forestSQLConstraint
collection of static string helper functions
/**
* replace multiple values in a string where we have numeric placeholders with a preceding character
*
* @param string $p_s_str string value with numeric placeholders
* @param array $p_a_vars array of values
* @param char $p_s_char numeric placeholder char for recognition
*
* @return string
*
* @access public
* @static yes
*/
public static function sprintf2($p_s_str = '', $p_a_vars = array(), $p_s_char = '%')
/**
* replace multiple chars in a string which are arranged in two parameter-arrays
*
* @param string $p_s_str string value, passed by reference
* @param array $p_a_search array of characters which should be replaced
* @param array $p_a_replace array of characters which are replacing the found characters
*
* @return null
*
* @access public
* @static yes
*/
public static function ReplaceChar(&$p_s_str, array $p_a_search, array $p_a_replace)
/**
* remove multiple chars in a string which are set in parameter-array
*
* @param string $p_s_str string value
* @param array $p_a_search array of characters which should be removed
*
* @return string
*
* @access public
* @static yes
*/
public static function RemoveChar($p_s_str, array $p_a_search)
/**
* converts sql-filter arguments into sql-clauses-array for implementing filter in query
* example: =35&<2|>=5&1..5&2*|ab?d
*
* @param string $p_s_value string value
*
* @return array array of filter clauses
*
* @access public
* @static yes
*/
public static function SplitFilter($p_s_value)
/**
* converts date/time/datetime-sql-string into forestDateTime object
*
* @param string $p_s_value string value
*
* @return forestDateTime
*
* @access public
* @static yes
*/
public static function TextToDate($p_s_value)
/**
* converts hex-value into integer
*
* @param string $p_s_value string value
*
* @return integer
*
* @access public
* @static yes
*/
public static function HexToInt($p_s_value)
/**
* converts integer into hex-value
*
* @param integer $p_i_value integer value
*
* @return string
*
* @access public
* @static yes
*/
public static function IntToHex($p_i_value)
/**
* check if a string starts with a specific order of characters
*
* @param string $p_s_str string value
* @param string $p_s_search search for occurence
*
* @return bool true - string starts with search value, false - string start not with search value
*
* @access public
* @static yes
*/
public static function StartsWith($p_s_str, $p_s_search)
/**
* check if a string ends with a specific order of characters
*
* @param string $p_s_str string value
* @param string $p_s_search search for occurence
*
* @return bool true - string ends with search value, false - string ends not with search value
*
* @access public
* @static yes
*/
public static function EndsWith($p_s_str, $p_s_search)
/**
* close all open html tags of the parameter string
*
* @param string $p_s_value string value
*
* @return string
*
* @access public
* @static yes
*/
public static function closeHTMLTags($p_s_value)
/**
* function to remove system prefix of sql table names
*
* @param string $p_s_table name of table, passed by reference
*
* @return null
*
* @access public
* @static yes
*/
public static function RemoveTablePrefix(&$p_s_table)
/**
* replace unicode escape sequence within a string
*
* @param string $p_s_string string value
*
* @return string
*
* @access public
* @static yes
*/
public static function ReplaceUnicodeEscapeSequence($p_s_string)
/**
* help function to increase alphanumeric and numeric only identifiers, with leading zeros as well
*
* @param string $p_s_identifier value of identifier
* @param string $p_i_increment increment value
*
* @return string incremented identifier
*
* @access public
* @static yes
*/
public static function IncreaseIdentifier($p_s_identifier, $p_i_increment)
/**
* parse a string value to a valid filename string
*
* @param string $p_s_string string value
*
* @return string
*
* @access public
* @static yes
*/
public static function ParseNameToFilename($p_s_string)
/**
* manual european money_format function
*
* @param string $format locale format e.g. en_US, de_DE
* @param float $number
*
* @return string well formated money string
*
* @access public
* @static yes
*/
public static function money_format($format, $number)
class to capsulate data about table fields
storing these objects in a global dictionary will reduce database record access for one session
/**
* constructor of forestTableFieldProperties class, holding all information of a sql column/field
*
* @param parameters based on the sql columns/fields of sys_fphp_tablefield table
*
* @return null
*
* @access public
* @static no
*/
public function __construct(
$p_s_uuid,
$p_s_tableUUID,
$p_s_fieldName,
$p_s_tabId,
$p_s_json,
$p_b_footerElement,
$p_s_subRecordField,
$p_i_order,
$p_s_formUUID,
$p_s_formName,
$p_s_formJSON,
$p_s_sqlUUID,
$p_s_sqlName,
$p_s_fdataUUID,
$p_s_fdataName
)
template class using to print standard data elements
/**
* access to forestTemplate type value
*
* @return string forestTemplate type
*
* @access public
* @static no
*/
public function getType()
/**
* constructor of forestTemplates class
*
* @param string $p_s_type string value as constant pointer to desired template
* @param array $p_a_placeHolders array list of values which should be inserted into the template
*
* @return null
*
* @access public
* @static no
*/
public function __construct($p_s_type, $p_a_placeHolders = null)
/**
* render method to print forestTemplate with values which should be inserted into template's content by sprintf2 helper function, usually dynamic values
*
* @return string
*
* @access public
* @static no
*/
public function __toString()
abstract class for all twig objects, one twig represents a table in a database
all necessary methods to read or manipulate data are implemented in this class
and can be used with every twig-object that stays for one table in the database
/**
* constructor of forestTwig class, creating a twig object representing a table with all its information and a table record
*
* @param array $p_a_record raw dataset of a record as an array
* @param integer $p_i_resultType standard ASSOC - ASSOC, NUM, BOTH, OBJ, LAZY
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct($p_a_record = array(), $p_i_resultType = \fPHP\Base\forestBase::ASSOC)
/* every class which inherits forestTwig must implement init-function */
abstract protected function init();
/**
* execute sql query to get table field properties
*
* @param string $p_s_tableUUID table uuid
* @param string $p_s_field field name
*
* @return array raw record data or null if no properties could be found
*
* @throws forestException if error occurs
* @access public
* @static yes
*/
public static function QueryFieldProperties($p_s_tableUUID, $p_s_field)
/**
* query sub records of a sub constraint
*
* @param subconstraintTwig $p_o_subconstraint sub constraint record
* @param bool $p_b_overwrite flag to overwrite information in global cache, standard false
*
* @return forestTwigList record list of sub records
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function QuerySubRecords(\fPHP\Twigs\subconstraintTwig $p_o_subconstraint, $p_b_overwrite = false)
/**
* fill Mapping array from forestTwig instance
*
* @param array $p_a_object_vars list of class variables
*
* @return null
*
* @access protected
* @static no
*/
protected function fphp_FillMapping(array $p_a_object_vars)
/**
* general method to get property field value, for sub records as well as for combination fields
*
* @param string $p_s_name sql column/field name
*
* @return object value behind sql column/field name of holded record
*
* @access public
* @static no
*/
public function GetFieldValue($p_s_name)
/**
* general method to set property field value, for sub records as well
*
* @param string $p_s_name sql column/field name
* @param object $p_o_value object value for sql column/field
*
* @return null
*
* @access public
* @static no
*/
public function SetFieldValue($p_s_name, $p_o_value)
/**
* if twig object is not empty, field value will be restored using record image
*
* @param string $p_s_name sql column/field name
*
* @return null
*
* @access public
* @static no
*/
public function RestoreFieldValue($p_s_name)
/**
* calculate value behind forestCombination field
*
* @param string $p_s_forestCombination forestCombination command
*
* @return object value behind forestCombination field, usually a string value
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function CalculateCombination($p_s_forestCombination)
/**
* get record with values of primary key
*
* @param array $p_a_primaryValues primary key values for where clause
*
* @return bool true - record found and values loaded into fields, false - record could not be found
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function GetRecord(array $p_a_primaryValues)
/**
* determine if current twig object is empty
*
* @return bool true - record is not empty, false - record is empty
*
* @access public
* @static no
*/
public function IsEmpty()
/**
* gets record with values of temporary other primary key
*
* @param array $p_a_primaryValues primary key values for where clause
* @param array $p_a_primaryKeys primary key names for where clause
*
* @return bool true - record found and values loaded into fields, false - record could not be found
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function GetRecordPrimary(array $p_a_primaryValues, array $p_a_primaryKeys)
/**
* showing all data fields of current twig object for log purposes
*
* @param bool $p_b_showViewFields true - show fields in view object list, false - show fields in mapping object list
* @param bool $p_b_printBreak true - print html-br-tag within return value, false - do not print html-br-tag within return value
*
* @return string record fields with values
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function ShowFields($p_b_showViewFields = true, $p_b_printBreak = false)
/**
* get first record of table
*
* @return bool true - record found and values loaded into fields, false - record could not be found
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function GetFirstRecord()
/**
* get last record of table
*
* @return bool true - record found and values loaded into fields, false - record could not be found
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function GetLastRecord()
/**
* get amount of records of current table or another table
*
* @param string $p_s_table name of table, optional
* @param bool $p_b_unlimited true - use filter and limit settings, false - ignore filter and limit settings
* @param bool $p_b_updateLimitAmount true - update global limit amount value, false - do not update global limit amount value
*
* @return integer amount of records
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function GetCount($p_s_table = null, $p_b_unlimited = false, $p_b_updateLimitAmount = false)
/**
* get all records, depending on filter and limit parameters
*
* @param bool $p_b_unlimited true - use filter and limit settings, false - ignore filter and limit settings
*
* @return result of function forestBase->FetchQuery
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function GetAllRecords($p_b_unlimited = false)
/**
* get records based on view columns, depending on filter and limit parameters
*
* @param bool $p_b_unlimited true - use filter and limit settings, false - ignore filter and limit settings
*
* @return result of function this->GetAllRecords
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function GetAllViewRecords($p_b_unlimited = false)
/**
* insert record into table, with primary key fields optional
*
* @param bool $p_b_withPrimary true - assume and set values for primary key, false - keep primary key values unchanged or let them handle by dbms
*
* @return integer -1 - unique issue, 0 - could not create record, 1 - record creation successful
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function InsertRecord($p_b_withPrimary = false, $p_b_full = false)
/**
* update record in table, you cannot modify primary key, with modify of unique fields optional
*
* @param bool $p_b_modifyUnique true - assume and set values for unique fields, false - keep unique key fields unchanged or let them handle by dbms
*
* @return integer -1 - unique issue, 0 - could not update record, 1 - record update successful
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function UpdateRecord($p_b_modifyUnique = true)
/**
* delete record in table
*
* @return integer 0 - could not delete record, 1 - record deletion successful
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function DeleteRecord()
/**
* truncate table
*
* @return integer 0 - could not truncate table, 1 - truncate of table successful
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function TruncateTable()
object collection of unique twigs, objects of one single database record
you enter a sql query result on construction of the twig list
it will automatically create the twig objects depending on how many records are present in the query result
/**
* constructor of forestTwigList class, creating a object list of forestTwig objects and possible join records
*
* @param string $p_s_table name of table
* @param array $p_a_records raw dataset of records as an array
* @param integer $p_i_resultType standard ASSOC - ASSOC, NUM, BOTH, OBJ, LAZY
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function __construct($p_s_table, $p_a_records = array(), $p_i_resultType = \fPHP\Base\forestBase::ASSOC)
class holding specific url information based on an arranged url-format
for more information about the arranged url-format, see the documentation
/**
* constructor of forestURL class
*
* @return null
*
* @access public
* @static no
*/
public function __construct()
/**
* retrieving detail information out of database based on information read out of url
*
* @param bool $p_b_show flag to show debug information
*
* @return null
*
* @throws forestException if error occurs
* @access public
* @static no
*/
public function RetrieveInformationByURL($p_b_show = false)