aboutsummaryrefslogtreecommitdiff
path: root/Neutron-trunk/cms-special/admin-v2/calendar/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'Neutron-trunk/cms-special/admin-v2/calendar/index.php')
-rw-r--r--Neutron-trunk/cms-special/admin-v2/calendar/index.php86
1 files changed, 86 insertions, 0 deletions
diff --git a/Neutron-trunk/cms-special/admin-v2/calendar/index.php b/Neutron-trunk/cms-special/admin-v2/calendar/index.php
new file mode 100644
index 0000000..e596551
--- /dev/null
+++ b/Neutron-trunk/cms-special/admin-v2/calendar/index.php
@@ -0,0 +1,86 @@
+<?php require_once "../../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?>
+<?php $pageConfig = [ "domName" => "Calendrier", "headerName" => "Gestion des événements" ]; include_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/precontent.php"; ?>
+ <?php
+
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/calendar_events")) {
+ $calevn = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/calendar_events");
+ } else {
+ $calevn = "3";
+ }
+
+ ?>
+ <?= $lang["admin-calendar"]["show"][0] ?> <select onchange="updateNextEvents()" id="nextevents">
+ <option value="1" <?php if ($calevn == "1") { echo("selected"); } ?>>1</option>
+ <option value="2" <?php if ($calevn == "2") { echo("selected"); } ?>>2</option>
+ <option value="3" <?php if ($calevn == "3") { echo("selected"); } ?>>3</option>
+ <option value="4" <?php if ($calevn == "4") { echo("selected"); } ?>>4</option>
+ <option value="5" <?php if ($calevn == "5") { echo("selected"); } ?>>5</option>
+ <option value="6" <?php if ($calevn == "6") { echo("selected"); } ?>>6</option>
+ <option value="7" <?php if ($calevn == "7") { echo("selected"); } ?>>7</option>
+ <option value="8" <?php if ($calevn == "8") { echo("selected"); } ?>>8</option>
+ <option value="9" <?php if ($calevn == "9") { echo("selected"); } ?>>9</option>
+ <option value="10" <?php if ($calevn == "10") { echo("selected"); } ?>>10</option>
+ </select> <?= $lang["admin-calendar"]["show"][1] ?>
+ <h3><?= $lang["admin-calendar"]["events"] ?></h3>
+ <ul>
+ <?php
+
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/caldb.json")) {
+ $dbraw = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/caldb.json");
+ $corrupted = false;
+ if (isJson($dbraw)) {
+ $events = json_decode($dbraw);
+ foreach ($events->events as $event) {
+ if (isset($event->timestamp)) {
+ echo("<li><span style=\"cursor:help;\" title=\"" . $event->description . "\">" . $event->name . "</span> (" . $event->datestr . ")" . " - <a class=\"sblink\" href=\"{$GLOBALS["SYSTEM_ROOT"]}/cms-special/admin/calendar/manage/?id=" . $event->timestamp . "\" title=\"{$lang['admin-calendar']['manageph']}\">" . $lang["admin-calendar"]["manage"] . "</a></li>");
+ }
+ }
+ } else {
+ echo("<div style=\"color:red; text-align: center;\"><b><u>{$lang['admin-calendar']['corrupt'][0]}</u> {$lang['admin-calendar']['corrupt'][1]} <u>{$lang['admin-calendar']['corrupt'][2]}</u></b></div>");
+ $corrupted = true;
+ }
+ } else {
+ echo("<div style=\"text-align: center;\">{$lang['admin-calendar']['nothing']}</div>");
+ }
+
+ ?>
+ <?php
+
+ if (!$corrupted) {
+ echo('<br><li><i><a href="' . $GLOBALS["SYSTEM_ROOT"] . '/cms-special/admin/calendar/add" title="' . $lang["admin-calendar"]["addph"] . '" class="sblink">' . $lang["admin-calendar"]["add"] . '</a></i></li>');
+ }
+
+ ?>
+ </ul>
+<?php include_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/postcontent.php"; ?>
+<script>
+
+function updateNextEvents() {
+ value = document.getElementById('nextevents').value;
+ var formData = new FormData();
+ formData.append("value", value);
+ document.getElementById('nextevents').disabled = true;
+ $.ajax({
+ type: "POST",
+ dataType: 'html',
+ url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/calendar_nextevents.php",
+ success: function (data) {
+ if (data == "ok") {
+ document.getElementById('nextevents').disabled = false;
+ } else {
+ alert("<?= $lang["admin-errors"]["errorprefix"] ?>" + data)
+ document.getElementById('nextevents').disabled = false;
+ }
+ },
+ error: function (error) {
+ alert("<?= $lang["admin-errors"]["connerror"] ?>")
+ document.getElementById('nextevents').disabled = false;
+ },
+ data: formData,
+ cache: false,
+ contentType: false,
+ processData: false
+ });
+}
+
+</script> \ No newline at end of file