Migrate v3 data; WIP on journal items

This commit is contained in:
2024-06-21 23:22:56 -04:00
parent 4aa6e832c7
commit 4ea55d4d25
12 changed files with 273 additions and 18 deletions

View File

@@ -1,7 +1,8 @@
<?php declare(strict_types=1);
use BitBadger\PDODocument\{Configuration, Definition, Mode};
use Dotenv\Dotenv;
use MyPrayerJournal\{Auth, Layout};
use MyPrayerJournal\{Auth, Layout, Table};
require __DIR__ . '/vendor/autoload.php';
@@ -16,6 +17,10 @@ if (!is_null($auth0_session)) {
$_SESSION['user_id'] = $auth0_session->user['sub'];
}
Configuration::$pdoDSN = 'sqlite:' . implode(DIRECTORY_SEPARATOR, [__DIR__, 'data', 'mpj.db']);
Configuration::$mode = Mode::SQLite;
Definition::ensureTable(Table::REQUEST);
/**
* Is this an htmx request?
*
@@ -33,6 +38,16 @@ function page_link(string $href, string $text, array $attrs = []): void
echo ">$text</a>";
}
/**
* Generate a material icon
*
* @param string $name The name of the material icon
* @return string The material icon wrapped in a `span` tag
*/
function icon(string $name): string {
return "<span class=material-icons>$name</span>";
}
function page_head(string $title): void
{
Layout::htmlHead($title);
@@ -42,6 +57,11 @@ function page_head(string $title): void
echo '<main role=main>';
}
function bare_head(): void
{
echo '<!DOCTYPE html><html lang=en><head><title></title></head><body>';
}
function page_foot(): void
{
echo '</main>';
@@ -51,3 +71,8 @@ function page_foot(): void
}
echo '</body></html>';
}
function bare_foot(): void
{
echo '</body></html>';
}