Files

95 lines
3.7 KiB
PHP
Raw Permalink Normal View History

2026-02-17 14:56:23 +01:00
<?php
$pdo = new PDO("mysql:host=".$GLOBALS['myservername'].";dbname=".$GLOBALS['mydb'].';charset=utf8', $GLOBALS['mylogin'], $GLOBALS['mypass']);
$GLOBALS["pdo_conn"] = $pdo;
$select_collection = $GLOBALS['pdo_conn']->prepare("SELECT * FROM main_collection WHERE main_collection_setup_id = :main_collection_setup_id ORDER BY sorting ASC");
$select_collection->execute(array(':main_collection_setup_id' => '6'));
$res_collection = $select_collection->fetchALL(PDO::FETCH_ASSOC);
$arr = array();
foreach ($res_collection as $key => $value) {
$date = new DateTime(getData($value['id'], '27'));
$time = getData($value['id'], '28');
$link = getData($value['id'], '29');
$addon = getData($value['id'], '30');+
$type = getCollectionGroup($value['id']);
$title = $type;
$weekday = array("Mo", "Di", "Mi", "Do", "Fr", "Sa", "So");
if($type == 'Gastspiel'){
$title = $addon;
}
$description =
"<span>".$addon."</span><br>
<span>".$weekday[$date->format('N')-1]. ". " .$date->format('d.m.Y')."</span><br>
<span>".$time." Uhr</span><br>
";
$fullviewLinkEvent = $link . '" target="_blank';
$linkTitle = $GLOBALS['tc']['learn_more'];
$arr[] = [
'id' => "event-".$value['id'],
'name' => $title,
'description' => $description,
'link' => $fullviewLinkEvent,
'link_title' => $linkTitle,
'date' => $date->format('Y.m.d'),
'type' => "event",
'color' => "var(--main-color)",
'everyYear' => false
];
}
// $select_collection2 = $GLOBALS['pdo_conn']->prepare("SELECT * FROM main_collection WHERE main_collection_setup_id = :main_collection_setup_id ORDER BY sorting ASC");
// $select_collection2->execute(array(':main_collection_setup_id' => '3'));
// $res_collection2 = $select_collection2->fetchALL(PDO::FETCH_ASSOC);
// foreach ($res_collection2 as $key => $value) {
// $date = new DateTime(getData($value['id'], '27'));
// $time = getData($value['id'], '28');
// $title = getData($value['id'], '30');
// $desc = getData($value['id'], '30');
// $description =
// "<span>".$addon."</span><br>
// <span>".$weekday[$date->format('N')-1]. ". " .$date->format('d.m.Y')."</span><br>
// <span>".$time." Uhr</span><br>
// ";
// $fullviewLinkEvent = get_link_to_navigation($GLOBALS["navigation"]['id']) . get_collection_rewrite($collectionData['description'], $collectionData['id']);
// $linkTitle = $GLOBALS['tc']['learn_more'];
// $arr[] = [
// 'id' => "event-".$value['id'],
// 'name' => $title,
// 'description' => $description,
// 'link' => $fullviewLinkEvent,
// 'link_title' => $linkTitle,
// 'date' => $date->format('Y.m.d'),
// 'type' => "event",
// 'color' => "var(--main-color)",
// 'everyYear' => false
// ];
// }
?>
<div id="calendar"></div>
<link rel="stylesheet" type="text/css" href="/plugins/evo-calendar/css/evo-calendar.min.css">
<script type="text/javascript" src="/plugins/evo-calendar/js/evo-calendar.min.js?time=<?= filemtime($_SERVER['DOCUMENT_ROOT'] . '/plugins/evo-calendar/js/evo-calendar.min.js')?>"></script>
<script>
var evoCalendar = [];
$('#calendar').evoCalendar({
todayHighlight: true,
sidebarDisplayDefault: false,
eventDisplayDefault: false,
firstDayOfWeek: 1,
'eventHeaderFormat': 'dd. MM yyyy',
language: 'de'
});
</script>
<?php foreach($arr as $key => $val){?>
<script>
evoCalendar.push(<? echo json_encode($val); ?>);
</script>
<?php } ?>
<script>
$("#calendar").evoCalendar('addCalendarEvent', evoCalendar);
</script>