", $htmlElement) . $br;
$html .= $htmlElement;
}
$json = $this->getJsonElementUpdate($htmlFormElementId, $value, $formElement[FE_MODE]);
return $html;
}
/**
* Builds a Selct (Dropdown) Box.
*
* @param array $formElement
* @param $htmlFormElementId
* @param $value
* @param array $json
* @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
* @return mixed
* @throws CodeException
* @throws \qfq\UserFormException
*/
public function buildSelect(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
$itemKey = array();
$itemValue = array();
// Fill $itemKey & $itemValue
$this->getKeyValueListFromSqlEnumSpec($formElement, $itemKey, $itemValue);
$attribute = $this->getAttributeFeMode($formElement[FE_MODE]);
$attribute .= Support::doAttribute('name', $htmlFormElementId);
$attribute .= Support::doAttribute('class', 'form-control');
$attribute .= Support::doAttribute('title', $formElement['tooltip']);
$attribute .= $this->getAttributeList($formElement, ['autofocus']);
$attribute .= Support::doAttribute('data-load', ($formElement['dynamicUpdate'] === 'yes') ? 'data-load' : '');
if (isset($formElement['size']) && $formElement['size'] > 1) {
$attribute .= Support::doAttribute('size', $formElement['size']);
$attribute .= Support::doAttribute('multiple', 'multiple');
}
$option = '';
$firstSelect = true;
$jsonValues = array();
for ($ii = 0; $ii < count($itemValue); $ii++) {
$option .= '
';
}
$json = $this->getJsonElementUpdate($htmlFormElementId, $jsonValues, $formElement[FE_MODE]);
return '
' . $this->getHelpBlock();
}
/**
* Construct a HTML table of the subrecord data.
* Column syntax definition: https://wikiit.math.uzh.ch/it/projekt/qfq/qfq-jqwidgets/Documentation#Type:_subrecord
*
* @param array $formElement
* @param $htmlFormElementId
* @param $value
* @param array $json
* @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
* @return string
* @throws CodeException
* @throws \qfq\UserFormException
*/
public function buildSubrecord(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
$rcText = false;
$nameColumnId = 'id';
$targetTableName = '';
$flagNew = false;
$flagEdit = false;
$flagDelete = false;
$linkNew = '';
$control = array();
$primaryRecord = $this->store->getStore(STORE_RECORD);
if (!$this->prepareSubrecod($formElement, $primaryRecord, $rcText, $nameColumnId)) {
return $rcText;
}
if (isset($formElement[SUBRECORD_PARAMETER_FORM])) {
$linkNew = Support::wrapTag('
', $columns);
foreach ($formElement['sql1'] as $row) {
$rowHtml = '';
if ($flagEdit) {
$rowHtml .= Support::wrapTag('', $this->createFormLink($formElement, $row[$nameColumnId], $primaryRecord, $this->symbol[SYMBOL_EDIT], 'Edit'));
} elseif ($flagNew) {
$rowHtml .= Support::wrapTag(' | ', $rowHtml, false);
}
// All columns
foreach ($row as $columnName => $value) {
if (isset($control['title'][$columnName]))
$rowHtml .= Support::wrapTag(' | ', $this->renderCell($control, $columnName, $value));
}
if ($flagDelete) {
$s = $this->createDeleteUrl($targetTableName, $row['id'], RETURN_SIP);
$rowHtml .= Support::wrapTag(' | ', Support::wrapTag(" |