", $htmlElement) . $br;
$html .= $htmlElement;
$attribute = $attributeBase;
}
$json = $this->getFormElementForJson($htmlFormElementName, $value, $formElement);
return $html;
}
/**
* Builds a Selct (Dropdown) Box.
*
* @param array $formElement
* @param $htmlFormElementName
* @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, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
$itemKey = array();
$itemValue = array();
$attribute = '';
// Fill $itemKey & $itemValue
$this->getKeyValueListFromSqlEnumSpec($formElement, $itemKey, $itemValue);
$attribute .= $this->getAttributeFeMode($formElement[FE_MODE]);
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID]);
$attribute .= Support::doAttribute('name', $htmlFormElementName);
$attribute .= Support::doAttribute('class', 'form-control');
$attribute .= Support::doAttribute('title', $formElement[FE_TOOLTIP]);
$attribute .= $this->getAttributeList($formElement, ['autofocus']);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
if (isset($formElement[FE_SIZE]) && $formElement[FE_SIZE] > 1) {
$attribute .= Support::doAttribute('size', $formElement[FE_SIZE]);
$attribute .= Support::doAttribute('multiple', 'multiple');
}
$option = '';
$firstSelect = true;
$jsonValues = array();
for ($ii = 0; $ii < count($itemValue); $ii++) {
$option .= '
';
}
$json = $this->getFormElementForJson($htmlFormElementName, $jsonValues, $formElement);
$html = '
';
$formElement = HelperFormElement::prepareExtraButton($formElement, false);
$html = $html . $this->getHelpBlock() . $formElement[FE_TMP_EXTRA_BUTTON_HTML];
return $html . $formElement[FE_INPUT_EXTRA_BUTTON_INFO];
}
/**
* 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 $htmlFormElementName
* @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, $htmlFormElementName, $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])) {
Support::setIfNotSet($formElement, F_EXTRA_DELETE_FORM, '');
$formElement[F_FINAL_DELETE_FORM] = $formElement[F_EXTRA_DELETE_FORM] != '' ? $formElement[F_EXTRA_DELETE_FORM] : $formElement[SUBRECORD_PARAMETER_FORM];
$linkNew = Support::wrapTag('
', $columns);
foreach ($formElement[FE_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) {
$toolTip = 'Delete';
if ($this->showDebugInfoFlag) {
$toolTip .= PHP_EOL . "form = '" . $formElement[F_FINAL_DELETE_FORM] . "'" . PHP_EOL . "r = '" . $row[$nameColumnId] . "'";
}
// $buttonDelete = $this->buildButtonCode('delete-button', $toolTip, GLYPH_ICON_DELETE, $disabled);
$s = $this->createDeleteUrl($formElement[F_FINAL_DELETE_FORM], $row[$nameColumnId], RETURN_SIP);
// $rowHtml .= Support::wrapTag(' | ', Support::wrapTag(" |