AO3-DL/webui/listSeriesContents.php
2026-01-04 15:44:43 -08:00

85 lines
3.1 KiB
PHP

<?php
# This file is part of AOMO, "Archive Of My Own", a collection of Python and PHP
# scripts designed act as an improved local backup system
# for works published on https://archiveofourown.org
#
# Copyright (c) 2025 Cyberpro123, except where otherwise noted.
#
# This project is available under the GNU General Public License (GPL) v2.0,
# available at https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
# or in the 'LICENSE.md' file that should be distributed alongside this one.
#
# Report issues to https://codeberg.org/Cyberpro123/AOMO
# Contact author at cyberpro123@posteo.com
#include ".aomoCommon.php";
include ".aomoLibList.php";
$rowSeries = sqlFetch(array("SELECT * FROM series_meta WHERE id=".ID))[0];
$error = 0;
if ($rowSeries) {
$rowSeries = $rowSeries[0];
$workIDs = harvestTags(sqlFetch(array("SELECT id FROM series_works WHERE series_id = ".ID." ORDER BY pos"))[0], "id");
$itemCount = count($workIDs);
$pagesCount = intdiv($itemCount, 20);
if (fmod($itemCount, 20) != 0) {
$pagesCount += 1;
}
$seriesTitle = $rowSeries['title'];
$seriesID = $rowSeries['id'];
echo getSiteMainLead("$seriesTitle - Browse Series - AOMO");
echo "<h2 class='heading'>$seriesTitle</h2>";
echo "<ul class='navigation actions' role='navigation'><li><a href='https://archiveofourown.org/series/$seriesID'>View on AO3</a></li></ul>";
echo "<h3 class='landmark heading'>Series Metadata</h3>";
# Begin series infobox
echo "<div class='wrapper'><dl class='series meta group'>";
echo "<dt>Series Begun:</dt><dd>".dateString($rowSeries['date_begun'])."</dd>";
echo "<dt>Series Updated:</dt><dd>".dateString($rowSeries['date_updated'])."</dd>";
echo "<dt>Series Checked:</dt><dd>".dateString($rowSeries['date_checked'])."</dd>";
echo "<dt>Works:</dt><dd>".$itemCount."</dd>";
echo "<dt>Author marked as complete:</dt><dd>";
if ($rowSeries['complete']) {
echo "Yes";
} else {
echo "No";
}
echo "</dd>";
if ($rowSeries['description']) {
echo "<dt>Description:</dt><dd><blockquote class='userstuff'>";
echo $rowSeries['description'];
echo "</blockquote></dd>";
}
if ($rowSeries['notes']) {
echo "<dt>Notes:</dt><dd><blockquote class='userstuff'>";
echo $rowSeries['notes'];
echo "</blockquote></dd>";
}
echo "</dl></div>";
# End series infobox
echo getPageWidget($pagesCount, "listWorks.php");
# Begin series list
echo "<ul class='series work index group'>";
$itemNo = 0;
foreach ($workIDs as $rowID) {
$itemNo += 1;
if ($itemNo >= START and $itemNo <= LIMIT) {
echo idToHtmlTags($rowID);
}
}
echo "</ul>";
echo getPageWidget($pagesCount, "listWorks.php");
# End series list
echo getSiteMainEnd();
} else {
$error = 1;
http_response_code(404);
echo getSiteMainLead("Invalid Series ID - AOMO");
echo "<h1>Error 404</h1>
<h2>Series ID <strong>".ID."</strong> not in database</h2>
<ul>
<li><a href='https://archiveofourown.org/series/".ID."'>Link to series on AO3</a></li>
<li><a href='listWorks.php'>Return to list of available works</a></li>
</ul>
";
echo getSiteMainEnd();
}
?>