Commit 0d45a374 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Hidden Values wurden nicht gespeichert. fixed.

Store.php: typo.
AbstractBuildForm.phhp: for all real form elements a fith't has been added: 'mode'.
parent 762ea337
......@@ -132,7 +132,7 @@ abstract class AbstractBuildForm {
/**
* Builds complete form. Depending of form specification, the layout will be 'plain' / 'table' / 'bootstrap'.
*
* @param $mode
* @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
* @return string|array $mode=LOAD_FORM: The whole form as HTML, $mode=FORM_UPDATE: array of all formElement.dynamicUpdate-yes values/states
* @throws CodeException
* @throws DbException
......@@ -173,12 +173,10 @@ abstract class AbstractBuildForm {
}
} else {
$recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP);
$htmlElements = $this->elements($recordId, $filter, 0, $json, $modeCollectFe, $htmlElementNameIdZero, $storeUse);
$htmlElements = $this->elements($recordId, $filter, 0, $json, $modeCollectFe, $htmlElementNameIdZero, $storeUse, $mode);
}
$htmlSip = $this->buildHiddenSip($json);
// </form>
return ($mode === FORM_LOAD) ? $htmlHead . $htmlElements . $htmlSip . $htmlTail . $htmlSubrecords : $json;
}
......@@ -328,13 +326,14 @@ abstract class AbstractBuildForm {
* @param string $modeCollectFe
* @param bool $htmlElementNameIdZero
* @param string $storeUse
* @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
* @return string
* @throws CodeException
* @throws DbException
* @throws \qfq\UserFormException
*/
public function elements($recordId, $filter = FORM_ELEMENTS_NATIVE, $feIdContainer = 0, array &$json,
$modeCollectFe = FLAG_DYNAMIC_UPDATE, $htmlElementNameIdZero = false, $storeUse = STORE_USE_DEFAULT) {
$modeCollectFe = FLAG_DYNAMIC_UPDATE, $htmlElementNameIdZero = false, $storeUse = STORE_USE_DEFAULT, $mode = FORM_LOAD) {
$html = '';
// get current data record
......@@ -384,7 +383,7 @@ abstract class AbstractBuildForm {
$jsonElement = array();
// Render pure element
$elementHtml = $this->$buildElementFunctionName($formElement, $htmlFormElementId, $value, $jsonElement);
$elementHtml = $this->$buildElementFunctionName($formElement, $htmlFormElementId, $value, $jsonElement, $mode);
// $fake0 = $fe['dynamicUpdate'];
// $fake1 = $formElement['dynamicUpdate'];
......@@ -436,7 +435,10 @@ abstract class AbstractBuildForm {
* @throws \qfq\UserFormException
*/
public function buildHiddenSip(array &$json) {
$sipArray = $this->store->getStore(STORE_SIP);
// do not include system vars
unset($sipArray[SIP_SIP]);
unset($sipArray[SIP_URLPARAM]);
......@@ -583,10 +585,11 @@ abstract class AbstractBuildForm {
* @param $htmlFormElementId
* @param $value
* @param array $json
* @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
* @return string
* @throws \qfq\UserFormException
*/
public function buildInput(array $formElement, $htmlFormElementId, $value, array &$json) {
public function buildInput(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
$textarea = '';
$attribute = Support::doAttribute('name', $htmlFormElementId);
......@@ -852,11 +855,12 @@ abstract class AbstractBuildForm {
* @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 buildCheckbox(array $formElement, $htmlFormElementId, $value, array &$json) {
public function buildCheckbox(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
$itemKey = array();
$itemValue = array();
......@@ -1185,13 +1189,19 @@ abstract class AbstractBuildForm {
* @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 buildHidden(array $formElement, $htmlFormElementId, $value, array &$json) {
public function buildHidden(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
$this->store->setVar($htmlFormElementId, $value, STORE_SIP, false);
if ($mode === FORM_LOAD) {
// Split 'grId:0' in 'grId' and '0'
$name = explode(':', $htmlFormElementId, 2);
$this->store->setVar($name[0], $value, STORE_SIP, false);
}
}
/**
......@@ -1207,11 +1217,12 @@ abstract class AbstractBuildForm {
* @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 buildRadio(array $formElement, $htmlFormElementId, $value, array &$json) {
public function buildRadio(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
$itemKey = array();
$itemValue = array();
......@@ -1284,11 +1295,12 @@ abstract class AbstractBuildForm {
* @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) {
public function buildSelect(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
$itemKey = array();
$itemValue = array();
......@@ -1342,11 +1354,12 @@ abstract class AbstractBuildForm {
* @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) {
public function buildSubrecord(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
$rcText = false;
$nameColumnId = 'id';
$targetTableName = '';
......@@ -1686,11 +1699,12 @@ abstract class AbstractBuildForm {
* @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 buildFile(array $formElement, $htmlFormElementId, $value, array &$json) {
public function buildFile(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
$attribute = '';
# Build param array for uniq SIP
......@@ -1749,10 +1763,11 @@ abstract class AbstractBuildForm {
* @param $htmlFormElementId
* @param $value
* @param array $json
* @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
* @return string
* @throws UserFormException
*/
public function buildDateTime(array $formElement, $htmlFormElementId, $value, array &$json) {
public function buildDateTime(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
$attribute = Support::doAttribute('name', $htmlFormElementId);
$attribute .= Support::doAttribute('class', 'form-control');
......@@ -1849,10 +1864,11 @@ abstract class AbstractBuildForm {
* @param $htmlFormElementId
* @param $value
* @param array $json
* @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
* @return string
* @throws UserFormException
*/
public function buildDateJQW(array $formElement, $htmlFormElementId, $value, array &$json) {
public function buildDateJQW(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
$arrMinMax = null;
// if ($formElement['placeholder'] == '') {
......@@ -1929,9 +1945,11 @@ abstract class AbstractBuildForm {
* @param array $formElement
* @param $htmlFormElementId
* @param $value
* @param $fake
* @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
* @throws UserFormException
*/
public function buildGridJQW(array $formElement, $htmlFormElementId, $value) {
public function buildGridJQW(array $formElement, $htmlFormElementId, $value, $fake, $mode = FORM_LOAD) {
// TODO: implement
throw new UserFormException("Not implemented yet: buildGridJQW()", ERROR_NOT_IMPLEMENTED);
}
......@@ -1942,10 +1960,11 @@ abstract class AbstractBuildForm {
* @param array $formElement
* @param $htmlFormElementId
* @param $value
* @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
* @param array $json
* @return mixed
*/
public function buildNote(array $formElement, $htmlFormElementId, $value, array &$json) {
public function buildNote(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
return $value;
}
......@@ -1969,11 +1988,12 @@ abstract class AbstractBuildForm {
* @param $htmlFormElementId
* @param $value
* @param array $json
* @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
* @return mixed
* @throws CodeException
* @throws DbException
*/
public function buildFieldset(array $formElement, $htmlFormElementId, $value, array &$json) {
public function buildFieldset(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
$attribute = '';
// save parent processed FE's
......
......@@ -294,10 +294,12 @@ class Save {
* @return bool|array if found the FormElement, else false.
*/
private function getFormElementByName($name) {
foreach ($this->feSpecNative as $formElement) {
if ($formElement['name'] === $name)
return $formElement;
}
return false;
}
......
......@@ -456,7 +456,7 @@ class Store {
throw new CodeException("setVar() for STORE_ZERO is impossible - there are no values.", ERROR_SET_STORE_ZERO);
if ($overWrite === false && isset(self::$raw[$store][$key])) {
throw new UserFormException("Value of '$key' already be set in store '$store'.", ERROR_STORE_KEY_EXIST);
throw new UserFormException("Value of '$key' already set in store '$store'.", ERROR_STORE_KEY_EXIST);
}
self::$raw[$store][$key] = $value;
......
......@@ -104,7 +104,7 @@ CREATE TABLE Address (
street VARCHAR(128) NOT NULL DEFAULT '',
city VARCHAR(128) NOT NULL DEFAULT '',
country ENUM('Switzerland', 'Austria', 'France', 'Germany') NOT NULL,
gr_id_typ BIGINT NOT NULL DEFAULT 0,
grIdTyp BIGINT NOT NULL DEFAULT 0,
modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment