update v2 - 2022

This commit is contained in:
Michael Reber 2022-07-03 22:25:01 +02:00
parent a2171f6597
commit 6b4c77e5a6
4 changed files with 87 additions and 74 deletions

View File

@ -82,7 +82,11 @@ class adventCalendar {
} else { } else {
$totalwidth = $entry['doorWidth']; $totalwidth = $entry['doorWidth'];
} }
if (time() >= strtotime($entry['unlockDate'])) { $itemDate = date("Y").'-'.$entry['unlockDate'];
if (time() >= strtotime($itemDate) || $testing_calender) {
//print(__DIR__.'/_gifts/'.$entry['url'].'.php'); //print(__DIR__.'/_gifts/'.$entry['url'].'.php');
require_once (__DIR__.'/_gifts/'.$entry['url'].'.php'); require_once (__DIR__.'/_gifts/'.$entry['url'].'.php');
$output .= '<a href="#'.$entry['url'].'" rel="modal:open" class="advent-calendar-entry" style="width:'.$totalwidth.'px;top:'.$entry['positionTop'].'px;left:'.$entry['positionLeft'].'px;">'; $output .= '<a href="#'.$entry['url'].'" rel="modal:open" class="advent-calendar-entry" style="width:'.$totalwidth.'px;top:'.$entry['positionTop'].'px;left:'.$entry['positionLeft'].'px;">';

View File

@ -2,13 +2,15 @@
"config": { "config": {
"calendarWidth": "472", "calendarWidth": "472",
"calendarHeight": "827", "calendarHeight": "827",
"nameUser": "TESTING-MODE",
"useModal": "true", "useModal": "true",
"showExtras": "true", "showExtras": "false",
"enableSnow": "true" "enableSnow": "true",
"testing_calender": "true"
}, },
"entries": [ "entries": [
{ {
"unlockDate": "2019-12-19", "unlockDate": "12-19",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "0", "positionTop": "0",
@ -18,7 +20,7 @@
"url": "adv19" "url": "adv19"
}, },
{ {
"unlockDate": "2019-12-02", "unlockDate": "12-02",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "0", "positionTop": "0",
@ -28,7 +30,7 @@
"url": "adv2" "url": "adv2"
}, },
{ {
"unlockDate": "2019-12-22", "unlockDate": "12-22",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "0", "positionTop": "0",
@ -38,7 +40,7 @@
"url": "adv22" "url": "adv22"
}, },
{ {
"unlockDate": "2019-12-17", "unlockDate": "12-17",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "0", "positionTop": "0",
@ -48,7 +50,7 @@
"url": "adv17" "url": "adv17"
}, },
{ {
"unlockDate": "2019-12-14", "unlockDate": "12-14",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "118", "positionTop": "118",
@ -58,7 +60,7 @@
"url": "adv14" "url": "adv14"
}, },
{ {
"unlockDate": "2019-12-06", "unlockDate": "12-06",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "118", "positionTop": "118",
@ -69,7 +71,7 @@
"url": "adv6" "url": "adv6"
}, },
{ {
"unlockDate": "2019-12-08", "unlockDate": "12-08",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "118", "positionTop": "118",
@ -79,7 +81,7 @@
"url": "adv8" "url": "adv8"
}, },
{ {
"unlockDate": "2019-12-10", "unlockDate": "12-10",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "236", "positionTop": "236",
@ -89,7 +91,7 @@
"url": "adv10" "url": "adv10"
}, },
{ {
"unlockDate": "2019-12-24", "unlockDate": "12-24",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "236", "doorHeight": "236",
"positionTop": "236", "positionTop": "236",
@ -100,7 +102,7 @@
"url": "adv24" "url": "adv24"
}, },
{ {
"unlockDate": "2019-12-11", "unlockDate": "12-11",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "236", "positionTop": "236",
@ -110,7 +112,7 @@
"url": "adv11" "url": "adv11"
}, },
{ {
"unlockDate": "2019-12-20", "unlockDate": "12-20",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "354", "positionTop": "354",
@ -120,7 +122,7 @@
"url": "adv20" "url": "adv20"
}, },
{ {
"unlockDate": "2019-12-13", "unlockDate": "12-13",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "354", "positionTop": "354",
@ -130,7 +132,7 @@
"url": "adv13" "url": "adv13"
}, },
{ {
"unlockDate": "2019-12-03", "unlockDate": "12-03",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "472", "positionTop": "472",
@ -140,7 +142,7 @@
"url": "adv3" "url": "adv3"
}, },
{ {
"unlockDate": "2019-12-09", "unlockDate": "12-09",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "472", "positionTop": "472",
@ -150,7 +152,7 @@
"url": "adv9" "url": "adv9"
}, },
{ {
"unlockDate": "2019-12-21", "unlockDate": "12-21",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "472", "positionTop": "472",
@ -160,7 +162,7 @@
"url": "adv21" "url": "adv21"
}, },
{ {
"unlockDate": "2019-12-23", "unlockDate": "12-23",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "472", "positionTop": "472",
@ -170,7 +172,7 @@
"url": "adv23" "url": "adv23"
}, },
{ {
"unlockDate": "2019-12-05", "unlockDate": "12-05",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "590", "positionTop": "590",
@ -180,7 +182,7 @@
"url": "adv5" "url": "adv5"
}, },
{ {
"unlockDate": "2019-12-16", "unlockDate": "12-16",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "590", "positionTop": "590",
@ -190,7 +192,7 @@
"url": "adv16" "url": "adv16"
}, },
{ {
"unlockDate": "2019-12-18", "unlockDate": "12-18",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "590", "positionTop": "590",
@ -200,7 +202,7 @@
"url": "adv18" "url": "adv18"
}, },
{ {
"unlockDate": "2019-12-15", "unlockDate": "12-15",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "590", "positionTop": "590",
@ -210,7 +212,7 @@
"url": "adv15" "url": "adv15"
}, },
{ {
"unlockDate": "2019-12-12", "unlockDate": "12-12",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "708", "positionTop": "708",
@ -220,7 +222,7 @@
"url": "adv12" "url": "adv12"
}, },
{ {
"unlockDate": "2019-12-07", "unlockDate": "12-07",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "708", "positionTop": "708",
@ -230,7 +232,7 @@
"url": "adv7" "url": "adv7"
}, },
{ {
"unlockDate": "2019-12-01", "unlockDate": "12-01",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "708", "positionTop": "708",
@ -240,7 +242,7 @@
"url": "adv1" "url": "adv1"
}, },
{ {
"unlockDate": "2019-12-04", "unlockDate": "12-04",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "708", "positionTop": "708",

View File

@ -2,13 +2,15 @@
"config": { "config": {
"calendarWidth": "472", "calendarWidth": "472",
"calendarHeight": "827", "calendarHeight": "827",
"nameUser": "YourName",
"useModal": "true", "useModal": "true",
"showExtras": "true", "showExtras": "false",
"enableSnow": "true" "enableSnow": "true",
"testing_calender": "false"
}, },
"entries": [ "entries": [
{ {
"unlockDate": "2020-12-19", "unlockDate": "12-19",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "0", "positionTop": "0",
@ -18,7 +20,7 @@
"url": "adv19" "url": "adv19"
}, },
{ {
"unlockDate": "2020-12-02", "unlockDate": "12-02",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "0", "positionTop": "0",
@ -28,7 +30,7 @@
"url": "adv2" "url": "adv2"
}, },
{ {
"unlockDate": "2020-12-22", "unlockDate": "12-22",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "0", "positionTop": "0",
@ -38,7 +40,7 @@
"url": "adv22" "url": "adv22"
}, },
{ {
"unlockDate": "2020-12-17", "unlockDate": "12-17",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "0", "positionTop": "0",
@ -48,7 +50,7 @@
"url": "adv17" "url": "adv17"
}, },
{ {
"unlockDate": "2020-12-14", "unlockDate": "12-14",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "118", "positionTop": "118",
@ -58,7 +60,7 @@
"url": "adv14" "url": "adv14"
}, },
{ {
"unlockDate": "2020-12-06", "unlockDate": "12-06",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "118", "positionTop": "118",
@ -69,7 +71,7 @@
"url": "adv6" "url": "adv6"
}, },
{ {
"unlockDate": "2020-12-08", "unlockDate": "12-08",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "118", "positionTop": "118",
@ -79,7 +81,7 @@
"url": "adv8" "url": "adv8"
}, },
{ {
"unlockDate": "2020-12-10", "unlockDate": "12-10",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "236", "positionTop": "236",
@ -89,7 +91,7 @@
"url": "adv10" "url": "adv10"
}, },
{ {
"unlockDate": "2020-12-24", "unlockDate": "12-24",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "236", "doorHeight": "236",
"positionTop": "236", "positionTop": "236",
@ -100,7 +102,7 @@
"url": "adv24" "url": "adv24"
}, },
{ {
"unlockDate": "2020-12-11", "unlockDate": "12-11",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "236", "positionTop": "236",
@ -110,7 +112,7 @@
"url": "adv11" "url": "adv11"
}, },
{ {
"unlockDate": "2020-12-20", "unlockDate": "12-20",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "354", "positionTop": "354",
@ -120,7 +122,7 @@
"url": "adv20" "url": "adv20"
}, },
{ {
"unlockDate": "2020-12-13", "unlockDate": "12-13",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "354", "positionTop": "354",
@ -130,7 +132,7 @@
"url": "adv13" "url": "adv13"
}, },
{ {
"unlockDate": "2020-12-03", "unlockDate": "12-03",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "472", "positionTop": "472",
@ -140,7 +142,7 @@
"url": "adv3" "url": "adv3"
}, },
{ {
"unlockDate": "2020-12-09", "unlockDate": "12-09",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "472", "positionTop": "472",
@ -150,7 +152,7 @@
"url": "adv9" "url": "adv9"
}, },
{ {
"unlockDate": "2020-12-21", "unlockDate": "12-21",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "472", "positionTop": "472",
@ -160,7 +162,7 @@
"url": "adv21" "url": "adv21"
}, },
{ {
"unlockDate": "2020-12-23", "unlockDate": "12-23",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "472", "positionTop": "472",
@ -170,7 +172,7 @@
"url": "adv23" "url": "adv23"
}, },
{ {
"unlockDate": "2020-12-05", "unlockDate": "12-05",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "590", "positionTop": "590",
@ -180,7 +182,7 @@
"url": "adv5" "url": "adv5"
}, },
{ {
"unlockDate": "2020-12-16", "unlockDate": "12-16",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "590", "positionTop": "590",
@ -190,7 +192,7 @@
"url": "adv16" "url": "adv16"
}, },
{ {
"unlockDate": "2020-12-18", "unlockDate": "12-18",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "590", "positionTop": "590",
@ -200,7 +202,7 @@
"url": "adv18" "url": "adv18"
}, },
{ {
"unlockDate": "2020-12-15", "unlockDate": "12-15",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "590", "positionTop": "590",
@ -210,7 +212,7 @@
"url": "adv15" "url": "adv15"
}, },
{ {
"unlockDate": "2020-12-12", "unlockDate": "12-12",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "708", "positionTop": "708",
@ -220,7 +222,7 @@
"url": "adv12" "url": "adv12"
}, },
{ {
"unlockDate": "2020-12-07", "unlockDate": "12-07",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "708", "positionTop": "708",
@ -230,7 +232,7 @@
"url": "adv7" "url": "adv7"
}, },
{ {
"unlockDate": "2020-12-01", "unlockDate": "12-01",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "708", "positionTop": "708",
@ -240,7 +242,7 @@
"url": "adv1" "url": "adv1"
}, },
{ {
"unlockDate": "2020-12-04", "unlockDate": "12-04",
"doorWidth": "118", "doorWidth": "118",
"doorHeight": "118", "doorHeight": "118",
"positionTop": "708", "positionTop": "708",

View File

@ -1,12 +1,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Seline Adventskalender</title> <title>Adventskalender</title>
<meta name="viewport" content="width=device-width, user-scalable=no" /> <meta name="viewport" content="width=device-width, user-scalable=no" />
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="theme-color" content="#2b1616"> <meta name="theme-color" content="#2b1616">
<meta property="og:title" content="Adventskalender Seline"> <meta property="og:title" content="Adventskalender">
<meta property="og:image" content="https://michu-it.com/seline/images/snowflake.png"/> <meta property="og:image" content="images/snowflake.png"/>
<!-- Include main jQuery :) --> <!-- Include main jQuery :) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
@ -23,7 +23,10 @@
</style> </style>
<![endif]--> <![endif]-->
<?php if (!$dev) { ?> <?php
error_reporting(E_ERROR | E_PARSE);
if (!$dev) { ?>
<!-- Matomo --> <!-- Matomo -->
<script type="text/javascript"> <script type="text/javascript">
var _paq = window._paq = window._paq || []; var _paq = window._paq = window._paq || [];
@ -43,21 +46,23 @@
<?php } ?> <?php } ?>
</head> </head>
<?php <?php
$dev = isset($_GET['dev']) ? $_GET['dev'] : false;
if ($dev) { $dev = isset($_GET['dev']) ? $_GET['dev'] : false;
$config = file_get_contents("./calendar_dev.json"); if ($dev) {
} else { $config = file_get_contents("./calendar_dev.json");
$config = file_get_contents("./calendar_prod.json"); } else {
} $config = file_get_contents("./calendar_prod.json");
}
require "adventCalendar.php"; require "adventCalendar.php";
$calendar = new adventCalendar(); $calendar = new adventCalendar();
$calendar->load_from_json($config); $calendar->load_from_json($config);
//echo $calendar->showExtras; //echo $calendar->showExtras;
//echo $calendar->enableSnow; //echo $calendar->enableSnow;
$showExtras = ($calendar->showExtras == 'true') ? true : false; $showExtras = ($calendar->showExtras == 'true') ? true : false;
$snow_enabled = ($calendar->enableSnow == 'true') ? true : false; $snow_enabled = ($calendar->enableSnow == 'true') ? true : false;
$testing_calender = ($calendar->testing_calender == 'true') ? true : false;
?> ?>
<body> <body>
@ -65,7 +70,7 @@
<canvas class="snow" id="snow"></canvas> <canvas class="snow" id="snow"></canvas>
<?php } ?> <?php } ?>
<center> <center>
<p style="color: white; font-family: christmasFont; font-size: 48px; margin: 16px 0px 20px 0px;">Adventskalender Seline</p> <p style="color: white; font-family: christmasFont; font-size: 48px; margin: 16px 0px 20px 0px;">Adventskalender</p>
<div class="mainCalendar"> <div class="mainCalendar">
<?php <?php
$calendar->render(); $calendar->render();
@ -74,11 +79,11 @@
<?php if ($showExtras) { ?> <?php if ($showExtras) { ?>
<hr> <hr>
<p style="color: white; font-family: christmasFont; font-size: 40px; margin: 16px 0px 20px 0px;">Zite wod nüt sötsch abmache :</p> <p style="color: white; font-family: christmasFont; font-size: 40px; margin: 16px 0px 20px 0px;">Zite wode nüt sötsch abmache :</p>
<ul style="list-style-type:disc; max-width: 245px; color: white;"> <ul style="list-style-type:disc; max-width: 245px; color: white;">
<li>06.12.2020 - Dr Morge</li> <li>06.12.202x - Dr Morge</li>
<li>11.12.2020 - Dr Abee</li> <li>11.12.202x - Dr Abee</li>
<li>TBD ..</li> <li>TBD ..</li>
</ul> </ul>
<?php } ?> <?php } ?>