__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* @package DPCalendar
* @copyright Copyright (C) 2024 Digital Peak GmbH. <https://www.digital-peak.com>
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
*/
namespace DigitalPeak\Component\DPCalendar\Administrator\Model;
defined('_JEXEC') or die();
use DigitalPeak\Component\DPCalendar\Administrator\Calendar\CalendarInterface;
use DigitalPeak\Component\DPCalendar\Administrator\Calendar\InternalCalendar;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Registry\Registry;
class CalendarModel extends BaseDatabaseModel
{
private static array $calendars = [];
public function getCalendar(mixed $id): ?CalendarInterface
{
if (isset(self::$calendars[$id])) {
return self::$calendars[$id];
}
$calendar = null;
if (is_numeric($id) || $id == 'root') {
$calendarNode = $this->bootComponent('dpcalendar')->getCategory()->get($id);
if ($calendarNode == null) {
return null;
}
$calendar = new InternalCalendar($calendarNode, $this->getCurrentUser());
} else {
PluginHelper::importPlugin('dpcalendar');
$tmp = Factory::getApplication()->triggerEvent('onCalendarsFetch', [$id]);
if (!empty($tmp)) {
foreach ($tmp as $calendars) {
foreach ($calendars as $fetchedCalendar) {
$calendar = $fetchedCalendar;
}
}
}
}
self::$calendars[$id] = $calendar;
return $calendar;
}
public function increaseEtag(string $calendarId): void
{
// If we are not a native calendar do nothing
if (!is_numeric($calendarId)) {
return;
}
$calendar = self::getCalendar($calendarId);
if (!$calendar instanceof CalendarInterface || ($calendar->getId() === '' || $calendar->getId() === '0')) {
return;
}
$params = new Registry($calendar->getParams());
$params->set('etag', $params->get('etag', 1) + 1);
// @phpstan-ignore-next-line
$db = $this->getDatabase();
// @phpstan-ignore-next-line
$db->setQuery('update #__categories set params = ' . $db->quote($params->toString()) . ' where id = ' . $db->quote($calendar->getId()));
$db->execute();
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| BookingsModel.php | File | 6.99 KB | 0664 |
|
| CaldavModel.php | File | 1.97 KB | 0664 |
|
| CalendarModel.php | File | 2.07 KB | 0664 |
|
| CountriesModel.php | File | 3.99 KB | 0664 |
|
| CountryModel.php | File | 2.86 KB | 0664 |
|
| CouponModel.php | File | 3.76 KB | 0664 |
|
| CouponsModel.php | File | 4.04 KB | 0664 |
|
| CpanelModel.php | File | 4.27 KB | 0664 |
|
| EventModel.php | File | 31.73 KB | 0664 |
|
| EventsModel.php | File | 14.48 KB | 0664 |
|
| ExtcalendarModel.php | File | 5.59 KB | 0664 |
|
| ExtcalendarsModel.php | File | 4.92 KB | 0664 |
|
| FieldsOrderModel.php | File | 5.69 KB | 0664 |
|
| GeoModel.php | File | 19.01 KB | 0664 |
|
| IcalModel.php | File | 14.86 KB | 0664 |
|
| ImportModel.php | File | 7.32 KB | 0664 |
|
| LayoutModel.php | File | 722 B | 0664 |
|
| LocationModel.php | File | 11.99 KB | 0664 |
|
| LocationsModel.php | File | 8.92 KB | 0664 |
|
| PluginModel.php | File | 783 B | 0664 |
|
| TaxrateModel.php | File | 3.58 KB | 0664 |
|
| TaxratesModel.php | File | 4.33 KB | 0664 |
|
| TicketsModel.php | File | 8.96 KB | 0664 |
|
| ToolsModel.php | File | 1.61 KB | 0664 |
|