added more claims to identity claim page

This commit is contained in:
Akinwale Ariwodola 2017-06-16 05:48:35 +01:00
parent 5f98c38c39
commit 6472a7ca49
2 changed files with 11 additions and 9 deletions

View file

@ -131,19 +131,21 @@ class MainController extends AppController {
return $this->redirect('/'); return $this->redirect('/');
} }
$json = json_decode($claim->Stream->Stream); if (isset($claim->Stream)) {
if (isset($json->metadata->license)) { $json = json_decode($claim->Stream->Stream);
$claim->License = $json->metadata->license; if (isset($json->metadata->license)) {
} $claim->License = $json->metadata->license;
if (isset($json->metadata->licenseUrl)) { }
$claim->LicenseUrl = $json->metadata->licenseUrl; if (isset($json->metadata->licenseUrl)) {
$claim->LicenseUrl = $json->metadata->licenseUrl;
}
} }
$moreClaims = []; $moreClaims = [];
if (isset($claim->Publisher)) { if (isset($claim->Publisher) || $claim->ClaimType == 1) {
// find more claims for the publisher // find more claims for the publisher
$moreClaims = $this->Claims->find()->contain(['Stream', 'Publisher' => ['fields' => ['Name']]])-> $moreClaims = $this->Claims->find()->contain(['Stream', 'Publisher' => ['fields' => ['Name']]])->
where(['Claims.ClaimType' => 2, 'Claims.Id <>' => $claim->Id, 'Claims.PublisherId' => $claim->Publisher->ClaimId])-> where(['Claims.ClaimType' => 2, 'Claims.Id <>' => $claim->Id, 'Claims.PublisherId' => isset($claim->Publisher) ? $claim->Publisher->ClaimId : $claim->ClaimId])->
limit(9)->order(['RAND()' => 'DESC'])->toArray(); limit(9)->order(['RAND()' => 'DESC'])->toArray();
for ($i = 0; $i < count($moreClaims); $i++) { for ($i = 0; $i < count($moreClaims); $i++) {
if (isset($moreClaims[$i]->Stream)) { if (isset($moreClaims[$i]->Stream)) {

View file

@ -138,7 +138,7 @@ if (strlen(trim($desc)) == 0) {
<?php if (count($moreClaims) > 0): ?> <?php if (count($moreClaims) > 0): ?>
<div class="more-claims"> <div class="more-claims">
<h4>More from the publisher</h4> <h4><?php echo isset($claim->Publisher) ? 'More from the publisher' : 'Published by this identity' ?></h4>
<div class="claims-grid"> <div class="claims-grid">
<?php $idx = 1; $row = 1; $rowCount = ceil(count($moreClaims) / 3); foreach ($moreClaims as $claim): <?php $idx = 1; $row = 1; $rowCount = ceil(count($moreClaims) / 3); foreach ($moreClaims as $claim):