wishthis/includes/pages/wishlist.php

72 lines
1.9 KiB
PHP
Raw Normal View History

2022-01-18 11:43:28 +00:00
<?php
/**
2022-01-20 12:45:09 +00:00
* Template for viewing a wishlist directly via its link.
2022-01-18 11:43:28 +00:00
*
* @author Jay Trees <github.jay@grandel.anonaddy.me>
*/
2022-01-20 12:45:09 +00:00
use wishthis\{Page, User, Wishlist};
2022-01-18 11:43:28 +00:00
2022-01-20 12:45:09 +00:00
$wishlist = new Wishlist($_GET['wishlist']);
2022-01-18 11:43:28 +00:00
2022-01-20 12:45:09 +00:00
if (!$wishlist->exists) {
2022-01-18 14:25:14 +00:00
http_response_code(404);
?>
<h1>Not found</h1>
<p>The requested Wishlist was not found and likely deleted by its creator.</p>
<?php
die();
}
2022-01-20 12:45:09 +00:00
$page = new page(__FILE__, $wishlist->data['name']);
$page->header();
$page->navigation();
2022-01-18 11:43:28 +00:00
?>
<main>
<div class="ui container">
<h1 class="ui header"><?= $page->title ?></h1>
2022-01-18 14:54:08 +00:00
<?php
/**
* Warn the wishlist creator
*/
2022-01-20 12:45:09 +00:00
if (isset($user->id) && $user->id === intval($wishlist->data['user'])) { ?>
2022-01-18 14:54:08 +00:00
<div class="ui icon warning message wishlist-own">
<i class="exclamation triangle icon"></i>
<div class="content">
<div class="header">
Careful
</div>
<div class="text">
2022-01-18 15:01:20 +00:00
<p>
You are viewing your own wishlist!
You will be able to see which products have already been bought for you.
Don't you want to be surprised?
</p>
<p>
It's probably best to just close this tab.
</p>
2022-01-18 14:54:08 +00:00
</div>
</div>
</div>
<?php } ?>
2022-01-18 11:43:28 +00:00
<div class="ui segment">
2022-01-20 12:45:09 +00:00
<h2 class="ui header">What to do?</h2>
<p>
If you found something you would like to buy,
click the <span class="ui tiny horizontal label">Commit</span> button
and it will become unavailable for others.
</p>
2022-01-18 11:43:28 +00:00
</div>
2022-01-20 12:45:09 +00:00
<?php $wishlist->getCards() ?>
2022-01-18 11:43:28 +00:00
</div>
</main>
<?php
$page->footer();
?>