]> git.mxchange.org Git - shipsimu.git/blobdiff - inc/classes/main/helper/web/forms/class_WebFormHelper.php
Rendering of helper code improved
[shipsimu.git] / inc / classes / main / helper / web / forms / class_WebFormHelper.php
index d167768878bed59912c5e98324eb994ace2167f8..4faaf74926bf041433e3d5ff32c81e1846841d34 100644 (file)
@@ -417,11 +417,15 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                                $this->addFormSubGroup();
                        } // END - if
 
+                       // Get previous group id
+                       $prevGroupId = $this->getPreviousGroupId();
+
                        // Switch the state
                        $this->closePreviousGroupByContent($content);
 
                        // All call it again if the group name is not empty
-                       if (!empty($groupId)) {
+                       if ((!empty($groupId)) && ($groupId != $prevGroupId)) {
+                               //* DEBUG: */ echo $groupId."/".$prevGroupId."<br />\n";
                                $this->addFormGroup($groupId, $groupText);
                        } // END - if
                }
@@ -451,11 +455,11 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                        throw new EmptyVariableException(array($this, 'subGroupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
                } elseif (empty($subGroupId)) {
                        // Close the last opened
-                       $subGroupId = $this->getSubGroupId();
+                       $subGroupId = $this->getPreviousSubGroupId();
                }
 
                // Same sub group to open?
-               if ((!$this->ifSubGroupOpenedPreviously()) && ($subGroupId == $this->getSubGroupId())) {
+               if ((!$this->ifSubGroupOpenedPreviously()) && ($subGroupId == $this->getPreviousSubGroupId())) {
                        // Abort here silently
                        return false;
                } // END - if
@@ -482,11 +486,14 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                        // Switch the state and remeber the name
                        $this->openSubGroupByIdContent($subGroupId, $content);
                } else {
+                       // Get previous sub group id
+                       $prevSubGroupId = $this->getPreviousSubGroupId();
+
                        // Switch the state
                        $this->closePreviousSubGroupByContent($content);
 
                        // All call it again if sub group name is not empty
-                       if (!empty($subGroupId)) {
+                       if ((!empty($subGroupId)) && ($subGroupId != $prevSubGroupId)) {
                                $this->addFormSubGroup($subGroupId, $subGroupText);
                        } // END - if
                }
@@ -599,7 +606,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                $captchaInstance->renderCode();
 
                // Get the content and add it to the helper
-               $this->addContent($captchaInstance->getContent());
+               $this->addContent($captchaInstance->renderContent());
        }
 
        /**
@@ -664,8 +671,8 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                }
 
                // Send content to template engine
-               //* DEBUG: */ echo __METHOD__.": form=".$this->getFormName().", size=".strlen($this->getContent())."<br />\n";
-               $this->getTemplateInstance()->assignVariable($this->getFormName(), $this->getContent());
+               //* DEBUG: */ echo __METHOD__.": form=".$this->getFormName().", size=".strlen($this->renderContent())."<br />\n";
+               $this->getTemplateInstance()->assignVariable($this->getFormName(), $this->renderContent());
        }
 }