web-base/core/Views/Account/AccountView.class.php

61 lines
1.8 KiB
PHP
Raw Normal View History

2020-07-01 22:13:50 +02:00
<?php
namespace Views\Account;
use Elements\Document;
use Elements\View;
abstract class AccountView extends View {
protected string $description;
2020-07-01 23:07:00 +02:00
protected string $icon;
2020-07-01 22:13:50 +02:00
public function __construct(Document $document, $loadView = true) {
parent::__construct($document, $loadView);
$this->description = "";
2020-07-01 23:07:00 +02:00
$this->icon = "image";
2020-07-01 22:13:50 +02:00
}
2020-07-02 00:59:55 +02:00
public function loadView() {
parent::loadView();
$document = $this->getDocument();
$settings = $document->getUser()->getConfiguration()->getSettings();
if ($settings->isRecaptchaEnabled()) {
$document->getHead()->loadGoogleRecaptcha($settings->getRecaptchaSiteKey());
}
}
2020-07-01 22:13:50 +02:00
public function getCode() {
$html = parent::getCode();
$content = $this->getAccountContent();
2020-07-01 23:07:00 +02:00
$icon = $this->createIcon($this->icon, "fas", "fa-3x");
2020-07-01 22:13:50 +02:00
$html .= "<div class=\"container mt-5\">
<div class=\"row\">
<div class=\"col-md-4 py-5 bg-primary text-white text-center\" style='border-top-left-radius:.4em;border-bottom-left-radius:.4em'>
<div class=\"card-body\">
$icon
<h2 class=\"py-3\">$this->title</h2>
<p>$this->description</p>
</div>
</div>
<div class=\"col-md-8 pt-5 pb-2 border border-info\" style='border-top-right-radius:.4em;border-bottom-right-radius:.4em'>
$content
<div class='alert mt-2' style='display:none' id='alertMessage'></div>
</div>
</div>
</div>";
2020-07-02 00:59:55 +02:00
$settings = $this->getDocument()->getUser()->getConfiguration()->getSettings();
if ($settings->isRecaptchaEnabled()) {
$siteKey = $settings->getRecaptchaSiteKey();
$html .= "<input type='hidden' value='$siteKey' id='siteKey' />";
}
2020-07-01 22:13:50 +02:00
return $html;
}
protected abstract function getAccountContent();
}