mirror of
https://github.com/Karaka-Management/oms-Calendar.git
synced 2026-02-16 00:18:41 +00:00
fix #105
This commit is contained in:
parent
d397a8cea3
commit
a70302d761
|
|
@ -146,9 +146,13 @@ class Controller extends ModuleAbstract implements WebInterface
|
||||||
$view = new View($this->app, $request, $response);
|
$view = new View($this->app, $request, $response);
|
||||||
$view->setTemplate('/Modules/Calendar/Theme/Backend/dashboard-calendar');
|
$view->setTemplate('/Modules/Calendar/Theme/Backend/dashboard-calendar');
|
||||||
|
|
||||||
|
$calendarView = new \Modules\Calendar\Theme\Backend\Components\Calendar\BaseView($this->app, $request, $response);
|
||||||
|
$calendarView->setTemplate('/Modules/Calendar/Theme/Backend/Components/Calendar/mini');
|
||||||
|
$view->addData('calendar', $calendarView);
|
||||||
|
|
||||||
$calendar = CalendarMapper::get(1);
|
$calendar = CalendarMapper::get(1);
|
||||||
$calendar->setDate(new SmartDateTime($request->getData('date') ?? 'now'));
|
$calendar->setDate(new SmartDateTime($request->getData('date') ?? 'now'));
|
||||||
$view->addData('calendar', $calendar);
|
$view->addData('cal', $calendar);
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
38
Theme/Backend/Components/Calendar/BaseView.php
Normal file
38
Theme/Backend/Components/Calendar/BaseView.php
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Modules\Calendar\Theme\Backend\Components\Calendar;
|
||||||
|
|
||||||
|
use phpOMS\Views\View;
|
||||||
|
use phpOMS\ApplicationAbstract;
|
||||||
|
use phpOMS\Message\RequestAbstract;
|
||||||
|
use phpOMS\Message\ResponseAbstract;
|
||||||
|
|
||||||
|
class BaseView extends View
|
||||||
|
{
|
||||||
|
protected $calendar = [];
|
||||||
|
|
||||||
|
public function __construct(ApplicationAbstract $app, RequestAbstract $request, ResponseAbstract $response)
|
||||||
|
{
|
||||||
|
parent::__construct($app, $request, $response);
|
||||||
|
$this->setTemplate('/Modules/Calendar/Theme/Backend/Components/Calendar/mini');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render(...$data) : string
|
||||||
|
{
|
||||||
|
$this->calendar = $data[0];
|
||||||
|
return parent::render();
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Theme/Backend/Components/Calendar/mini.tpl.php
Normal file
36
Theme/Backend/Components/Calendar/mini.tpl.php
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
<div id="calendar" class="m-calendar m-calendar-mini" data-action='[
|
||||||
|
{
|
||||||
|
"listener": "click", "selector": "#calendar span.tag", "action": [
|
||||||
|
{"key": 1, "type": "dom.popup", "tpl": "calendar-event-popup-tpl", "aniIn": "fadeIn"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]'>
|
||||||
|
<div class="box wf-100">
|
||||||
|
<ul class="weekdays green">
|
||||||
|
<li><?= $this->getHtml('Sunday', 'Calendar'); ?>
|
||||||
|
<li><?= $this->getHtml('Monday', 'Calendar'); ?>
|
||||||
|
<li><?= $this->getHtml('Tuesday', 'Calendar'); ?>
|
||||||
|
<li><?= $this->getHtml('Wednesday', 'Calendar'); ?>
|
||||||
|
<li><?= $this->getHtml('Thursday', 'Calendar'); ?>
|
||||||
|
<li><?= $this->getHtml('Friday', 'Calendar'); ?>
|
||||||
|
<li><?= $this->getHtml('Saturday', 'Calendar'); ?>
|
||||||
|
</ul>
|
||||||
|
<?php $current = $this->calendar->getDate()->getMonthCalendar(0); $isActiveMonth = false;
|
||||||
|
for($i = 0; $i < 6; $i++) : ?>
|
||||||
|
<ul class="days">
|
||||||
|
<?php for($j = 0; $j < 7; $j++) :
|
||||||
|
$isActiveMonth = ((int) $current[$i*7+$j]->format('d') === 1) ? !$isActiveMonth : $isActiveMonth;
|
||||||
|
?>
|
||||||
|
<?php if($isActiveMonth) :?>
|
||||||
|
<li class="day<?= $this->calendar->hasEventOnDate($current[$i*7+$j]) ? ' has-event' : '';?>">
|
||||||
|
<div class="date"><?= $current[$i*7+$j]->format('d'); ?></div>
|
||||||
|
<?php else: ?>
|
||||||
|
<li class="day other-month<?= $this->calendar->hasEventOnDate($current[$i*7+$j]) ? ' has-event' : '';?>">
|
||||||
|
<div class="date"><?= $current[$i*7+$j]->format('d'); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<?php endfor;?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -1,39 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
$calendar = $this->getData('calendar');
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
?>
|
?>
|
||||||
<div id="calendar" class="m-calendar m-calendar-mini col-xs-12 col-md-6" draggable="true" data-action='[
|
<div id="calendar" class="ol-xs-12 col-md-6" draggable="true">
|
||||||
{
|
<?= $this->getData('calendar')->render($this->getData('cal')); ?>
|
||||||
"listener": "click", "selector": "#calendar span.tag", "action": [
|
|
||||||
{"key": 1, "type": "dom.popup", "tpl": "calendar-event-popup-tpl", "aniIn": "fadeIn"}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]'>
|
|
||||||
<div class="box wf-100">
|
|
||||||
<ul class="weekdays green">
|
|
||||||
<li><?= $this->getHtml('Sunday'); ?>
|
|
||||||
<li><?= $this->getHtml('Monday'); ?>
|
|
||||||
<li><?= $this->getHtml('Tuesday'); ?>
|
|
||||||
<li><?= $this->getHtml('Wednesday'); ?>
|
|
||||||
<li><?= $this->getHtml('Thursday'); ?>
|
|
||||||
<li><?= $this->getHtml('Friday'); ?>
|
|
||||||
<li><?= $this->getHtml('Saturday'); ?>
|
|
||||||
</ul>
|
|
||||||
<?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 = ((int) $current[$i*7+$j]->format('d') === 1) ? !$isActiveMonth : $isActiveMonth;
|
|
||||||
?>
|
|
||||||
<?php if($isActiveMonth) :?>
|
|
||||||
<li class="day<?= $calendar->hasEventOnDate($current[$i*7+$j]) ? ' has-event' : '';?>">
|
|
||||||
<div class="date"><?= $current[$i*7+$j]->format('d'); ?></div>
|
|
||||||
<?php else: ?>
|
|
||||||
<li class="day other-month<?= $calendar->hasEventOnDate($current[$i*7+$j]) ? ' has-event' : '';?>">
|
|
||||||
<div class="date"><?= $current[$i*7+$j]->format('d'); ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endfor; ?>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<?php endfor;?>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user