From cbee21c07cd30c29c2190be32a414f09cab794a7 Mon Sep 17 00:00:00 2001 From: marcdeb1 Date: Wed, 19 Dec 2018 00:37:01 +0100 Subject: [PATCH] Other claim page bugs --- src/Controller/MainController.php | 5 +-- src/Template/Element/claimbox.ctp | 72 ++++++++++++++++++++++++++++++ src/Template/Main/claims.ctp | 74 +------------------------------ 3 files changed, 76 insertions(+), 75 deletions(-) create mode 100644 src/Template/Element/claimbox.ctp diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 056c958..cbb5a14 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -171,7 +171,7 @@ class MainController extends AppController { $this->set('currentPage', $page); $this->set('claims', $claims); } else { - $claim = $this->Claims->find()->select($this->Claims)->select(['Claims__publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->where(['Claims.claim_id' => $id])->order(['Claims.created_at' => 'DESC'])->first(); + $claim = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->where(['Claims.claim_id' => $id])->order(['Claims.created_at' => 'DESC'])->first(); if (!$claim) { return $this->redirect('/'); } @@ -193,7 +193,7 @@ class MainController extends AppController { $moreClaims = []; if (isset($claim->publisher) || $claim->claim_type == 1) { // find more claims for the publisher - $moreClaims = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->where(['Claims.claim_type' => 2, 'Claims.id <>' => $claim->id, 'Claims.publisher_id' => isset($claim->publisher) ? $claim->publisher_id : $claim->claim_id])->limit(9)->order(['Claims.fee' => 'DESC', 'RAND()' => 'DESC'])->toArray(); + $moreClaims = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->where(['Claims.claim_type' => 1, 'Claims.id <>' => $claim->id, 'Claims.publisher_id' => isset($claim->publisher) ? $claim->publisher_id : $claim->claim_id])->limit(9)->order(['Claims.fee' => 'DESC', 'RAND()' => 'DESC'])->toArray(); for ($i = 0; $i < count($moreClaims); $i++) { if ($canConvert && $moreClaims[$i]->fee > 0 && $moreClaims[$i]->fee_currency == 'USD') { $moreClaims[$i]->price = $moreClaims[$i]->fee / $priceInfo->price; @@ -210,7 +210,6 @@ class MainController extends AppController { } } } - $this->set('claim', $claim); $this->set('moreClaims', $moreClaims); } diff --git a/src/Template/Element/claimbox.ctp b/src/Template/Element/claimbox.ctp new file mode 100644 index 0000000..5e4a677 --- /dev/null +++ b/src/Template/Element/claimbox.ctp @@ -0,0 +1,72 @@ +getAutoThumbText(); +$cost = ''; +if (isset($claim->Price) && $claim->Price > 0) { + $cost = $this->Amount->formatCurrency($claim->Price) . ' LBC'; +} else if (isset($claim->fee) && strtolower($claim->fee_currency) === 'lbc') { + $cost = $this->Amount->formatCurrency($claim->fee) . ' LBC'; +} +$a = ['purple', 'orange', 'blue', 'teal', 'green', 'yellow']; +// content type +$ctTag = $claim->getContentTag(); +?> +
+ 0): ?> +
+ + +
+ +
+ + is_nsfw): ?> +
NSFW
+ +
+ +
+ is_nsfw && strlen(trim($claim->thumbnail_url)) > 0): ?> + + +
+ +
+ + +
\ No newline at end of file diff --git a/src/Template/Main/claims.ctp b/src/Template/Main/claims.ctp index 182112c..4458105 100644 --- a/src/Template/Main/claims.ctp +++ b/src/Template/Main/claims.ctp @@ -154,7 +154,7 @@ if (strlen(trim($desc)) == 0) { if ($idx % 3 == 0) { $row++; } - echo $this->element('claimbox', array('claim' => $claim)); + echo $this->element('claimbox', array('claim' => $claim, 'idx' => $idx, 'last_row' => $last_row)); $idx++; endforeach; ?>
@@ -185,77 +185,7 @@ if (strlen(trim($desc)) == 0) { if ($idx % 3 == 0) { $row++; } -$autoThumbText = $claim->getAutoThumbText(); -$cost = ''; -if (isset($claim->Price) && $claim->Price > 0) { - $cost = $this->Amount->formatCurrency($claim->Price) . ' LBC'; -} else if (isset($claim->fee) && strtolower($claim->fee_currency) === 'lbc') { - $cost = $this->Amount->formatCurrency($claim->fee) . ' LBC'; -} - -// content type -$ctTag = $claim->getContentTag(); -?> -
- 0): ?> -
- - -
- -
- - is_nsfw): ?> -
NSFW
- -
- -
- is_nsfw && strlen(trim($claim->thumbnail_url)) > 0): ?> - - -
- -
- - -
element('claimbox', array('claim' => $claim, 'idx' => $idx, 'last_row' => $last_row)); $idx++; endforeach; ?>