Added DAL entities

This commit is contained in:
Lukáš Plevač 2023-08-30 10:05:44 +02:00
parent 52d20f76a8
commit 2fc3c1fadc
27 changed files with 426 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "web/wsos"]
path = web/wsos
url = https://github.com/Lukas0025/wsos

View File

@ -0,0 +1,8 @@
$container = new \wsos\structs\container();
$templates = $container->get("templateLoader");
$context = $container->get("context");
$templates->load("info.html");
$templates->render($context);
$templates->show();

14
web/DAL/antenna.php Normal file
View File

@ -0,0 +1,14 @@
<?php
namespace DAL;
class antenna extends \wsos\database\core\row {
public \wsos\database\types\text $name; // YAGI, DISH, ...
public \wsos\database\types\text $description;
function __construct($id = null, $name = "", $description = "") {
parent::__construct($id);
$this->name = new \wsos\database\types\text($name);
$this->description = new \wsos\database\types\text($description);
}
}
?>

14
web/DAL/dataType.php Normal file
View File

@ -0,0 +1,14 @@
<?php
namespace DAL;
class dataType extends \wsos\database\core\row {
public \wsos\database\types\text $name; // MSR, TELEMETRY, ...
public \wsos\database\types\text $description;
function __construct($id = null, $name = "", $description = "") {
parent::__construct($id);
$this->name = new \wsos\database\types\text($name);
$this->description = new \wsos\database\types\text($description);
}
}
?>

14
web/DAL/modulation.php Normal file
View File

@ -0,0 +1,14 @@
<?php
namespace DAL;
class modulation extends \wsos\database\core\row {
public \wsos\database\types\text $name; // BPSK, QPSK, ...
public \wsos\database\types\text $description;
function __construct($id = null, $name = "", $description = "") {
parent::__construct($id);
$this->name = new \wsos\database\types\text($name);
$this->description = new \wsos\database\types\text($description);
}
}
?>

38
web/DAL/observation.php Normal file
View File

@ -0,0 +1,38 @@
<?php
namespace DAL;
class observation extends \wsos\database\core\row {
public \wsos\database\types\reference $transmitter; // observed trasmitter
public \wsos\database\types\reference $receiver; // used reciver
public \wsos\database\types\enum $status; // fail, planed, ...
public \wsos\database\types\text $record; // path to record
public \wsos\database\types\json $artefacts; // JSON array of artefacts
public \wsos\database\types\json $locator; // TLE, GPS or URL locator if avaible
function __construct(
$id = null,
$transmitter = null,
$receiver = null,
$status = "",
$record = "",
$artefacts = [],
$locator = ["tle" => null, "gps" => null, "url" => null]
) {
parent::__construct($id);
$this->transmitter = new \wsos\database\types\reference($transmitter, \DAL\transmitter::class);
$this->receiver = new \wsos\database\types\reference($receiver, \DAL\receiver::class);
$this->status = new \wsos\database\types\enum($status, [
"fail",
"success",
"recording",
"decoding",
"planed",
"unknow"
], "unknow");
$this->record = new \wsos\database\types\text($record);
$this->artefacts = new \wsos\database\types\json($artefacts);
$this->locator = new \wsos\database\types\json($locator);
}
}
?>

14
web/DAL/processPipe.php Normal file
View File

@ -0,0 +1,14 @@
<?php
namespace DAL;
class processPipe extends \wsos\database\core\row {
public \wsos\database\types\text $name;
public \wsos\database\types\json $pipe;
function __construct($id = null, $name = "", $pipe = []) {
parent::__construct($id);
$this->name = new \wsos\database\types\text($name);
$this->pipe = new \wsos\database\types\json($pipe);
}
}
?>

28
web/DAL/receiver.php Normal file
View File

@ -0,0 +1,28 @@
<?php
namespace DAL;
class receiver extends \wsos\database\core\row {
public \wsos\database\types\reference $station; // station with antena
public \wsos\database\types\reference $antenna; // YAGI, DISH, ....
public \wsos\database\types\integer $centerFrequency; // in Hz
public \wsos\database\types\integer $bandwidth; // in Hz
public \wsos\database\types\integer $gain; // gain of reciver setup
function __construct(
$id = null,
$station = null,
$antenna = null,
$centerFrequency = 0,
$bandwidth = 0,
$gain = 0
) {
parent::__construct($id);
$this->object = new \wsos\database\types\reference($station, \DAL\station::class);
$this->antenna = new \wsos\database\types\reference($antenna, \DAL\antenna::class);
$this->centerFrequency = new \wsos\database\types\integer($centerFrequency);
$this->bandwidth = new \wsos\database\types\integer($bandwidth);
$this->gain = new \wsos\database\types\integer($gain);
}
}
?>

