404 seiten auf unterseiten gehen jetzt, icons werden jetzt korrekt bei menüs angezeigt, die submenüs haben
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
This commit is contained in:
parent
ea4069f8b8
commit
135958c9f0
@ -86,10 +86,15 @@ function callHook($url)
|
|||||||
} else
|
} else
|
||||||
$dispatch = new $componentName($component, $action, true, $queryString);
|
$dispatch = new $componentName($component, $action, true, $queryString);
|
||||||
|
|
||||||
if (method_exists($componentName, $action)) {
|
if (method_exists($componentName, $action))
|
||||||
$response = call_user_func_array(array($dispatch, $action), $queryString);
|
$response = call_user_func_array(array($dispatch, $action), $queryString);
|
||||||
} else if (method_exists($componentName, 'catchAll'))
|
else if (method_exists($componentName, 'catchAll'))
|
||||||
$response = call_user_func_array(array($dispatch, 'catchAll'), array($params));
|
$response = call_user_func_array(array($dispatch, 'catchAll'), array($params));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$dispatch = new Err('err', 'notfound', false);
|
||||||
|
$response = call_user_func_array(array($dispatch, 'notfound'), array($params));
|
||||||
|
}
|
||||||
|
|
||||||
if(is_string($response))
|
if(is_string($response))
|
||||||
return $response;
|
return $response;
|
||||||
|
@ -4,7 +4,6 @@ class Dog extends Model
|
|||||||
{
|
{
|
||||||
protected $dbTable = "dogs";
|
protected $dbTable = "dogs";
|
||||||
protected $dbFields = array(
|
protected $dbFields = array(
|
||||||
'uuid' => ['type' => 'text', 'required', 'unique', 'autoValMethod' => 'gen_ulid'],
|
|
||||||
'registered' => ['type' => 'datetime', 'required', 'unique', 'autoValMethod' => 'getDateTime'],
|
'registered' => ['type' => 'datetime', 'required', 'unique', 'autoValMethod' => 'getDateTime'],
|
||||||
'name' => ['type' => 'text'],
|
'name' => ['type' => 'text'],
|
||||||
'kennel_name' => ['type' => 'text'],
|
'kennel_name' => ['type' => 'text'],
|
||||||
|
17
web/models/Tournament.model.php
Normal file
17
web/models/Tournament.model.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Tournament extends Model
|
||||||
|
{
|
||||||
|
protected $dbTable = "tournaments";
|
||||||
|
protected $dbFields = array(
|
||||||
|
'registered' => ['type' => 'datetime', 'required', 'unique', 'autoValMethod' => 'getDateTime'],
|
||||||
|
'name' => ['type' => 'text', 'required'],
|
||||||
|
'date' => ['type' => 'datetime','required'],
|
||||||
|
'duration' => ['type' => 'int'], //in days
|
||||||
|
'referee' => ['type' => 'text'],
|
||||||
|
'text' => ['type' => 'text'],
|
||||||
|
'url' => ['type' => 'text'], //if there is one
|
||||||
|
'logo' => ['type' => 'text', 'default' => 'https://pictshare.net/prrnrk.jpg']
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
@ -3,7 +3,6 @@
|
|||||||
class User extends Model {
|
class User extends Model {
|
||||||
protected $dbTable = "users";
|
protected $dbTable = "users";
|
||||||
protected $dbFields = Array (
|
protected $dbFields = Array (
|
||||||
'uuid' => ['type'=>'text','required','unique','autoValMethod'=>'gen_ulid'],
|
|
||||||
'password' => ['type'=>'text'],
|
'password' => ['type'=>'text'],
|
||||||
'registered' => ['type'=>'datetime','required','unique','autoValMethod'=>'getDateTime'],
|
'registered' => ['type'=>'datetime','required','unique','autoValMethod'=>'getDateTime'],
|
||||||
'email' => ['type'=>'email','unique'],
|
'email' => ['type'=>'email','unique'],
|
||||||
@ -13,6 +12,7 @@ class User extends Model {
|
|||||||
'token' => ['type'=>'text','required','unique','autoValMethod'=>'uuid4'],
|
'token' => ['type'=>'text','required','unique','autoValMethod'=>'uuid4'],
|
||||||
'timezone' => ['type'=>'int'],
|
'timezone' => ['type'=>'int'],
|
||||||
'dogs' => ['type'=> 'array','default'=>[]],
|
'dogs' => ['type'=> 'array','default'=>[]],
|
||||||
|
'tournaments' => ['type'=> 'array','default'=>[]],
|
||||||
'active' => ['type'=>'int','default'=>0]
|
'active' => ['type'=>'int','default'=>0]
|
||||||
);
|
);
|
||||||
protected $hidden = ['password','token'];
|
protected $hidden = ['password','token'];
|
||||||
|
@ -5,3 +5,5 @@
|
|||||||
<?= partial('info.html',['infoTitle'=>'Dies ist ein Info titel','infoMessage'=>'InfoNachricht ist so']); ?>
|
<?= partial('info.html',['infoTitle'=>'Dies ist ein Info titel','infoMessage'=>'InfoNachricht ist so']); ?>
|
||||||
|
|
||||||
<?= partial('notice.html',['noticeTitle'=>'Dies ist ein notice titel','noticeMessage'=>'noticeNachricht ist so']); ?>
|
<?= partial('notice.html',['noticeTitle'=>'Dies ist ein notice titel','noticeMessage'=>'noticeNachricht ist so']); ?>
|
||||||
|
|
||||||
|
<?= partial('../../pages/tournaments/edit.html',[]); ?>
|
@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
class Err extends Page {
|
class Err extends Page {
|
||||||
|
|
||||||
function notfound($params)
|
function notfound($params=false)
|
||||||
{
|
{
|
||||||
$this->set("page",$params[0]);
|
$this->set("page",$params[0]);
|
||||||
$this->set('template', "notfound.html");
|
$this->set('template', "notfound.html");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function notallowed()
|
function notallowed()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4" role="alert">
|
<div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4" role="alert">
|
||||||
<p class="font-bold">404 - Not found</p>
|
<p class="font-bold">404 - Not found</p>
|
||||||
<p>I have no memory of <?= escape($page) ?></p>
|
<p>I have no memory of <span class="badge"><?= escape($page) ?></span></p>
|
||||||
<img src="https://pictshare.net/4s9gi3.gif" alt="Gandalf: I have no memory of this place"/>
|
<img src="https://pictshare.net/4s9gi3.gif" alt="Gandalf: I have no memory of this place"/>
|
||||||
</div>
|
</div>
|
@ -9,188 +9,29 @@ class Tournaments extends Page {
|
|||||||
$this->menu_priority = 1;
|
$this->menu_priority = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setSubmenu()
|
||||||
|
{
|
||||||
|
$this->addSubmenuItem('Übersicht','/tournaments','far fa-list-alt');
|
||||||
|
$this->addSubmenuItem('Turnier anlegen','/tournaments/add','fas fa-calendar-plus');
|
||||||
|
if($_SESSION['user']->data['dogs'] && count($_SESSION['user']->data['tournaments']) > 0)
|
||||||
|
{
|
||||||
|
$this->addSubmenuItem('divider');
|
||||||
|
foreach($_SESSION['user']->data['tournaments'] as $tid)
|
||||||
|
{
|
||||||
|
$t = new Tournament();
|
||||||
|
$t->load($tid);
|
||||||
|
$this->addSubmenuItem($t->data['name'],'/dogs/overview/'.$tid,'fas fa-dog');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function add()
|
||||||
|
{
|
||||||
|
$this->set('template','edit_tournament.html');
|
||||||
|
}
|
||||||
|
|
||||||
function index() {
|
function index() {
|
||||||
$dogs = $_SESSION['user']->data['dogs'];
|
|
||||||
$doggos = [];
|
|
||||||
|
|
||||||
foreach($dogs as $key => $dogid)
|
|
||||||
{
|
|
||||||
//var_dump($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]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//var_dump($doggos);
|
|
||||||
|
|
||||||
if(count($doggos) > 0)
|
|
||||||
{
|
|
||||||
$this->set('doggos',$doggos);
|
|
||||||
$this->set('template', 'list.html');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->set('template','/templates/partials/info.html');
|
|
||||||
$this->set('infoTitle', 'Keine Turniere gefunden');
|
|
||||||
$this->set('infoMessage', 'Du hast aktuell noch kein Turnier angelegt. Klicke im Menü auf "Turnier hinzufügen" um einen Turnier anzulegen.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function add() {
|
|
||||||
$this->set('template', 'edit.html');
|
|
||||||
}
|
|
||||||
|
|
||||||
function edit() {
|
|
||||||
if($_REQUEST['submit'])
|
|
||||||
{
|
|
||||||
$id = $_REQUEST['dog_id'];
|
|
||||||
$name = $_REQUEST['name'];
|
|
||||||
$kennel_name = $_REQUEST['kennel_name'];
|
|
||||||
$dog_breed = $_REQUEST['dog_breed'];
|
|
||||||
$dog_size = $_REQUEST['dog_size'];
|
|
||||||
$dog_birthday = $_REQUEST['dog_birthday'];
|
|
||||||
$agi_height_category = $_REQUEST['agi_height_category'];
|
|
||||||
$newphoto = false;
|
|
||||||
|
|
||||||
if($_FILES['photo'])
|
|
||||||
{
|
|
||||||
$photo = $_FILES['photo'];
|
|
||||||
$photo_name = $photo['name'];
|
|
||||||
$photo_tmp_name = $photo['tmp_name'];
|
|
||||||
$photo_size = $photo['size'];
|
|
||||||
$photo_error = $photo['error'];
|
|
||||||
$photo_type = $photo['type'];
|
|
||||||
|
|
||||||
$allowed = ['jpg','jpeg','png'];
|
|
||||||
$photo_ext = strtolower(end(explode('.', $photo_name)));
|
|
||||||
$photo_name = $name.'.'.$photo_ext;
|
|
||||||
$photo_path = 'uploads/'.$photo_name;
|
|
||||||
|
|
||||||
if(in_array($photo_ext, $allowed))
|
|
||||||
{
|
|
||||||
if($photo_error === 0)
|
|
||||||
{
|
|
||||||
if($photo_size < 10000000)
|
|
||||||
{
|
|
||||||
$answer = pictshareUploadImage($photo_tmp_name);
|
|
||||||
if($answer['status']=='ok' && in_array($answer['filetype'],['jpeg','png','gif']))
|
|
||||||
$newphoto = $answer['url'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return partial('error.html', ['errorTitle' => 'Error', 'errorMessage' => 'Die Datei ist zu groß. Bitte eine kleinere Datei hochladen']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return partial('error.html', ['errorTitle' => 'Error', 'errorMessage' => 'Beim Upload der Datei ist ein Fehler aufgetreten']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return partial('error.html', ['errorTitle' => 'Error', 'errorMessage' => 'Dieser Dateityp ist nicht erlaubt. Bitte nur jpg, jpeg oder png Dateien hochladen']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$error = false;
|
|
||||||
if(!$name || !$dog_birthday )
|
|
||||||
$error = 'Bitte zumindest Name und Geburtsdatum angeben';
|
|
||||||
else if(!strtotime($dog_birthday))
|
|
||||||
$error = 'Das Geburstdatum ist ungültig. Bitte die Eingabe prüfen';
|
|
||||||
|
|
||||||
if($error){
|
|
||||||
$this->set('errorMessage', $error);
|
|
||||||
$this->set('template', '/templates/partials/error.html');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$dog = new Dog();
|
|
||||||
if($id)
|
|
||||||
$dog->load($id);
|
|
||||||
|
|
||||||
$dog->name = $name;
|
|
||||||
$dog->kennel_name = $kennel_name;
|
|
||||||
$dog->breed = $dog_breed;
|
|
||||||
$dog->size = $dog_size;
|
|
||||||
$dog->birthday = $dog_birthday;
|
|
||||||
$dog->agility_size = $agi_height_category;
|
|
||||||
if($newphoto)
|
|
||||||
$dog->photo = $newphoto;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$dogid = $dog->save();
|
|
||||||
}
|
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
$this->set('template', '/templates/partials/error.html');
|
|
||||||
$this->set('errorTitle', 'Error');
|
|
||||||
$this->set('errorMessage', $e->getMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//var_dump($_SESSION['user']->data['dogs']);
|
|
||||||
|
|
||||||
if(!is_array($_SESSION['user']->data['dogs']) || !in_array($dogid, $_SESSION['user']->data['dogs'])) // new dog!
|
|
||||||
{
|
|
||||||
$_SESSION['user']->data['dogs'][] = $dogid;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$_SESSION['user']->save();
|
|
||||||
}
|
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
$this->set('template', '/templates/partials/error.html');
|
|
||||||
$this->set('errorTitle', 'Error');
|
|
||||||
$this->set('errorMessage', $e->getMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$this->redirect('/dogs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->set('template', '/templates/partials/success.html');
|
|
||||||
$this->set('successMessage', "Daten erfolgreich gespeichert");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//checken ob der den hund eh bearbeiten darf
|
|
||||||
$id = $this->params[0];
|
|
||||||
$dog = new Dog();
|
|
||||||
$dog->load($id);
|
|
||||||
$this->set('dogdata',$dog->data);
|
|
||||||
$this->set('dogid',$dog->id);
|
|
||||||
$this->set('template', 'edit.html');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function overview()
|
|
||||||
{
|
|
||||||
$dogid = $this->params[0];
|
|
||||||
$d = new Dog();
|
|
||||||
|
|
||||||
if(!$d->isMyDog($dogid))
|
|
||||||
return 'Not your dog :(';
|
|
||||||
|
|
||||||
$d->load($dogid);
|
|
||||||
$this->set('dogdata', $d->data);
|
|
||||||
$this->set('dogid', $dogid);
|
|
||||||
$this->set('template', 'dog.html');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function maySeeThisPage() {
|
function maySeeThisPage() {
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
<div>
|
<div>
|
||||||
<label for="run_category" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Parcourtyp</label>
|
<label for="run_category" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Parcourtyp</label>
|
||||||
<select id="run_category" name="run_category" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
<select id="run_category" name="run_category" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||||
<option value="Agility" <?= $dogdata['run_category']=='Agility'?'selected':''; ?>>Agility</option>
|
<option value="Agility" <?= $tournamentdata['run_category']=='Agility'?'selected':''; ?>>Agility</option>
|
||||||
<option value="Jumping" <?= $dogdata['run_category']=='Jumping'?'selected':''; ?>>Jumping</option>
|
<option value="Jumping" <?= $tournamentdata['run_category']=='Jumping'?'selected':''; ?>>Jumping</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -57,10 +57,10 @@
|
|||||||
<div>
|
<div>
|
||||||
<label for="bewertung" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Bewertung</label>
|
<label for="bewertung" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Bewertung</label>
|
||||||
<select id="bewertung" name="bewertung" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
<select id="bewertung" name="bewertung" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||||
<option value="V" <?= $dogdata['bewertung']=='V'?'selected':''; ?>>V</option>
|
<option value="V" <?= $tournamentdata['bewertung']=='V'?'selected':''; ?>>V</option>
|
||||||
<option value="SG" <?= $dogdata['bewertung']=='SG'?'selected':''; ?>>SG</option>
|
<option value="SG" <?= $tournamentdata['bewertung']=='SG'?'selected':''; ?>>SG</option>
|
||||||
<option value="G" <?= $dogdata['bewertung']=='G'?'selected':''; ?>>G</option>
|
<option value="G" <?= $tournamentdata['bewertung']=='G'?'selected':''; ?>>G</option>
|
||||||
<option Galue="B" <?= $dogdata['bewertung']=='B'?'selected':''; ?>>B</option>
|
<option Galue="B" <?= $tournamentdata['bewertung']=='B'?'selected':''; ?>>B</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -20,9 +20,3 @@
|
|||||||
<progress id='progress' value='0' max='100'></progress>
|
<progress id='progress' value='0' max='100'></progress>
|
||||||
<div id="response"></div>
|
<div id="response"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
htmx.on('#dogeditform', 'htmx:xhr:progress', function(evt) {
|
|
||||||
htmx.find('#progress').setAttribute('value', evt.detail.loaded/evt.detail.total * 100)
|
|
||||||
});
|
|
||||||
</script>
|
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle <?= $item['menu_classes'] ?>" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
<a class="nav-link dropdown-toggle <?= $item['menu_classes'] ?>" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="<?= $item['image'] ?>"></i>
|
||||||
<?= $item['text']?>
|
<?= $item['text']?>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
|
Reference in New Issue
Block a user