update
This commit is contained in:
@@ -29,11 +29,12 @@
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($article['wp_post_id'] && !empty($article['site_url'])): ?>
|
||||
<?php $publishedUrl = !empty($article['wp_post_url']) ? (string) $article['wp_post_url'] : ((string) $article['site_url'] . '/?p=' . (int) $article['wp_post_id']); ?>
|
||||
<div class="alert alert-info d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<i class="bi bi-wordpress me-1"></i>
|
||||
Post WordPress ID: <strong><?= $article['wp_post_id'] ?></strong>
|
||||
| <a href="<?= htmlspecialchars($article['site_url']) ?>/?p=<?= $article['wp_post_id'] ?>" target="_blank">Zobacz na stronie</a>
|
||||
| <a href="<?= htmlspecialchars($publishedUrl) ?>" target="_blank">Zobacz na stronie</a>
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<input type="file" id="imageFile" accept="image/jpeg,image/png,image/gif,image/webp" class="form-control form-control-sm" style="max-width: 250px;">
|
||||
|
||||
@@ -13,9 +13,10 @@
|
||||
</head>
|
||||
<body class="bg-light-subtle">
|
||||
<?php if (\App\Core\Auth::check()): ?>
|
||||
<div class="d-flex min-vh-100">
|
||||
<div class="app-shell" id="js-app-shell">
|
||||
<?php require __DIR__ . '/sidebar.php'; ?>
|
||||
<div class="flex-grow-1 d-flex flex-column content-area">
|
||||
<div class="sidebar-backdrop" id="js-sidebar-backdrop"></div>
|
||||
<div class="app-main">
|
||||
<?php require __DIR__ . '/header.php'; ?>
|
||||
<main class="p-4 flex-grow-1">
|
||||
<div class="container-fluid p-0">
|
||||
|
||||
@@ -1,81 +1,110 @@
|
||||
<nav class="sidebar d-flex flex-column flex-shrink-0 min-vh-100" style="width: 260px;">
|
||||
<div class="sidebar-header">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="bg-primary rounded-3 p-2 me-3 shadow-sm">
|
||||
<i class="bi bi-rocket-takeoff-fill text-white fs-4"></i>
|
||||
</div>
|
||||
<div>
|
||||
<h5 class="mb-0 text-white fw-bold tracking-tight">BackPRO</h5>
|
||||
<p class="text-secondary small mb-0" style="font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;">SEO Engine</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$uri = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
|
||||
$uri = rtrim($uri, '/') ?: '/';
|
||||
|
||||
$isActive = function (string ...$paths) use ($uri): bool {
|
||||
foreach ($paths as $path) {
|
||||
if ($uri === $path || str_starts_with($uri, $path . '/')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
$menuMain = $isActive('/', '/sites', '/seo');
|
||||
$menuContent = $isActive('/global-topics', '/articles', '/statlink');
|
||||
$menuAdmin = $isActive('/installer', '/settings', '/logs');
|
||||
?>
|
||||
<aside class="sidebar" id="js-sidebar">
|
||||
<div class="sidebar__brand">
|
||||
<span class="sidebar__brand-text">Back<strong>PRO</strong></span>
|
||||
<button class="sidebar__collapse-btn" id="js-sidebar-collapse" title="Zwin menu" aria-label="Zwin menu">
|
||||
<svg class="sidebar__collapse-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M15 18l-6-6 6-6"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex-grow-1 py-4 overflow-y-auto">
|
||||
<div class="px-4 mb-3 text-uppercase text-secondary small fw-bold" style="font-size: 0.65rem; letter-spacing: 0.1em;">Menu główne</div>
|
||||
<ul class="nav flex-column mb-4">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= \App\Core\Router::isCurrent('/') ? 'active' : '' ?>" href="/">
|
||||
<i class="bi bi-grid-1x2-fill"></i>Dashboard
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= \App\Core\Router::isCurrent('/sites') ? 'active' : '' ?>" href="/sites">
|
||||
<i class="bi bi-browser-safari"></i>Strony WP
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= \App\Core\Router::isCurrent('/seo/stats') ? 'active' : '' ?>" href="/seo/stats">
|
||||
<i class="bi bi-bar-chart-line-fill"></i>Statystyki SEO
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<nav class="sidebar__nav" aria-label="Menu glowne">
|
||||
<!-- Glowne -->
|
||||
<details class="sidebar__group<?= $menuMain ? ' is-active' : '' ?>"<?= $menuMain ? ' open' : '' ?>>
|
||||
<summary class="sidebar__group-toggle">
|
||||
<span class="sidebar__icon">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="sidebar__label">Glowne</span>
|
||||
<svg class="sidebar__toggle-arrow" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M6 9l6 6 6-6"/>
|
||||
</svg>
|
||||
</summary>
|
||||
<div class="sidebar__group-links">
|
||||
<a class="sidebar__sublink<?= $uri === '/' ? ' is-active' : '' ?>" href="/">Dashboard</a>
|
||||
<a class="sidebar__sublink<?= $isActive('/sites') ? ' is-active' : '' ?>" href="/sites">Strony WP</a>
|
||||
<a class="sidebar__sublink<?= $isActive('/seo') ? ' is-active' : '' ?>" href="/seo/stats">Statystyki SEO</a>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<div class="px-4 mb-3 text-uppercase text-secondary small fw-bold" style="font-size: 0.65rem; letter-spacing: 0.1em;">Zasoby i Treści</div>
|
||||
<ul class="nav flex-column mb-4">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= \App\Core\Router::isCurrent('/global-topics') ? 'active' : '' ?>" href="/global-topics">
|
||||
<i class="bi bi-tags-fill"></i>Biblioteka Tematów
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= \App\Core\Router::isCurrent('/articles') ? 'active' : '' ?>" href="/articles">
|
||||
<i class="bi bi-journal-richtext"></i>Artykuły
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Tresci -->
|
||||
<details class="sidebar__group<?= $menuContent ? ' is-active' : '' ?>"<?= $menuContent ? ' open' : '' ?>>
|
||||
<summary class="sidebar__group-toggle">
|
||||
<span class="sidebar__icon">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
|
||||
<polyline points="14 2 14 8 20 8"/>
|
||||
<line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="sidebar__label">Tresci</span>
|
||||
<svg class="sidebar__toggle-arrow" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M6 9l6 6 6-6"/>
|
||||
</svg>
|
||||
</summary>
|
||||
<div class="sidebar__group-links">
|
||||
<a class="sidebar__sublink<?= $isActive('/global-topics') ? ' is-active' : '' ?>" href="/global-topics">Biblioteka Tematow</a>
|
||||
<a class="sidebar__sublink<?= $isActive('/articles') ? ' is-active' : '' ?>" href="/articles">Artykuly</a>
|
||||
<a class="sidebar__sublink<?= $isActive('/statlink') ? ' is-active' : '' ?>" href="/statlink">StatLink</a>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<div class="px-4 mb-3 text-uppercase text-secondary small fw-bold" style="font-size: 0.65rem; letter-spacing: 0.1em;">Administracja</div>
|
||||
<ul class="nav flex-column">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= \App\Core\Router::isCurrent('/installer') ? 'active' : '' ?>" href="/installer">
|
||||
<i class="bi bi-magic"></i>Instalator WP
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= \App\Core\Router::isCurrent('/settings') ? 'active' : '' ?>" href="/settings">
|
||||
<i class="bi bi-sliders"></i>Ustawienia API
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= \App\Core\Router::isCurrent('/logs') ? 'active' : '' ?>" href="/logs">
|
||||
<i class="bi bi-shield-lock-fill"></i>Dziennik Zdarzeń
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Administracja -->
|
||||
<details class="sidebar__group<?= $menuAdmin ? ' is-active' : '' ?>"<?= $menuAdmin ? ' open' : '' ?>>
|
||||
<summary class="sidebar__group-toggle">
|
||||
<span class="sidebar__icon">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="12" r="3"/>
|
||||
<path d="M12 2v2M12 20v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M2 12h2M20 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="sidebar__label">Administracja</span>
|
||||
<svg class="sidebar__toggle-arrow" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M6 9l6 6 6-6"/>
|
||||
</svg>
|
||||
</summary>
|
||||
<div class="sidebar__group-links">
|
||||
<a class="sidebar__sublink<?= $isActive('/installer') ? ' is-active' : '' ?>" href="/installer">Instalator WP</a>
|
||||
<a class="sidebar__sublink<?= $isActive('/settings') && !$isActive('/settings/database') ? ' is-active' : '' ?>" href="/settings">Ustawienia API</a>
|
||||
<a class="sidebar__sublink<?= $isActive('/settings/database') ? ' is-active' : '' ?>" href="/settings/database">Baza danych</a>
|
||||
<a class="sidebar__sublink<?= $isActive('/logs') ? ' is-active' : '' ?>" href="/logs">Dziennik zdarzen</a>
|
||||
</div>
|
||||
</details>
|
||||
</nav>
|
||||
|
||||
<div class="p-4 bg-black bg-opacity-10 border-top border-white border-opacity-5">
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<div class="rounded-circle bg-secondary d-flex align-items-center justify-content-center text-white" style="width: 32px; height: 32px; font-size: 0.8rem; font-weight: 600;">
|
||||
<div class="sidebar__footer">
|
||||
<div class="sidebar__user">
|
||||
<div class="sidebar__avatar">
|
||||
<?= strtoupper(substr(\App\Core\Auth::user()['username'] ?? 'U', 0, 1)) ?>
|
||||
</div>
|
||||
<div class="overflow-hidden">
|
||||
<div class="text-white small text-truncate fw-medium"><?= htmlspecialchars(\App\Core\Auth::user()['username'] ?? 'Użytkownik') ?></div>
|
||||
<a href="/logout" class="text-secondary small text-decoration-none hover-white d-flex align-items-center">
|
||||
<i class="bi bi-box-arrow-right me-1"></i> Wyloguj
|
||||
<div class="sidebar__user-info">
|
||||
<div class="sidebar__user-name"><?= htmlspecialchars(\App\Core\Auth::user()['username'] ?? 'Uzytkownik') ?></div>
|
||||
<a href="/logout" class="sidebar__user-logout">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/>
|
||||
</svg>
|
||||
Wyloguj
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</aside>
|
||||
|
||||
77
templates/settings/database.php
Normal file
77
templates/settings/database.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
$migrationStatus = is_array($status ?? null) ? $status : [];
|
||||
$pending = (int) ($migrationStatus['pending'] ?? 0);
|
||||
$total = (int) ($migrationStatus['total'] ?? 0);
|
||||
$applied = (int) ($migrationStatus['applied'] ?? 0);
|
||||
$pendingFiles = (array) ($migrationStatus['pending_files'] ?? []);
|
||||
$logs = is_array($runLogs ?? null) ? $runLogs : [];
|
||||
?>
|
||||
|
||||
<h4 class="fw-bold mb-4">Baza danych — Migracje</h4>
|
||||
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="col-md-4">
|
||||
<div class="card text-center">
|
||||
<div class="card-body">
|
||||
<div class="text-muted small text-uppercase fw-bold">Wszystkie</div>
|
||||
<div class="fs-3 fw-bold text-dark"><?= $total ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card text-center">
|
||||
<div class="card-body">
|
||||
<div class="text-muted small text-uppercase fw-bold">Wykonane</div>
|
||||
<div class="fs-3 fw-bold text-success"><?= $applied ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card text-center">
|
||||
<div class="card-body">
|
||||
<div class="text-muted small text-uppercase fw-bold">Oczekujace</div>
|
||||
<div class="fs-3 fw-bold <?= $pending > 0 ? 'text-warning' : 'text-muted' ?>"><?= $pending ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($pending > 0): ?>
|
||||
<div class="alert alert-warning d-flex align-items-center justify-content-between">
|
||||
<span><strong><?= $pending ?></strong> migracji oczekuje na wykonanie.</span>
|
||||
<form action="/settings/database/migrate" method="post" class="d-inline">
|
||||
<button type="submit" class="btn btn-primary btn-sm">Uruchom migracje</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="alert alert-success mb-4">Baza danych jest aktualna.</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">Oczekujace pliki migracji</div>
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-sm mb-0">
|
||||
<thead>
|
||||
<tr><th>Plik</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($pendingFiles)): ?>
|
||||
<tr><td class="text-muted">Brak oczekujacych migracji.</td></tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($pendingFiles as $filename): ?>
|
||||
<tr><td><code><?= htmlspecialchars((string) $filename) ?></code></td></tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($logs)): ?>
|
||||
<div class="card">
|
||||
<div class="card-header">Logi ostatniego uruchomienia</div>
|
||||
<div class="card-body">
|
||||
<pre class="mb-0 small" style="white-space: pre-wrap;"><?php foreach ($logs as $line): ?><?= htmlspecialchars((string) $line) . "\n" ?><?php endforeach; ?></pre>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -46,8 +46,33 @@
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="article_generation_prompt" class="form-label">Prompt do generowania artykułu</label>
|
||||
<textarea class="form-control" id="article_generation_prompt" name="article_generation_prompt" rows="6"><?= htmlspecialchars($settings['article_generation_prompt']) ?></textarea>
|
||||
<small class="text-muted">Dostępne placeholdery: {min_words}, {max_words}</small>
|
||||
<textarea class="form-control" id="article_generation_prompt" name="article_generation_prompt" rows="10"><?= htmlspecialchars($settings['article_generation_prompt']) ?></textarea>
|
||||
<small class="text-muted">Dostepne placeholdery: {min_words}, {max_words}. Zalecenie: prompt opisuje styl i strukture, a temat jest dopinany automatycznie.</small>
|
||||
</div>
|
||||
|
||||
<h6 class="mb-3 mt-4 border-bottom pb-2">Linkowanie wewnetrzne (Smart Matching)</h6>
|
||||
|
||||
<div class="form-check form-switch mb-3">
|
||||
<input type="hidden" name="internal_linking_enabled" value="0">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="internal_linking_enabled" name="internal_linking_enabled" value="1" <?= (string) ($settings['internal_linking_enabled'] ?? '1') !== '0' ? 'checked' : '' ?>>
|
||||
<label class="form-check-label" for="internal_linking_enabled">Wlacz automatyczne linkowanie wewnetrzne</label>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<label for="internal_link_min_count" class="form-label">Min. liczba linkow</label>
|
||||
<input type="number" class="form-control" id="internal_link_min_count" name="internal_link_min_count" min="0" max="8" value="<?= htmlspecialchars($settings['internal_link_min_count'] ?? '2') ?>">
|
||||
</div>
|
||||
<div class="col">
|
||||
<label for="internal_link_max_count" class="form-label">Max. liczba linkow</label>
|
||||
<input type="number" class="form-control" id="internal_link_max_count" name="internal_link_max_count" min="1" max="8" value="<?= htmlspecialchars($settings['internal_link_max_count'] ?? '4') ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="openai_embedding_model" class="form-label">Model embeddingow</label>
|
||||
<input type="text" class="form-control" id="openai_embedding_model" name="openai_embedding_model" value="<?= htmlspecialchars($settings['openai_embedding_model'] ?? 'text-embedding-3-small') ?>" placeholder="text-embedding-3-small">
|
||||
<small class="text-muted">Wykorzystywany do semantycznego dopasowania powiazanych artykulow.</small>
|
||||
</div>
|
||||
|
||||
<h5 class="mb-3 mt-4 border-bottom pb-2">Obrazki</h5>
|
||||
|
||||
143
templates/statlink/index.php
Normal file
143
templates/statlink/index.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
$links = $links ?? [];
|
||||
$stats = $stats ?? [];
|
||||
$page = (int) ($page ?? 1);
|
||||
$totalPages = (int) ($totalPages ?? 1);
|
||||
$totalLinks = (int) ($totalLinks ?? 0);
|
||||
|
||||
$active = (int) ($stats['active'] ?? 0);
|
||||
$expired = (int) ($stats['expired'] ?? 0);
|
||||
$removed = (int) ($stats['removed'] ?? 0);
|
||||
$failed = (int) ($stats['failed'] ?? 0);
|
||||
|
||||
$statusBadge = function (string $status): string {
|
||||
return match ($status) {
|
||||
'active' => '<span class="badge bg-success">Aktywny</span>',
|
||||
'expired' => '<span class="badge bg-secondary">Wygasly</span>',
|
||||
'removed' => '<span class="badge bg-secondary">Usuniety</span>',
|
||||
'failed' => '<span class="badge bg-danger">Blad</span>',
|
||||
default => '<span class="badge bg-light text-dark">' . htmlspecialchars($status) . '</span>',
|
||||
};
|
||||
};
|
||||
?>
|
||||
|
||||
<h4 class="fw-bold mb-4">StatLink — Publikacje</h4>
|
||||
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="col-md-3">
|
||||
<div class="card text-center border-success border-opacity-25">
|
||||
<div class="card-body py-3">
|
||||
<div class="text-muted small text-uppercase fw-bold">Aktywne</div>
|
||||
<div class="fs-3 fw-bold text-success"><?= $active ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card text-center">
|
||||
<div class="card-body py-3">
|
||||
<div class="text-muted small text-uppercase fw-bold">Wygasle</div>
|
||||
<div class="fs-3 fw-bold text-secondary"><?= $expired ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card text-center">
|
||||
<div class="card-body py-3">
|
||||
<div class="text-muted small text-uppercase fw-bold">Usuniete</div>
|
||||
<div class="fs-3 fw-bold text-secondary"><?= $removed ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card text-center border-danger border-opacity-25">
|
||||
<div class="card-body py-3">
|
||||
<div class="text-muted small text-uppercase fw-bold">Bledy</div>
|
||||
<div class="fs-3 fw-bold text-danger"><?= $failed ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<span>Lista linkow (<?= $totalLinks ?>)</span>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-hover mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Artykul</th>
|
||||
<th>Strona</th>
|
||||
<th>Anchor</th>
|
||||
<th>Dodano</th>
|
||||
<th>Wygasa</th>
|
||||
<th>Status</th>
|
||||
<th>ID</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($links)): ?>
|
||||
<tr><td colspan="7" class="text-muted text-center py-4">Brak linkow StatLink.</td></tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($links as $link): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if (!empty($link['article_title'])): ?>
|
||||
<a href="/articles/<?= (int) $link['article_id'] ?>" class="text-decoration-none">
|
||||
<?= htmlspecialchars(mb_strimwidth((string) $link['article_title'], 0, 50, '...')) ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<span class="text-muted">ID: <?= (int) $link['article_id'] ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="text-nowrap"><?= htmlspecialchars((string) ($link['site_name'] ?? '')) ?></td>
|
||||
<td>
|
||||
<small class="text-muted"><?= htmlspecialchars(mb_strimwidth((string) $link['anchor'], 0, 40, '...')) ?></small>
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
<small><?= !empty($link['added_at']) ? date('Y-m-d', strtotime($link['added_at'])) : '-' ?></small>
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
<small><?= !empty($link['expires_at']) ? date('Y-m-d', strtotime($link['expires_at'])) : '-' ?></small>
|
||||
</td>
|
||||
<td><?= $statusBadge((string) $link['status']) ?></td>
|
||||
<td><small class="text-muted"><?= $link['statlink_id'] ?? '-' ?></small></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($totalPages > 1): ?>
|
||||
<div class="card-footer">
|
||||
<nav>
|
||||
<ul class="pagination pagination-sm mb-0 justify-content-center">
|
||||
<?php if ($page > 1): ?>
|
||||
<li class="page-item"><a class="page-link" href="/statlink?page=<?= $page - 1 ?>">«</a></li>
|
||||
<?php endif; ?>
|
||||
<?php for ($i = max(1, $page - 2); $i <= min($totalPages, $page + 2); $i++): ?>
|
||||
<li class="page-item <?= $i === $page ? 'active' : '' ?>">
|
||||
<a class="page-link" href="/statlink?page=<?= $i ?>"><?= $i ?></a>
|
||||
</li>
|
||||
<?php endfor; ?>
|
||||
<?php if ($page < $totalPages): ?>
|
||||
<li class="page-item"><a class="page-link" href="/statlink?page=<?= $page + 1 ?>">»</a></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($links)): ?>
|
||||
<div class="mt-3 text-muted small">
|
||||
<strong>Legenda:</strong>
|
||||
<?= $statusBadge('active') ?> linkowany w StatLink ·
|
||||
<?= $statusBadge('expired') ?> oczekuje na usuniecie ·
|
||||
<?= $statusBadge('removed') ?> usuniety ze StatLink ·
|
||||
<?= $statusBadge('failed') ?> blad dodawania/usuwania
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
Reference in New Issue
Block a user