Skip to content

Commit

Permalink
Calendar: Fix typos, date format and more (#1141)
Browse files Browse the repository at this point in the history
* Fix typos and date format
* Update FullCalendar to 6.1.15
* Small code improvements
  • Loading branch information
blackcoder87 authored Dec 8, 2024
1 parent 2640ffe commit 6abb594
Show file tree
Hide file tree
Showing 117 changed files with 14,967 additions and 2,193 deletions.
9 changes: 4 additions & 5 deletions application/modules/calendar/boxes/views/calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<div id='calendarbox<?=$this->get('uniqid') ?>'></div>
</div>

<script src="<?=$this->getBoxUrl('static/js/fullcalendar-6.1.10/dist/index.global.min.js') ?>"></script>
<script src="<?=$this->getBoxUrl('static/js/fullcalendar-6.1.10/packages/core/locales-all.global.min.js') ?>"></script>
<script src="<?=$this->getBoxUrl('static/js/fullcalendar-6.1.15/dist/index.global.min.js') ?>"></script>
<script src="<?=$this->getBoxUrl('static/js/fullcalendar-6.1.15/packages/core/locales-all.global.min.js') ?>"></script>
<script>
if (typeof languagecalendar === 'undefined') {
var languagecalendar = '<?=substr($this->getTranslator()->getLocale(), 0, 2) ?>';
Expand Down Expand Up @@ -45,9 +45,8 @@
<?php endforeach; ?>
],
eventDidMount: function (info) {
$('#calendarbox<?=$this->get('uniqid') ?> .fc-daygrid-day.fc-day').each(function(i) {
let date = $(this).data('date'),
eventframe = $(this).find('.fc-daygrid-day-frame .fc-daygrid-day-events');
$('#calendarbox<?=$this->get('uniqid') ?> .fc-daygrid-day.fc-day').each(function() {
let eventframe = $(this).find('.fc-daygrid-day-frame .fc-daygrid-day-events');

let count = eventframe[0].childElementCount;
count--;
Expand Down
8 changes: 6 additions & 2 deletions application/modules/calendar/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Config extends \Ilch\Config\Install
{
public $config = [
'key' => 'calendar',
'version' => '1.11.2',
'version' => '1.11.3',
'icon_small' => 'fa-solid fa-calendar',
'author' => 'Veldscholten, Kevin',
'link' => 'https://ilch.de',
Expand Down Expand Up @@ -258,8 +258,12 @@ public function getUpdate(string $installedVersion): string
removeDir(APPLICATION_PATH . '/modules/calendar/static/js/fullcalendar_5_11_3/');
// no break
case "1.10.0":
// no break
case "1.11.0":
case "1.11.1":
case "1.11.2":
// Remove old version of fullcalendar as this version comes with version 6.1.15.
removeDir(APPLICATION_PATH . '/modules/calendar/static/js/fullcalendar-6.1.10/');
// no break
}

return '"' . $this->config['key'] . '" Update-function executed.';
Expand Down
7 changes: 4 additions & 3 deletions application/modules/calendar/controllers/admin/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Modules\Calendar\Controllers\Admin;

use Ilch\Date;
use Modules\Calendar\Mappers\Calendar as CalendarMapper;
use Modules\Calendar\Models\Calendar as CalendarModel;
use Modules\User\Mappers\Group as GroupMapper;
Expand Down Expand Up @@ -130,13 +131,13 @@ public function treatAction()
$calendarModel->setUid(($this->getRequest()->getParam('id')) ? $calendarModel->getUid() : generateUUID())
->setTitle($this->getRequest()->getPost('title'))
->setPlace($this->getRequest()->getPost('place'))
->setStart(new \Ilch\Date($this->getRequest()->getPost('start')))
->setEnd($this->getRequest()->getPost('end') ? new \Ilch\Date($this->getRequest()->getPost('end')) : '1000-01-01 00:00:00')
->setStart(new Date($this->getRequest()->getPost('start')))
->setEnd($this->getRequest()->getPost('end') ? new Date($this->getRequest()->getPost('end')) : '1000-01-01 00:00:00')
->setText($this->getRequest()->getPost('text'))
->setColor($this->getRequest()->getPost('color'))
->setPeriodDay($this->getRequest()->getPost('periodDay'))
->setPeriodType($this->getRequest()->getPost('periodType'))
->setRepeatUntil($this->getRequest()->getPost('repeatUntil') ? new \Ilch\Date($this->getRequest()->getPost('repeatUntil')) : '1000-01-01 00:00:00')
->setRepeatUntil($this->getRequest()->getPost('repeatUntil') ? new Date($this->getRequest()->getPost('repeatUntil')) : '1000-01-01 00:00:00')
->setReadAccess($groups);
$calendarMapper->save($calendarModel);

Expand Down
8 changes: 5 additions & 3 deletions application/modules/calendar/mappers/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
namespace Modules\Calendar\Mappers;

use Ilch\Date;
use Ilch\Pagination;
use Modules\Calendar\Models\Calendar as EntriesModel;

class Calendar extends \Ilch\Mapper
{
public $tablename = 'calendar';
public string $tablename = 'calendar';

/**
* returns if the module is installed.
Expand All @@ -29,10 +30,10 @@ public function checkDB(): bool
*
* @param array $where
* @param array $orderBy
* @param \Ilch\Pagination|null $pagination
* @param Pagination|null $pagination
* @return array|null
*/
public function getEntriesBy(array $where = [], array $orderBy = ['c.id' => 'DESC'], ?\Ilch\Pagination $pagination = null): ?array
public function getEntriesBy(array $where = [], array $orderBy = ['c.id' => 'DESC'], ?Pagination $pagination = null): ?array
{
$read_access = '';
if (isset($where['ra.group_id'])) {
Expand Down Expand Up @@ -303,6 +304,7 @@ public function repeat(string $type, Date $startdate, Date $enddate, Date $until
break;
}

/** @noinspection PhpConditionAlreadyCheckedInspection */
if ($startdateRecurrence <= $untilDate) {
$event['start'] = clone $startdateRecurrence;
$event['end'] = clone $enddateRecurrence;
Expand Down
7 changes: 4 additions & 3 deletions application/modules/calendar/mappers/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@

namespace Modules\Calendar\Mappers;

use Ilch\Pagination;
use Modules\Calendar\Models\Events as EntriesModel;

class Events extends \Ilch\Mapper
{
public $tablename = 'calendar_events';
public string $tablename = 'calendar_events';

/**
* returns if the module is installed.
Expand All @@ -28,10 +29,10 @@ public function checkDB(): bool
*
* @param array $where
* @param array $orderBy
* @param \Ilch\Pagination|null $pagination
* @param Pagination|null $pagination
* @return array|null
*/
public function getEntriesBy(array $where = [], array $orderBy = ['id' => 'DESC'], ?\Ilch\Pagination $pagination = null): ?array
public function getEntriesBy(array $where = [], array $orderBy = ['id' => 'DESC'], ?Pagination $pagination = null): ?array
{
$select = $this->db()->select()
->fields(['*'])
Expand Down
24 changes: 12 additions & 12 deletions application/modules/calendar/models/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Calendar extends \Ilch\Model
*
* @var int
*/
protected $id = 0;
protected int $id = 0;

/**
* The uid of the calendar.
Expand All @@ -23,77 +23,77 @@ class Calendar extends \Ilch\Model
* @var string
* @see https://icalendar.org/New-Properties-for-iCalendar-RFC-7986/5-3-uid-property.html
*/
protected $uid = '';
protected string $uid = '';

/**
* The title of the calendar.
*
* @var string
*/
protected $title = '';
protected string $title = '';

/**
* The place of the calendar.
*
* @var string
*/
protected $place = '';
protected string $place = '';

/**
* The start date of the calendar.
*
* @var string
*/
protected $start = '';
protected string $start = '';

/**
* The end date of the calendar.
*
* @var string
*/
protected $end = '';
protected string $end = '';

/**
* The text of the calendar.
*
* @var string
*/
protected $text = '';
protected string $text = '';

/**
* The color of the calendar.
*
* @var string
*/
protected $color = '';
protected string $color = '';

/**
* The period day of the calendar.
*
* @var int
*/
protected $periodDay = 0;
protected int $periodDay = 0;

/**
* Read access of the calendar.
*
* @var string
*/
protected $readAccess = '';
protected string $readAccess = '';

/**
* period day of the calendar.
*
* @var string
*/
protected $periodType = '';
protected string $periodType = '';

/**
* Repeat event until a specific date.
*
* @var string
*/
protected $repeatUntil = '';
protected string $repeatUntil = '';

/**
* Gets the id of the calendar.
Expand Down
4 changes: 2 additions & 2 deletions application/modules/calendar/models/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ class Events extends \Ilch\Model
*
* @var int
*/
protected $id = 0;
protected int $id = 0;

/**
* The Url of the events.
*
* @var string
*/
protected $url = '';
protected string $url = '';

/**
* Sets Model by Array.
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 6abb594

Please sign in to comment.