aboutsummaryrefslogtreecommitdiff
path: root/models/webpage.php
diff options
context:
space:
mode:
authorGeorgi Nikolov <ggeorgi60@gmail.com>2025-01-26 20:28:22 +0200
committerGeorgi Nikolov <ggeorgi60@gmail.com>2025-01-26 20:28:22 +0200
commit9121554ce064629dc7aef74434b65ee10756a8a7 (patch)
tree9ff596abcead2cffea6b889edfc70398d8354bd0 /models/webpage.php
parent5b61a18f1bab2cf17f849b64129efa9726848262 (diff)
downloadnowayforward_human-9121554ce064629dc7aef74434b65ee10756a8a7.tar
nowayforward_human-9121554ce064629dc7aef74434b65ee10756a8a7.tar.gz
nowayforward_human-9121554ce064629dc7aef74434b65ee10756a8a7.zip
Added a navbar on top of the archived pages
Diffstat (limited to 'models/webpage.php')
-rw-r--r--models/webpage.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/models/webpage.php b/models/webpage.php
index 3445f62..e6d964f 100644
--- a/models/webpage.php
+++ b/models/webpage.php
@@ -27,6 +27,39 @@ class Webpage extends Table {
);
}
+ static function getPageById(int $id) : Webpage {
+ return Table::_fromDB(
+ "SELECT * FROM Webpages WHERE WID = \"$id\"",
+ "Database\Webpage"
+ );
+ }
+
+ static function getPreviousPageId(string $url, string $date) : int {
+ $foundId = Table::_get_all(
+ "Webpages",
+ "Database\Webpage",
+ "WHERE URL = \"$url\" && Date < \"$date\" ORDER BY Date DESC LIMIT 1",
+ "WID"
+ );
+ if (count($foundId) > 0) {
+ return $foundId[0]->WID;
+ }
+ return 0;
+ }
+
+ static function getNextPageId(string $url, string $date) : int {
+ $foundId = Table::_get_all(
+ "Webpages",
+ "Database\Webpage",
+ "WHERE URL = \"$url\" && Date > \"$date\" ORDER BY Date ASC LIMIT 1",
+ "WID"
+ );
+ if (count($foundId) > 0) {
+ return $foundId[0]->WID;
+ }
+ return 0;
+ }
+
static function getPagesCount() : int {
return Table::_get_entries_count("Webpages");
}