create a new instance
FormCreator
FormCreator
()
Description:
This creates and initializes a new instance of this class.
trigger wether the user should be allowed to create new entries
bool
allowNewEntry
(
[bool $allowNewEntry = null]
)
List of parameters:
Name |
Type |
Description |
$allowNewEntry |
bool |
|
Description:
Use this function to trigger the "new entry" row on edit-forms. If $allowNewEntries is true, the row will be shown, else it will be hidden.
Note that this row can be hidden automatically, if a not-nullable column is not visible to the user, making it practically impossible to add entries. However: you may overrule this behavior by calling this function and setting the value to true.
Returns the old value of the property. If you just want to read the current setting, call this function without providing any argument.
create a form from the current instance and return it
string
createForm
()
Description:
Returns the HTML-code for this form.
turn advanced search on / off
bool
enableAdvancedSearch
(
[bool $advancedSearch = true]
)
List of parameters:
Name |
Type |
Description |
$advancedSearch |
bool |
|
Description:
Triggers wether advanced search is to be used (true=yes, false=no). Returns bool(true) on success and bool(false) on error.
turn array keys on / off
bool
enableArrayKeys
(
[bool $arrayKeys = true]
)
List of parameters:
Name |
Type |
Description |
$arrayKeys |
bool |
|
Description:
Triggers wether for columns of type array the keys are to be used (true=yes, false=no). Returns bool(true) on success and bool(false) on error.
turn titles on / off
bool
enableTitles
(
[bool $titles = true]
)
List of parameters:
Name |
Type |
Description |
$titles |
bool |
|
Description:
Triggers wether fieldnames are to be shown (true=yes, false=no). Returns bool(true) on success and bool(false) on error.
get action for an event
bool(false)|string
getAction
(
string $name
)
List of parameters:
Name |
Type |
Description |
$name |
string |
name of event |
Description:
Returns the lower-cased name of the currently selected action, or bool(false) if none has been selected yet.
get state of advanced search (on / off)
bool
getAdvancedSearch
()
Description:
Returns bool(true) if enabled, or bool(false) if disabled.
get state of array keys (on / off)
bool
getArrayKeys
()
Description:
This option triggers how to display columns of type "array". If enabled the keys are visible and editable (on edit forms). If disabled the keys are hidden.
Returns bool(true) if enabled, or bool(false) if disabled.
get selected columns
array
getColumns
()
Description:
get delete action
bool(false)|string
getDeleteAction
()
Description:
get download action
bool(false)|string
getDownloadAction
()
Description:
get edit action
bool(false)|string
getEditAction
()
Description:
get number of entries to show per page
bool(false)|int
getEntriesPerPage
()
Description:
Returns the number of the current page, or bool(false) on error.
get the currently selected file
bool(false)|string
getFile
()
Description:
Returns the lower-cased name of the currently selected file, or bool(false) if none has been selected yet.
get data from posted form
array|bool(false)
getFormdata
(
int $form,
string|DbStructure $source,
string $table, [
array $data =
null], [
array $columns =
null]
)
List of parameters:
Name |
Type |
Description |
$form |
int |
choose the form, the data came from (FORM_NEW, FORM_EDIT, FORM_SEARCH, FORM_ADV_SEARCH) |
$source |
string|DbStructure |
name of the database structure file to use |
$table |
string |
name of the database table, the data is related to |
$data |
array |
provide the form data |
$columns |
array |
you may limit the results to these columns (if not provided, all columns are returned) |
Description:
This function can be used to collect the data submitted by a form, which was created using the Yana form generator.
It returns an array containing the converted form data or bool(false) on error.
If the argument $data is not provided, the function automatically takes it from the $_POST array instead.
get namespace
string|bool(false)
getNamespace
()
Description:
Returns bool(false) on error.
get new action
bool(false)|string
getNewAction
()
Description:
get the currently selected page
bool(false)|int
getPage
()
Description:
Returns the number of the current page, or bool(false) on error.
get result rows
array
&getRows
()
Description:
This function returns a reference to the rows that will be displayed. You may use this to modify the result before it is send to the browser.
Example:
foreach ($rows as $i => $row)
{
$rows[$i]['FOO'] = $row['BAR'] . "\n" . $row['FOO'];
unset($rows[$i]['BAR']);
}
Returns an empty array on error.
get search action
bool(false)|string
getSearchAction
()
Description:
get the name of the column the resultset is ordered by
bool(false)|string
getSort
()
Description:
Returns the lower-cased column name, or bool(false) if none has been set yet.
get the currently selected table
bool(false)|string
getTable
()
Description:
Returns the lower-cased name of the currently selected table, or bool(false) if none has been selected yet.
get the currently selected template file
bool(false)|string
getTemplate
()
Description:
Returns the filename of the template that is currently, selected, or bool(false) if none has been set.
get state of titles (on / off)
bool
getTitles
()
Description:
Triggers wether fieldnames are to be shown (true=yes, false=no). Returns bool(true) if enabled, or bool(false) if disabled.
get the currently set where clause
bool(false)|string|array
getWhere
()
Description:
Returns the current where clause, or bool(false) if none has been set yet.
check if a filter is set on a column
bool
hasFilter
(
string $column
)
List of parameters:
Name |
Type |
Description |
$column |
string |
name of column to check |
Description:
Returns bool(true) if a filter has been set on the column and bool(false) otherwise.
check if resultset is sorted in descending order
bool
isDescending
()
Description:
Returns bool(true) if sorted descending and bool(false) otherwise.
set action for an event
bool
setAction
(
string $name, string $value
)
List of parameters:
Name |
Type |
Description |
$name |
string |
|
$value |
string |
|
Description:
Returns bool(true) on success and bool(false) on error.
select columns to view in form
bool
setColumns
(
[array $columns = null]
)
List of parameters:
Name |
Type |
Description |
$columns |
array |
|
Description:
Returns bool(true) on success and bool(false) on error.
set delete action
bool
setDeleteAction
(
string $action
)
List of parameters:
Name |
Type |
Description |
$action |
string |
|
Description:
set download action
bool
setDownloadAction
(
string $action
)
List of parameters:
Name |
Type |
Description |
$action |
string |
|
Description:
set edit action
bool
setEditAction
(
string $action
)
List of parameters:
Name |
Type |
Description |
$action |
string |
|
Description:
set number of entries per page
bool
setEntriesPerPage
(
[int $entries = null]
)
List of parameters:
Name |
Type |
Description |
$entries |
int |
number of entries per page |
Description:
The number of entries per page needs to greater 0, defaults to 5.
Returns bool(true) on success and bool(false) on error.
Note that 'get' and 'session' vars may overrule this setting.
set source file
bool
setFile
(
string $file
)
List of parameters:
Name |
Type |
Description |
$file |
string |
|
Description:
Returns bool(true) on success and bool(false) on error.
set new action
bool
setNewAction
(
string $action
)
List of parameters:
Name |
Type |
Description |
$action |
string |
|
Description:
set current page
List of parameters:
Name |
Type |
Description |
$page |
int |
number of start page |
Description:
The first page is 0, the second is 1, aso., defaults to 0.
Returns bool(true) on success and bool(false) on error.
Note that 'get' and 'session' vars may overrule this setting.
set search action
bool
setSearchAction
(
string $action
)
List of parameters:
Name |
Type |
Description |
$action |
string |
|
Description:
set column to sort the resultset by
bool
setSort
(
[string $orderBy = ''], [bool $desc = null]
)
List of parameters:
Name |
Type |
Description |
$orderBy |
string |
column name (defaults to primary key) |
$desc |
bool |
sort descending (true=yes, false=no, defaults to false) |
Description:
Note that 'get' and 'session' vars overrule this setting.
Returns bool(true) on success and bool(false) on error.
set source table
bool
setTable
(
string $table
)
List of parameters:
Name |
Type |
Description |
$table |
string |
|
Description:
Returns bool(true) on success and bool(false) on error.
select a template for output
bool
setTemplate
(
int|string $template, int $layout
)
List of parameters:
Name |
Type |
Description |
$template |
int|string |
|
$layout |
int |
does only apply if $template is a string |
Description:
You may use either a filename, or one of the following constants:
- FORM_VIEW
- FORM_EDIT
- FORM_NEW
- FORM_SEARCH
Returns bool(true) on success and bool(false) on error. Issues an E_USER_WARNING, if the template is unknown.
Note that the argument $layout can be overruled by 'get' and 'session' vars.
set where clause (filter)
bool
setWhere
(
[string|array $where = null], [bool $replace = false]
)
List of parameters:
Name |
Type |
Description |
$where |
string|array |
|
$replace |
bool |
|
Description:
The syntax is as follows: column1=value1,column2=value2,...,columnN=valueN
The alternative is as follows: array(array(0=>column1,1=>value1,2=>operator1),...) Where "operator" can be one of the following: '=', 'LIKE', '<', '>', '!=', '<=', '>='
To unset the where clause, call this function without providing a parameter.
Returns bool(true) on success and bool(false) on error.
inherited from base classes
Inherited From Object