Quelltext des aktuellen Standes
<?php
$this->layout('layouts/main', [
'page_title' => $page_title,
'current_route' => $current_route,
'full_width' => true,
]);
use OpenNIT\Software\LicenseComparison;
$rows = $rows ?? [];
$unlinked = $unlinked ?? [];
$counts = $counts ?? ['lizenzen' => 0, 'programme' => 0, 'ohne_lizenz' => 0, 'ueberzogen' => 0];
$view = $this;
$tonPill = [
'fehlend' => 'status-pill--danger',
'genau' => 'status-pill--warning',
'frei' => 'status-pill--success',
'unbegrenzt' => 'status-pill--muted',
];
?>
<div class="content-header">
<div>
<h1><?= $this->te('Lizenz-Abgleich') ?></h1>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/"><?= $this->te('Home') ?></a></li>
<li class="breadcrumb-item"><a href="/licenses"><?= $this->te('Lizenzen') ?></a></li>
<li class="breadcrumb-item active"><?= $this->te('Abgleich') ?></li>
</ol>
</div>
<div class="content-header-actions">
<a href="/software" class="btn btn-default btn-sm"><i class="fas fa-box-open"></i> <?= $this->te('Software-Inventar') ?></a>
</div>
</div>
<div class="page-body">
<div class="kpi-row">
<div class="kpi-col">
<div class="small-box bg-info">
<div class="inner"><h3><?= (int)$counts['lizenzen'] ?></h3><p><?= $this->te('Lizenzen mit Zuordnung') ?></p></div>
<div class="icon"><i class="fas fa-certificate"></i></div>
</div>
</div>
<div class="kpi-col">
<div class="small-box bg-secondary">
<div class="inner"><h3><?= (int)$counts['programme'] ?></h3><p><?= $this->te('Zugeordnete Programme') ?></p></div>
<div class="icon"><i class="fas fa-box-open"></i></div>
</div>
</div>
<div class="kpi-col">
<div class="small-box <?= (int)$counts['ueberzogen'] > 0 ? 'bg-danger' : 'bg-success' ?>">
<div class="inner"><h3><?= (int)$counts['ueberzogen'] ?></h3><p><?= $this->te('Mehr installiert als lizenziert') ?></p></div>
<div class="icon"><i class="fas fa-exclamation-triangle"></i></div>
</div>
</div>
<div class="kpi-col">
<div class="small-box bg-warning">
<div class="inner"><h3><?= (int)$counts['ohne_lizenz'] ?></h3><p><?= $this->te('Programme ohne Zuordnung') ?></p></div>
<div class="icon"><i class="fas fa-question-circle"></i></div>
</div>
</div>
</div>
<div class="detail-card" style="margin-bottom:1rem;">
<div class="detail-card-header">
<h2 class="detail-card-title"><?= $this->te('Gekauft und tatsächlich installiert') ?></h2>
</div>
<div class="detail-card-body">
<p class="text-muted" style="margin-top:0;font-size:.87rem;">
<?= $this->t('Verglichen wird nur, wofür jemand ein Programm zugeordnet hat – die Zuordnung entsteht auf der Lizenzseite und wird nicht geraten. Die Spalte <em>Installiert</em> zählt Geräte aus dem Software-Inventar, <em>Plätze</em> steht an der Lizenz (bei Microsoft-Lizenzen aus dem Entra-Abgleich).') ?>
</p>
<?php if (empty($rows)): ?>
<div class="empty-state">
<p>
<?= $this->t('Noch keine Lizenz mit einem Programm verbunden. Auf einer Lizenzseite unter <em>Software-Inventar</em> ein Programm zuordnen – dort stehen auch Vorschläge.') ?>
</p>
</div>
<?php else: ?>
<div class="table-wrapper">
<table class="data-table">
<thead>
<tr>
<th scope="col"><?= $this->te('Lizenz') ?></th>
<th scope="col"><?= $this->te('Hersteller') ?></th>
<th scope="col"><?= $this->te('Programme') ?></th>
<th scope="col"><?= $this->te('Plätze') ?></th>
<th scope="col"><?= $this->te('Installiert') ?></th>
<th scope="col"><?= $this->te('Bewertung') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($rows as $r): $d = $r['differenz']; ?>
<tr>
<td>
<a href="/licenses/<?= (int)$r['id'] ?>" class="table-link"><?= $view->e((string)$r['name']) ?></a>
<?php if (($r['external_source'] ?? '') === 'entra'): ?>
<span class="badge"><?= $this->te('Entra') ?></span>
<?php endif; ?>
</td>
<td class="text-muted"><?= $view->e((string)($r['vendor'] ?? '')) ?: '—' ?></td>
<td class="text-muted"><?= (int)$r['programme'] ?></td>
<td><?= (int)$r['seats'] > 0 ? (int)$r['seats'] : '<span class="text-muted">unbegrenzt</span>' ?></td>
<td><strong><?= (int)$r['installationen'] ?></strong></td>
<td>
<span class="status-pill <?= $tonPill[$d['ton']] ?? 'status-pill--muted' ?>">
<?= $view->e($d['text']) ?>
</span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</div>
<div class="detail-card">
<div class="detail-card-header">
<h2 class="detail-card-title">
<?= $this->te('Installiert, aber keiner Lizenz zugeordnet') ?>
<span class="badge"><?= count($unlinked) ?></span>
</h2>
</div>
<div class="detail-card-body">
<p class="text-muted" style="margin-top:0;font-size:.87rem;">
<?= $this->t('Das ist <strong>keine</strong> Aussage über Lizenzpflicht – vieles davon ist frei oder gehört zum Betriebssystem. Es ist die Liste dessen, worüber noch niemand entschieden hat. Systembestandteile sind ausgenommen.') ?>
</p>
<?php if (empty($unlinked)): ?>
<div class="empty-state"><p><?= $this->te('Jedes erfasste Programm ist einer Lizenz zugeordnet.') ?></p></div>
<?php else: ?>
<div class="table-wrapper">
<table class="data-table">
<thead><tr><th scope="col"><?= $this->te('Programm') ?></th><th scope="col"><?= $this->te('Hersteller') ?></th><th scope="col"><?= $this->te('Geräte') ?></th></tr></thead>
<tbody>
<?php foreach ($unlinked as $u): ?>
<tr>
<td><a href="/software/<?= (int)$u['id'] ?>" class="table-link"><?= $view->e((string)$u['name']) ?></a></td>
<td class="text-muted"><?= $view->e((string)$u['publisher']) ?: '—' ?></td>
<td><strong><?= (int)$u['geraete'] ?></strong></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</div>
</div>