]> git.mxchange.org Git - shipsimu.git/commitdiff
Final fixes for helper sub/groups
authorRoland Häder <roland@mxchange.org>
Tue, 12 Aug 2008 22:20:57 +0000 (22:20 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 12 Aug 2008 22:20:57 +0000 (22:20 +0000)
inc/classes/main/helper/class_BaseHelper.php
inc/classes/main/helper/web/forms/class_WebFormHelper.php

index 0e21d884cedef39181e8496dac304067c6f02b68..3993e984015ac37ad37fd779e1de72c51a18258d 100644 (file)
@@ -89,7 +89,29 @@ class BaseHelper extends BaseFrameworkSystem {
         * @return      void
         */
        protected final function addContent ($newContent) {
         * @return      void
         */
        protected final function addContent ($newContent) {
-               $this->content .= (string) trim($newContent) . "\r\n";
+               $this->content .= (string) trim($newContent)."\n";
+       }
+
+       /**
+        * Add header content to the helper
+        *
+        * @param       $content        Content to to the base
+        * @return      void
+        */
+       protected function addHeaderContent ($content) {
+               // Add the header content
+               $this->groups['header']['content'] = (string) trim($content);
+       }
+
+       /**
+        * Add footer content to the helper
+        *
+        * @param       $content        Content to to the base
+        * @return      void
+        */
+       protected function addFooterContent ($content) {
+               // Add the footer content
+               $this->groups['footer']['content'] = (string) trim($content);
        }
 
        /**
        }
 
        /**
@@ -317,8 +339,17 @@ class BaseHelper extends BaseFrameworkSystem {
         * @return      $content        Rendered HTML content
         */
        public function renderContent () {
         * @return      $content        Rendered HTML content
         */
        public function renderContent () {
+               // Initialize content
+               $content = "";
+
+               // Is header content there?
+               if (isset($this->groups['header'])) {
+                       // Then add it
+                       $content .= $this->groups['header']['content']."\n";
+               } // END - if
+
                // Initiate content
                // Initiate content
-               $content = $this->getContent();
+               $content .= $this->getContent();
 
                // Now "walk" through all groups and sub-groups
                for ($idx = 1; $idx <= $this->totalCounter; $idx++) {
 
                // Now "walk" through all groups and sub-groups
                for ($idx = 1; $idx <= $this->totalCounter; $idx++) {
@@ -340,6 +371,12 @@ class BaseHelper extends BaseFrameworkSystem {
 
                } // END - for
 
 
                } // END - for
 
+               // Is footer content there?
+               if (isset($this->groups['footer'])) {
+                       // Then add it
+                       $content .= $this->groups['footer']['content']."\n";
+               } // END - if
+
                // Return it
                //* DEBUG: */ echo "content=<pre>".htmlentities($content)."</pre> (".strlen($content).")<br />\n";
                return $content;
                // Return it
                //* DEBUG: */ echo "content=<pre>".htmlentities($content)."</pre> (".strlen($content).")<br />\n";
                return $content;
index 126752082e4f8407d95464a72695a74db55fcffa..20693f90b2861ae5b999de7b8f9d05db8a6d9707 100644 (file)
@@ -132,6 +132,9 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
 
                        // Open the form and remeber the form name
                        $this->formOpened = true;
 
                        // Open the form and remeber the form name
                        $this->formOpened = true;
+
+                       // Add it to the content
+                       $this->addHeaderContent($formContent);
                } else {
                        // Add the hidden field required to identify safely this form
                        $this->addInputHiddenField('form', $this->getFormName());
                } else {
                        // Add the hidden field required to identify safely this form
                        $this->addInputHiddenField('form', $this->getFormName());
@@ -144,10 +147,10 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
 
                        // Simply close it
                        $this->formOpened = false;
 
                        // Simply close it
                        $this->formOpened = false;
-               }
 
 
-               // Add it to the content
-               $this->addContent($formContent);
+                       // Add it to the content
+                       $this->addFooterContent($formContent);
+               }
        }
 
        /**
        }
 
        /**