summaryrefslogtreecommitdiffstats
path: root/modules/main.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2014-05-19 15:30:59 +0200
committerSimon Rettberg2014-05-19 15:30:59 +0200
commitf6ceaa03052e6878afd53a4bbb7f4429849fe25a (patch)
tree9f5582c8c275494728f6d6dcf656479714688934 /modules/main.inc.php
parentWorking on config.tgz composition through config modules (diff)
downloadslx-admin-f6ceaa03052e6878afd53a4bbb7f4429849fe25a.tar.gz
slx-admin-f6ceaa03052e6878afd53a4bbb7f4429849fe25a.tar.xz
slx-admin-f6ceaa03052e6878afd53a4bbb7f4429849fe25a.zip
OO style modules
Diffstat (limited to 'modules/main.inc.php')
-rw-r--r--modules/main.inc.php47
1 files changed, 27 insertions, 20 deletions
diff --git a/modules/main.inc.php b/modules/main.inc.php
index 24f519c6..3b35ad53 100644
--- a/modules/main.inc.php
+++ b/modules/main.inc.php
@@ -1,27 +1,34 @@
<?php
-User::load();
-
-function render_module()
+class Page_Main extends Page
{
- // Render::setTitle('abc');
-
- if (!User::isLoggedIn()) {
- Render::addTemplate('page-main-guest');
- return;
+
+ protected function doPreprocess()
+ {
+ User::load();
}
- // Logged in here
- $ipxe = true;
- $file = CONFIG_IPXE_DIR . '/last-ip';
- if (file_exists($file)) {
- $last = file_get_contents($file);
- exec('/bin/ip a', $ips);
- foreach ($ips as $ip) {
- if (preg_match("#inet $last/\d+.*scope#", $ip)) $ipxe = false;
+
+ protected function doRender()
+ {
+ // Render::setTitle('abc');
+
+ if (!User::isLoggedIn()) {
+ Render::addTemplate('page-main-guest');
+ return;
}
+ // Logged in here
+ $ipxe = true;
+ $file = CONFIG_IPXE_DIR . '/last-ip';
+ if (file_exists($file)) {
+ $last = file_get_contents($file);
+ exec('/bin/ip a', $ips);
+ foreach ($ips as $ip) {
+ if (preg_match("#inet $last/\d+.*scope#", $ip)) $ipxe = false;
+ }
+ }
+ $sysconfig = !file_exists(CONFIG_HTTP_DIR . '/default/config.tgz');
+ $minilinux = !file_exists(CONFIG_HTTP_DIR . '/default/kernel') || !file_exists(CONFIG_HTTP_DIR . '/default/initramfs-stage31') || !file_exists(CONFIG_HTTP_DIR . '/default/stage32.sqfs');
+ Render::addTemplate('page-main', array('user' => User::getName(), 'ipxe' => $ipxe, 'sysconfig' => $sysconfig, 'minilinux' => $minilinux));
}
- $sysconfig = !file_exists(CONFIG_HTTP_DIR . '/default/config.tgz');
- $minilinux = !file_exists(CONFIG_HTTP_DIR . '/default/kernel') || !file_exists(CONFIG_HTTP_DIR . '/default/initramfs-stage31') || !file_exists(CONFIG_HTTP_DIR . '/default/stage32.sqfs');
- Render::addTemplate('page-main', array('user' => User::getName(), 'ipxe' => $ipxe, 'sysconfig' => $sysconfig, 'minilinux' => $minilinux));
-}
+}