Update calendar templates

This commit is contained in:
Dennis Eichhorn 2017-08-11 20:08:52 +02:00
parent 73fdc8c285
commit 5bde21e683
4 changed files with 48 additions and 36 deletions

View File

@ -32,20 +32,19 @@ $calendar = $this->getData('calendar');
<li><?= $this->getHtml('Friday'); ?>
<li><?= $this->getHtml('Saturday'); ?>
</ul>
<?php $current = new \phpOMS\Datatypes\SmartDateTime($calendar->getDate()->format('Y') . '-' . $calendar->getDate()->format('m') . '-' . '01');
<?php $current = $calendar->getDate()->getMonthCalendar(0); $isActiveMonth = false;
for($i = 0; $i < 6; $i++) : ?>
<ul class="days">
<?php for($j = 0; $j < 7; $j++) : ?>
<?php if($calendar->getDate()->getFirstDayOfMonth() <= $i*7+$j+1 && $calendar->getDate()->getDaysOfMonth() >= $i*7+$j+1) : ?>
<?php for($j = 0; $j < 7; $j++) : $isActiveMonth = ($current[$i*7+$j] === 1) ? !$isActiveMonth : $isActiveMonth; ?>
<?php if($isActiveMonth) : ?>
<li class="day">
<div class="date"><?= ($i*7+$j+1); ?></div>
<div class="date"><?= $current[$i*7+$j]; ?></div>
<?php else: ?>
<li class="day other-month">
<div class="date"><?= $current->createModify(0, 0, -2)->format('d'); ?></div>
<div class="date"><?= $current[$i*7+$j]; ?></div>
<?php endif; ?>
<?php
$events = $calendar->getEventByDate($current);
$current->smartModify(0, 0, 1);
$events = $calendar->getEventByDate(new \DateTime('now'));
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>

View File

@ -54,9 +54,13 @@
overflow: hidden; }
.m-calendar .event-time {
font-size: 0.7rem; }
.m-calendar .other-month {
background: #f5f5f5;
.m-calendar .day {
background: #fff;
color: #666; }
.m-calendar .day.other-month {
background: #dfdfdf; }
.m-calendar.m-calendar-mini .days li {
height: auto; }
@media (max-width: 768px) {
.m-calendar .weekdays, .m-calendar .other-month {

View File

@ -77,9 +77,19 @@
font-size: 0.7rem;
}
.other-month {
background: #f5f5f5;
.day {
background: #fff;
color: #666;
&.other-month {
background: #dfdfdf;
}
}
&.m-calendar-mini {
.days li {
height: auto;
}
}
}

View File

@ -1,7 +1,7 @@
<?php
$calendar = $this->getData('calendar');
?>
<div id="calendar" class="m-calendar col-xs-12 col-md-6" draggable="true" data-action='[
<div id="calendar" class="m-calendar m-calendar-mini col-xs-12 col-md-6" draggable="true" data-action='[
{
"listener": "click", "selector": "#calendar span.tag", "action": [
{"key": 1, "type": "dom.popup", "tpl": "calendar-event-popup-tpl", "aniIn": "fadeIn"}
@ -17,28 +17,27 @@ $calendar = $this->getData('calendar');
<li><?= $this->getHtml('Friday'); ?>
<li><?= $this->getHtml('Saturday'); ?>
</ul>
<?php $current = new \phpOMS\Datatypes\SmartDateTime($calendar->getDate()->format('Y') . '-' . $calendar->getDate()->format('m') . '-' . '01');
for($i = 0; $i < 6; $i++) : ?>
<ul class="days">
<?php for($j = 0; $j < 7; $j++) : ?>
<?php if($calendar->getDate()->getFirstDayOfMonth() <= $i*7+$j+1 && $calendar->getDate()->getDaysOfMonth() >= $i*7+$j+1) : ?>
<li class="day">
<div class="date"><?= ($i*7+$j+1); ?></div>
<?php else: ?>
<li class="day other-month">
<div class="date"><?= $current->createModify(0, 0, -2)->format('d'); ?></div>
<?php endif; ?>
<?php
$events = $calendar->getEventByDate($current);
$current->smartModify(0, 0, 1);
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>
<?php endfor;?>
<?php $current = $calendar->getDate()->getMonthCalendar(0); $isActiveMonth = false;
for($i = 0; $i < 6; $i++) : ?>
<ul class="days">
<?php for($j = 0; $j < 7; $j++) : $isActiveMonth = ($current[$i*7+$j] === 1) ? !$isActiveMonth : $isActiveMonth; ?>
<?php if($isActiveMonth) :?>
<li class="day">
<div class="date"><?= $current[$i*7+$j]; ?></div>
<?php else: ?>
<li class="day other-month">
<div class="date"><?= $current[$i*7+$j]; ?></div>
<?php endif; ?>
<?php
$events = $calendar->getEventByDate(new \DateTime('now'));
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>
<?php endfor;?>
</div>