style: auto-fix 1340 phpcs PSR-12 violations via phpcbf; exclude MissingNamespace and SideEffects
This commit is contained in:
+14
-12
@@ -72,38 +72,40 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($apiKeys)): ?>
|
||||
<?php if (empty($apiKeys)) : ?>
|
||||
<tr><td colspan="8" class="lt-empty">No API keys found. Generate one above.</td></tr>
|
||||
<?php else: foreach ($apiKeys as $key): ?>
|
||||
<?php $expired = $key['expires_at'] && strtotime($key['expires_at']) < time(); ?>
|
||||
<?php else :
|
||||
foreach ($apiKeys as $key) : ?>
|
||||
<?php $expired = $key['expires_at'] && strtotime($key['expires_at']) < time(); ?>
|
||||
<tr id="key-row-<?= (int)$key['api_key_id'] ?>">
|
||||
<td data-label="Name"><strong><?= htmlspecialchars($key['key_name']) ?></strong></td>
|
||||
<td data-label="Prefix" class="lt-text-xs"><code><?= htmlspecialchars($key['key_prefix']) ?>…</code></td>
|
||||
<td data-label="Created By" class="lt-text-xs"><?= htmlspecialchars($key['display_name'] ?? $key['username'] ?? 'Unknown') ?></td>
|
||||
<td data-label="Created" class="lt-text-xs lt-text-muted"><?= date('Y-m-d H:i', strtotime($key['created_at'])) ?></td>
|
||||
<td data-label="Expires" class="lt-text-xs <?= $expired ? 'lt-text-danger' : 'lt-text-cyan' ?>">
|
||||
<?= $key['expires_at'] ? date('Y-m-d', strtotime($key['expires_at'])) . ($expired ? ' (Expired)' : '') : 'Never' ?>
|
||||
<?= $key['expires_at'] ? date('Y-m-d', strtotime($key['expires_at'])) . ($expired ? ' (Expired)' : '') : 'Never' ?>
|
||||
</td>
|
||||
<td data-label="Last Used" class="lt-text-xs lt-text-muted">
|
||||
<?= $key['last_used'] ? date('Y-m-d H:i', strtotime($key['last_used'])) : 'Never' ?>
|
||||
<?= $key['last_used'] ? date('Y-m-d H:i', strtotime($key['last_used'])) : 'Never' ?>
|
||||
</td>
|
||||
<td data-label="Status">
|
||||
<?php if ($key['is_active']): ?>
|
||||
<?php if ($key['is_active']) : ?>
|
||||
<span class="lt-status lt-status-open">Active</span>
|
||||
<?php else: ?>
|
||||
<?php else : ?>
|
||||
<span class="lt-status lt-status-closed">Revoked</span>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td data-label="Actions">
|
||||
<?php if ($key['is_active']): ?>
|
||||
<?php if ($key['is_active']) : ?>
|
||||
<button type="button" class="lt-btn lt-btn-sm lt-btn-danger"
|
||||
data-action="revoke-key" data-id="<?= (int)$key['api_key_id'] ?>">REVOKE</button>
|
||||
<?php else: ?>
|
||||
<?php else : ?>
|
||||
<span class="lt-text-muted lt-text-xs">—</span>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; endif ?>
|
||||
<?php endforeach;
|
||||
endif ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -29,7 +29,7 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
<label class="lt-label" for="action_type">Action Type</label>
|
||||
<select name="action_type" id="action_type" class="lt-select lt-select-sm">
|
||||
<option value="">All Actions</option>
|
||||
<?php foreach (['create','update','delete','comment','assign','status_change','login','security'] as $a): ?>
|
||||
<?php foreach (['create','update','delete','comment','assign','status_change','login','security'] as $a) : ?>
|
||||
<option value="<?= htmlspecialchars($a, ENT_QUOTES, 'UTF-8') ?>" <?= ($filters['action_type'] ?? '') === $a ? 'selected' : '' ?>><?= htmlspecialchars(ucfirst(str_replace('_', ' ', $a)), ENT_QUOTES, 'UTF-8') ?></option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
@@ -38,11 +38,13 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
<label class="lt-label" for="user_id">User</label>
|
||||
<select name="user_id" id="user_id" class="lt-select lt-select-sm">
|
||||
<option value="">All Users</option>
|
||||
<?php if (isset($users)): foreach ($users as $u): ?>
|
||||
<?php if (isset($users)) :
|
||||
foreach ($users as $u) : ?>
|
||||
<option value="<?= (int)$u['user_id'] ?>" <?= ($filters['user_id'] ?? '') == $u['user_id'] ? 'selected' : '' ?>>
|
||||
<?= htmlspecialchars($u['display_name'] ?? $u['username']) ?>
|
||||
<?= htmlspecialchars($u['display_name'] ?? $u['username']) ?>
|
||||
</option>
|
||||
<?php endforeach; endif ?>
|
||||
<?php endforeach;
|
||||
endif ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="lt-form-group" style="margin:0">
|
||||
@@ -76,73 +78,79 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($auditLogs)): ?>
|
||||
<?php if (empty($auditLogs)) : ?>
|
||||
<tr><td colspan="7" class="lt-empty">No audit log entries found.</td></tr>
|
||||
<?php else: foreach ($auditLogs as $log): ?>
|
||||
<?php else :
|
||||
foreach ($auditLogs as $log) : ?>
|
||||
<tr>
|
||||
<td data-label="Timestamp" class="lt-text-xs"><?= date('Y-m-d H:i:s', strtotime($log['created_at'])) ?></td>
|
||||
<td data-label="User"><?= htmlspecialchars($log['display_name'] ?? $log['username'] ?? 'System') ?></td>
|
||||
<td data-label="Action"><span class="lt-text-amber"><?= htmlspecialchars($log['action_type']) ?></span></td>
|
||||
<td data-label="Entity" class="lt-text-xs"><?= htmlspecialchars($log['entity_type'] ?? '-') ?></td>
|
||||
<td data-label="Entity ID" class="lt-text-xs">
|
||||
<?php if ($log['entity_type'] === 'ticket' && $log['entity_id']): ?>
|
||||
<?php if ($log['entity_type'] === 'ticket' && $log['entity_id']) : ?>
|
||||
<a href="/ticket/<?= htmlspecialchars($log['entity_id']) ?>"><?= htmlspecialchars($log['entity_id']) ?></a>
|
||||
<?php else: ?>
|
||||
<?= htmlspecialchars($log['entity_id'] ?? '-') ?>
|
||||
<?php endif ?>
|
||||
<?php else : ?>
|
||||
<?= htmlspecialchars($log['entity_id'] ?? '-') ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td data-label="Details" class="lt-text-xs lt-text-muted" style="max-width:200px;overflow:hidden;text-overflow:ellipsis">
|
||||
<?php
|
||||
if ($log['details']) {
|
||||
$det = is_string($log['details']) ? json_decode($log['details'], true) : $log['details'];
|
||||
echo '<code>' . htmlspecialchars(is_array($det) ? json_encode($det) : (string)$log['details']) . '</code>';
|
||||
} else {
|
||||
echo '-';
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if ($log['details']) {
|
||||
$det = is_string($log['details']) ? json_decode($log['details'], true) : $log['details'];
|
||||
echo '<code>' . htmlspecialchars(is_array($det) ? json_encode($det) : (string)$log['details']) . '</code>';
|
||||
} else {
|
||||
echo '-';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td data-label="IP" class="lt-text-xs lt-text-muted"><?= htmlspecialchars($log['ip_address'] ?? '-') ?></td>
|
||||
</tr>
|
||||
<?php endforeach; endif ?>
|
||||
<?php endforeach;
|
||||
endif ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
<?php if (($totalPages ?? 1) > 1): ?>
|
||||
<?php if (($totalPages ?? 1) > 1) : ?>
|
||||
<div class="lt-pagination" role="navigation">
|
||||
<?php
|
||||
$params = $_GET;
|
||||
$start = max(1, $page - 2);
|
||||
$end = min($totalPages, $page + 2);
|
||||
if ($page > 1) {
|
||||
$params['page'] = $page - 1;
|
||||
$pUrl = htmlspecialchars('?' . http_build_query($params), ENT_QUOTES, 'UTF-8');
|
||||
echo '<a href="' . $pUrl . '" class="lt-btn lt-btn-sm" aria-label="Previous page">«</a> ';
|
||||
}
|
||||
if ($start > 1) {
|
||||
$params['page'] = 1;
|
||||
echo '<a href="' . htmlspecialchars('?' . http_build_query($params), ENT_QUOTES, 'UTF-8') . '" class="lt-btn lt-btn-sm">1</a> ';
|
||||
if ($start > 2) echo '<span class="lt-text-muted lt-text-xs">…</span>';
|
||||
}
|
||||
for ($i = $start; $i <= $end; $i++) {
|
||||
$params['page'] = $i;
|
||||
$url = htmlspecialchars('?' . http_build_query($params), ENT_QUOTES, 'UTF-8');
|
||||
$class = ($i == $page) ? ' lt-btn-primary' : '';
|
||||
$curr = ($i == $page) ? ' aria-current="page"' : '';
|
||||
echo '<a href="' . $url . '" class="lt-btn lt-btn-sm' . $class . '"' . $curr . '>' . $i . '</a> ';
|
||||
}
|
||||
if ($end < $totalPages) {
|
||||
if ($end < $totalPages - 1) echo '<span class="lt-text-muted lt-text-xs">…</span>';
|
||||
$params['page'] = $totalPages;
|
||||
echo '<a href="' . htmlspecialchars('?' . http_build_query($params), ENT_QUOTES, 'UTF-8') . '" class="lt-btn lt-btn-sm">' . $totalPages . '</a> ';
|
||||
}
|
||||
if ($page < $totalPages) {
|
||||
$params['page'] = $page + 1;
|
||||
$nUrl = htmlspecialchars('?' . http_build_query($params), ENT_QUOTES, 'UTF-8');
|
||||
echo '<a href="' . $nUrl . '" class="lt-btn lt-btn-sm" aria-label="Next page">»</a>';
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
$params = $_GET;
|
||||
$start = max(1, $page - 2);
|
||||
$end = min($totalPages, $page + 2);
|
||||
if ($page > 1) {
|
||||
$params['page'] = $page - 1;
|
||||
$pUrl = htmlspecialchars('?' . http_build_query($params), ENT_QUOTES, 'UTF-8');
|
||||
echo '<a href="' . $pUrl . '" class="lt-btn lt-btn-sm" aria-label="Previous page">«</a> ';
|
||||
}
|
||||
if ($start > 1) {
|
||||
$params['page'] = 1;
|
||||
echo '<a href="' . htmlspecialchars('?' . http_build_query($params), ENT_QUOTES, 'UTF-8') . '" class="lt-btn lt-btn-sm">1</a> ';
|
||||
if ($start > 2) {
|
||||
echo '<span class="lt-text-muted lt-text-xs">…</span>';
|
||||
}
|
||||
}
|
||||
for ($i = $start; $i <= $end; $i++) {
|
||||
$params['page'] = $i;
|
||||
$url = htmlspecialchars('?' . http_build_query($params), ENT_QUOTES, 'UTF-8');
|
||||
$class = ($i == $page) ? ' lt-btn-primary' : '';
|
||||
$curr = ($i == $page) ? ' aria-current="page"' : '';
|
||||
echo '<a href="' . $url . '" class="lt-btn lt-btn-sm' . $class . '"' . $curr . '>' . $i . '</a> ';
|
||||
}
|
||||
if ($end < $totalPages) {
|
||||
if ($end < $totalPages - 1) {
|
||||
echo '<span class="lt-text-muted lt-text-xs">…</span>';
|
||||
}
|
||||
$params['page'] = $totalPages;
|
||||
echo '<a href="' . htmlspecialchars('?' . http_build_query($params), ENT_QUOTES, 'UTF-8') . '" class="lt-btn lt-btn-sm">' . $totalPages . '</a> ';
|
||||
}
|
||||
if ($page < $totalPages) {
|
||||
$params['page'] = $page + 1;
|
||||
$nUrl = htmlspecialchars('?' . http_build_query($params), ENT_QUOTES, 'UTF-8');
|
||||
echo '<a href="' . $nUrl . '" class="lt-btn lt-btn-sm" aria-label="Next page">»</a>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
|
||||
@@ -41,9 +41,10 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($customFields)): ?>
|
||||
<?php if (empty($customFields)) : ?>
|
||||
<tr><td colspan="8" class="lt-empty">No custom fields defined. Create fields to extend ticket metadata.</td></tr>
|
||||
<?php else: foreach ($customFields as $field): ?>
|
||||
<?php else :
|
||||
foreach ($customFields as $field) : ?>
|
||||
<tr>
|
||||
<td data-label="Order" class="lt-text-xs lt-text-muted"><?= (int)$field['display_order'] ?></td>
|
||||
<td data-label="Field Name"><code class="lt-text-cyan lt-text-xs"><?= htmlspecialchars($field['field_name']) ?></code></td>
|
||||
@@ -51,11 +52,11 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
<td data-label="Type" class="lt-text-xs"><?= htmlspecialchars(ucfirst($field['field_type'])) ?></td>
|
||||
<td data-label="Category" class="lt-text-xs"><?= htmlspecialchars($field['category'] ?? 'All') ?></td>
|
||||
<td data-label="Required" class="lt-text-center">
|
||||
<?= $field['is_required'] ? '<span class="lt-text-amber">✓</span>' : '<span class="lt-text-muted">—</span>' ?>
|
||||
<?= $field['is_required'] ? '<span class="lt-text-amber">✓</span>' : '<span class="lt-text-muted">—</span>' ?>
|
||||
</td>
|
||||
<td data-label="Status">
|
||||
<span class="lt-status <?= $field['is_active'] ? 'lt-status-open' : 'lt-status-closed' ?>">
|
||||
<?= $field['is_active'] ? 'Active' : 'Inactive' ?>
|
||||
<?= $field['is_active'] ? 'Active' : 'Inactive' ?>
|
||||
</span>
|
||||
</td>
|
||||
<td data-label="Actions">
|
||||
@@ -67,7 +68,8 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; endif ?>
|
||||
<?php endforeach;
|
||||
endif ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -116,7 +118,7 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
<label class="lt-label" for="cf-category">Category <span class="lt-text-muted lt-text-xs">(empty = all categories)</span></label>
|
||||
<select id="cf-category" name="category" class="lt-select">
|
||||
<option value="">All Categories</option>
|
||||
<?php foreach (['General','Hardware','Software','Network','Security'] as $c): ?>
|
||||
<?php foreach (['General','Hardware','Software','Network','Security'] as $c) : ?>
|
||||
<option value="<?= $c ?>"><?= $c ?></option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
|
||||
@@ -40,32 +40,33 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($recurringTickets)): ?>
|
||||
<?php if (empty($recurringTickets)) : ?>
|
||||
<tr><td colspan="7" class="lt-empty">No recurring tickets configured. Create schedules to auto-generate tickets.</td></tr>
|
||||
<?php else: foreach ($recurringTickets as $rt): ?>
|
||||
<?php
|
||||
$schedule = ucfirst($rt['schedule_type']);
|
||||
if ($rt['schedule_type'] === 'weekly') {
|
||||
$days = ['', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
||||
$schedule .= ' (' . ($days[$rt['schedule_day']] ?? '?') . ')';
|
||||
} elseif ($rt['schedule_type'] === 'monthly') {
|
||||
$schedule .= ' (Day ' . $rt['schedule_day'] . ')';
|
||||
}
|
||||
$schedule .= ' @ ' . substr($rt['schedule_time'], 0, 5);
|
||||
?>
|
||||
<?php else :
|
||||
foreach ($recurringTickets as $rt) : ?>
|
||||
<?php
|
||||
$schedule = ucfirst($rt['schedule_type']);
|
||||
if ($rt['schedule_type'] === 'weekly') {
|
||||
$days = ['', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
||||
$schedule .= ' (' . ($days[$rt['schedule_day']] ?? '?') . ')';
|
||||
} elseif ($rt['schedule_type'] === 'monthly') {
|
||||
$schedule .= ' (Day ' . $rt['schedule_day'] . ')';
|
||||
}
|
||||
$schedule .= ' @ ' . substr($rt['schedule_time'], 0, 5);
|
||||
?>
|
||||
<tr>
|
||||
<td data-label="Title"><strong><?= htmlspecialchars($rt['title_template']) ?></strong></td>
|
||||
<td data-label="Schedule" class="lt-text-xs lt-text-cyan"><?= htmlspecialchars($schedule) ?></td>
|
||||
<td data-label="Category" class="lt-text-xs"><?= htmlspecialchars($rt['category']) ?></td>
|
||||
<td data-label="Assigned To" class="lt-text-xs">
|
||||
<?= htmlspecialchars($rt['assigned_name'] ?? $rt['assigned_username'] ?? 'Unassigned') ?>
|
||||
<?= htmlspecialchars($rt['assigned_name'] ?? $rt['assigned_username'] ?? 'Unassigned') ?>
|
||||
</td>
|
||||
<td data-label="Next Run" class="lt-text-xs lt-text-muted">
|
||||
<?= date('M d, Y H:i', strtotime($rt['next_run_at'])) ?>
|
||||
<?= date('M d, Y H:i', strtotime($rt['next_run_at'])) ?>
|
||||
</td>
|
||||
<td data-label="Status">
|
||||
<span class="lt-status <?= $rt['is_active'] ? 'lt-status-open' : 'lt-status-closed' ?>">
|
||||
<?= $rt['is_active'] ? 'Active' : 'Inactive' ?>
|
||||
<?= $rt['is_active'] ? 'Active' : 'Inactive' ?>
|
||||
</span>
|
||||
</td>
|
||||
<td data-label="Actions">
|
||||
@@ -81,7 +82,8 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; endif ?>
|
||||
<?php endforeach;
|
||||
endif ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -131,7 +133,7 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
<div class="lt-form-group">
|
||||
<label class="lt-label" for="rec-category">Category</label>
|
||||
<select id="rec-category" name="category" class="lt-select">
|
||||
<?php foreach (['General','Hardware','Software','Network','Security'] as $c): ?>
|
||||
<?php foreach (['General','Hardware','Software','Network','Security'] as $c) : ?>
|
||||
<option value="<?= $c ?>"><?= $c ?></option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
@@ -139,7 +141,7 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
<div class="lt-form-group">
|
||||
<label class="lt-label" for="rec-type">Type</label>
|
||||
<select id="rec-type" name="type" class="lt-select">
|
||||
<?php foreach (['Issue','Maintenance','Install','Task','Upgrade','Problem'] as $t): ?>
|
||||
<?php foreach (['Issue','Maintenance','Install','Task','Upgrade','Problem'] as $t) : ?>
|
||||
<option value="<?= $t ?>"><?= $t ?></option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
|
||||
@@ -39,14 +39,18 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($templates)): ?>
|
||||
<?php if (empty($templates)) : ?>
|
||||
<tr><td colspan="6" class="lt-empty">No templates defined. Create templates to speed up ticket creation.</td></tr>
|
||||
<?php else: foreach ($templates as $tpl): ?>
|
||||
<?php else :
|
||||
foreach ($templates as $tpl) : ?>
|
||||
<tr>
|
||||
<td data-label="Name"><strong><?= htmlspecialchars($tpl['template_name']) ?></strong></td>
|
||||
<td data-label="Category" class="lt-text-xs"><?= htmlspecialchars($tpl['category'] ?? 'Any') ?></td>
|
||||
<td data-label="Type" class="lt-text-xs"><?= htmlspecialchars($tpl['type'] ?? 'Any') ?></td>
|
||||
<?php $tp = (int)($tpl['default_priority'] ?? 4); $tBadge = match($tp) { 1 => 'lt-badge-p1', 2 => 'lt-badge-p2', 3 => 'lt-badge-p3', default => 'lt-badge-p4' }; ?>
|
||||
<?php $tp = (int)($tpl['default_priority'] ?? 4);
|
||||
$tBadge = match ($tp) {
|
||||
1 => 'lt-badge-p1', 2 => 'lt-badge-p2', 3 => 'lt-badge-p3', default => 'lt-badge-p4'
|
||||
}; ?>
|
||||
<td data-label="Priority"><span class="lt-badge <?= $tBadge ?>">P<?= $tp ?></span></td>
|
||||
<td data-label="Status">
|
||||
<span class="lt-status <?= ($tpl['is_active'] ?? 1) ? 'lt-status-open' : 'lt-status-closed' ?>">
|
||||
@@ -62,7 +66,8 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; endif ?>
|
||||
<?php endforeach;
|
||||
endif ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -99,7 +104,7 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
<label class="lt-label" for="tpl-category">Category</label>
|
||||
<select id="tpl-category" name="category" class="lt-select">
|
||||
<option value="">Any</option>
|
||||
<?php foreach (['General','Hardware','Software','Network','Security'] as $c): ?>
|
||||
<?php foreach (['General','Hardware','Software','Network','Security'] as $c) : ?>
|
||||
<option value="<?= $c ?>"><?= $c ?></option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
@@ -108,7 +113,7 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
<label class="lt-label" for="tpl-type">Type</label>
|
||||
<select id="tpl-type" name="type" class="lt-select">
|
||||
<option value="">Any</option>
|
||||
<?php foreach (['Maintenance','Install','Task','Upgrade','Issue','Problem'] as $t): ?>
|
||||
<?php foreach (['Maintenance','Install','Task','Upgrade','Issue','Problem'] as $t) : ?>
|
||||
<option value="<?= $t ?>"><?= $t ?></option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
@@ -116,7 +121,7 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
<div class="lt-form-group">
|
||||
<label class="lt-label" for="tpl-priority">Priority</label>
|
||||
<select id="tpl-priority" name="priority" class="lt-select">
|
||||
<?php foreach ([1=>'P1',2=>'P2',3=>'P3',4=>'P4 (default)',5=>'P5'] as $v=>$l): ?>
|
||||
<?php foreach ([1 => 'P1',2 => 'P2',3 => 'P3',4 => 'P4 (default)',5 => 'P5'] as $v => $l) : ?>
|
||||
<option value="<?= $v ?>" <?= $v === 4 ? 'selected' : '' ?>><?= $l ?></option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
|
||||
@@ -42,7 +42,7 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
</form>
|
||||
|
||||
<!-- Summary stats -->
|
||||
<?php if (!empty($userStats)): ?>
|
||||
<?php if (!empty($userStats)) : ?>
|
||||
<div class="lt-stats-grid lt-mb-md">
|
||||
<div class="lt-stat-card">
|
||||
<div class="lt-stat-icon lt-text-cyan">[ # ]</div>
|
||||
@@ -89,25 +89,27 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($userStats)): ?>
|
||||
<?php if (empty($userStats)) : ?>
|
||||
<tr><td colspan="6" class="lt-empty">No user activity data available.</td></tr>
|
||||
<?php else: foreach ($userStats as $u): ?>
|
||||
<?php else :
|
||||
foreach ($userStats as $u) : ?>
|
||||
<tr>
|
||||
<td data-label="User">
|
||||
<strong><?= htmlspecialchars($u['display_name'] ?? $u['username']) ?></strong>
|
||||
<?php if ($u['is_admin']): ?>
|
||||
<?php if ($u['is_admin']) : ?>
|
||||
<span class="lt-badge lt-badge-admin lt-text-xs">ADMIN</span>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td data-label="Created"><span class="lt-text-cyan"><?= (int)($u['tickets_created'] ?? 0) ?></span></td>
|
||||
<td data-label="Resolved"><span class="lt-text-muted"><?= (int)($u['tickets_resolved'] ?? 0) ?></span></td>
|
||||
<td data-label="Comments"><span class="lt-text-amber"><?= (int)($u['comments_added'] ?? 0) ?></span></td>
|
||||
<td data-label="Assigned"><?= (int)($u['tickets_assigned'] ?? 0) ?></td>
|
||||
<td data-label="Last Activity" class="lt-text-xs lt-text-muted">
|
||||
<?= $u['last_activity'] ? date('M d, Y H:i', strtotime($u['last_activity'])) : 'Never' ?>
|
||||
<?= $u['last_activity'] ? date('M d, Y H:i', strtotime($u['last_activity'])) : 'Never' ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; endif ?>
|
||||
<?php endforeach;
|
||||
endif ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -25,17 +25,23 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
<div class="lt-section-body">
|
||||
<div class="lt-grid-4">
|
||||
<?php
|
||||
$statuses = ['Open', 'Pending', 'In Progress', 'Closed'];
|
||||
foreach ($statuses as $status):
|
||||
$slug = strtolower(str_replace(' ', '-', $status));
|
||||
$toCount = 0;
|
||||
if (isset($workflows)) { foreach ($workflows as $w) { if ($w['from_status'] === $status) $toCount++; } }
|
||||
?>
|
||||
$statuses = ['Open', 'Pending', 'In Progress', 'Closed'];
|
||||
foreach ($statuses as $status) :
|
||||
$slug = strtolower(str_replace(' ', '-', $status));
|
||||
$toCount = 0;
|
||||
if (isset($workflows)) {
|
||||
foreach ($workflows as $w) {
|
||||
if ($w['from_status'] === $status) {
|
||||
$toCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="lt-card lt-text-center">
|
||||
<span class="lt-status lt-status-<?= $slug ?>"><?= $status ?></span>
|
||||
<div class="lt-text-xs lt-text-muted lt-mt-sm">→ <?= $toCount ?> transition<?= $toCount !== 1 ? 's' : '' ?></div>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<p class="lt-text-xs lt-text-muted lt-mt-sm">
|
||||
Define which status transitions are allowed. This controls what options appear in the status dropdown on tickets.
|
||||
@@ -61,10 +67,12 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($workflows)): ?>
|
||||
<?php if (empty($workflows)) : ?>
|
||||
<tr><td colspan="7" class="lt-empty">No transitions defined. Add transitions to enable status changes.</td></tr>
|
||||
<?php else: foreach ($workflows as $wf): ?>
|
||||
<?php $fromSlug = preg_replace('/[^a-z-]/', '', strtolower(str_replace(' ', '-', $wf['from_status']))); $toSlug = preg_replace('/[^a-z-]/', '', strtolower(str_replace(' ', '-', $wf['to_status']))); ?>
|
||||
<?php else :
|
||||
foreach ($workflows as $wf) : ?>
|
||||
<?php $fromSlug = preg_replace('/[^a-z-]/', '', strtolower(str_replace(' ', '-', $wf['from_status'])));
|
||||
$toSlug = preg_replace('/[^a-z-]/', '', strtolower(str_replace(' ', '-', $wf['to_status']))); ?>
|
||||
<tr>
|
||||
<td data-label="From">
|
||||
<span class="lt-status lt-status-<?= $fromSlug ?>"><?= htmlspecialchars($wf['from_status']) ?></span>
|
||||
@@ -74,15 +82,15 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
<span class="lt-status lt-status-<?= $toSlug ?>"><?= htmlspecialchars($wf['to_status']) ?></span>
|
||||
</td>
|
||||
<td data-label="Req. Comment" class="lt-text-center">
|
||||
<?= $wf['requires_comment'] ? '<span class="lt-text-cyan">✓</span>' : '<span class="lt-text-muted">—</span>' ?>
|
||||
<?= $wf['requires_comment'] ? '<span class="lt-text-cyan">✓</span>' : '<span class="lt-text-muted">—</span>' ?>
|
||||
</td>
|
||||
<td data-label="Req. Admin" class="lt-text-center">
|
||||
<?= $wf['requires_admin'] ? '<span class="lt-text-amber">✓</span>' : '<span class="lt-text-muted">—</span>' ?>
|
||||
<?= $wf['requires_admin'] ? '<span class="lt-text-amber">✓</span>' : '<span class="lt-text-muted">—</span>' ?>
|
||||
</td>
|
||||
<td data-label="Active" class="lt-text-center">
|
||||
<?= $wf['is_active']
|
||||
? '<span class="lt-text-cyan">✓</span>'
|
||||
: '<span class="lt-text-danger">✗</span>' ?>
|
||||
<?= $wf['is_active']
|
||||
? '<span class="lt-text-cyan">✓</span>'
|
||||
: '<span class="lt-text-danger">✗</span>' ?>
|
||||
</td>
|
||||
<td data-label="Actions">
|
||||
<div class="lt-btn-group">
|
||||
@@ -93,7 +101,8 @@ include __DIR__ . '/../../views/layout_header.php';
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; endif ?>
|
||||
<?php endforeach;
|
||||
endif ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user