kundenkarte/ajax/anlage_images.php
data 844e6060c6 feat(pwa): Offline-fähige Progressive Web App für Elektriker
PWA Mobile App für Schaltschrank-Dokumentation vor Ort:
- Token-basierte Authentifizierung (15 Tage gültig)
- Kundensuche mit Offline-Cache
- Anlagen-Auswahl und Offline-Laden
- Felder/Hutschienen/Automaten erfassen
- Automatische Synchronisierung wenn wieder online
- Installierbar auf dem Smartphone Home Screen
- Touch-optimiertes Dark Mode Design
- Quick-Select für Automaten-Werte (B16, C32, etc.)

Schaltplan-Editor Verbesserungen:
- Block Hover-Tooltip mit show_in_hover Feldern
- Produktinfo mit Icon im Tooltip
- Position und Breite in TE

Neue Dateien:
- pwa.php, pwa_auth.php - PWA Einstieg & Auth
- ajax/pwa_api.php - PWA AJAX API
- js/pwa.js, css/pwa.css - PWA App & Styles
- sw.js, manifest.json - Service Worker & Manifest
- img/pwa-icon-192.png, img/pwa-icon-512.png

Version: 5.2.0

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-23 15:27:06 +01:00

57 lines
1.6 KiB
PHP
Executable file

<?php
/* Copyright (C) 2026 Alles Watt lauft
*
* AJAX endpoint to get images for an installation element
*/
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
$res = 0;
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
if (!$res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php";
if (!$res) die("Include of main fails");
dol_include_once('/kundenkarte/class/anlagefile.class.php');
dol_include_once('/kundenkarte/class/anlage.class.php');
header('Content-Type: application/json');
// Berechtigungsprüfung
if (!$user->hasRight('kundenkarte', 'read')) {
http_response_code(403);
echo json_encode(['error' => 'Permission denied']);
exit;
}
$anlageId = GETPOSTINT('anlage_id');
if ($anlageId <= 0) {
echo json_encode(array('error' => 'Invalid ID', 'images' => array()));
exit;
}
// Get the anlage to know the socid
$anlage = new Anlage($db);
if ($anlage->fetch($anlageId) <= 0) {
echo json_encode(array('error' => 'Element not found', 'images' => array()));
exit;
}
// Get images for this element
$anlagefile = new AnlageFile($db);
$files = $anlagefile->fetchAllByAnlage($anlageId, 'image');
$images = array();
foreach ($files as $file) {
$images[] = array(
'id' => $file->id,
'name' => $file->filename,
'url' => $file->getUrl(),
'thumb' => $file->getThumbUrl() ?: $file->getUrl(),
);
}
echo json_encode(array('images' => $images));