class Common (View source)

Common functions for Designer

Methods

__construct(DatabaseInterface $dbi, Relation $relation)

No description

array
getTablesInfo(string|null $db = null, string|null $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
getAllKeys(array $designerTables)

Returns all indices

array
getScriptTabs(array $designerTables)

Return j_tab and h_tab arrays

array
getTablePositions(int $pg)

Returns table positions of a given pdf page

string|null
getPageName(int $pg)

Returns page name of a given pdf page

bool
deletePage(int $pg)

Deletes a given pdf page and its corresponding coordinates

int
getDefaultPage(string $db)

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

bool
getPageExists(string $pg)

Get the status if the page already exists If no such exists, returns negative index.

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

bool
saveTablePositions(int $pg)

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

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

Saves the display field for a table.

array
addNewRelation(string $t1, string $f1, string $t2, string $f2, string $onDelete, string $onUpdate, 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

__construct(DatabaseInterface $dbi, Relation $relation)

No description

Parameters

DatabaseInterface $dbi
Relation $relation

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

Retrieves table info and returns it

Parameters

string|null $db

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

string|null $table

(optional) Filter only a table ($db is now required)

Return Value

array

with table info

array getColumnsInfo(array $designerTables)

Retrieves table column info

Parameters

array $designerTables

The designer tables

Return Value

array

table column nfo

array getScriptContr(array $designerTables)

Returns JavaScript code for initializing vars

Parameters

array $designerTables

The designer tables

Return Value

array

JavaScript code

array getAllKeys(array $designerTables)

Returns all indices

Parameters

array $designerTables

The designer tables

Return Value

array

array getScriptTabs(array $designerTables)

Return j_tab and h_tab arrays

Parameters

array $designerTables

The designer tables

Return Value

array

array getTablePositions(int $pg)

Returns table positions of a given pdf page

Parameters

int $pg

pdf page id

Return Value

array

of table positions

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

bool deletePage(int $pg)

Deletes a given pdf page and its corresponding coordinates

Parameters

int $pg

page id

Return Value

bool

int 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

id of the default pdf page for the database

bool getPageExists(string $pg)

Get the status if the page already exists If no such exists, returns negative index.

Parameters

string $pg name

Return Value

bool

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

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

bool saveTablePositions(int $pg)

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

Parameters

int $pg

pdf page id

Return Value

bool

array 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

array

array addNewRelation(string $t1, string $f1, string $t2, string $f2, string $onDelete, string $onUpdate, string $db1, string $db2)

Adds a new foreign relation

Parameters

string $t1

foreign table

string $f1

foreign field

string $t2

master table

string $f2

master field

string $onDelete

on delete action

string $onUpdate

on update action

string $db1 database
string $db2 database

Return Value

array

array of success/failure and message

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

bool saveSetting(string $index, string $value)

Save value for a designer setting

Parameters

string $index setting
string $value value

Return Value

bool