diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e6437db --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3.8' +services: + RadioMasterWeb: + image: radiomasterphp + build: ./web + volumes: + - ./web:/var/www/html/ + ports: + - 8000:80 + +# RadioMasterDb: +# \ No newline at end of file diff --git a/web/.htaccess b/web/.htaccess new file mode 100644 index 0000000..f2b5913 --- /dev/null +++ b/web/.htaccess @@ -0,0 +1,4 @@ +RewriteEngine on +RewriteBase / +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^(.*)$ /index.php [L,QSA] \ No newline at end of file diff --git a/web/CONTROLERS/dashboard.php b/web/CONTROLERS/dashboard.php deleted file mode 100644 index 79b1da9..0000000 --- a/web/CONTROLERS/dashboard.php +++ /dev/null @@ -1,8 +0,0 @@ -$container = new \wsos\structs\container(); - -$templates = $container->get("templateLoader"); -$context = $container->get("context"); - -$templates->load("info.html"); -$templates->render($context); -$templates->show(); \ No newline at end of file diff --git a/web/CONTROLLERS/dashboard.php b/web/CONTROLLERS/dashboard.php new file mode 100644 index 0000000..a6fdb94 --- /dev/null +++ b/web/CONTROLLERS/dashboard.php @@ -0,0 +1,33 @@ +get("templateLoader"); + $context = $container->get("context"); + $auth = $container->get("auth"); + + // to show this page user must be logined + $auth->requireLogin(); + + $context["successCount"] = 75; + $context["planedCount"] = 15; + $context["lastPlaned"] = 2; + $context["failCount"] = 5; + $context["observationsCount"] = 5; + + // create planed template observations + $planed = new \DAL\observation(); + $planed->status->set("planed"); + + $observationsTable = new \wsos\database\core\table(\DAL\observation::class); + $planedTable = $observationsTable->query("status=?", [$planed->status->value]); + + $observationsLocators = new \wsos\structs\vector(); + foreach($planedTable->values as $obs) { + $observationsLocators->append($obs->locator->get()); + } + + $context["planedLocators"] = json_encode($observationsLocators->values); + + $templates->load("dashboard.html"); + $templates->render($context); + $templates->show(); \ No newline at end of file diff --git a/web/CONTROLLERS/login.php b/web/CONTROLLERS/login.php new file mode 100644 index 0000000..36d509a --- /dev/null +++ b/web/CONTROLLERS/login.php @@ -0,0 +1,31 @@ +get("templateLoader"); + $context = $container->get("context"); + $auth = $container->get("auth"); + + //add basic info to context + $context["pagename"] = "login"; + $context["fail"] = false; + $context["failInfo"] = []; + + //pass login + if (isset($_POST["username"]) && isset($_POST["password"])) { + + if ($auth->login($_POST["username"], $_POST["password"])) { + header("Location: /"); + die("logined"); + } + + $context["fail"] = true; + $context["failInfo"] = [ + "title" => "Login failed!", + "description" => "Login failed because the user does not exist or the correct password was not used. Please try again." + ]; + } + + $templates->load("login.html"); + $templates->render($context); + $templates->show(); +?> \ No newline at end of file diff --git a/web/CONTROLLERS/observations.php b/web/CONTROLLERS/observations.php new file mode 100644 index 0000000..d6b216f --- /dev/null +++ b/web/CONTROLLERS/observations.php @@ -0,0 +1,15 @@ +get("templateLoader"); + $context = $container->get("context"); + $auth = $container->get("auth"); + + // to show this page user must be logined + $auth->requireLogin(); + + $context["observations"] = new \wsos\database\core\table(\DAL\observation::class); + + $templates->load("observations.html"); + $templates->render($context); + $templates->show(); \ No newline at end of file diff --git a/web/DAL/receiver.php b/web/DAL/receiver.php index 13bd9e9..07b0d64 100644 --- a/web/DAL/receiver.php +++ b/web/DAL/receiver.php @@ -17,7 +17,7 @@ $gain = 0 ) { parent::__construct($id); - $this->object = new \wsos\database\types\reference($station, \DAL\station::class); + $this->station = 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); diff --git a/web/DAL/station.php b/web/DAL/station.php index c1aeb57..77026fd 100644 --- a/web/DAL/station.php +++ b/web/DAL/station.php @@ -6,7 +6,7 @@ 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]) { + function __construct($id = null, $name = "", $description = "", $locator = []) { parent::__construct($id); $this->name = new \wsos\database\types\text($name); $this->description = new \wsos\database\types\text($description); diff --git a/web/DAL/target.php b/web/DAL/target.php index 4f84ed4..232cf2e 100644 --- a/web/DAL/target.php +++ b/web/DAL/target.php @@ -7,10 +7,10 @@ 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]) { + function __construct($id = null, $name = "", $type = null, $description = "", $locator = []) { parent::__construct($id); $this->name = new \wsos\database\types\text($name); - $this->type = new \wsos\database\types\reference($type, ); + $this->type = new \wsos\database\types\reference($type, \DAL\targetType::class); $this->description = new \wsos\database\types\text($description); $this->locator = new \wsos\database\types\json($locator); diff --git a/web/DAL/targetsType.php b/web/DAL/targetType.php similarity index 100% rename from web/DAL/targetsType.php rename to web/DAL/targetType.php diff --git a/web/DAL/transmitter.php b/web/DAL/transmitter.php index eded62a..459a67a 100644 --- a/web/DAL/transmitter.php +++ b/web/DAL/transmitter.php @@ -13,7 +13,7 @@ function __construct( $id = null, - $object = null, + $target = null, $antenna = null, $modulation = null, $dataType = null, @@ -23,11 +23,11 @@ $processPipe = null ) { parent::__construct($id); - $this->object = new \wsos\database\types\reference($object, \DAL\object::class); + $this->target = new \wsos\database\types\reference($target, \DAL\target::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->processPipe = 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); diff --git a/web/Dockerfile b/web/Dockerfile new file mode 100644 index 0000000..0d701a2 --- /dev/null +++ b/web/Dockerfile @@ -0,0 +1,3 @@ +FROM php:7-apache + +RUN a2enmod rewrite \ No newline at end of file diff --git a/web/VIEWS/blocks/alert-danger.html b/web/VIEWS/blocks/alert-danger.html new file mode 100644 index 0000000..3e4ee41 --- /dev/null +++ b/web/VIEWS/blocks/alert-danger.html @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/web/VIEWS/blocks/nav-item.html b/web/VIEWS/blocks/nav-item.html new file mode 100644 index 0000000..82c1d9c --- /dev/null +++ b/web/VIEWS/blocks/nav-item.html @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/web/VIEWS/blocks/observation-item.html b/web/VIEWS/blocks/observation-item.html new file mode 100644 index 0000000..319245a --- /dev/null +++ b/web/VIEWS/blocks/observation-item.html @@ -0,0 +1,18 @@ + + {% BIND item.receiver.station.name %} + {% BIND item.transmitter.target.name %} + {% BIND item.transmitter.modulation.name %} + {% BIND item.transmitter.dataType.name %} + {% BIND item.transmitter.centerFrequency %}Hz + + {% BIND item.status %} + + {% BIND item.start %} + {% BIND item.end %} + \ No newline at end of file diff --git a/web/VIEWS/dashboard.html b/web/VIEWS/dashboard.html new file mode 100644 index 0000000..495a445 --- /dev/null +++ b/web/VIEWS/dashboard.html @@ -0,0 +1,594 @@ + + + {% INCLUDE layout/head.html %} + +
+ {% BINDINCLUDE layout/header.html logined %} + + + +
+
+
+ +
+
+
+
+
Success
+
+ Last 7 days +
+
+
{% BIND successCount %}
+
+
+
+ +
+
+
+
+
Fail
+
+ Last 7 days +
+
+
{% BIND failCount %}
+
+
+
+ +
+
+
+
+
Planed
+
+ For {% BIND lastPlaned %} days +
+
+
{% BIND planedCount %}
+
+
+
+ +
+
+
+
+
all
+
+ Last 7 days +
+
+
{% BIND observationsCount %}
+
+
+
+ +
+ +
+ +
+
+
+
+
+

