summaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authorSimon Rettberg2014-06-05 20:40:34 +0200
committerSimon Rettberg2014-06-05 20:40:34 +0200
commita9057c94f4e423057222e6f6db3883cbce5017d7 (patch)
tree146d8cccc1693cf05855f7c7d2a33b923820c5b5 /inc
parentMerge branch 'master' of dnbd3:openslx-ng/slx-admin (diff)
downloadslx-admin-a9057c94f4e423057222e6f6db3883cbce5017d7.tar.gz
slx-admin-a9057c94f4e423057222e6f6db3883cbce5017d7.tar.xz
slx-admin-a9057c94f4e423057222e6f6db3883cbce5017d7.zip
Add functions to add script includes to the beginning or end of the document to Render class
Diffstat (limited to 'inc')
-rw-r--r--inc/render.inc.php34
1 files changed, 33 insertions, 1 deletions
diff --git a/inc/render.inc.php b/inc/render.inc.php
index 6c746c93..9bea4639 100644
--- a/inc/render.inc.php
+++ b/inc/render.inc.php
@@ -18,6 +18,7 @@ class Render
private static $mustache = false;
private static $body = '';
private static $header = '';
+ private static $footer = '';
private static $title = '';
private static $templateCache = array();
private static $tags = array();
@@ -66,7 +67,10 @@ class Render
<script src="script/bootstrap.min.js"></script>
<script src="script/bootstrap-tagsinput.min.js"></script>
<script src="script/taskmanager.js"></script>
- </html>'
+ ',
+ self::$footer
+ ,
+ '</html>'
;
if ($zip) {
Header('Content-Encoding: gzip');
@@ -95,6 +99,34 @@ class Render
}
/**
+ * Add raw html data to the footer-section of the generated page (after the closing body tag)
+ */
+ public static function addFooter($html)
+ {
+ self::$footer .= $html . "\n";
+ }
+
+ /**
+ * Add given js script file from the script directory to the header
+ *
+ * @param string $file file name of script
+ */
+ public static function addScriptTop($file)
+ {
+ self::addHeader('<script src="script/' . $file . '.js"></script>');
+ }
+
+ /**
+ * Add given js script file from the script directory to the bottom
+ *
+ * @param string $file file name of script
+ */
+ public static function addScriptBottom($file)
+ {
+ self::addFooter('<script src="script/' . $file . '.js"></script>');
+ }
+
+ /**
* Add the given template to the output, using the given params for placeholders in the template
*/
public static function addTemplate($template, $params = false)