dolibarr.agendawrapper/core/modules/modAgendWrapper.class.php
data e7fbffa12f AgendWrapper v1.0.0 - ICS-Proxy fuer Nextcloud-Kalender
Erstes Release des Moduls. Fungiert als ICS-Proxy zwischen
Nextcloud CalDAV und Dolibarr, um VTIMEZONE-Inkompatibilitaeten
zu umgehen.

- Proxy-Endpunkt mit API-Key-Absicherung
- Automatische VTIMEZONE->UTC Konvertierung
- Basic-Auth-Anbindung an Nextcloud
- Datei-basiertes Caching
- Admin-Seite mit Verbindungstest
- Statusseite mit Cache-Verwaltung
- Optionaler Cron-Job
- Sprachdateien de_DE + en_US

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 20:29:23 +01:00

170 lines
4.5 KiB
PHP
Executable file

<?php
/* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \defgroup agendwrapper Module AgendWrapper
* \brief ICS-Proxy fuer Nextcloud-Kalender mit Zeitzonen-Konvertierung
*
* \file htdocs/agendwrapper/core/modules/modAgendWrapper.class.php
* \ingroup agendwrapper
* \brief Modul-Deskriptor fuer AgendWrapper
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
/**
* Modul-Deskriptor fuer AgendWrapper
*/
class modAgendWrapper extends DolibarrModules
{
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
global $conf, $langs;
$this->db = $db;
$this->numero = 500023;
$this->rights_class = 'agendwrapper';
$this->family = "interface";
$this->module_position = '90';
$this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "AgendWrapperDescription";
$this->descriptionlong = "AgendWrapperDescription";
$this->editor_name = 'Alles Watt laeuft';
$this->editor_url = '';
$this->version = '1.0';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->picto = 'fa-calendar-alt';
$this->module_parts = array(
'triggers' => 0,
'login' => 0,
'substitutions' => 0,
'menus' => 0,
'tpl' => 0,
'barcode' => 0,
'models' => 0,
'printing' => 0,
'theme' => 0,
'css' => array(),
'js' => array(),
'hooks' => array(),
'moduleforexternal' => 0,
'websitetemplates' => 0,
'captcha' => 0
);
// Cache-Verzeichnis
$this->dirs = array("/agendwrapper/temp");
$this->config_page_url = array("setup.php@agendwrapper");
$this->hidden = getDolGlobalInt('MODULE_AGENDWRAPPER_DISABLED');
$this->depends = array();
$this->requiredby = array();
$this->conflictwith = array();
$this->langfiles = array("agendwrapper@agendwrapper");
$this->phpmin = array(7, 4);
$this->need_dolibarr_version = array(19, -3);
$this->need_javascript_ajax = 0;
$this->warnings_activation = array();
$this->warnings_activation_ext = array();
// Konstanten bei Modulaktivierung
$this->const = array(
1 => array('AGENDWRAPPER_CACHE_DURATION', 'chaine', '300', 'Cache-Dauer in Sekunden', 0, 'current', 0),
);
if (!isModEnabled("agendwrapper")) {
$conf->agendwrapper = new stdClass();
$conf->agendwrapper->enabled = 0;
}
$this->tabs = array();
$this->dictionaries = array();
$this->boxes = array();
// Cron-Job: Cache aufwaermen (standardmaessig deaktiviert)
$this->cronjobs = array(
0 => array(
'label' => 'AgendWrapper Cache aufwaermen',
'jobtype' => 'method',
'class' => '/agendwrapper/class/IcsProxy.class.php',
'objectname' => 'IcsProxy',
'method' => 'warmCache',
'parameters' => '',
'comment' => 'Holt ICS-Daten von Nextcloud und aktualisiert den Cache',
'frequency' => 5,
'unitfrequency' => 60,
'status' => 0,
'test' => 'isModEnabled("agendwrapper")',
'priority' => 50,
),
);
// Rechte
$this->rights = array();
$r = 0;
$this->rights[$r][0] = $this->numero . '011';
$this->rights[$r][1] = 'Zugriff auf AgendWrapper Proxy';
$this->rights[$r][4] = 'proxy';
$this->rights[$r][5] = 'read';
$r++;
// Kein Top-Menu (Utility-Modul, nur Admin-Seite)
$this->menu = array();
}
/**
* Modul aktivieren
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int<-1,1> 1 if OK, <=0 if KO
*/
public function init($options = '')
{
$result = $this->_load_tables('/agendwrapper/sql/');
if ($result < 0) {
return -1;
}
$this->remove($options);
$sql = array();
return $this->_init($sql, $options);
}
/**
* Modul deaktivieren
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int<-1,1> 1 if OK, <=0 if KO
*/
public function remove($options = '')
{
$sql = array();
return $this->_remove($sql, $options);
}
}