mirror of
https://github.com/Karaka-Management/oms-Calendar.git
synced 2026-01-31 00:38:44 +00:00
Added calendar dashboard test
This commit is contained in:
parent
93546a5206
commit
b54206958d
|
|
@ -104,4 +104,25 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Generic data
|
||||
*
|
||||
* @return \Serializable
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function viewDashboard(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
|
||||
{
|
||||
$view = new View($this->app, $request, $response);
|
||||
$view->setTemplate('/Modules/Calendar/Theme/Backend/dashboard-calendar');
|
||||
|
||||
$calendar = CalendarMapper::get(1);
|
||||
$calendar->setDate(new SmartDateTime($request->getData('date') ?? 'now'));
|
||||
$view->addData('calendar', $calendar);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,4 +90,4 @@ $calendar = $this->getData('calendar');
|
|||
<menuitem label="Delete"></menuitem>
|
||||
</menu>
|
||||
|
||||
<?= htmlspecialchars($this->getData('calendarEventPopup')->render('iCalendarEvent'), ENT_COMPAT, 'utf-8'); ?>
|
||||
<?= $this->getData('calendarEventPopup')->render('iCalendarEvent'); ?>
|
||||
|
|
@ -1,3 +1,33 @@
|
|||
<section>
|
||||
Calendar
|
||||
</section>
|
||||
<?php
|
||||
$calendar = $this->getData('calendar');
|
||||
?>
|
||||
<div id="calendar" class="m-calendar-month" data-action='[
|
||||
{
|
||||
"listener": "click", "selector": "#calendar span.tag", "action": [
|
||||
{"key": 1, "type": "dom.popup", "tpl": "calendar-event-popup-tpl", "aniIn": "fadeIn"}
|
||||
]
|
||||
}
|
||||
]'>
|
||||
<?php $current = new \phpOMS\Datatypes\SmartDateTime($calendar->getDate()->format('Y') . '-' . $calendar->getDate()->format('m') . '-' . '01');
|
||||
for($i = 0; $i < 6; $i++) : ?>
|
||||
<div class="wf-100">
|
||||
<?php for($j = 0; $j < 7; $j++) : ?>
|
||||
<div contextmenu="calendar-day-menu" style="display: inline-block; box-sizing: border-box; width: 13.0%; height: 50px; border: 1px solid #000; margin: 0; padding: 3px; overflow: hidden">
|
||||
<?php if($calendar->getDate()->getFirstDayOfMonth() <= $i*7+$j+1 && $calendar->getDate()->getDaysOfMonth() >= $i*7+$j+1) {
|
||||
echo ($i*7+$j+1) . ' ' . jddayofweek($j, 1);
|
||||
} else {
|
||||
echo $current->createModify(0, 0, -2)->format('d') . ' ' . jddayofweek($j, 1);
|
||||
} ?>
|
||||
<ul>
|
||||
<?php
|
||||
$events = $calendar->getEventByDate($current);
|
||||
$current->smartModify(0, 0, 1);
|
||||
foreach($events as $event) : ?>
|
||||
<li><span id="event-tag-<?= htmlspecialchars($event->getId(), ENT_COMPAT, 'utf-8'); ?>" class="tag purple" style="white-space: nowrap;"><?= htmlspecialchars($event->getName(), ENT_COMPAT, 'utf-8'); ?></span>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endfor; ?>
|
||||
</div>
|
||||
<?php endfor;?>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user