Merge done
This commit is contained in:
parent
9ce8e7515a
commit
f23606de64
|
@ -9,8 +9,7 @@ use Picea,
|
|||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Storage\Session;
|
||||
|
||||
use Laminas\Diactoros\Response\{ HtmlResponse, TextResponse, RedirectResponse, JsonResponse, EmptyResponse };
|
||||
use Laminas\Diactoros\Response\{EmptyResponse, HtmlResponse, TextResponse, RedirectResponse, JsonResponse};
|
||||
|
||||
use Ulmus\EntityCollection;
|
||||
|
||||
|
@ -79,12 +78,12 @@ trait ControllerTrait {
|
|||
|
||||
public static function renderNothing(int $code = 204, array $headers = []) : ResponseInterface
|
||||
{
|
||||
return new EmptyResponse($code, $headers);
|
||||
return new EmptyResponse($code, $headers);
|
||||
}
|
||||
|
||||
public static function renderText(string $text, int $code = 200, array $headers = []) : ResponseInterface
|
||||
public static function renderText(string $html, int $code = 200, array $headers = []) : ResponseInterface
|
||||
{
|
||||
return new TextResponse($text, $code, $headers);
|
||||
return new TextResponse($html, $code, $headers);
|
||||
}
|
||||
|
||||
public static function renderHtml(string $html, int $code = 200, array $headers = []) : ResponseInterface
|
||||
|
@ -92,7 +91,7 @@ trait ControllerTrait {
|
|||
return new HtmlResponse($html, $code, $headers);
|
||||
}
|
||||
|
||||
public static function renderJson(array $data, int $code = 200, array $headers = []) : ResponseInterface
|
||||
public static function renderJson(/*\JsonSerializable|array*/ $data, int $code = 200, array $headers = []) : ResponseInterface
|
||||
{
|
||||
return new JsonResponse($data, $code, $headers);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
{% use
|
||||
Ulmus\Entity\Field\Date
|
||||
%}
|
||||
|
||||
{% arguments int $month, int $year %}
|
||||
|
||||
{% define "week.heading", int $day, int $month, int $year %}
|
||||
{% define "day.content", \DateTime $date, bool $today %}
|
||||
{% define "day.empty", int $day, int $month, int $year %}
|
||||
|
||||
{% php
|
||||
$month = ltrim($month, "0");
|
||||
$datetime = ( new Date( "{$year}-{$month}-1" ) );
|
||||
$index = $datetime->format('w');
|
||||
$dayCount = $datetime->format('t');
|
||||
$currentDay = 0;
|
||||
%}
|
||||
|
||||
<div class="calendar-wrapper">
|
||||
<div class='week-heading'>
|
||||
{% foreach range(1, 7) as $day %}
|
||||
{% slot "week.heading", $day, $month, $year %}
|
||||
<div class="day-box">
|
||||
{# Random calendar date that starts on a sunday #}
|
||||
{{ substr(( new Date("2019-12-$day") )->formatLocale("%A"), 0, 3) }}
|
||||
</div>
|
||||
{% endslot %}
|
||||
{% endforeach %}
|
||||
</div>
|
||||
|
||||
{% foreach range(0, 5) as $week %}
|
||||
<div class="week">
|
||||
{% foreach range(0, 6) as $day %}
|
||||
{% if ( $week * 6 + $day >= $index ) && ( $currentDay < $dayCount ) %}
|
||||
{% php
|
||||
$currentDay++;
|
||||
%}
|
||||
|
||||
{% slot "day.content", new \DateTime("$year-$month-$currentDay"), date("$year-$month-$currentDay") === date('Y-n-j') %}
|
||||
<div class="day-box {{ $today ? 'today' : '' }}">{{ $date->format('d') }}</div>
|
||||
{% endslot %}
|
||||
{% else %}
|
||||
{% slot "day.empty", $day, $month, $year %}
|
||||
<div class="day-box"></div>
|
||||
{% endslot %}
|
||||
{% endif %}
|
||||
{% endforeach %}
|
||||
</div>
|
||||
|
||||
{% if $currentDay >= $dayCount %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% endforeach %}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.legend {margin:6px 0 0 0; padding:5px 8px;background:#f9f2f2}
|
||||
.calendar-wrapper {border:1px solid #e3e6f0}
|
||||
.calendar-wrapper .day-box {position:relative;width:14.29%;border:2px solid #fff;height:60px;display:flex;flex-direction:column;justify-content:center;padding:6px 0; text-align:center}
|
||||
.calendar-wrapper .day-box.today {border:2px dashed #4e73df;}
|
||||
.calendar-wrapper .bg-conge,
|
||||
.calendar-wrapper .bg-pedagogique {position:absolute;top:0;bottom:0;left:0;right:0;opacity:0.5;pointer-events:none;}
|
||||
.calendar-wrapper .week,
|
||||
.calendar-wrapper .week-heading {display:flex;}
|
||||
.week-heading {background:#eaecf4;font-weight:bold;}
|
||||
.week:nth-child(even) {background:#f9f2f2; }
|
||||
</style>
|
Loading…
Reference in New Issue