separated home logged in and not
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
This commit is contained in:
parent
ffb8e552d2
commit
44c0cfcfae
@ -59,7 +59,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container" id="sitemain">
|
||||
<div class="container pb-4" id="sitemain">
|
||||
<!-- table of all runs of this dog-->
|
||||
<h2>Alle Ergebnisse</h2>
|
||||
|
||||
@ -70,7 +70,7 @@
|
||||
2023
|
||||
</button>
|
||||
</h3>
|
||||
<div id="collapseOne" class="accordion-collapse collapse show" data-bs-parent="#accordion-dog-runs">
|
||||
<div id="collapseOne" class="accordion-collapse collapse" data-bs-parent="#accordion-dog-runs">
|
||||
<div class="accordion-body">
|
||||
<table class="table">
|
||||
<thead>
|
||||
@ -87,29 +87,7 @@
|
||||
<th class="text-end">Platz</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Turnier</th>
|
||||
<th>Lauf</th>
|
||||
<th class="text-end">VW</th>
|
||||
<th class="text-end">F</th>
|
||||
<th class="text-end">ZF</th>
|
||||
<th class="text-end">Zeit</th>
|
||||
<th class="text-end">GF</th>
|
||||
<th class="text-end">m/Sek</th>
|
||||
<th class="text-end">Bew.</th>
|
||||
<th class="text-end">Platz</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody>
|
||||
<?php if(count($results) > 0): ?>
|
||||
<?php foreach($results as $result) : ?>
|
||||
<?php
|
||||
@ -175,92 +153,93 @@
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
<?php if(count($results) > 0): ?>
|
||||
<div class="col">
|
||||
<div id="graph" data-bs-theme="light" class="card bg-light text-black" style="min-height: 400px;"></div>
|
||||
<script type="text/javascript">
|
||||
// Initialize the echarts instance based on the prepared dom
|
||||
var myChart = echarts.init(document.getElementById('graph'));
|
||||
|
||||
// Specify the configuration items and data for the chart
|
||||
var option = {
|
||||
title: {
|
||||
text: 'Stacked Line'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: ['Geschwindigkeit', 'Fehler', 'Verweigerungen', 'Zeit', 'Geschwindigkeit','Punkte','Platz']
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
saveAsImage: {}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: <?= json_encode($sdata['dates']); ?>
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: 'Geschwindigkeit',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['speed']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Fehler',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['errors']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Verweigerungen',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['refusals']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Zeit',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['time']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Punkte',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['points']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Platz',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['ranking']); ?>
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Display the chart using the configuration items and data just specified.
|
||||
myChart.setOption(option);
|
||||
</script>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if(count($results) > 0): ?>
|
||||
<div class="col">
|
||||
<div id="graph" data-bs-theme="light" class="card bg-light text-black" style="min-height: 400px;"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
// Initialize the echarts instance based on the prepared dom
|
||||
var myChart = echarts.init(document.getElementById('graph'));
|
||||
|
||||
// Specify the configuration items and data for the chart
|
||||
var option = {
|
||||
title: {
|
||||
text: 'Stacked Line'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: ['Geschwindigkeit', 'Fehler', 'Verweigerungen', 'Zeit', 'Geschwindigkeit','Punkte','Platz']
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
saveAsImage: {}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: <?= json_encode($sdata['dates']); ?>
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: 'Geschwindigkeit',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['speed']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Fehler',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['errors']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Verweigerungen',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['refusals']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Zeit',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['time']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Punkte',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['points']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Platz',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['ranking']); ?>
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Display the chart using the configuration items and data just specified.
|
||||
myChart.setOption(option);
|
||||
</script>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -13,8 +13,37 @@ class Home extends Page
|
||||
{
|
||||
$u = new User();
|
||||
$this->set('userdata', $u->getAll());
|
||||
$this->set('template', "home.html");
|
||||
//return $this->renderPagecontent();
|
||||
|
||||
if(!$_SESSION['user'])
|
||||
{
|
||||
$this->set('template', 'home-nouser.html');
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$dogs = $_SESSION['user']->data['dogs'];
|
||||
$doggos = [];
|
||||
|
||||
foreach($dogs as $key => $dogid)
|
||||
{
|
||||
$dog = new Dog();
|
||||
try{
|
||||
$dog->load($dogid);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
error_log("Dog $dogid not found. Deleting from user");
|
||||
unset($_SESSION['user']->data['dogs'][$key]);
|
||||
$_SESSION['user']->save();
|
||||
continue;
|
||||
}
|
||||
if($dog->data)
|
||||
$doggos[] = array_merge($dog->data,['id'=>$dogid]);
|
||||
$this->set('doggos',$doggos);
|
||||
}
|
||||
//var_dump($doggos);
|
||||
$this->set('template', "home.html");
|
||||
}
|
||||
}
|
||||
|
||||
function maySeeThisPage(){return true;}
|
||||
|
56
web/pages/home/home-nouser.html
Normal file
56
web/pages/home/home-nouser.html
Normal file
@ -0,0 +1,56 @@
|
||||
<div class="text-center mt-3">
|
||||
<h1 class="text-4xl font-bold tracking-tight text-gray-900 sm:text-6xl">Dogstats - der Agilityhelfer</h1>
|
||||
<p class="mt-6 text-lg leading-8 text-gray-600">Steigere deine Leistung mit Dogstats.</p>
|
||||
</div>
|
||||
|
||||
<h1>Admin stuff</h1>
|
||||
|
||||
<div class="container text-center">
|
||||
<div class="row">
|
||||
<?php foreach ($userdata as $user) : ?>
|
||||
<div class="m-3 col">
|
||||
<div class="card">
|
||||
<img src="<?= $user['photo']?:'https://pictshare.net/pj7vzx.jpg' ?>" class="card-img-top" alt="...">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><?= escape($user['firstname'].' '.$user['lastname']) ?></h5>
|
||||
<p class="card-text"><?= escape($user['email']) ?></p>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
<h6>uuid</h6>
|
||||
<span class="badge rounded-pill text-bg-secondary"><?= escape($user['uuid']); ?></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<h6>Registered</h6>
|
||||
<?= escape($user['registered']); ?>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<h6>last_login</h6>
|
||||
<?= escape($user['last_login']); ?>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<h6>Active</h6>
|
||||
<?= $user['active']?'yes':'no'; ?>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<h6>Dogs</h6>
|
||||
<?php foreach($user['dogs'] as $dog): ?>
|
||||
<a href="/dogs/overview/<?= $dog ?>" class="btn btn-secondary"><?= escape((new Dog())->getField('name',$dog)); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-body">
|
||||
<button class="btn btn-primary" name="email" value="<?= $user['email'] ?>" hx-post="/admin/loginas/">Login</button>
|
||||
<button class="btn btn-primary"name="email" value="<?= $user['email'] ?>" hx-post="/admin/edituser/" hx-target="#main">Edit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden sm:mb-8 sm:flex sm:justify-center">
|
||||
<div class="relative rounded-full px-3 py-1 text-sm leading-6 text-gray-600 ring-1 ring-gray-900/10 hover:ring-gray-900/20">
|
||||
Currently logged in as:
|
||||
<?= $_SESSION['userid']?:'nobody' ?>
|
||||
</div>
|
||||
</div>
|
@ -1,62 +1,30 @@
|
||||
<div class="hidden sm:mb-8 sm:flex sm:justify-center">
|
||||
<div class="relative rounded-full px-3 py-1 text-sm leading-6 text-gray-600 ring-1 ring-gray-900/10 hover:ring-gray-900/20">
|
||||
Currently logged in as:
|
||||
<?= $_SESSION['userid']?:'nobody' ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<div class="text-center mt-3">
|
||||
<h1 class="text-4xl font-bold tracking-tight text-gray-900 sm:text-6xl">Dogstats - der Agilityhelfer</h1>
|
||||
<p class="mt-6 text-lg leading-8 text-gray-600">Anim aute id magna aliqua ad ad non deserunt sunt.
|
||||
Qui irure qui lorem cupidatat commodo. Elit sunt amet fugiat veniam occaecat fugiat aliqua.</p>
|
||||
<div class="mt-10 flex items-center justify-center gap-x-6">
|
||||
<a href="#" class="rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">Get
|
||||
started</a>
|
||||
<a href="#" class="text-sm font-semibold leading-6 text-gray-900">Learn more <span aria-hidden="true">→</span></a>
|
||||
</div>
|
||||
<p class="mt-6 text-lg leading-8 text-gray-600">Steigere deine Leistung mit Dogstats.</p>
|
||||
</div>
|
||||
|
||||
<h1>Admin stuff</h1>
|
||||
|
||||
<div class="container text-center">
|
||||
<div class="row">
|
||||
<?php foreach ($userdata as $user) : ?>
|
||||
<div class="m-3 col">
|
||||
<div class="card">
|
||||
<img src="<?= $user['photo']?:'https://pictshare.net/pj7vzx.jpg' ?>" class="card-img-top" alt="...">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><?= escape($user['firstname'].' '.$user['lastname']) ?></h5>
|
||||
<p class="card-text"><?= escape($user['email']) ?></p>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
<h6>uuid</h6>
|
||||
<span class="badge rounded-pill text-bg-secondary"><?= escape($user['uuid']); ?></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<h6>Registered</h6>
|
||||
<?= escape($user['registered']); ?>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<h6>last_login</h6>
|
||||
<?= escape($user['last_login']); ?>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<h6>Active</h6>
|
||||
<?= $user['active']?'yes':'no'; ?>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<h6>Dogs</h6>
|
||||
<?php foreach($user['dogs'] as $dog): ?>
|
||||
<a href="/dogs/overview/<?= $dog ?>" class="btn btn-secondary"><?= escape((new Dog())->getField('name',$dog)); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-body">
|
||||
<button class="btn btn-primary" name="email" value="<?= $user['email'] ?>" hx-post="/admin/loginas/">Login</button>
|
||||
<button class="btn btn-primary"name="email" value="<?= $user['email'] ?>" hx-post="/admin/edituser/" hx-target="#main">Edit</button>
|
||||
</div>
|
||||
<div>
|
||||
<h3 class="text-center">Schnellauswahl</h3>
|
||||
<div class="d-sm-flex justify-content-sm-center">
|
||||
<div class="m-sm-2 border p-3 rounded-2 shadow">
|
||||
<a href="/tournaments/add" class="btn btn-secondary mb-2">Turnier hinzufügen</a>
|
||||
</div>
|
||||
<?php if ($doggos) : ?>
|
||||
<?php foreach ($doggos as $dog) : ?>
|
||||
<?php if (!$dog['active']) continue; ?>
|
||||
<div class="m-sm-2 border p-3 rounded-2 shadow">
|
||||
<div class="d-flex mb-2 align-items-center">
|
||||
<img src="<?= $dog['photo'] ?>/100x100/forcesize">
|
||||
<a href="/dogs/overview/<?= $dog['id'] ?>" class="ms-3 link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover"><?= escape($dog['name']); ?></a>
|
||||
</div>
|
||||
<a href="/smart#<?= escape($dog['name']); ?>" class="btn btn-secondary mb-2 d-block">Turnier importieren</a>
|
||||
<a href="#" class="btn btn-secondary mb-2 d-block">Training hinzufügen</a>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<div class="">
|
||||
<a href="/dogs/add" class="btn btn-secondary mb-2 d-block">Hund hinzufügen</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user