Properties

$formSpec

$formSpec : 

Type

$feSpecAction

$feSpecAction : 

Type

$feSpecNative

$feSpecNative : 

Type

$store

$store : 

Type

$evaluate

$evaluate : 

Type

$buildElementFunctionName

$buildElementFunctionName : 

Type

$pattern

$pattern : 

Type

$wrap

$wrap : 

Type

$symbol

$symbol : 

Type

$showDebugInfo

$showDebugInfo : 

Type

$inputCheckPattern

$inputCheckPattern : 

Type

$formId

$formId : 

Type

Methods

__construct()

__construct(array  $formSpec, array  $feSpecAction, array  $feSpecNative) 

AbstractBuildForm constructor.

Parameters

array $formSpec
array $feSpecAction
array $feSpecNative

fillWrap()

fillWrap() 

process()

process(  $mode) : string|array

Builds complete form. Depending of Formspecification, the layout will be 'plain' / 'table' / 'bootstrap'.

Parameters

$mode

Throws

\qfq\CodeException
\qfq\DbException
\qfq\UserFormException

Returns

string|array —

$mode=LOAD_FORM: The whole form as HTML, $mode=FORM_UPDATE: array of all formElement.dynamicUpdate-yes values/states

head()

head() : string

Builds the head area of the form.

Returns

string

createFormEditUrl()

createFormEditUrl() : string

If SHOW_DEBUG_INFO=yes: create a link (incl. SIP) to edit the current form. Show also the hidden content of the SIP.

Returns

string —

String: Edit [sip:..., r:..., urlparam:..., ...]

wrapItem()

wrapItem(  $item,   $value, boolean|false  $flagOmitEmpty = false) : string

Wrap's $this->wrap[$item][WRAP_SETUP_START] around $value. If $flagOmitEmpty==true && $value=='': return ''.

Parameters

$item
$value
boolean|false $flagOmitEmpty

Returns

string

getFormTag()

getFormTag() : string

Returns '<form .

..>'-tag with various attributes.

Returns

string

getFormTagAtrributes()

getFormTagAtrributes() : array

Build an assoc array with standard form attributes.

Returns

array

getFormId()

getFormId() : string

Returns

string

getActionUrl()

getActionUrl() : string

Builds the HTML 'form'-tag inlcuding all attributes and target.

Notice: the SIP will be transferred as POST Parameter.

Throws

\qfq\DbException

Returns

string

tail()

tail() 

doSubrecords()

doSubrecords() 

getProcessFilter()

getProcessFilter() 

elements()

elements(  $recordId, string  $filter = FORM_ELEMENTS_NATIVE, integer  $feIdContainer,   $json) : string

Process all FormElements: build corresponding HTML code. Collect and return all HTML code.

Parameters

$recordId
string $filter

FORM_ELEMENTS_NATIVE | FORM_ELEMENTS_SUBRECORD | FORM_ELEMENTS_NATIVE_SUBRECORD

integer $feIdContainer
$json

Throws

\qfq\CodeException
\qfq\DbException
\qfq\UserFormException

Returns

string

deriveNewRecordUrlFromExistingSip()

deriveNewRecordUrlFromExistingSip(  $toolTipNew) 

Takes the current SIP ('form' and additional parameter), set SIP_RECORD_ID=0 and create a new 'NewRecordUrl'.

Parameters

$toolTipNew

Throws

\qfq\CodeException
\qfq\UserFormException

buildRowNative()

buildRowNative(  $formElement,   $elementHtml) 

Parameters

$formElement
$elementHtml

buildRowPill()

buildRowPill(  $formElement,   $elementHtml) 

Parameters

$formElement
$elementHtml

buildRowFieldset()

buildRowFieldset(  $formElement,   $elementHtml) 

Parameters

$formElement
$elementHtml

buildRowSubrecord()

buildRowSubrecord(  $formElement,   $elementHtml) 

Parameters

$formElement
$elementHtml

buildLabel()

buildLabel(array  $htmlFormElementId,   $label) : string

Builds a label, typically for an html-'<input>'-element.

Parameters

array $htmlFormElementId
$label

Returns

string

buildInput()

buildInput(array  $formElement,   $htmlFormElementId,   $value,   $json) : string

Builds HTML 'input' element.

Format: <input name="$htmlFormElementId" <type="email|input|password|url" [autocomplete="autocomplete"] [autofocus="autofocus"] [maxlength="$maxLength"] [placeholder="$placeholder"] [size="$size"] [min="$min"] [max="$max"] [pattern="$pattern"] [readonly="readonly"] [required="required"] [disabled="disabled"] value="$value">

Parameters

array $formElement
$htmlFormElementId
$value
$json

Throws

\qfq\UserFormException

Returns

string

buildCheckbox()

buildCheckbox(array  $formElement,   $htmlFormElementId,   $value,   $json) : string

Builds HTML 'checkbox' element.

Checkboxes will only be submitted, if they are checked. Therefore, a hidden element with the unchecked value will be transferred first.

