85 lines
1.6 KiB
PHP
Executable File
85 lines
1.6 KiB
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace mirzaev\arming_bot\controllers;
|
|
|
|
// Files of the project
|
|
use mirzaev\arming_bot\controllers\core,
|
|
mirzaev\arming_bot\models\menu;
|
|
|
|
// Framework for PHP
|
|
use mirzaev\minimal\http\enumerations\content;
|
|
|
|
/**
|
|
* Controller of pages
|
|
*
|
|
* @package mirzaev\arming_bot\controllers
|
|
* @param array $errors Registry of errors
|
|
*
|
|
* @method null offer() Public offer
|
|
*
|
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
|
*/
|
|
final class index extends core
|
|
{
|
|
/**
|
|
* Errors
|
|
*
|
|
* @var array $errors Registry of errors
|
|
*/
|
|
protected array $errors = [
|
|
'session' => [],
|
|
'account' => [],
|
|
'menu' => []
|
|
];
|
|
|
|
/**
|
|
* Public offer
|
|
*
|
|
* @return null
|
|
*/
|
|
public function offer(): null
|
|
{
|
|
if (isset($menu)) {
|
|
//
|
|
|
|
} else {
|
|
// Not received ... menu
|
|
|
|
// Search for filters and write to the buffer of global variables of view templater
|
|
$this->view->menu = menu::_read(
|
|
return: 'MERGE(d, { name: d.name.@language })',
|
|
sort: 'd.style.order ASC, d.created DESC, d._key DESC',
|
|
amount: 4,
|
|
parameters: ['language' => $this->language->name],
|
|
errors: $this->errors['menu']
|
|
);
|
|
}
|
|
|
|
if (str_contains($this->request->headers['accept'], content::any->value)) {
|
|
// Request for any response
|
|
|
|
// Render page
|
|
$page = $this->view->render('offer/page.html');
|
|
|
|
// Sending response
|
|
$this->response
|
|
->start()
|
|
->clean()
|
|
->sse()
|
|
->write($page)
|
|
->validate($this->request)
|
|
?->body()
|
|
->end();
|
|
|
|
// Deinitializing rendered page
|
|
unset($page);
|
|
}
|
|
|
|
// Exit (success/fail)
|
|
return null;
|
|
}
|
|
}
|