From beb32da3b4ff1b2103bfcf01589c6018cf069c85 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Fri, 7 Apr 2023 18:56:04 +0200 Subject: [PATCH] Itemset/Summary (#351) * disable compare button for empty item sets * do not display summary for empty item sets --- pages/itemset.php | 19 +++++++++++-------- template/pages/itemset.tpl.php | 6 ++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/pages/itemset.php b/pages/itemset.php index bcd06555..786d0149 100644 --- a/pages/itemset.php +++ b/pages/itemset.php @@ -18,6 +18,8 @@ class ItemsetPage extends GenericPage protected $mode = CACHE_TYPE_PAGE; protected $js = [[JS_FILE, 'swfobject.js'], [JS_FILE, 'Summary.js']]; + protected $summary = []; + protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkDomain']]; private $powerTpl = '$WowheadPower.registerItemSet(%d, %d, %s);'; @@ -167,15 +169,16 @@ class ItemsetPage extends GenericPage BUTTON_WOWHEAD => $this->typeId > 0, // bool only BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId], BUTTON_VIEW3D => ['type' => Type::ITEMSET, 'typeId' => $this->typeId, 'equipList' => $eqList], - BUTTON_COMPARE => ['eqList' => implode(':', $compare), 'qty' => $_cnt] - ); - $this->summary = array( - 'id' => 'itemset', - 'template' => 'itemset', - 'parent' => 'summary-generic', - 'groups' => array_map(function ($v) { return [[$v]]; }, $compare), - 'level' => $this->subject->getField('reqLevel'), + BUTTON_COMPARE => $compare ? ['eqList' => implode(':', $compare), 'qty' => $_cnt] : false ); + if ($compare) + $this->summary = array( + 'id' => 'itemset', + 'template' => 'itemset', + 'parent' => 'summary-generic', + 'groups' => array_map(function ($v) { return [[$v]]; }, $compare), + 'level' => $this->subject->getField('reqLevel'), + ); /**************/ /* Extra Tabs */ diff --git a/template/pages/itemset.tpl.php b/template/pages/itemset.tpl.php index 92944936..ac46fca9 100644 --- a/template/pages/itemset.tpl.php +++ b/template/pages/itemset.tpl.php @@ -68,6 +68,9 @@ foreach ($this->spells as $i => $s): endforeach; ?> +summary): +?>

@@ -75,6 +78,9 @@ endforeach; +