Format: <input name="$htmlFormElementId" type="checkbox" [autofocus="autofocus"] [readonly="readonly"] [required="required"] [disabled="disabled"] value="" [checked="checked"] >

Parameters

array $formElement
$htmlFormElementId
$value
$json

Throws

\qfq\UserFormException

Returns

string

getKeyValueListFromSqlEnumSpec()

getKeyValueListFromSqlEnumSpec(array  $formElement,   $itemKey,   $itemValue) 

Look for key/value list (in this order, first match counts) in a) `sql1` b) `parameter:itemList` c) table.column definition

Copies the found keys to &$itemKey and the values to &$itemValue If there are no &$itemKey, copy &$itemValue to &$itemKey.

Parameters

array $formElement
$itemKey
$itemValue

Throws

\qfq\CodeException
\qfq\UserFormException

buildCheckboxSingle()

buildCheckboxSingle(array  $formElement,   $htmlFormElementId,   $attribute,   $value) : string

Build a Checkbox based on two values.

Parameters

array $formElement
$htmlFormElementId
$attribute
$value

Returns

string

buildNativeHidden()

buildNativeHidden(  $htmlFormElementId,   $value) : string

Builds a real HTML hidden form element. Useful for checkboxes, Multiple-Select and Radios.

Parameters

$htmlFormElementId
$value

Returns

string

buildCheckboxMulti()

buildCheckboxMulti(array  $formElement,   $htmlFormElementId,   $attributeBase,   $value, array  $itemKey, array  $itemValue) : string

Build as many Checkboxes as items.

Layout: The Bootstrap Layout needs very special setup, the checkboxes are wrapped differently with

depending of if they aligned horizontal or vertical.

Parameters

array $formElement
$htmlFormElementId
$attributeBase
$value
array $itemKey
array $itemValue

Returns

string

buildHidden()

buildHidden(array  $formElement,   $htmlFormElementId,   $value,   $json) : string

Submit hidden values by SIP.

Sometimes, it's usefull to precalculate values during formload and to submit them as hidden fields. To avoid any manipulation on those fields, the values will be transferred by SIP.

Parameters

array $formElement
$htmlFormElementId
$value
$json

Returns

string

buildRadio()

buildRadio(array  $formElement,   $htmlFormElementId,   $value,   $json) : string

Build HTML 'radio' element.

Checkboxes will only be submitted, if they are checked. Therefore, a hidden element with the unchecked value will be transfered first.

Format: <input name="$htmlFormElementId" type="radio" [autofocus="autofocus"] [readonly="readonly"] [required="required"] [disabled="disabled"] value="" [checked="checked"] >

Parameters

array $formElement
$htmlFormElementId
$value
$json

Throws

\qfq\UserFormException

Returns

string

buildSelect()

buildSelect(array  $formElement,   $htmlFormElementId,   $value,   $json) : mixed

Builds a Selct (Dropdown) Box.

Parameters

array $formElement
$htmlFormElementId
$value
$json

Returns

mixed

createDeleteUrl()

createDeleteUrl(  $table,   $recordId,   $mode = RETURN_URL) : string

Create a link (incl. SIP) to delete the current record.

Parameters

$table
$recordId
$mode

Returns

string —

String: "API_DIR/delete.php?sip=...."

buildFile()

buildFile(array  $formElement,   $htmlFormElementId,   $value,   $json) : string

Builds an Upload (File) Button.

Parameters

array $formElement
$htmlFormElementId
$value
$json

Throws

\qfq\UserFormException

Returns

string

buildDateJQW()

buildDateJQW(array  $formElement,   $htmlFormElementId,   $value) 

Build Date JQW element.

Parameters

array $formElement
$htmlFormElementId
$value

Throws

\qfq\UserFormException

buildGridJQW()

buildGridJQW(array  $formElement,   $htmlFormElementId,   $value) 

Build Grid JQW element.

Parameters

array $formElement
$htmlFormElementId
$value

Throws

\qfq\UserFormException

buildNote()

buildNote(array  $formElement,   $htmlFormElementId,   $value,   $json) : mixed

Build Note.

Parameters

array $formElement
$htmlFormElementId
$value
$json

Returns

mixed

buildPill()

buildPill(array  $formElement,   $htmlFormElementId,   $value,   $json) : mixed

Build Pill

Parameters

array $formElement
$htmlFormElementId
$value
$json

Returns

mixed

buildFieldset()

buildFieldset(array  $formElement,   $htmlFormElementId,   $value,   $json) : mixed

Build a HTML fieldset. Renders all assigned FormElements inside the fieldset.

Parameters

array $formElement
$htmlFormElementId
$value
$json

Returns

mixed

buildNewSip()

buildNewSip() : string

Create a new sip, based on latest STORE_SIP Values. Return complete HTML 'hidden' element.

Returns

string

adjustMaxLength()

adjustMaxLength(array  $formElement) 

Parameters

array $formElement

getColumnSize()

getColumnSize(  $column) : boolean|integer

