OpenNIT

Quelltext des aktuellen Standes

Fassung 1.1.1

profile.php

3 KB
<?php $this->layout('layouts/portal', [
    'page_title' => 'Mein Profil',
    'ssp_active' => 'profile',
]);
$du = ($portal_address ?? 'du') !== 'sie';
$d  = $details ?? [];
$ov = $overview ?? [];

// Anzuzeigende Verzeichnisfelder (leere werden ausgelassen).
$fields = [
    ['icon' => 'fa-user',       'label' => 'Name',      'value' => $d['display_name'] ?? ''],
    ['icon' => 'fa-envelope',   'label' => 'E-Mail',    'value' => $d['email'] ?? ''],
    ['icon' => 'fa-briefcase',  'label' => 'Position',  'value' => $d['job_title'] ?? ''],
    ['icon' => 'fa-sitemap',    'label' => 'Abteilung', 'value' => $d['department'] ?? ''],
    ['icon' => 'fa-phone',      'label' => 'Telefon',   'value' => $d['phone'] ?? ''],
];

// Übersichtskacheln nur für freigeschaltete Bereiche (null = Bereich aus).
$tiles = [];
if (($ov['tickets'] ?? null) !== null)   { $tiles[] = ['icon' => 'fa-ticket-alt',     'label' => 'Offene Tickets',    'count' => (int)$ov['tickets'],   'href' => '/portal/tickets']; }
if (($ov['requests'] ?? null) !== null)  { $tiles[] = ['icon' => 'fa-file-signature', 'label' => 'Offene Anträge',     'count' => (int)$ov['requests'],  'href' => '/portal/requests']; }
if (($ov['approvals'] ?? null) !== null) { $tiles[] = ['icon' => 'fa-clipboard-check','label' => 'Offene Genehmigungen','count' => (int)$ov['approvals'],'href' => '/portal/approvals']; }
if (($ov['devices'] ?? null) !== null)   { $tiles[] = ['icon' => 'fa-laptop',         'label' => 'Meine Geräte',       'count' => (int)$ov['devices'],   'href' => '/portal/devices']; }
?>
<div class="ssp-hello">
    <h1><?= $this->te('Mein Profil') ?></h1>
    <p><?= $du
        ? $this->te('Deine im Verzeichnis hinterlegten Daten und ein Überblick über deine Vorgänge.')
        : $this->te('Ihre im Verzeichnis hinterlegten Daten und ein Überblick über Ihre Vorgänge.') ?></p>
</div>

<?php if (!empty($tiles)): ?>
<div class="ssp-profile-tiles">
    <?php foreach ($tiles as $t): ?>
    <a class="ssp-profile-tile" href="<?= $this->e($t['href']) ?>">
        <span class="ssp-profile-tile-icon"><i class="fas <?= $this->e($t['icon']) ?>" aria-hidden="true"></i></span>
        <span class="ssp-profile-tile-num"><?= (int)$t['count'] ?></span>
        <span class="ssp-profile-tile-label"><?= $this->e($t['label']) ?></span>
    </a>
    <?php endforeach; ?>
</div>
<?php endif; ?>

<div class="ssp-card">
    <h2><span class="ssp-card-icon"><i class="fas fa-id-card" aria-hidden="true"></i></span> <?= $du ? $this->te('Deine Daten') : $this->te('Ihre Daten') ?></h2>
    <dl class="ssp-profile-list">
        <?php foreach ($fields as $f): if (trim((string)$f['value']) === '') { continue; } ?>
        <div class="ssp-profile-row">
            <dt><i class="fas <?= $this->e($f['icon']) ?>" aria-hidden="true"></i> <?= $this->e($f['label']) ?></dt>
            <dd><?= $this->e($f['value']) ?></dd>
        </div>
        <?php endforeach; ?>
    </dl>
    <p class="ssp-hint">
        <i class="fas fa-info-circle" aria-hidden="true"></i>
        <?= $du
            ? $this->te('Diese Daten stammen aus dem zentralen Verzeichnis der IT.')
            : $this->te('Diese Daten stammen aus dem zentralen Verzeichnis der IT.') ?>
        <?php if (!empty($tickets_on)): ?>
            <?= $du ? $this->te('Stimmt etwas nicht?') : $this->te('Stimmt etwas nicht?') ?>
            <a href="/portal/tickets/new"><?= $du ? $this->te('Melde es der IT.') : $this->te('Melden Sie es der IT.') ?></a>
        <?php endif; ?>
    </p>
</div>