Unit __construct(
string
$name, [string
$item_class = 'Item'], [string
$prefix = ''], [string
$col_prefix = ''], [array
$params = NULL], [string
$primary_key = 'id']
)
|
|
Initializes controller Unit
Parameters:
string |
$name: |
Unit name |
string |
$item_class: |
Name of the Item class representing objects for this Unit |
string |
$prefix: |
Table prefix |
string |
$col_prefix: |
Column prefix |
array |
$params: |
Array of Param objects |
string |
$primary_key: |
Primary key |
API Tags:
Redefinition of:
- Entity::__construct()
- Entity constructor
Redefined in descendants as:
Basic add scenario
API Tags:
Redefinition of:
- Entity::add()
- Adds a new entry to the entity parameter list. After the parameter has been added, you will be able to access it by name in associative array style.
void display_form(
XTemplate
$tpl, [string
$block = 'MAIN'], [string
$action = 'update'], [Item
$item = NULL]
)
|
|
Renders add/edit form display. A form will be empty if object has no data and if some data was imported, it will be already in the inputs.
TPL designer must specify unit parameters explicitly. TPL example: <!-- BEGIN: MY_UNIT --> <form action="{ACTION}" method="post"> <stong>{FOO_TITLE}:</strong> {FOO_INPUT} <em>{FOO_HINT}</em> <stong>{BAR_TITLE}:</strong> {BAR_INPUT} <em>{BAR_HINT}</em> <input type="submit" value="Submit" /> </form> <!-- END: MY_UNIT -->
Parameters:
XTemplate |
$tpl: |
Layout template object |
string |
$block: |
Full block name to render the object in, e.g. 'MAIN.MY_UNIT' |
string |
$action: |
Action that is being performed by the form. Usually 'edit', 'add' or 'remove' |
Item |
$item: |
An imported item if performing edit rather than add |
API Tags:
void display_form_auto(
XTemplate
$tpl, string
$block, string
$row_block, [string
$action = 'update'], [Item
$item = NULL], [string
$title_tag = 'PARAM_TITLE'], [string
$input_tag = 'PARAM_INPUT'], [string
$hint_tag = 'PARAM_HINT']
)
|
|
Row-based automatic form render TPL designer specifies parameters implicitly with row block.
TPL example: <!-- BEGIN: MY_UNIT --> <!-- BEGIN: MY_PARAM --> <stong>{PARAM_TITLE}:</strong> {PARAM} <!-- END: MY_PARAM --> <!-- END: MY_UNIT -->
Parameters:
XTemplate |
$tpl: |
Layout template object |
string |
$block: |
Full block name to render the object in, e.g. 'MAIN.MY_UNIT' |
string |
$row_block: |
Row block name for parameter row, e.g. 'MY_PARAM' |
string |
$action: |
Action that is being performed by the form. Usually 'edit', 'add' or 'remove' |
Item |
$item: |
An imported item if performing edit rather than add |
string |
$title_tag: |
Tag name for parameter title |
string |
$input_tag: |
Tag name for parameter value input |
string |
$hint_tag: |
Tag name for hint displayed for the input |
API Tags:
Basic item display scenario
API Tags:
void display_list(
XTemplate
$tpl, [string
$block = 'MAIN'], [string
$filter = ''], [int
$start = 0], [int
$items = NULL]
)
|
|
Renders a simple list of objects to be displayed on screen.
Parameters:
XTemplate |
$tpl: |
Layout template object |
string |
$block: |
Full block name to render the object in, e.g. 'MAIN.MY_UNIT' |
string |
$filter: |
Filter condition |
int |
$start: |
Index of an item in the result set to start with |
int |
$items: |
Max. number of items to select from result set. NULL - unlimited. |
API Tags:
void display_list_edit(
XTemplate
$tpl, [string
$block = 'MAIN'], [string
$filter = ''], [int
$start = 0], [int
$items = NULL]
)
|
|
Renders an editable list of objects to edit many instances of the entity at once
Parameters:
XTemplate |
$tpl: |
Layout template object |
string |
$block: |
Full block name to render the object in, e.g. 'MAIN.MY_UNIT' |
string |
$filter: |
Filter condition |
int |
$start: |
Index of an item in the result set to start with |
int |
$items: |
Max. number of items to select from result set. NULL - unlimited. |
API Tags:
Basic edit scenario
API Tags:
Basic item listing scenario
API Tags:
Basic main unit scenario
API Tags:
Redefined in descendants as:
Basic remove scenario
API Tags: