Items/Menu

* fixed preselection of menu items on Items List Page
 * fixed display and preselection of 'Type' option list
This commit is contained in:
Sarjuuk
2017-03-16 15:13:25 +01:00
parent 13d0dfeb07
commit 2ec5fda3e7
3 changed files with 15 additions and 6 deletions

View File

@@ -247,9 +247,9 @@ class GenericPage
{ {
$this->addArticle(); $this->addArticle();
$this->generateContent();
$this->generatePath(); $this->generatePath();
$this->generateTitle(); $this->generateTitle();
$this->generateContent();
$this->applyGlobals(); $this->applyGlobals();

View File

@@ -87,7 +87,7 @@ class ItemsPage extends GenericPage
parent::__construct($pageCall, $pageParam); parent::__construct($pageCall, $pageParam);
$this->name = Util::ucFirst(Lang::game('items')); $this->name = Util::ucFirst(Lang::game('items'));
$this->subCat = $pageParam ? '='.$pageParam : ''; $this->subCat = $pageParam !== NULL ? '='.$pageParam : '';
} }
protected function generateContent() protected function generateContent()
@@ -112,7 +112,6 @@ class ItemsPage extends GenericPage
$this->filter['fi'] = $this->filterObj->getForm(); $this->filter['fi'] = $this->filterObj->getForm();
$menu = $this->createExtraMenus(); $menu = $this->createExtraMenus();
foreach ($menu['type'][0] as $k => $str) foreach ($menu['type'][0] as $k => $str)
if ($str && (!$menu['type'][1] || ($menu['type'][1] & (1 << $k)))) if ($str && (!$menu['type'][1] || ($menu['type'][1] & (1 << $k))))
$this->filter['type'][$k] = $str; $this->filter['type'][$k] = $str;
@@ -436,6 +435,8 @@ class ItemsPage extends GenericPage
$tPart = Lang::item('cat', $this->category[0], 1, $this->category[1], 1, $this->category[2]); $tPart = Lang::item('cat', $this->category[0], 1, $this->category[1], 1, $this->category[2]);
else if (isset($this->category[1]) && is_array(Lang::item('cat', $this->category[0]))) else if (isset($this->category[1]) && is_array(Lang::item('cat', $this->category[0])))
$tPart = Lang::item('cat', $this->category[0], 1, $this->category[1]); $tPart = Lang::item('cat', $this->category[0], 1, $this->category[1]);
else if ($this->category[0] == 0 && isset($this->filter['ty']) && !is_array($this->filter['ty']))
$tPart = Lang::item('cat', 0, 1, $this->filter['ty']);
else else
$tPart = Lang::item('cat', $this->category[0]); $tPart = Lang::item('cat', $this->category[0]);
@@ -451,6 +452,8 @@ class ItemsPage extends GenericPage
$form = $this->filterObj->getForm('form'); $form = $this->filterObj->getForm('form');
if (count($this->path) == 4 && $this->category[0] == 4 && isset($form['sl']) && !is_array($form['sl'])) if (count($this->path) == 4 && $this->category[0] == 4 && isset($form['sl']) && !is_array($form['sl']))
$this->path[] = $form['sl']; $this->path[] = $form['sl'];
else if ($this->category[0] == 0 && isset($form['ty']) && !is_array($form['ty']))
$this->path[] = $form['ty'];
} }
// fetch best possible gems for chosen weights // fetch best possible gems for chosen weights
@@ -528,7 +531,6 @@ class ItemsPage extends GenericPage
switch ($this->category[0]) switch ($this->category[0])
{ {
case 0: case 0:
if (!isset($this->category[1]))
$menu['type'] = [Lang::item('cat', 0, 1), null]; $menu['type'] = [Lang::item('cat', 0, 1), null];
if (!isset($this->category[1]) || in_array($this->category[1], [6, -3])) if (!isset($this->category[1]) || in_array($this->category[1], [6, -3]))

View File

@@ -55,7 +55,14 @@ if (!empty($f['type'])):
<select name="ty[]" size="<?php echo min(count($f['type']), 7); ?>" multiple="multiple" class="rightselect"> <select name="ty[]" size="<?php echo min(count($f['type']), 7); ?>" multiple="multiple" class="rightselect">
<?php <?php
foreach ($f['type'] as $k => $str): foreach ($f['type'] as $k => $str):
echo ' <option value="'.$k.'" '.(isset($f['ty']) && in_array($k, (array)$f['ty']) ? ' selected' : null).'>'.(is_array($str) ? $str[0] : $str)."</option>\n"; $selected = false;
if (isset($f['ty']) && in_array($k, (array)$f['ty'])):
$selected = true;
elseif (isset($this->category[1]) && $this->category[0] == 0 && $this->category[1] == $k):
$selected = true;
endif;
echo ' <option value="'.$k.'" '.( $selected ? ' selected' : null).'>'.(is_array($str) ? $str[0] : $str)."</option>\n";
endforeach; endforeach;
?> ?>
</select> </select>