Using Storage 6854.45 MB of 8 GB

+
+
+
+
+
+
+
+ + Regular + 915MB +
+
+ + System + 415MB +
+
+ + Shared + 201MB +
+
+ + Free + 612MB +
+
+
+
+
+ +
+
+
+
+
+
Planed targets map
+
+
+
+ +
+ + +
+
+
+ + + +
+
+
+

Social Media Traffic

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NetworkVisitors
Instagram3,550 +
+
+
+
Twitter1,798 +
+
+
+
Facebook1,245 +
+
+
+
TikTok986 +
+
+
+
Pinterest854 +
+
+
+
VK650 +
+
+
+
Pinterest420 +
+
+
+
+
+
+ +
+
+
+

Invoices

+
+
+
+
+ Show +
+ +
+ entries +
+
+ Search: +
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
No. + + Invoice SubjectClientVAT No.CreatedStatusPrice
001401Design Works + + Carlson Limited + + 87956621 + + 15 Dec 2017 + + Paid + $887 + + + + +
001402UX Wireframes + + Adobe + + 87956421 + + 12 Apr 2017 + + Pending + $1200 + + + + +
001403New Dashboard + + Bluewolf + + 87952621 + + 23 Oct 2017 + + Pending + $534 + + + + +
001404Landing Page + + Salesforce + + 87953421 + + 2 Sep 2017 + + Due in 2 Weeks + $1500 + + + + +
001405Marketing Templates + + Printic + + 87956621 + + 29 Jan 2018 + + Paid Today + $648 + + + + +
001406Sales Presentation + + Tabdaq + + 87956621 + + 4 Feb 2018 + + Due in 3 Weeks + $300 + + + + +
001407Logo & Print + + Apple + + 87956621 + + 22 Mar 2018 + + Paid Today + $2500 + + + + +
001408Icons + + Tookapic + + 87956621 + + 13 May 2018 + + Paid Today + $940 + + + + +
+
+ +
+
+
+
+
+ + + +
+ + \ No newline at end of file diff --git a/web/VIEWS/layout/head.html b/web/VIEWS/layout/head.html index b2332cb..4e00440 100644 --- a/web/VIEWS/layout/head.html +++ b/web/VIEWS/layout/head.html @@ -1,5 +1,28 @@ - - - - - \ No newline at end of file + + + + + + {% BIND pagename %} - RadioMaster + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/web/VIEWS/layout/header.html b/web/VIEWS/layout/header.html index c98a566..57a62db 100644 --- a/web/VIEWS/layout/header.html +++ b/web/VIEWS/layout/header.html @@ -8,21 +8,38 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/web/VIEWS/login.html b/web/VIEWS/login.html new file mode 100644 index 0000000..1443af7 --- /dev/null +++ b/web/VIEWS/login.html @@ -0,0 +1,44 @@ + + + {% INCLUDE layout/head.html %} + +
+
+
+ + Tabler + +
+
+
+

