X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fhelper%2Fweb%2Fforms%2Fclass_WebFormHelper.php;h=1fffb7af1d9c215d0de1850bce4190ee0bf92aa6;hb=5bf79580029c4f6ee71e6c9e7890169e4b344def;hp=ea7f4526a27a96559fe34778ea4dc73c1fc809cc;hpb=5db7219f63e257943e11d0ef20cb75c7514d769d;p=shipsimu.git
diff --git a/inc/classes/main/helper/web/forms/class_WebFormHelper.php b/inc/classes/main/helper/web/forms/class_WebFormHelper.php
index ea7f452..1fffb7a 100644
--- a/inc/classes/main/helper/web/forms/class_WebFormHelper.php
+++ b/inc/classes/main/helper/web/forms/class_WebFormHelper.php
@@ -378,7 +378,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
} // END - if
// At least the group name should be set
- if ((empty($groupId)) && (!$this->ifGroupOpenedPreviously())) {
+ if ((empty($groupId)) && ($this->ifGroupOpenedPreviously() === false)) {
// Throw exception here
throw new EmptyVariableException(array($this, 'groupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} elseif (empty($groupId)) {
@@ -387,7 +387,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
}
// Same group to open?
- if ((!$this->ifGroupOpenedPreviously()) && ($groupId == $this->getPreviousGroupId())) {
+ if (($this->ifGroupOpenedPreviously() === false) && ($groupId === $this->getPreviousGroupId())) {
// Abort here silently
return false;
} // END - if
@@ -396,7 +396,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
$content = " \n";
// Is this group opened?
- if (!$this->ifGroupOpenedPreviously()) {
+ if ($this->ifGroupOpenedPreviously() === false) {
// Begin the div/span blocks
$content = sprintf("
@@ -412,7 +412,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
);
// Switch the state
- $this->openGroupByIdContent($groupId, $content);
+ $this->openGroupByIdContent($groupId, $content, "div");
} else {
// Is a sub group opened?
if ($this->ifSubGroupOpenedPreviously()) {
@@ -426,7 +426,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
// Switch the state
$this->closePreviousGroupByContent($content);
- // All call it again if the group name is not empty
+ // All call it again if group name is not empty
if ((!empty($groupId)) && ($groupId != $prevGroupId)) {
//* DEBUG: */ echo $groupId."/".$prevGroupId." \n";
$this->addFormGroup($groupId, $groupText);
@@ -436,8 +436,8 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
/**
* Add a form sub group or close an already opened and open a new one or
- * throws an exception if no group has been opened before or if the sub
- * group name is empty.
+ * throws an exception if no group has been opened before or if sub group
+ * name is empty.
*
* @param $subGroupId Name of the group or last opened if empty
* @param $subGroupText Text including HTML to show above this group
@@ -447,13 +447,13 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
*/
public function addFormSubGroup ($subGroupId = "", $subGroupText = "") {
// Is a group opened?
- if (!$this->ifGroupOpenedPreviously()) {
+ if ($this->ifGroupOpenedPreviously() === false) {
// Throw exception here
throw new FormFormClosedException(array($this, $subGroupId), self::EXCEPTION_UNEXPECTED_CLOSED_GROUP);
} // END - if
// At least the sub group name should be set
- if ((empty($subGroupId)) && (!$this->ifSubGroupOpenedPreviously())) {
+ if ((empty($subGroupId)) && ($this->ifSubGroupOpenedPreviously() === false)) {
// Throw exception here
throw new EmptyVariableException(array($this, 'subGroupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} elseif (empty($subGroupId)) {
@@ -462,7 +462,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
}
// Same sub group to open?
- if ((!$this->ifSubGroupOpenedPreviously()) && ($subGroupId == $this->getPreviousSubGroupId())) {
+ if (($this->ifSubGroupOpenedPreviously() === false) && ($subGroupId == $this->getPreviousSubGroupId())) {
// Abort here silently
return false;
} // END - if
@@ -471,7 +471,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
$content = "
\n";
// Is this group opened?
- if (!$this->ifSubGroupOpenedPreviously()) {
+ if ($this->ifSubGroupOpenedPreviously() === false) {
// Begin the span block
$content = sprintf("
@@ -487,7 +487,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
);
// Switch the state and remeber the name
- $this->openSubGroupByIdContent($subGroupId, $content);
+ $this->openSubGroupByIdContent($subGroupId, $content, "div");
} else {
// Get previous sub group id
$prevSubGroupId = $this->getPreviousSubGroupId();
@@ -552,12 +552,6 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
throw new FormClosedException (array($this, "form_notes"), self::EXCEPTION_CLOSED_FORM);
} // END - if
- // Is a group open?
- if ($this->ifGroupOpenedPreviously()) {
- // Then automatically close it here
- $this->addFormGroup();
- } // END - if
-
// Generate the content
$inputContent = sprintf("
%s
@@ -587,11 +581,11 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
} // END - if
// Shall we close or open the sub group?
- if ((!$this->ifSubGroupOpenedPreviously()) && ($this->getPreviousSubGroupId() !== $selectId)) {
+ if (($this->ifSubGroupOpenedPreviously() === false) && ($this->getPreviousSubGroupId() !== $selectId)) {
// Initialize first entry (which might be non-selectable if content is provided
if (!empty($firstEntry)) {
// Add selection around it
- $firstEntry = sprintf("\n",
+ $firstEntry = sprintf("\n",
$firstEntry
);
} // END - if
@@ -605,10 +599,10 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
);
// Open the sub group
- $this->openSubGroupByIdContent($selectId, $content);
+ $this->openSubGroupByIdContent($selectId, $content, "select");
} elseif ($this->getPreviousSubGroupId() != $selectId) {
// Something went wrong!
- $this->debugInstance();
+ $this->debugInstance(__METHOD__."(): Previous sub group id {$this->getPreviousSubGroupId()} does not match current id {$selectId}.");
} else {
// Close the sub group
$this->closePreviousSubGroupByContent("");
@@ -628,14 +622,13 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
*/
public function addSelectSubOption ($subName, $subValue) {
// Is there a sub group (shall be a selection box!)
- if (!$this->ifSubGroupOpenedPreviously()) {
+ if ($this->ifSubGroupOpenedPreviously() === false) {
// Then throw an exception here
throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
} // END - if
// Render the content
- $content = sprintf("\n",
- $subName,
+ $content = sprintf("\n",
$subName,
$subValue
);
@@ -657,13 +650,13 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
*/
public function addSelectOption ($optionName, $optionValue) {
// Is there a sub group (shall be a selection box!)
- if (!$this->ifSubGroupOpenedPreviously()) {
+ if ($this->ifSubGroupOpenedPreviously() === false) {
// Then throw an exception here
throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
} // END - if
// Render the content
- $content = sprintf("\n",
+ $content = sprintf("\n",
$optionName,
$optionName,
$optionValue