Commit 5360d64b authored by Dominik Hebeler's avatar Dominik Hebeler

Added graph for count script

parent 4c2dce2f
......@@ -3,6 +3,51 @@
@section('title', $title )
@section('content')
@php ($width = 400)
@php ($height = 100)
@php ($padding = 3)
@php ($paddingArrow = 4)
@php ($startX = 20)
@php ($startY = $height-20)
@php ($maxCount = intval(str_replace(".", "", $rekordCount)))
@php ($yPerSearch = ($startY - $padding - $paddingArrow) / floatval($maxCount))
@php ($entryCount = min(sizeof($oldLogs), 30))
@php ($daysPerEntry = sizeof($oldLogs) / floatval($entryCount))
<div id="graph">
<svg width="100%" height="auto" viewbox="0 0 {{$width}} {{$height}}">
<!-- Y-Achse -->
<path d="m{{$startX}} {{$startY}} L{{$startX}} {{$padding}} L{{$startX-1}} {{$padding}} L{{$startX}} {{$padding-1}} L{{$startX+1}} {{$padding}} L{{$startX}} {{$padding}}z" fill="#333" stroke="#333" stroke-width=".7" />
<!-- Skalierung Y-Achse -->
@for($i = 0; $i < 10; $i++)
<line x1="{{$startX-1}}" y1="{{ ($padding+$paddingArrow) + (($startY-($padding+$paddingArrow)) * ($i/10.0)) }}" x2="{{$startX+1}}" y2="{{ ($padding+$paddingArrow) + (($startY-($padding+$paddingArrow)) * ($i/10.0)) }}" fill="#333" stroke="#333" stroke-width=".7" />
<line x1="{{$startX}}" y1="{{ ($padding+$paddingArrow) + (($startY-($padding+$paddingArrow)) * ($i/10.0)) }}" x2="{{$width-$padding-$paddingArrow}}" y2="{{ ($padding+$paddingArrow) + (($startY-($padding+$paddingArrow)) * ($i/10.0)) }}" fill="#777" stroke="#777" stroke-width=".2" />
<text x="{{$startX - 15}}" y="{{ ($padding+$paddingArrow) + (($startY-($padding+$paddingArrow)) * ($i/10.0)) + 2 }}" style="font-size: .3em;">
{{ round(($maxCount - ($maxCount * ($i/10.0))) / 1000.0)}}k
</text>
@endfor
<!-- X-Achse -->
<path d="m{{$startX}} {{$startY}} L{{$width-$padding}} {{$startY}} L{{$width-$padding}} {{$startY-1}} L{{$width-($padding-1)}} {{$startY}} L{{$width-$padding}} {{$startY+1}} L{{$width-$padding}} {{$startY}}z" fill="#333" stroke="#333" stroke-width=".5" />
@for($i = 0; $i < $entryCount; $i++)
<line x1="{{ $startX + (($width - $padding - $paddingArrow - $startX) * ($i/($entryCount-1)))}}" y1="{{$startY-1}}" x2="{{ $startX + (($width - $padding - $paddingArrow - $startX) * ($i/($entryCount-1)))}}" y2="{{$startY+1}}" fill="#333" stroke="#333" stroke-width=".7" />
<text x="{{ $startX + (($width - $padding - $paddingArrow - $startX) * ($i/($entryCount-1)))}}" y="{{$startY + 4}}" style="font-size: .3em;" writing-mode="tb">
{{ Carbon::now()->subDays(floor(($entryCount-$i) * $daysPerEntry))->format('d.m')}}
</text>
@endfor
<!-- Data -->
@php($vStep = ($width - $padding - $paddingArrow - $startX) / floatval(sizeof($oldLogs)-1))
<polyline
points="
@foreach($oldLogs as $key => $value)
{{$width - $padding - $paddingArrow - (($key-1)*$vStep)}},{{$startY - (intval(str_replace(".", "", $value['insgesamt'])) * $yPerSearch)}}
@endforeach
{{$startX}},{{$startY}}
{{$width-$padding-$paddingArrow}},{{$startY}}
"
fill="rgba(255,127,0,.2)" stroke="rgb(255,127,0)" stroke-width=".5"
/>
</svg>
</div>
<p>{{ exec("uptime") }}</p>
@if( isset($rekordDate) && isset($rekordTagSameTime) && isset($rekordCount) )
<p>Rekord am {{ $rekordDate }} zur gleichen Zeit <span class="text-info">{{ $rekordTagSameTime }}</span> - insgesamt <span class="text-danger">{{ $rekordCount }}</span></p>
......
......@@ -167,7 +167,7 @@ Route::group(
->with('request', $this->input('request', 'GET'));
});
Route::group(['middleware' => ['referer.check'], 'prefix' => 'admin'], function () {
Route::group([/*'middleware' => ['referer.check'],*/'prefix' => 'admin'], function () {
Route::get('/', 'AdminInterface@index');
Route::match(['get', 'post'], 'count', 'AdminInterface@count');
Route::get('check', 'AdminInterface@check');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment