summaryrefslogtreecommitdiffstats
path: root/inc/module.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2016-06-17 15:45:21 +0200
committerSimon Rettberg2016-06-17 15:45:21 +0200
commitb0522a82ce65abb8309a9d9eefdce3186320444f (patch)
tree9c68e2759dce87a8eba69b923fa3823eec4dbc82 /inc/module.inc.php
parentMerge branch 'modularization' of git.openslx.org:openslx-ng/slx-admin into mo... (diff)
downloadslx-admin-b0522a82ce65abb8309a9d9eefdce3186320444f.tar.gz
slx-admin-b0522a82ce65abb8309a9d9eefdce3186320444f.tar.xz
slx-admin-b0522a82ce65abb8309a9d9eefdce3186320444f.zip
[render/modules] Include scripts/css in order according to dependencies
Diffstat (limited to 'inc/module.inc.php')
-rw-r--r--inc/module.inc.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/inc/module.inc.php b/inc/module.inc.php
index 58484f34..336d0a5b 100644
--- a/inc/module.inc.php
+++ b/inc/module.inc.php
@@ -95,11 +95,13 @@ class Module
public static function getActivated()
{
$ret = array();
+ $i = 0;
foreach (self::$modules as $module) {
- if ($module->activated) {
- $ret[] = $module;
+ if ($module->activated !== false) {
+ $ret[sprintf('%05d_%d', $module->activated, $i++)] = $module;
}
}
+ ksort($ret);
return $ret;
}
@@ -162,11 +164,11 @@ class Module
return new $class();
}
- public function activate()
+ public function activate($depth = 1)
{
- if ($this->activated || $this->depsMissing)
+ if ($this->activated !== false || $this->depsMissing)
return;
- $this->activated = true;
+ $this->activated = $depth;
spl_autoload_register(function($class) {
$file = 'modules/' . $this->name . '/inc/' . preg_replace('/[^a-z0-9]/', '', strtolower($class)) . '.inc.php';
if (!file_exists($file))
@@ -176,7 +178,7 @@ class Module
foreach ($this->dependencies as $dep) {
$get = self::get($dep);
if ($get !== false) {
- $get->activate();
+ $get->activate($depth + 1);
}
}
}