17
web/DAL/station.php Normal file
View File

@ -0,0 +1,17 @@
<?php
namespace DAL;
class station extends \wsos\database\core\row {
public \wsos\database\types\text $name; // Satellite, ...
public \wsos\database\types\text $description;
public \wsos\database\types\json $locator;
function __construct($id = null, $name = "", $description = "", $locator = ["tle" => null, "gps" => null, "url" => null]) {
parent::__construct($id);
$this->name = new \wsos\database\types\text($name);
$this->description = new \wsos\database\types\text($description);
$this->locator = new \wsos\database\types\json($locator);
}
}
?>

19
web/DAL/target.php Normal file
View File

@ -0,0 +1,19 @@
<?php
namespace DAL;
class target extends \wsos\database\core\row {
public \wsos\database\types\text $name; // noaa19, jonHAM, ... , ...
public \wsos\database\types\reference $type; // sat, groundStation, ...
public \wsos\database\types\text $description;
public \wsos\database\types\json $locator; // TLE, GPS or URL locator if avaible
function __construct($id = null, $name = "", $type = null, $description = "", $locator = ["tle" => null, "gps" => null, "url" => null]) {
parent::__construct($id);
$this->name = new \wsos\database\types\text($name);
$this->type = new \wsos\database\types\reference($type, );
$this->description = new \wsos\database\types\text($description);
$this->locator = new \wsos\database\types\json($locator);
}
}
?>

14
web/DAL/targetsType.php Normal file
View File

@ -0,0 +1,14 @@
<?php
namespace DAL;
class targetType extends \wsos\database\core\row {
public \wsos\database\types\text $name; // Satellite, ...
public \wsos\database\types\text $description;
function __construct($id = null, $name = "", $description = "") {
parent::__construct($id);
$this->name = new \wsos\database\types\text($name);
$this->description = new \wsos\database\types\text($description);
}
}
?>

37
web/DAL/transmitter.php Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace DAL;
class transmitter extends \wsos\database\core\row {
public \wsos\database\types\reference $target; // object what hame this transmitter
public \wsos\database\types\reference $antenna; // YAGI, DISH, ....
public \wsos\database\types\reference $modulation; // BPSK, QPSK, AM, FM, ....
public \wsos\database\types\reference $dataType; // MSR, TELEMETRY, ....
public \wsos\database\types\reference $processPipe; // process pipe for transmitter
public \wsos\database\types\integer $centerFrequency; // in Hz
public \wsos\database\types\integer $bandwidth; // in Hz
public \wsos\database\types\boolean $autoPlan; // can be events autoplaned?
function __construct(
$id = null,
$object = null,
$antenna = null,
$modulation = null,
$dataType = null,
$centerFrequency = 0,
$bandwidth = 0,
$autoPlan = false,
$processPipe = null
) {
parent::__construct($id);
$this->object = new \wsos\database\types\reference($object, \DAL\object::class);
$this->antenna = new \wsos\database\types\reference($antenna, \DAL\antenna::class);
$this->modulation = new \wsos\database\types\reference($modulation, \DAL\modulation::class);
$this->dataType = new \wsos\database\types\reference($dataType, \DAL\dataType::class);
$this->object = new \wsos\database\types\reference($processPipe, \DAL\processPipe::class);
$this->centerFrequency = new \wsos\database\types\integer($centerFrequency);
$this->bandwidth = new \wsos\database\types\integer($bandwidth);
$this->autoPlan = new \wsos\database\types\boolean($autoPlan);
}
}
?>

20
web/DAL/user.php Normal file
View File

@ -0,0 +1,20 @@
<?php
namespace DAL;
class user extends \wsos\database\core\row {
public \wsos\database\types\text $userName;
public \wsos\database\types\text $realName;
public \wsos\database\types\password $pass;
public \wsos\database\types\boolean $admin;
public \wsos\database\types\json $radios;
function __construct($id = null, $userName = "", $realName = "", $password = "", $admin = false, $radios = []) {
parent::__construct($id);
$this->userName = new \wsos\database\types\text($userName);
$this->realName = new \wsos\database\types\text($realName);
$this->pass = new \wsos\database\types\password($password);
$this->admin = new \wsos\database\types\boolean($admin);
$this->radios = new \wsos\database\types\json($radios);
}
}
?>

