OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)
This commit is contained in:
61
app/Domain/Calendar/Controllers/CalendarSettings.php
Normal file
61
app/Domain/Calendar/Controllers/CalendarSettings.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Calendar\Controllers;
|
||||
|
||||
use Leantime\Core\Auth\Permissions\RequiresPermission;
|
||||
use Leantime\Core\Controller\Controller;
|
||||
use Leantime\Domain\Calendar\Permissions\CalendarPermissions;
|
||||
use Leantime\Domain\Calendar\Services\Calendar as CalendarService;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* CalendarSettings Controller - Displays calendar settings modal.
|
||||
*
|
||||
* Plugins can register additional settings sections via the filter:
|
||||
* 'leantime.domain.calendar.controllers.calendarsettings.get.calendarSettings.sections'
|
||||
*
|
||||
* Plugins can mark calendars as plugin-managed (hides edit/delete UI) via the filter:
|
||||
* 'leantime.domain.calendar.controllers.calendarsettings.get.calendarSettings.externalCalendars'
|
||||
*
|
||||
* Section array structure:
|
||||
* - id: string (unique identifier)
|
||||
* - icon: string (FontAwesome class or SVG markup)
|
||||
* - iconType: string ('fontawesome'|'svg', default 'fontawesome')
|
||||
* - title: string (section heading)
|
||||
* - description: string (optional description text)
|
||||
* - content: string (raw HTML content - plugin must sanitize)
|
||||
* - actions: array (optional action buttons with url, label, class, icon, type keys)
|
||||
*/
|
||||
class CalendarSettings extends Controller
|
||||
{
|
||||
private CalendarService $calendarService;
|
||||
|
||||
/**
|
||||
* Initialize the controller with dependencies.
|
||||
*/
|
||||
public function init(CalendarService $calendarService): void
|
||||
{
|
||||
$this->calendarService = $calendarService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the Calendar Settings modal.
|
||||
*/
|
||||
#[RequiresPermission(CalendarPermissions::VIEW)]
|
||||
public function get(array $params): Response
|
||||
{
|
||||
// Get external calendars for the current user
|
||||
$externalCalendars = $this->calendarService->getMyExternalCalendars((int) session('userdata.id'));
|
||||
|
||||
// Plugins can augment calendar data (e.g., add 'managedByPlugin' => true to hide edit/delete)
|
||||
$externalCalendars = self::dispatchFilter('calendarSettings.externalCalendars', $externalCalendars);
|
||||
|
||||
// Plugins can add their settings sections via this filter
|
||||
$pluginSections = self::dispatchFilter('calendarSettings.sections', []);
|
||||
|
||||
$this->tpl->assign('externalCalendars', $externalCalendars);
|
||||
$this->tpl->assign('pluginSections', $pluginSections);
|
||||
|
||||
return $this->tpl->displayPartial('calendar.calendarSettings');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user