|
@@ -229,4 +229,14 @@ class UI {
|
|
|
return number_format($value, 2, $dec, ' ');
|
|
return number_format($value, 2, $dec, ' ');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static function inlineJS($jsFile, $jsonVars = []) {
|
|
|
|
|
+ if (!file_exists($jsFile)) throw new Exception("js file '" . basename($jsFile) . "' not exists!");
|
|
|
|
|
+ UI::startTag('script', [], "\n");
|
|
|
|
|
+ foreach ($jsonVars as $name => $var) {
|
|
|
|
|
+ echo "var {$name} = " . json_encode($var) . ";\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ include $jsFile;
|
|
|
|
|
+ UI::endTag('script', "\n");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|