Get column spec from tabledefinition and parse size of it. If nothing defined, return false.

Parameters

$column

Returns

boolean|integer

getAttributeList()

getAttributeList(array  $formElement, array  $attributeList) : string

Builds a HTML attribute list, based on $attributeList.

E.g.: attributeList: [ 'type', 'autofocus' ] generates: 'type="$formElement['type']" autofocus="$formElement['autofocus']" '

Parameters

array $formElement
array $attributeList

Returns

string

getInputCheckPattern()

getInputCheckPattern(  $type,   $data) : string

Construct HTML Input attribute for Client Validation:

type data result


min|max | min="$attrData[0]"|max="$attrData[1]" pattern pattern="$data" digit - pattern="^[0-9]$" email - pattern="^[_a-z0-9-]+(.[_a-z0-9-]+)@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})$" alnumx -

For 'min/max' and 'pattern' the 'data' will be injected in the attribute string via '%s'.

Parameters

$type
$data

Throws

\qfq\UserFormException

Returns

string

getAttributeMode()

getAttributeMode(array  $formElement) : string

Set corresponding html attributes readonly/required/disabled, based on $formElement['mode'].

Parameters

array $formElement

Throws

\qfq\UserFormException

Returns

string

getJsonElementUpdate()

getJsonElementUpdate(  $htmlFormElementId, string|array  $value,   $mode) : array

Parameters

$htmlFormElementId
string|array $value
$mode

Returns

array

getItemsForEnumOrSet()

getItemsForEnumOrSet(  $column,   $fieldType) : array

Get the attribute definition list of an enum or set column. For strings, get the default value. Return elements as an array.

Parameters

$column
$fieldType

Throws

\qfq\UserFormException

Returns

array

prepareCheckboxCheckedUncheckedValue()

prepareCheckboxCheckedUncheckedValue(array  $itemKey, array  $formElement) 

For CheckBox's with only one checkbox: if no parameter:checked|unchecked is defined, take defaults:

checked: first Element in $itemKey unchecked: ''

Parameters

array $itemKey
array $formElement

Throws

\qfq\UserFormException

prepareSubrecod()

prepareSubrecod(  $formElement,   $primaryRecord,   $rcText,   $nameColumnId) : boolean

Parameters

$formElement
$primaryRecord
$rcText
$nameColumnId

Throws

\qfq\UserFormException

Returns

boolean

createFormLink()

createFormLink(  $formElement,   $targetRecordId,   $record,   $symbol,   $toolTip) : string

Renders an Link with a symbol (edit/new) and register a new SIP to grant permission to the link.

.

Returns [icon]

Link: ?s= & SIP: form = $formElement['form'] (provided via formElement['parameter']) r = $targetRecordId Parse $formElement['detail'] with possible key/value pairs. E.g.: detail=id:gr_id,#{{a}}:p_id,#12:x_id gr_id = <> p_id = <> x_id = 12 (constant)

Parameters

$formElement
$targetRecordId
$record
$symbol
$toolTip

Throws

\qfq\UserFormException

Returns

string

getFormTable()

getFormTable(  $formName) : string

Get the name for the given form $formName. If not found, return ''.

Parameters

$formName

Throws

\qfq\CodeException
\qfq\DbException

Returns

string —

tableName for $formName

getSubrecordColumnControl()

getSubrecordColumnControl(  $titleRaw) : array

Get various column format information based on the 'raw' column title. The attributes are separated by '|' and specified as 'key' or 'key=value'.

  • Return all parsed values as an assoc array.
  • For regular columns: If there is no 'width' specified, take the default 'SUBRECORD_COLUMN_WIDTH'
  • For 'icon / url / mailto': no width limit.

Returned assoc array: title Only key. Element is non numeric, which is not a keyword 'width/nostrip/icon/url/mailto' width Key/Value Pair. Not provided for 'icon/url/mailto'. nostrip Only key. Do not strip HTML Tags from the content. icon Only key. Value will rendered (later) as an image. url Only key. Value will rendered (later) as a 'href' mailto Only key. Value will rendered (later) as a 'href mailto'

Parameters

$titleRaw

Throws

\qfq\UserFormException

Returns

array

renderCell()

renderCell(array  $control,   $columnName,   $value) : string

Renders $value as specified in array $control

nostrip: by default, HTML tags are removed. With this attribute, the value will be delivered as it is. width: if there is a size limit - apply it. icon: The cell will be rendered as an image. $value should contain the name of an image in 'fileadmin/icons/' mailto: The cell will be rendered as an tag with the 'mailto' attribute. url: The cell will be rendered as an tag. The value will be exploded by '|'. $value[0] = href, value[1] = text. E.g. $value = 'www.math.uzh.ch/?id=45&v=234|Show details for Modul 123' >> Show details for Modul 123

Parameters

array $control
$columnName
$value

Returns

string

createDeleteLink()

createDeleteLink(  $table,   $recordId,   $symbol,   $toolTip) : string

Parameters

$table
$recordId
$symbol
$toolTip

Returns

string