Add more details to the asset listing

This commit is contained in:
Bojidar Marinov
2016-06-30 18:22:23 +03:00
parent 80d839f5ec
commit 7e7b143cbc
2 changed files with 28 additions and 23 deletions

View File

@@ -13,7 +13,7 @@ return [
'list' => 'SELECT category_id as id, category as name FROM `as_categories` WHERE category_type = :category_type ORDER BY category_id',
],
'asset' => [
'search' => 'SELECT asset_id, title, username as author, user_id as author_id, category_id, rating, cost, support_level, icon_url, version, version_string FROM `as_assets`
'search' => 'SELECT asset_id, title, username as author, user_id as author_id, category, category_id, rating, cost, support_level, icon_url, version, version_string FROM `as_assets`
LEFT JOIN `as_users` USING (user_id)
LEFT JOIN `as_categories` USING (category_id)

View File

@@ -1,27 +1,32 @@
<?php include("_header.phtml") ?>
<?php foreach($result as $i => $asset): ?>
<div class="row">
<div class="col-12">
<div class="media">
<div class="media-left">
<a href="#">
<img class="media-object" src="<?php echo htmlspecialchars($asset['icon_url']) ?>" alt="<?php echo htmlspecialchars($asset['title']) ?>'s icon'" width=80 height=80>
</a>
</div>
<div class="media-body">
<h4 class="media-heading">
<?php echo htmlspecialchars($asset['title']) ?>
<small>(by <?php echo htmlspecialchars($asset['author']) ?>)</small>
<span class="label label-<?php echo htmlspecialchars([
'official' => 'success',
'community' => 'info',
'testing' => 'default',
][$asset['support_level']]) ?>"><?php echo htmlspecialchars($asset['support_level']) ?></span>
</h4>
...
<?php foreach($data['result'] as $i => $asset): ?>
<div class="col-md-6">
<div class="media">
<div class="media-left">
<a href="<?php echo $basepath . '/asset/' . $asset['asset_id'] ?>">
<img class="media-object" src="<?php echo htmlspecialchars($asset['icon_url']) ?>" alt="<?php echo htmlspecialchars($asset['title']) ?>'s icon" width=80 height=80>
</a>
</div>
<div class="media-body">
<h4 class="media-heading">
<?php echo htmlspecialchars($asset['title']) ?>
<small><?php echo htmlspecialchars($asset['version_string']) ?></small>
<?php for ($star=1; $star <= 5; $star++) { ?>
<i class="glyphicon glyphicon-star<?php if($asset['rating'] < $star) echo '-empty'; ?>"></i>
<?php } ?>
<span class="label label-primary"><?php echo htmlspecialchars($asset['category']) ?></span>
<span class="label label-<?php echo htmlspecialchars([
'official' => 'success',
'community' => 'info',
'testing' => 'default',
][$asset['support_level']]) ?>"><?php echo htmlspecialchars($asset['support_level']) ?></span>
</h4>
<p>Submitted by user <?php echo htmlspecialchars($asset['author']) ?>; <?php echo htmlspecialchars($asset['cost']) ?></p>
</div>
</div>
</div>
</div>
<?php endforeach ?>
</div>
<?php endforeach ?>
<?php include("_footer.phtml") ?>
<?php include("_footer.phtml") ?>