diff --git a/includes/class.achievement.php b/includes/class.achievement.php
index e8c89318..78df3d24 100644
--- a/includes/class.achievement.php
+++ b/includes/class.achievement.php
@@ -5,6 +5,8 @@ if (!defined('AOWOW_REVISION'))
class AchievementList extends BaseType
{
+ use listviewHelper;
+
public $criteria = [];
public $tooltip = [];
diff --git a/includes/class.title.php b/includes/class.title.php
index 4130ad9d..5f73e7c6 100644
--- a/includes/class.title.php
+++ b/includes/class.title.php
@@ -5,7 +5,9 @@ if (!defined('AOWOW_REVISION'))
class TitleList extends BaseType
{
- private $sources = [];
+ use listviewHelper;
+
+ public $sources = [];
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_titles WHERE [cond] ORDER BY Id ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM ?_titles WHERE [cond]';
@@ -33,6 +35,7 @@ class TitleList extends BaseType
}
}
}
+ $this->reset(); // push first element back for instant use
}
public function getListviewData()
@@ -127,7 +130,7 @@ class TitleList extends BaseType
public function getHtmlizedName($gender = GENDER_MALE)
{
- return str_replace('%s', '<'.Lang::$main['name'].'>', $this->name[$gender]);
+ return str_replace('%s', '<'.Lang::$main['name'].'>', $this->names[$this->id][$gender]);
}
public function addRewardsToJScript(&$ref) { }
diff --git a/includes/utilities.php b/includes/utilities.php
index f769f4f9..29cd9065 100644
--- a/includes/utilities.php
+++ b/includes/utilities.php
@@ -193,6 +193,41 @@ abstract class BaseType
abstract public function renderTooltip();
}
+trait listviewHelper
+{
+ public function hasDiffCategories()
+ {
+ $this->reset();
+ $curCat = $this->getField('category');
+ if ($curCat === null)
+ return false;
+
+ while ($this->iterate())
+ if ($curCat != $this->getField('category'))
+ return true;
+
+ return false;
+ }
+
+ public function hasAnySource()
+ {
+ if (!isset($this->sources))
+ return false;
+
+ foreach ($this->sources as $src)
+ {
+ if (!is_array($src))
+ continue;
+
+ if (!empty($src))
+ return true;
+ }
+
+ return false;
+ }
+
+}
+
class Lang
{
public static $main;
diff --git a/pages/titles.php b/pages/titles.php
index 8c0a8a06..212c4b0a 100644
--- a/pages/titles.php
+++ b/pages/titles.php
@@ -27,6 +27,12 @@ if (!$smarty->loadCache($cacheKey, $pageData))
)
);
+ if ($titles->hasDiffCategories())
+ $pageData['params']['visibleCols'] = "$['category']";
+
+ if (!$titles->hasAnySource())
+ $pageData['params']['hiddenCols'] = "$['source']";
+
$smarty->saveCache($cacheKey, $pageData);
}