Calendar Refinement
This commit is contained in:
23
action.php
23
action.php
@@ -155,6 +155,8 @@ class action_plugin_luxtools extends ActionPlugin
|
||||
if ($baseNs === '') {
|
||||
$baseNs = 'chronological';
|
||||
}
|
||||
$size = ChronologicalCalendarWidget::normalizeSize((string)$INPUT->str('size'));
|
||||
$showTimes = ChronologicalCalendarWidget::normalizeShowTimes($INPUT->str('show_times'));
|
||||
|
||||
if (!ChronologicalCalendarWidget::isValidMonth($year, $month)) {
|
||||
http_status(400);
|
||||
@@ -164,12 +166,21 @@ class action_plugin_luxtools extends ActionPlugin
|
||||
|
||||
$this->sendNoStoreHeaders();
|
||||
|
||||
// Load slot indicators and colors for the calendar widget
|
||||
$slots = CalendarSlot::loadEnabled($this);
|
||||
$indicators = CalendarService::monthIndicators($slots, $year, $month);
|
||||
$widgetSlots = CalendarSlot::filterWidgetVisible($slots);
|
||||
$indicators = [];
|
||||
$dayEvents = [];
|
||||
if ($size === 'large') {
|
||||
$widgetData = CalendarService::monthWidgetData($widgetSlots, $year, $month);
|
||||
$indicators = $widgetData['indicators'];
|
||||
$dayEvents = $widgetData['events'];
|
||||
} else {
|
||||
$indicators = CalendarService::monthIndicators($widgetSlots, $year, $month);
|
||||
}
|
||||
|
||||
$slotColors = [];
|
||||
$slotDisplays = [];
|
||||
foreach ($slots as $slot) {
|
||||
foreach ($widgetSlots as $slot) {
|
||||
$color = $slot->getColor();
|
||||
if ($color !== '') {
|
||||
$slotColors[$slot->getKey()] = $color;
|
||||
@@ -177,7 +188,11 @@ class action_plugin_luxtools extends ActionPlugin
|
||||
$slotDisplays[$slot->getKey()] = $slot->getDisplay();
|
||||
}
|
||||
|
||||
$html = ChronologicalCalendarWidget::render($year, $month, $baseNs, $indicators, $slotColors, $slotDisplays);
|
||||
$html = ChronologicalCalendarWidget::render($year, $month, $baseNs, $indicators, $slotColors, $slotDisplays, [
|
||||
'size' => $size,
|
||||
'showTimes' => $showTimes,
|
||||
'dayEvents' => $dayEvents,
|
||||
]);
|
||||
if ($html === '') {
|
||||
http_status(500);
|
||||
echo 'Calendar rendering failed';
|
||||
|
||||
Reference in New Issue
Block a user