class Common

Common functions for Designer

Methods

__construct(DatabaseInterface $dbi, Relation $relation)

Common constructor.

array
getTablesInfo(string $db = null, string $table = null)

Retrieves table info and returns it

array
getColumnsInfo(array $designerTables)

Retrieves table column info

array
getScriptContr(array $designerTables)

Returns JavaScript code for initializing vars

array
getPkOrUniqueKeys(array $designerTables)

Returns UNIQUE and PRIMARY indices

array
getAllKeys(array $designerTables, bool $unique_only = false)

Returns all indices

array
getScriptTabs(array $designerTables)

Return j_tab and h_tab arrays

array|null
getTablePositions(int $pg)

Returns table positions of a given pdf page

string|null
getPageName(int $pg)

Returns page name of a given pdf page

boolean
deletePage(int $pg)

Deletes a given pdf page and its corresponding coordinates

int|null
getDefaultPage(string $db)

Returns the id of the default pdf page of the database.

int
getLoadingPage(string $db)

Get the id of the page to load. If a default page exists it will be returned.

int|null
createNewPage(string $pageName, string $db)

Creates a new page and returns its auto-incrementing id

boolean
saveTablePositions(int $pg)

Saves positions of table(s) of a given pdf page

boolean
saveDisplayField(string $db, string $table, string $field)

Saves the display field for a table.

array
addNewRelation(string $db, string $T1, string $F1, string $T2, string $F2, string $on_delete, string $on_update, string $DB1, string $DB2)

Adds a new foreign relation

array
removeRelation(string $T1, string $F1, string $T2, string $F2)

Removes a foreign relation

bool
saveSetting(string $index, string $value)

Save value for a designer setting

Details

at line 42
__construct(DatabaseInterface $dbi, Relation $relation)

Common constructor.

Parameters

DatabaseInterface $dbi DatabaseInterface object
Relation $relation Relation instance

at line 55
array getTablesInfo(string $db = null, string $table = null)

Retrieves table info and returns it

Parameters

string $db (optional) Filter only a DB ($table is required if you use $db)
string $table (optional) Filter only a table ($db is now required)

Return Value

array with table info

at line 89
array getColumnsInfo(array $designerTables)

Retrieves table column info

Parameters

array $designerTables The designer tables

Return Value

array table column nfo

at line 127
array getScriptContr(array $designerTables)

Returns JavaScript code for initializing vars

Parameters

array $designerTables The designer tables

Return Value

array JavaScript code

at line 204
array getPkOrUniqueKeys(array $designerTables)

Returns UNIQUE and PRIMARY indices

Parameters

array $designerTables The designer tables

Return Value

array unique or primary indices

at line 217
array getAllKeys(array $designerTables, bool $unique_only = false)

Returns all indices

Parameters

array $designerTables The designer tables
bool $unique_only whether to include only unique ones

Return Value

array indices

at line 243
array getScriptTabs(array $designerTables)

Return j_tab and h_tab arrays

Parameters

array $designerTables The designer tables

Return Value

array

at line 266
array|null getTablePositions(int $pg)

Returns table positions of a given pdf page

Parameters

int $pg pdf page id

Return Value

array|null of table positions

at line 300
string|null getPageName(int $pg)

Returns page name of a given pdf page

Parameters

int $pg pdf page id

Return Value

string|null table name

at line 328
boolean deletePage(int $pg)

Deletes a given pdf page and its corresponding coordinates

Parameters

int $pg page id

Return Value

boolean success/failure

at line 366
int|null getDefaultPage(string $db)

Returns the id of the default pdf page of the database.

Default page is the one which has the same name as the database.

Parameters

string $db database

Return Value

int|null id of the default pdf page for the database

at line 401
int getLoadingPage(string $db)

Get the id of the page to load. If a default page exists it will be returned.

If no such exists, returns the id of the first page of the database.

Parameters

string $db database

Return Value

int id of the page to load

at line 441
int|null createNewPage(string $pageName, string $db)

Creates a new page and returns its auto-incrementing id

Parameters

string $pageName name of the page
string $db name of the database

Return Value

int|null

at line 461
boolean saveTablePositions(int $pg)

Saves positions of table(s) of a given pdf page

Parameters

int $pg pdf page id

Return Value

boolean success/failure

at line 526
boolean saveDisplayField(string $db, string $table, string $field)

Saves the display field for a table.

Parameters

string $db database name
string $table table name
string $field display field name

Return Value

boolean

at line 554
array addNewRelation(string $db, string $T1, string $F1, string $T2, string $F2, string $on_delete, string $on_update, string $DB1, string $DB2)

Adds a new foreign relation

Parameters

string $db database name
string $T1 foreign table
string $F1 foreign field
string $T2 master table
string $F2 master field
string $on_delete on delete action
string $on_update on update action
string $DB1 database
string $DB2 database

Return Value

array array of success/failure and message

at line 692
array removeRelation(string $T1, string $F1, string $T2, string $F2)

Removes a foreign relation

Parameters

string $T1 foreign db.table
string $F1 foreign field
string $T2 master db.table
string $F2 master field

Return Value

array array of success/failure and message

at line 769
bool saveSetting(string $index, string $value)

Save value for a designer setting

Parameters

string $index setting
string $value value

Return Value

bool whether the operation succeeded