/**
  * create a /cache/appStart-unminified.js file. Grunt will handle the renaming of the file and the generation
  * of the /cache/minifiedResourcePaths.php file.
  */
 public static function createAppStartFile()
 {
     $exportTypes = Core::$exportTypePlugins;
     $exportTypeJSModules = ExportTypePluginHelper::getExportTypeJSResources($exportTypes, "string");
     $dataTypes = DataTypePluginHelper::getDataTypeList(Core::$dataTypePlugins);
     $dataTypeJSModules = DataTypePluginHelper::getDataTypeJSResources($dataTypes, "string");
     $js = 'require(["manager","generator","accountManager",' . $exportTypeJSModules . "," . $dataTypeJSModules . ',"pageInit"], function(manager) {manager.start(); });';
     $file = realpath(__DIR__ . "/../../cache/") . "/appStartGenerated.js";
     if (is_file($file)) {
         unlink($file);
     }
     if (file_put_contents($file, $js)) {
         return true;
     } else {
         return false;
     }
 }
Example #2
0
Core::init();
// if need be, redirect to the install instructions page
Utils::maybeShowInstallationPage();
if (!Core::checkIsLoggedIn() && !Core::checkAllowMultiUserAnonymousUse()) {
    header("location: login.php#t1");
    exit;
}
// start piecing together all the various info we need to pass to the page
$pageParams = array();
$settings = Settings::getSettings();
$exportTypes = Core::$exportTypePlugins;
$exportTypeAdditionalSettings = ExportTypePluginHelper::getExportTypeAdditionalSettingsHTML($exportTypes);
$dataTypes = DataTypePluginHelper::getDataTypeList(Core::$dataTypePlugins);
$exportTypeJSModules = ExportTypePluginHelper::getExportTypeJSResources($exportTypes, "string");
$exportTypeCssIncludes = ExportTypePluginHelper::getExportTypeCSSIncludes($exportTypes);
$dataTypeJSModules = DataTypePluginHelper::getDataTypeJSResources($dataTypes, "string");
$dataTypeCssIncludes = DataTypePluginHelper::getDataTypeCSSIncludes($dataTypes);
$cssIncludes = $exportTypeCssIncludes . "\n" . $dataTypeCssIncludes;
// used in the settings page
$pageParams["allCountryPlugins"] = Core::$countryPlugins;
$pageParams["allExportTypes"] = $exportTypes;
$pageParams["groupedDataTypes"] = Core::$dataTypePlugins;
$pageParams["allDataTypes"] = $dataTypes;
$pageParams["allTranslations"] = Core::$translations->getList();
$useMinifiedResources = Core::isUsingMinifiedResources();
$pageParams["useMinifiedResources"] = $useMinifiedResources;
if ($useMinifiedResources) {
    $pageParams["minifiedResourcePaths"] = Minification::getMinifiedResourcePaths();
}
$pageParams["dataTypeJSModules"] = $dataTypeJSModules;
$pageParams["exportTypeJSModules"] = $exportTypeJSModules;