mirror of
https://github.com/Karaka-Management/oms-Calendar.git
synced 2026-02-13 15:08:40 +00:00
Create better minimized version
This commit is contained in:
parent
5bde21e683
commit
3c848bc8ae
|
|
@ -315,4 +315,24 @@ class Calendar
|
||||||
|
|
||||||
return $events;
|
return $events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has event on date
|
||||||
|
*
|
||||||
|
* @param \DateTime $date Date of the event
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function hasEventOnDate(\DateTime $date) : bool
|
||||||
|
{
|
||||||
|
foreach ($this->events as $event) {
|
||||||
|
if ($event->getCreatedAt()->format('Y-m-d') === $date->format('Y-m-d')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
* @license OMS License 1.0
|
* @license OMS License 1.0
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @link http://orange-management.com
|
* @link http://orange-management.com
|
||||||
|
* @todo only load events of 3 month or 1 year?!
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace Modules\Calendar\Models;
|
namespace Modules\Calendar\Models;
|
||||||
|
|
|
||||||
|
|
@ -35,23 +35,25 @@ $calendar = $this->getData('calendar');
|
||||||
<?php $current = $calendar->getDate()->getMonthCalendar(0); $isActiveMonth = false;
|
<?php $current = $calendar->getDate()->getMonthCalendar(0); $isActiveMonth = false;
|
||||||
for($i = 0; $i < 6; $i++) : ?>
|
for($i = 0; $i < 6; $i++) : ?>
|
||||||
<ul class="days">
|
<ul class="days">
|
||||||
<?php for($j = 0; $j < 7; $j++) : $isActiveMonth = ($current[$i*7+$j] === 1) ? !$isActiveMonth : $isActiveMonth; ?>
|
<?php for($j = 0; $j < 7; $j++) :
|
||||||
<?php if($isActiveMonth) : ?>
|
$isActiveMonth = ((int) $current[$i*7+$j]->format('d') === 1) ? !$isActiveMonth : $isActiveMonth;
|
||||||
<li class="day">
|
?>
|
||||||
<div class="date"><?= $current[$i*7+$j]; ?></div>
|
<?php if($isActiveMonth) :?>
|
||||||
<?php else: ?>
|
<li class="day">
|
||||||
<li class="day other-month">
|
<div class="date"><?= $current[$i*7+$j]->format('d'); ?></div>
|
||||||
<div class="date"><?= $current[$i*7+$j]; ?></div>
|
<?php else: ?>
|
||||||
<?php endif; ?>
|
<li class="day other-month">
|
||||||
<?php
|
<div class="date"><?= $current[$i*7+$j]->format('d'); ?></div>
|
||||||
$events = $calendar->getEventByDate(new \DateTime('now'));
|
<?php endif; ?>
|
||||||
foreach($events as $event) : ?>
|
<?php
|
||||||
<div id="event-tag-<?= htmlspecialchars($event->getId(), ENT_COMPAT, 'utf-8'); ?>" class="event">
|
$events = $calendar->getEventByDate($current[$i*7+$j]);
|
||||||
<div class="event-desc"><?= htmlspecialchars($event->getName(), ENT_COMPAT, 'utf-8'); ?></div>
|
foreach($events as $event) : ?>
|
||||||
<div class="event-time">2:00pm to 5:00pm</div>
|
<div id="event-tag-<?= htmlspecialchars($event->getId(), ENT_COMPAT, 'utf-8'); ?>" class="event">
|
||||||
</div>
|
<div class="event-desc"><?= htmlspecialchars($event->getName(), ENT_COMPAT, 'utf-8'); ?></div>
|
||||||
<?php endforeach; ?>
|
<div class="event-time">2:00pm to 5:00pm</div>
|
||||||
<?php endfor; ?>
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endfor; ?>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<?php endfor;?>
|
<?php endfor;?>
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,9 @@
|
||||||
background: #dfdfdf; }
|
background: #dfdfdf; }
|
||||||
.m-calendar.m-calendar-mini .days li {
|
.m-calendar.m-calendar-mini .days li {
|
||||||
height: auto; }
|
height: auto; }
|
||||||
|
.m-calendar .has-event {
|
||||||
|
font-weight: bold;
|
||||||
|
background: #009aaf; }
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.m-calendar .weekdays, .m-calendar .other-month {
|
.m-calendar .weekdays, .m-calendar .other-month {
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,11 @@
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.has-event {
|
||||||
|
font-weight: bold;
|
||||||
|
background: #009aaf;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media(max-width: 768px) {
|
@media(max-width: 768px) {
|
||||||
|
|
|
||||||
|
|
@ -20,24 +20,18 @@ $calendar = $this->getData('calendar');
|
||||||
<?php $current = $calendar->getDate()->getMonthCalendar(0); $isActiveMonth = false;
|
<?php $current = $calendar->getDate()->getMonthCalendar(0); $isActiveMonth = false;
|
||||||
for($i = 0; $i < 6; $i++) : ?>
|
for($i = 0; $i < 6; $i++) : ?>
|
||||||
<ul class="days">
|
<ul class="days">
|
||||||
<?php for($j = 0; $j < 7; $j++) : $isActiveMonth = ($current[$i*7+$j] === 1) ? !$isActiveMonth : $isActiveMonth; ?>
|
<?php for($j = 0; $j < 7; $j++) :
|
||||||
|
$isActiveMonth = ((int) $current[$i*7+$j]->format('d') === 1) ? !$isActiveMonth : $isActiveMonth;
|
||||||
|
?>
|
||||||
<?php if($isActiveMonth) :?>
|
<?php if($isActiveMonth) :?>
|
||||||
<li class="day">
|
<li class="day<?= $calendar->hasEventOnDate($current[$i*7+$j]) ? ' has-event' : '';?>">
|
||||||
<div class="date"><?= $current[$i*7+$j]; ?></div>
|
<div class="date"><?= $current[$i*7+$j]->format('d'); ?></div>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<li class="day other-month">
|
<li class="day other-month<?= $calendar->hasEventOnDate($current[$i*7+$j]) ? ' has-event' : '';?>">
|
||||||
<div class="date"><?= $current[$i*7+$j]; ?></div>
|
<div class="date"><?= $current[$i*7+$j]->format('d'); ?></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php
|
<?php endfor; ?>
|
||||||
$events = $calendar->getEventByDate(new \DateTime('now'));
|
</li>
|
||||||
foreach($events as $event) : ?>
|
|
||||||
<div id="event-tag-<?= htmlspecialchars($event->getId(), ENT_COMPAT, 'utf-8'); ?>" class="event">
|
|
||||||
<div class="event-desc"><?= htmlspecialchars($event->getName(), ENT_COMPAT, 'utf-8'); ?></div>
|
|
||||||
<div class="event-time">2:00pm to 5:00pm</div>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php endfor; ?>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<?php endfor;?>
|
<?php endfor;?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user