Printing data on numpad key press, first version. Settings page for mapping key to actions.
This commit is contained in:
93
app/Http/Controllers/AirlyController.php
Normal file
93
app/Http/Controllers/AirlyController.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: k
|
||||
* Date: 10.02.2017
|
||||
* Time: 20:10
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
set_time_limit(-1);
|
||||
|
||||
use App\Paper\Airly;
|
||||
use App\Paper\Paper;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AirlyController extends Controller
|
||||
{
|
||||
|
||||
private $paper = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->paper = new Paper();
|
||||
}
|
||||
|
||||
/**
|
||||
* get:/airly_all
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function airly_all()
|
||||
{
|
||||
$airly = new Airly();
|
||||
$this->paper->sendImagePrint($airly->icon);
|
||||
$this->paper->sendHeaderPrint('Jakość powietrza:' . PHP_EOL . date('H:i d-m-Y'));
|
||||
$airly->setStations(config('paper.airly.stations'));
|
||||
|
||||
foreach ($airly->getStations() as $stationId) {
|
||||
$stationInfo = $airly->getStationInfo($stationId);
|
||||
$this->paper->sendHeaderPrint($stationInfo['address']['locality'] . ' ' . $stationInfo['address']['route']);
|
||||
$dataText = $airly->getInformationText($stationId);
|
||||
$this->paper->sendPrint('', $dataText);
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
public function airly_rzeczypospolitej()
|
||||
{
|
||||
$airly = new Airly();
|
||||
$this->paper->sendImagePrint($airly->icon);
|
||||
$this->paper->sendHeaderPrint('Jakość powietrza:' . PHP_EOL . date('H:i d-m-Y'));
|
||||
$airly->setStations([config('paper.airly.rzeczypospolitej')]);
|
||||
|
||||
foreach ($airly->getStations() as $stationId) {
|
||||
$stationInfo = $airly->getStationInfo($stationId);
|
||||
$this->paper->sendHeaderPrint($stationInfo['address']['locality'] . ' ' . $stationInfo['address']['route']);
|
||||
$dataText = $airly->getInformationText($stationId);
|
||||
$this->paper->sendPrint('', $dataText);
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
public function airly_grunwaldzka()
|
||||
{
|
||||
$airly = new Airly();
|
||||
$this->paper->sendImagePrint($airly->icon);
|
||||
$this->paper->sendHeaderPrint('Jakość powietrza:' . PHP_EOL . date('H:i d-m-Y'));
|
||||
$airly->setStations([config('paper.airly.grunwaldzka')]);
|
||||
|
||||
foreach ($airly->getStations() as $stationId) {
|
||||
$stationInfo = $airly->getStationInfo($stationId);
|
||||
$this->paper->sendHeaderPrint($stationInfo['address']['locality'] . ' ' . $stationInfo['address']['route']);
|
||||
$dataText = $airly->getInformationText($stationId);
|
||||
$this->paper->sendPrint('', $dataText);
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
public function airly_sowinskiego()
|
||||
{
|
||||
$airly = new Airly();
|
||||
$this->paper->sendImagePrint($airly->icon);
|
||||
$this->paper->sendHeaderPrint('Jakość powietrza:' . PHP_EOL . date('H:i d-m-Y'));
|
||||
$airly->setStations([config('paper.airly.sowinskiego')]);
|
||||
|
||||
foreach ($airly->getStations() as $stationId) {
|
||||
$stationInfo = $airly->getStationInfo($stationId);
|
||||
$this->paper->sendHeaderPrint($stationInfo['address']['locality'] . ' ' . $stationInfo['address']['route']);
|
||||
$dataText = $airly->getInformationText($stationId);
|
||||
$this->paper->sendPrint('', $dataText);
|
||||
}
|
||||
return back();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user