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

74 lines
1.8 KiB
PHP
Raw Normal View History

2020-06-20 15:49:53 +02:00
<?php
namespace Documents {
use Documents\Account\AccountBody;
use Documents\Account\AccountHead;
use Elements\Document;
use Objects\User;
class Account extends Document {
public function __construct(User $user, ?string $view) {
parent::__construct($user, AccountHead::class, AccountBody::class, $view);
}
}
}
namespace Documents\Account {
use Elements\Head;
2021-11-11 14:25:26 +01:00
use Elements\Link;
2020-07-01 22:13:50 +02:00
use Elements\Script;
2020-06-20 15:49:53 +02:00
use Elements\SimpleBody;
class AccountHead extends Head {
public function __construct($document) {
parent::__construct($document);
}
protected function initSources() {
2020-07-01 22:13:50 +02:00
$this->loadJQuery();
$this->addJS(Script::CORE);
$this->addJS(Script::ACCOUNT);
$this->loadBootstrap();
$this->loadFontawesome();
2021-11-11 14:25:26 +01:00
$this->addCSS(Link::CORE);
2020-06-20 15:49:53 +02:00
}
2021-04-02 21:58:06 +02:00
protected function initMetas(): array {
2020-07-01 22:13:50 +02:00
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'),
);
2020-06-20 15:49:53 +02:00
}
2021-04-02 21:58:06 +02:00
protected function initRawFields(): array {
2020-06-20 15:49:53 +02:00
return array();
}
2021-04-02 21:58:06 +02:00
protected function initTitle(): string {
2020-06-20 15:49:53 +02:00
return "Account";
}
}
class AccountBody extends SimpleBody {
public function __construct($document) {
parent::__construct($document);
}
2021-04-02 21:58:06 +02:00
protected function getContent(): string {
2020-07-01 22:13:50 +02:00
2020-06-20 15:49:53 +02:00
$view = $this->getDocument()->getView();
if ($view === null) {
return "The page you does not exist or is no longer valid. <a href='/'>Return to start page</a>";
}
return $view->getCode();
}
}
}