}} */ class syntax_plugin_luxtools_maintenance extends SyntaxPlugin { /** @inheritdoc */ public function getType() { return 'substition'; } /** @inheritdoc */ public function getPType() { return 'block'; } /** @inheritdoc */ public function getSort() { return 225; } /** @inheritdoc */ public function connectTo($mode) { $this->Lexer->addSpecialPattern( '\{\{maintenance_tasks>\}\}', $mode, 'plugin_luxtools_maintenance' ); } /** @inheritdoc */ public function handle($match, $state, $pos, Doku_Handler $handler) { return ['ok' => true]; } /** @inheritdoc */ public function render($format, Doku_Renderer $renderer, $data) { if ($data === false || !is_array($data)) return false; if ($format !== 'xhtml') return false; if (!($renderer instanceof Doku_Renderer_xhtml)) return false; $renderer->nocache(); $slots = CalendarSlot::loadAll($this); $maintenanceSlot = $slots['maintenance'] ?? null; if ($maintenanceSlot === null || !$maintenanceSlot->isEnabled()) { $renderer->doc .= '
' . '

' . hsc($this->getLang('maintenance_no_tasks')) . '

'; return true; } $todayIso = date('Y-m-d'); $tasks = CalendarService::openMaintenanceTasks($maintenanceSlot, $todayIso); $title = (string)$this->getLang('chronological_maintenance_title'); if ($title === '') $title = 'Tasks'; $renderer->doc .= '
'; $renderer->doc .= '

' . hsc($title) . '

'; if ($tasks === []) { $noTasks = (string)$this->getLang('maintenance_no_tasks'); if ($noTasks === '') $noTasks = 'No open tasks.'; $renderer->doc .= '

' . hsc($noTasks) . '

'; } else { $renderer->doc .= ''; } $renderer->doc .= '
'; return true; } }