View File

@ -0,0 +1,5 @@
<!-- CSS files -->
<link href="./dist/tabler/css/tabler.min.css?1668287865" rel="stylesheet"/>
<link href="./dist/tabler/css/tabler-flags.min.css?1668287865" rel="stylesheet"/>
<link href="./dist/tabler/css/tabler-payments.min.css?1668287865" rel="stylesheet"/>
<link href="./dist/tabler/css/tabler-vendors.min.css?1668287865" rel="stylesheet"/>

View File

@ -0,0 +1,28 @@
<header class="navbar navbar-expand-md navbar-light d-print-none">
<div class="container-xl">
<h1 class="navbar-brand navbar-brand-autodark d-none-navbar-horizontal pe-0 pe-md-3">
<a href=".">
<img src="{% BIND logo %}" width="110" height="32" alt="Tabler" class="navbar-brand-image">
</a>
</h1>
<div class="navbar-nav flex-row order-md-last">
<div class="nav-item dropdown">
<a href="#" class="nav-link d-flex lh-1 text-reset p-0 show" data-bs-toggle="dropdown" aria-label="Open user menu" aria-expanded="true">
<span class="avatar avatar-sm" style="background-image: url({% BIND user.img %})"></span>
<div class="d-none d-xl-block ps-2">
<div>{% BIND user.name %}</div>
<div class="mt-1 small text-muted">{% BIND user.info %}</div>
</div>
</a>
<div class="dropdown-menu dropdown-menu-end dropdown-menu-arrow show" data-bs-popper="static">
<a href="#" class="dropdown-item">Status</a>
<a href="#" class="dropdown-item">Profile</a>
<a href="#" class="dropdown-item">Feedback</a>
<div class="dropdown-divider"></div>
<a href="./settings.html" class="dropdown-item">Settings</a>
<a href="./sign-in.html" class="dropdown-item">Logout</a>
</div>
</div>
</div>
</div>
</header>

9
web/dist/css/tabler-flags.min.css vendored Normal file

File diff suppressed because one or more lines are too long

9
web/dist/css/tabler-flags.rtl.min.css vendored Normal file

File diff suppressed because one or more lines are too long

9
web/dist/css/tabler-payments.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

9
web/dist/css/tabler-vendors.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

14
web/dist/css/tabler.min.css vendored Normal file

File diff suppressed because one or more lines are too long

14
web/dist/css/tabler.rtl.min.css vendored Normal file

File diff suppressed because one or more lines are too long

15
web/dist/js/tabler.esm.min.js vendored Normal file

File diff suppressed because one or more lines are too long

15
web/dist/js/tabler.min.js vendored Normal file

File diff suppressed because one or more lines are too long

41
web/index.php Normal file
View File

@ -0,0 +1,41 @@
<?php
include __DIR__ . "/wsos/autoload.php";
include "DAL/user.php";
$container = new \wsos\structs\container();
$db = new \wsos\database\drivers\inAppArray();
$auth = new \wsos\auth\basic\manager(DAL\user::class, "userName", "pass", "/login");
//get current url
$url = $_SERVER['REQUEST_URI'];
// create Basic context
$context = [
"url" => $url,
"menu_items" => [
["url" => "/", "name" => "Dashboard"],
["url" => "/observations", "name" => "Observations"],
["url" => "/stations", "name" => "Stations"],
["url" => "/targets", "name" => "Targets"],
["url" => "/modulations", "name" => "Modulations"],
["url" => "/datatypes", "name" => "Data Types"],
],
"logined" => $auth->getActive()
];
// register containers
$container->register("DBDriver", $db);
$container->register("templateLoader", new wsos\templates\loader(__DIR__ . "/VIEWS"));
$container->register("context", $context);
$container->register("auth", $auth);
// seeds DB
// do not do this in release!!
include "seeds.php";
if ($url == "/") include "CONTROLLERS/dashboard.php";
else if ($url == "/observations") include "CONTROLLERS/observations.php";
else if ($url == "/stations") include "CONTROLLERS/stations.php";
else include "CONTROLLERS/404.php";
?>

0
web/seeds.php Normal file
View File