web-base/core/Documents/Admin.class.php

79 lines
1.8 KiB
PHP
Raw Normal View History

2020-02-10 00:52:25 +01:00
<?php
namespace Documents {
2020-04-03 15:56:04 +02:00
use Documents\Admin\AdminBody;
use Documents\Admin\AdminHead;
use Elements\Document;
class Admin extends Document {
2020-02-10 00:52:25 +01:00
public function __construct($user) {
2020-04-03 15:56:04 +02:00
parent::__construct($user, AdminHead::class, AdminBody::class);
2020-02-10 00:52:25 +01:00
}
}
}
namespace Documents\Admin {
2020-04-03 15:56:04 +02:00
use Elements\Body;
use Elements\Head;
use Elements\Link;
use Elements\Script;
use Views\Admin;
use Views\Login;
class AdminHead extends Head {
2020-02-10 00:52:25 +01:00
public function __construct($document) {
parent::__construct($document);
}
protected function initSources() {
$this->loadJQuery();
$this->loadBootstrap();
$this->loadFontawesome();
2020-04-03 15:56:04 +02:00
$this->addJS(Script::CORE);
$this->addCSS(Link::CORE);
$this->addJS(Script::ADMIN);
$this->addCSS(Link::ADMIN);
2020-02-10 00:52:25 +01:00
}
protected function initMetas() {
return array(
array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0'),
array('name' => 'format-detection', 'content' => 'telephone=yes'),
array('charset' => 'utf-8'),
array("http-equiv" => 'expires', 'content' => '0'),
array("name" => 'robots', 'content' => 'noarchive'),
);
}
protected function initRawFields() {
return array();
}
protected function initTitle() {
return "WebBase - Administration";
}
}
2020-04-03 15:56:04 +02:00
class AdminBody extends Body {
2020-02-10 00:52:25 +01:00
public function __construct($document) {
parent::__construct($document);
}
public function getCode() {
$html = parent::getCode();
$document = $this->getDocument();
if(!$document->getUser()->isLoggedIn()) {
2020-04-03 15:56:04 +02:00
$html .= new Login($document);
2020-02-10 00:52:25 +01:00
} else {
2020-04-03 15:56:04 +02:00
$html .= new Admin($document);
2020-02-10 00:52:25 +01:00
}
return $html;
}
}
2020-04-03 15:56:04 +02:00
}