Group remembered wishlists by user
This commit is contained in:
parent
3b7a902f8e
commit
c0e9d66df0
1 changed files with 34 additions and 20 deletions
|
@ -13,34 +13,48 @@ $page->header();
|
|||
$page->bodyStart();
|
||||
$page->navigation();
|
||||
|
||||
$wishlists = $_SESSION['user']->getSavedWishlists();
|
||||
$wishlists = $_SESSION['user']->getSavedWishlists();
|
||||
$wishlists_by_user = array();
|
||||
|
||||
foreach ($wishlists as $wishlist_saved) {
|
||||
$wishlists_by_user[$wishlist_saved['user']][] = $wishlist_saved;
|
||||
}
|
||||
?>
|
||||
<main>
|
||||
<div class="ui container">
|
||||
<h1 class="ui header"><?= $page->title ?></h1>
|
||||
|
||||
<?php if (!empty($wishlists)) { ?>
|
||||
<div class="ui four column doubling stackable grid wishlists-saved">
|
||||
<?php foreach ($wishlists as $wishlist_saved) { ?>
|
||||
<?php
|
||||
$wishlist = new Wishlist($wishlist_saved['wishlist']);
|
||||
$wishlist_user = User::getFromID($wishlist_saved['user']);
|
||||
$wishlist_href = Page::PAGE_WISHLIST . '&hash=' . $wishlist->hash;
|
||||
?>
|
||||
<div class="column">
|
||||
<a class="header" href="<?= $wishlist_href ?>">
|
||||
<div class="ui rounded bordered fluid image">
|
||||
<?= file_get_contents(ROOT . '/' . Wish::NO_IMAGE) ?>
|
||||
</div>
|
||||
</a>
|
||||
<?php if (!empty($wishlists_by_user)) { ?>
|
||||
<?php foreach ($wishlists_by_user as $wishlist_user => $wishlists_saved) { ?>
|
||||
<?php
|
||||
$wishlist_user = User::getFromID($wishlist_user);
|
||||
?>
|
||||
<h2 class="ui header"><?= $wishlist_user->getDisplayName() ?></h2>
|
||||
|
||||
<div class="content">
|
||||
<a class="header" href="<?= $wishlist_href ?>"><?= $wishlist->getTitle(); ?></a>
|
||||
<div class="description"><?= $wishlist_user->getDisplayName(); ?></div>
|
||||
</div>
|
||||
<?php if (!empty($wishlists_saved)) { ?>
|
||||
<div class="ui four column doubling stackable grid wishlists-saved">
|
||||
<?php foreach ($wishlists_saved as $wishlist_saved) { ?>
|
||||
<?php
|
||||
$wishlist = new Wishlist($wishlist_saved['wishlist']);
|
||||
$wishlist_href = Page::PAGE_WISHLIST . '&hash=' . $wishlist->hash;
|
||||
?>
|
||||
|
||||
<div class="column">
|
||||
<a class="header" href="<?= $wishlist_href ?>">
|
||||
<div class="ui rounded bordered fluid image">
|
||||
<?= file_get_contents(ROOT . '/' . Wish::NO_IMAGE) ?>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<div class="content">
|
||||
<a class="header" href="<?= $wishlist_href ?>"><?= $wishlist->getTitle(); ?></a>
|
||||
<div class="description"><?= $wishlist_user->getDisplayName(); ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<?= Page::info(__('Ask somebody to share their wishlist with you and hit the remember button for it to show up here!'), __('No lists')); ?>
|
||||
<?php } ?>
|
||||
|
|
Loading…
Reference in a new issue