Skip to content

Commit

Permalink
0.38.3 New Listener Signals Export, export in Listener Logs and Signals
Browse files Browse the repository at this point in the history
  • Loading branch information
classaxe committed Feb 18, 2020
1 parent f5e1423 commit 8d60369
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 3 deletions.
9 changes: 9 additions & 0 deletions public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,15 @@ table.seeklist tbody td div.sl_d.inactive {
font-weight: bold;
box-shadow: #777 2px 2px 5px;
}
.controlPanel .header a.export {
border-radius: 3px;
border: 1px solid #000000;
background: #ffffa0;
color: #0000ff;
float: right;
padding: 0 0.5em;
margin-right: 0.5em;
}
.controlPanel .content {
border: 1px solid #cacaca;
box-shadow: #777 2px 2px 5px;
Expand Down
9 changes: 9 additions & 0 deletions public/css/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,15 @@ table.seeklist {
font-size: 80%;
font-weight: bold;
box-shadow: #777 2px 2px 5px;
a.export {
border-radius: 3px;
border: 1px solid #000000;
background: #ffffa0;
color: #0000ff;
float: right;
padding: 0 0.5em;
margin-right: 0.5em;
}
}
.content {
border: 1px solid #cacaca;
Expand Down
2 changes: 1 addition & 1 deletion public/css/style.min.css

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions src/Controller/Web/Listeners/Export/Signals.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
namespace App\Controller\Web\Listeners\Export;

use App\Controller\Web\Listeners\Base;
use App\Repository\ListenerRepository;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

/**
* Class Listeners
* @package App\Controller\Web\Listener\Export
*/
class Signals extends Base
{
/**
* @Route(
* "/{_locale}/{system}/listeners/{id}/export/signals",
* requirements={
* "_locale": "de|en|es|fr",
* "system": "reu|rna|rww"
* },
* defaults={"id"=""},
* name="listener_export_signals"
* )
* @param $_locale
* @param $system
* @param $id
* @param ListenerRepository $listenerRepository
* @return RedirectResponse|Response
*/
public function controller(
$_locale,
$system,
$id,
ListenerRepository $listenerRepository
) {
if (!$listener = $this->getValidReportingListener($id, $listenerRepository)) {
return $this->redirectToRoute(
'listeners',
[ '_locale' => $_locale, 'system' => $system ]
);
}
$signals = $listenerRepository->getSignalsForListener($id);
$parameters = [
'_locale' => $_locale,
'title' => strToUpper($system) . ' signals for '.$listener->getName() . " on " . date('Y-m-d'),
'subtitle' => '(' . count($signals) . ' records sorted by Frequency and callsign and Time)',
'system' => $system,
'listener' => $listener,
'signals' => $signals
];
$parameters = array_merge($parameters, $this->parameters);
$response = $this->render('listener/export/signals.txt.twig', $parameters);
$response->headers->set('Content-Type', 'text/plain');
return $response;
}
}
4 changes: 4 additions & 0 deletions templates/listener/export.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
View <a href="{{ url('listener_export_logs', { 'system' : system, 'id': id }) }}" rel="external">text listing</a>
showing all {{ logs }} logs.
</li>
<li>
View <a href="{{ url('listener_export_signals', { 'system' : system, 'id': id }) }}" rel="external">text listing</a>
showing all {{ signals }} signals.
</li>
<li>
View <a href="{{ url('listener_export_signalmap', { 'system' : system, 'id': id }) }}" data-popup="1">Google Map</a>
showing all {{ signals }} signals.
Expand Down
19 changes: 19 additions & 0 deletions templates/listener/export/signals.txt.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{ title }}
{{ subtitle }}
---------------------------------------------------------------------------------------------------
KHz ID Logs KM Mi PWR GSQ SP ITU Location
---------------------------------------------------------------------------------------------------
{% for signal in signals %}
{{
"% -8s" | format((0 + signal.khz)) }} {{
"% -10s" | format(signal.call) }} {{
"% 6s" | format(signal.logs) }} {{
"% 5s" | format(signal.dxKm) }} {{
"% 5s" | format(signal.dxMiles) }} {{
"% 5s" | format(signal.pwr ? signal.pwr : '') }} {{
"% 6s" | format(signal.gsq) }} {{
"% 2s" | format(signal.sp) }} {{
"% 3s" | format(signal.itu) }} {{
signal.qth|raw
}}
{% endfor %}
4 changes: 3 additions & 1 deletion templates/listener/logs.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
{% set form_class='listener_logs' %}
{% include 'listener/tabs.html.twig' %}
<div class="controlPanel {{ form_class }}">
<div class="header">{{ mode|raw }}</div>
<div class="header">{{ mode|raw }}
<a class="export" href="{{ url('listener_export_logs', { 'system' : system, 'id': id }) }}" rel="external">Export <span class='ui-icon ui-icon-document'></span></a>
</div>
<div class="content scroll" id="list">
{{ form_start(form) }}
{% include 'forms/paging.html.twig' %}
Expand Down
4 changes: 3 additions & 1 deletion templates/listener/signals.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
{% set form_class='listener_signals' %}
{% include 'listener/tabs.html.twig' %}
<div class="controlPanel {{ form_class }}">
<div class="header">{{ mode|raw }}</div>
<div class="header">{{ mode|raw }}
<a class="export" href="{{ url('listener_export_signals', { 'system' : system, 'id': id }) }}" rel="external">Export <span class='ui-icon ui-icon-document'></span></a>
</div>
<div class="content scroll" id="list">
{{ form_start(form) }}
{% include 'forms/paging.html.twig' %}
Expand Down

0 comments on commit 8d60369

Please sign in to comment.