Jelajahi Sumber

Ticket #1015 - point №2.

AntonLV 8 tahun lalu
induk
melakukan
44079f01f9

+ 8 - 14
inc/classes/BxDolTemplate.php

@@ -1303,20 +1303,14 @@ class BxDolTemplate extends BxDolFactory implements iBxDolSingleton
                 if(isset($this->aPage['header_text']))
                     $sRet = bx_process_output($this->aPage['header_text']);
                 break;
-            case 'popup_loading':
-                $s = $this->parsePageByName('popup_loading.html', array());
-                $sRet = BxTemplFunctions::getInstance()->transBox('bx-popup-loading', $s, true);
-
-                $oSearch = new BxTemplSearch();
-                $oSearch->setLiveSearch(true);
-                $sRet .= $this->parsePageByName('search.html', array(
-                    'search_form' => $oSearch->getForm(BX_DB_CONTENT_ONLY),
-                    'results' => $oSearch->getResultsContainer(),
-                ));
-
-                $sRet .= $this->getMenu ('sys_site');                
-                $sRet .= isLogged() ? $this->getMenu ('sys_add_content') : '';
-                $sRet .= isLogged() ? $this->getMenu ('sys_account_popup') : '';
+            case 'injection_head':
+                $sRet = $this->_oTemplateFunctions->getInjectionHead();
+                break;
+            case 'injection_header':
+                $sRet = $this->_oTemplateFunctions->getInjectionHeader();
+                break;
+            case 'injection_footer':
+                $sRet = $this->_oTemplateFunctions->getInjectionFooter();
                 break;
             case 'lang':
                 $sRet = bx_lang_name();

+ 1 - 1
studio/template/_footer.html

@@ -1,4 +1,4 @@
-       __popup_loading__
+       __injection_footer__
        <bx_injection:injection_footer />
     </body>
 </html>

+ 2 - 2
studio/template/_header.html

@@ -61,9 +61,9 @@
         </script>
         __extra_js__
 
+        __injection_head__
         <bx_injection:injection_head />
-
     </head>
-
     <body class="bx-def-font bx-def-color-bg-page bx-std-bg<bx_injection:injection_body_style />" <bx_injection:injection_body /> >
+        __injection_header__
         <bx_injection:injection_header />

+ 5 - 0
studio/template/scripts/BxBaseStudioFunctions.php

@@ -54,6 +54,11 @@ class BxBaseStudioFunctions extends BxBaseFunctions implements iBxDolSingleton
         $oTemplate->setPageContent ('page_main_code', $sHtml);
         $oTemplate->getPageCode();
     }
+
+    protected function getInjFooterPopupMenus() 
+    {
+        return '';
+    }
 }
 
 /** @} */

+ 1 - 1
template/_footer.html

@@ -1,4 +1,4 @@
-        __popup_loading__
+        __injection_footer__
        <bx_injection:injection_footer />
     </body>
 </html>

+ 2 - 2
template/_header.html

@@ -31,9 +31,9 @@
 
     __extra_js__
 
+    __injection_head__
     <bx_injection:injection_head />
-
 </head>
-
 <body class="bx-def-font bx-def-color-bg-page" dir="__lang_direction__" <bx_injection:injection_body /> >
+    __injection_header__
     <bx_injection:injection_header />

+ 4 - 2
template/page_2.html

@@ -18,10 +18,12 @@
 		__dol_lang__
 		__dol_options__
 
+        __injection_head__
 	    <bx_injection:injection_head />
 	</head>
 	<body class="bx-def-font bx-def-color-bg-page" dir="__lang_direction__" <bx_injection:injection_body /> >
-	    <bx_injection:injection_header />
-	    __page_main_code__
+		__injection_header__
+		<bx_injection:injection_header />
+		__page_main_code__
 	</body>
 </html>

+ 6 - 7
template/page_44.html

@@ -25,16 +25,15 @@
     </script>
     __extra_js__
 
+    __injection_head__
     <bx_injection:injection_head />
-
 </head>
-
 <body class="bx-def-font bx-def-color-bg-page" dir="__lang_direction__" <bx_injection:injection_body /> >
-    <bx_injection:injection_header />
-
-    <div class="bx-def-padding-sec">
-        __page_main_code__
-    </div>
+	__injection_header__
+	<bx_injection:injection_header />
 
+	<div class="bx-def-padding-sec">
+	    __page_main_code__
+	</div>
 </body>
 </html>

+ 52 - 0
template/scripts/BxBaseFunctions.php

@@ -401,6 +401,21 @@ class BxBaseFunctions extends BxDolFactory implements iBxDolSingleton
         return $sRet;
     }
 
+    function getInjectionHead() 
+    {
+        return $this->getInjection('getInjHead');
+    }
+
+    function getInjectionHeader() 
+    {
+        return $this->getInjection('getInjHeader');
+    }
+
+    function getInjectionFooter() 
+    {
+        return $this->getInjection('getInjFooter');
+    }
+
     /**
      * Output time wrapped in <time> tag in HTML.
      * Then time is autoformatted using JS upon page load, this is aumatically converted to user's timezone and
@@ -465,6 +480,43 @@ class BxBaseFunctions extends BxDolFactory implements iBxDolSingleton
                     ' . ($sUrlMP4  ? '<source type="video/mp4" src="' . $sUrlMP4 . '" />' : '') . '
                 </video>';
     }
+
+    protected function getInjection($sPrefix)
+    {
+        $sContent = '';
+
+        $aMethods = get_class_methods($this);
+        foreach($aMethods as $sMethod)
+            if(substr($sMethod, 0, strlen($sPrefix)) == $sPrefix)
+                $sContent .= $this->$sMethod();
+
+        return $sContent;
+    }
+
+    protected function getInjFooterPopupLoading() 
+    {
+        return $this->transBox('bx-popup-loading', $this->_oTemplate->parsePageByName('popup_loading.html', array()), true);  
+    }
+
+    protected function getInjFooterPopupMenus() 
+    {
+        $sContent = '';
+
+        $oSearch = new BxTemplSearch();
+        $oSearch->setLiveSearch(true);
+        $sContent .= $this->_oTemplate->parsePageByName('search.html', array(
+            'search_form' => $oSearch->getForm(BX_DB_CONTENT_ONLY),
+            'results' => $oSearch->getResultsContainer(),
+        ));
+
+        $sContent .= $this->_oTemplate->getMenu ('sys_site');
+        if(isLogged()) {
+            $sContent .= $this->_oTemplate->getMenu ('sys_add_content');
+            $sContent .= $this->_oTemplate->getMenu ('sys_account_popup');
+        }
+
+        return $sContent;
+    }
 }
 
 /** @} */