Login to your account

+ + {% IF fail==true USE BINDINCLUDE blocks/alert-danger.html failInfo %} + +
+
+ + +
+
+ +
+ +
+
+
+ +
+
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/web/VIEWS/observations.html b/web/VIEWS/observations.html new file mode 100644 index 0000000..e68a5db --- /dev/null +++ b/web/VIEWS/observations.html @@ -0,0 +1,63 @@ + + + {% INCLUDE layout/head.html %} + +
+ {% BINDINCLUDE layout/header.html logined %} + + + +
+
+
+ + +
+
+
+

Planed, Successed and Faild

+
+
+ + + + + + + + + + + + + + + {% FOREACH observations RENDER blocks/observation-item.html %} + +
StationTargetModulationTypeFrequencyStatusStartEnd
+
+
+
+
+
+
+ + + +
+ + \ No newline at end of file diff --git a/web/dist/js/satellite.min.js b/web/dist/js/satellite.min.js new file mode 100644 index 0000000..4d2bdf7 --- /dev/null +++ b/web/dist/js/satellite.min.js @@ -0,0 +1,8 @@ +/*! + * satellite-js v4.0.0 + * (c) 2013 Shashwat Kandadai and UCSC + * https://github.com/shashwatak/satellite-js + * License: MIT + */ + +!function(o,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(o=o||self).satellite=t()}(this,function(){"use strict";var Ho=Math.PI,Yo=2*Ho,m=Ho/180,t=180/Ho,o=398600.5,Ao=6378.137,Bo=60/Math.sqrt(Ao*Ao*Ao/o),zo=Ao*Bo/60,p=1/Bo,Co=.00108262998905,s=-253215306e-14,Uo=-161098761e-14,Do=s/Co,Jo=2/3;function l(o,t){for(var s=[31,o%4==0?29:28,31,30,31,30,31,31,30,31,30,31],e=Math.floor(t),a=1,n=0;n+s[a-1]Ho&&(so $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"], + ["url" => "/", "name" => "Dashboard", "icon" => "/static/icons/dashboard.svg"], + ["url" => "/observations", "name" => "Observations", "icon" => "/static/icons/telescope.svg"], + ["url" => "/stations", "name" => "Stations", "icon" => "/static/icons/radio.svg"], + ["url" => "/targets", "name" => "Targets", "icon" => "/static/icons/focus-2.svg"], + ["url" => "/modulations", "name" => "Modulations", "icon" => "/static/icons/wave-sine.svg"], + ["url" => "/datatypes", "name" => "Data Types", "icon" => "/static/icons/file-analytics.svg"], ], "logined" => $auth->getActive() @@ -34,8 +37,9 @@ // 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"; + if ($url == "/") include __DIR__ . "/CONTROLLERS/dashboard.php"; + else if ($url == "/observations") include __DIR__ . "/CONTROLLERS/observations.php"; + else if ($url == "/stations") include __DIR__ . "/CONTROLLERS/stations.php"; + else if ($url == "/login") include __DIR__ . "/CONTROLLERS/login.php"; + else include __DIR__ . "/CONTROLLERS/404.php"; ?> \ No newline at end of file diff --git a/web/seeds.php b/web/seeds.php index e69de29..f43a721 100644 --- a/web/seeds.php +++ b/web/seeds.php @@ -0,0 +1,96 @@ +userName->set("admin"); + $admin->pass->set("admin"); + $admin->admin->set(true); + $admin->commit(); /* commit changes to DB */ + + $satType = new \DAL\targetType(); + $satType->name->set("sat"); + $satType->commit(); + + $wetImgType = new \DAL\dataType(); + $wetImgType->name->set("weather photo"); + $wetImgType->commit(); + + + /** + * Test station + */ + $myStation = new \DAL\station(); + $myStation->name->set("Medlánky"); + $myStation->commit(); + + $myStation137 = new \DAL\receiver(); + $myStation137->station->set($myStation); + $myStation137->commit(); + + /** + * NOAA modulations + */ + + $fm = new \DAL\modulation(); + $fm->name->set("FM"); + $fm->commit(); + + + /** + * NOAA 19 + */ + $noaa19 = new \DAL\target(); + $noaa19->name->set("NOAA 19"); + $noaa19->type->set($satType); + $noaa19->description->set("NOAA 19 is the fifth in a series of five Polar-orbiting Operational Environmental Satellites (POES) with advanced microwave sounding instruments that provide imaging and sounding capabilities."); + $noaa19->locator->set([ + "tle" => "NOAA 19\n1 33591U 09005A 23243.18101660 .00000207 00000-0 13587-3 0 9998\n2 33591 99.0938 290.2850 0014342 35.8617 324.3514 14.12812127750532" + ]); + $noaa19->commit(); + + $noaa19APT = new \DAL\transmitter(); + $noaa19APT->target->set($noaa19); + $noaa19APT->dataType->set($wetImgType); + $noaa19APT->bandwidth->set(100); + $noaa19APT->centerFrequency->set(137100000); + $noaa19APT->modulation->set($fm); + $noaa19APT->commit(); + + /** + * NOAA 18 + */ + $noaa18 = new \DAL\target(); + $noaa18->name->set("NOAA 18"); + $noaa18->type->set($satType); + $noaa18->description->set("NOAA 18, known before launch as NOAA-N, is a weather forecasting satellite run by NOAA. NOAA-N (18) was launched into a sun-synchronous orbit at an altitude of 854 km above the Earth, with an orbital period of 102 minutes. It hosts the AMSU-A, MHS, AVHRR, Space Environment Monitor SEM/2 instrument and High Resolution Infrared Radiation Sounder (HIRS) instruments, as well as the SBUV/2 ozone-monitoring instrument."); + $noaa18->locator->set([ + "tle" => "NOAA 18\n1 28654U 05018A 23250.34978256 .00000271 00000-0 16921-3 0 9997\n2 28654 98.9045 324.3258 0015006 144.5825 215.6347 14.13000434943172" + ]); + $noaa18->commit(); + + $noaa18APT = new \DAL\transmitter(); + $noaa18APT->target->set($noaa18); + $noaa18APT->dataType->set($wetImgType); + $noaa18APT->bandwidth->set(100); + $noaa18APT->centerFrequency->set(137912500); + $noaa18APT->modulation->set($fm); + $noaa18APT->commit(); + + + /** + * Plan observation + */ + $noaa19Plan = new \DAL\observation(); + $noaa19Plan->status->set("planed"); + $noaa19Plan->locator->set($noaa19->locator->get()); + $noaa19Plan->transmitter->set($noaa19APT); + $noaa19Plan->receiver->set($myStation137); + $noaa19Plan->commit(); + + $noaa18Plan = new \DAL\observation(); + $noaa18Plan->status->set("planed"); + $noaa18Plan->locator->set($noaa18->locator->get()); + $noaa18Plan->transmitter->set($noaa18APT); + $noaa18Plan->receiver->set($myStation137); + $noaa18Plan->commit(); \ No newline at end of file diff --git a/web/static/icons/antenna.svg b/web/static/icons/antenna.svg new file mode 100644 index 0000000..13545c8 --- /dev/null +++ b/web/static/icons/antenna.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/web/static/icons/dashboard.svg b/web/static/icons/dashboard.svg new file mode 100644 index 0000000..14a9b32 --- /dev/null +++ b/web/static/icons/dashboard.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/web/static/icons/file-analytics.svg b/web/static/icons/file-analytics.svg new file mode 100644 index 0000000..e9f19c4 --- /dev/null +++ b/web/static/icons/file-analytics.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/web/static/icons/focus-2.svg b/web/static/icons/focus-2.svg new file mode 100644 index 0000000..9f66b5e --- /dev/null +++ b/web/static/icons/focus-2.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/web/static/icons/radio.svg b/web/static/icons/radio.svg new file mode 100644 index 0000000..3189074 --- /dev/null +++ b/web/static/icons/radio.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/web/static/icons/satellite.svg b/web/static/icons/satellite.svg new file mode 100644 index 0000000..2d639fd --- /dev/null +++ b/web/static/icons/satellite.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/web/static/icons/telescope.svg b/web/static/icons/telescope.svg new file mode 100644 index 0000000..293d906 --- /dev/null +++ b/web/static/icons/telescope.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/web/static/icons/user.svg b/web/static/icons/user.svg new file mode 100644 index 0000000..7061db9 --- /dev/null +++ b/web/static/icons/user.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/web/static/icons/wave-sine.svg b/web/static/icons/wave-sine.svg new file mode 100644 index 0000000..a318081 --- /dev/null +++ b/web/static/icons/wave-sine.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/web/wsos b/web/wsos new file mode 160000 index 0000000..ff5a891 --- /dev/null +++ b/web/wsos @@ -0,0 +1 @@ +Subproject commit ff5a891a3dee6a9363984dde57163b142fd22c52