Template/Update (Part 19)

* convert dbtype 'achievement'
This commit is contained in:
Sarjuuk
2025-08-10 20:14:03 +02:00
parent 26226e2bad
commit 98a54cd871
14 changed files with 776 additions and 852 deletions

View File

@@ -1,7 +1,10 @@
<?php namespace Aowow; ?>
<?php
namespace Aowow\Template;
<?php $this->brick('header'); ?>
use \Aowow\Lang;
$this->brick('header');
?>
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
@@ -20,75 +23,29 @@ $this->brick('headIcons');
$this->brick('redButtons');
?>
<h1><?=$this->name; ?></h1>
<h1><?=$this->h1; ?></h1>
<?=$this->description.PHP_EOL; ?>
<h3><?=Lang::achievement('criteria').($this->reqCrtQty ? ' &ndash; <small><b>'.Lang::achievement('reqNumCrt', [$this->reqCrtQty, count($this->criteria)]).'</b></small>' : ''); ?></h3>
<?php
echo $this->description;
echo '<h3>'.Lang::achievement('criteria').($this->criteria['reqQty'] ? ' &ndash; <small><b>'.Lang::achievement('reqNumCrt').' '.$this->criteria['reqQty'].' '.Lang::achievement('outOf').' '.count($this->criteria['data']).'</b></small>' : null)."</h3>\n";
?>
<?php
$tbl1 = '<div style="float: left;"><table class="iconlist">%s</table></div>';
$tbl2 = '<div style="float: left; margin-right: 25px"><table class="iconlist">%s</table></div>';
$rows1 = '';
$rows2 = '';
foreach ($this->criteria['data'] as $i => $cr):
if (isset($cr['icon'])):
$row = '<tr><th align="right" id="iconlist-icon'.$cr['icon'].'"></th>';
else:
$row = '<tr><th><ul><li><var>&nbsp;</var></li></ul></th>';
endif;
$row .= '<td><span class="tip" title="ID'.Lang::main('colon').$cr['id'].'">';
if (!empty($cr['link'])):
$row .= '<a href="'.$cr['link']['href'].'"'.(isset($cr['link']['quality']) ? ' class="q'.$cr['link']['quality'].'"' : null).'>'.Util::htmlEscape($cr['link']['text']).'</a>';
endif;
if (!empty($cr['link']['count']) && $cr['link']['count'] > 1):
$row .= '&nbsp;('.$cr['link']['count'].')';
endif;
if (isset($cr['extraText'])):
$row .= ' '.$cr['extraText'];
endif;
$row .= '</span>';
if (!empty($cr['extraData'])):
$buff = [];
foreach ($cr['extraData'] as $xd):
$buff[] = $xd[0] ? '<a href="'.$xd[0].'">'.$xd[1].'</a>' : '<span>'.$xd[1].'</span>';
endforeach;
$row .= '<br /><sup style="margin-left:8px;">('.implode(', ', $buff).')</sup>';
endif;
$row .= '</td></tr>';
$rows0 = $rows1 = '';
foreach ($this->criteria as $i => $icon):
// every odd number of elements
if ($i + 1 > round(count($this->criteria['data']) / 2)):
$rows2 .= $row;
else:
$rows1 .= $row;
endif;
${'rows' . ($i % 2)} .= $icon->renderContainer(20, $i, true);
endforeach;
if ($rows2):
echo sprintf($tbl2, $rows2);
if ($rows0):
echo " <div style=\"float: left; margin-right: 25px\"><table class=\"iconlist\">\n".$rows0." </table></div>\n";
endif;
if ($rows1):
echo sprintf($tbl1, $rows1);
echo " <div style=\"float: left;\"><table class=\"iconlist\">\n".$rows1." </table></div>\n";
endif;
?>
<script type="text/javascript">//<![CDATA[
<?php
foreach ($this->criteria['icons'] as $k => $ic):
echo ' $WH.ge(\'iconlist-icon'.$ic['itr'].'\').appendChild('.$ic['type'].'.createIcon('.$ic['id'].', 0, '.(!empty($ic['count']) ? $ic['count'] : 0)."));\n";
foreach ($this->criteria as $crt):
echo $crt->renderJS(24);
endforeach;
?>
//]]></script>
@@ -96,29 +53,28 @@ endforeach;
<div style="clear: left"></div>
<?php
if ($r = $this->rewards):
if (!empty($r['item'])):
if ([$rewItems, $rewTitle, $rewText] = $this->rewards):
if ($rewItems):
echo '<h3>'.Lang::main('rewards')."</h3>\n";
$this->brick('rewards', ['rewards' => $r['item'], 'rewTitle' => null]);
$this->brick('rewards', ['rewards' => $rewItems, 'rewTitle' => null]);
endif;
if (!empty($r['title'])):
if ($rewTitle):
echo '<h3>'.Lang::main('gains')."</h3>\n<ul>";
foreach ($r['title'] as $i):
foreach ($rewTitle as $i):
echo ' <li><div>'.$i."</div></li>\n";
endforeach;
echo "</ul>\n";
endif;
if (empty($r['title']) && empty($r['item']) && $r['text']):
echo '<h3>'.Lang::main('rewards')."</h3>\n" .
'<ul><li><div>'.$r['text']."</div></li></ul>\n";
if (!$rewTitle && !$rewItems && $rewText):
echo '<h3>'.Lang::main('rewards')."</h3>\n<ul><li><div>".$rewText."</div></li></ul>\n";
endif;
endif;
$this->brick('mail');
$this->brickIf($this->mail, 'mail');
if (!empty($this->transfer)):
if ($this->transfer):
echo " <div style=\"clear: left\"></div>";
echo " <div class=\"pad\"></div>\n ".$this->transfer."\n";
endif;
@@ -129,7 +85,7 @@ endif;
</div>
<?php
$this->brick('lvTabs', ['relTabs' => true]);
$this->brick('lvTabs');
$this->brick('contribute');
?>

View File

@@ -1,10 +1,11 @@
<?php namespace Aowow; ?>
<?php
$this->brick('header');
$f = $this->filterObj->values // shorthand
?>
namespace Aowow\Template;
use \Aowow\Lang;
$this->brick('header');
$f = $this->filter->values; // shorthand
?>
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
@@ -12,37 +13,38 @@ $f = $this->filterObj->values // shorthand
<?php
$this->brick('announcement');
$this->brick('pageTemplate', ['fiQuery' => $this->filterObj->query, 'fiMenuItem' => [9]]);
$this->brick('pageTemplate', ['fiQuery' => $this->filter->query, 'fiMenuItem' => [9]]);
?>
<div id="fi" style="display: <?=$this->filterObj->query ? 'block' : 'none'; ?>;">
<div id="fi" style="display: <?=$this->filter->query ? 'block' : 'none'; ?>;">
<form action="?filter=achievements<?=$this->subCat; ?>" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<div class="text">
<?php
$this->brick('headIcons');
$this->brick('redButtons');
?>
<h1><?=$this->h1; ?></h1>
</div>
<table>
<tr>
<td><?=Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
<td><?=$this->ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
<td colspan="3">
<table><tr>
<td>&nbsp;<input type="text" name="na" size="30" <?=isset($f['na']) ? 'value="'.$f['na'].'"' : null; ?>/></td>
<td>&nbsp; <input type="checkbox" name="ex" value="on" id="achievement-ex" <?=isset($f['ex']) ? 'checked="checked"' : null; ?>/></td>
<td>&nbsp;<input type="text" name="na" size="30" <?=$f['na'] ? 'value="'.$f['na'].'"' : ''; ?>/></td>
<td>&nbsp; <input type="checkbox" name="ex" value="on" id="achievement-ex" <?=$f['ex'] ? 'checked="checked"' : ''; ?>/></td>
<td><label for="achievement-ex"><span class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_extendedachievementsearch, 0, 0, 'q')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"><?=Lang::main('extSearch'); ?></span></label></td>
</tr></table>
</td>
</tr><tr>
<td class="padded"><?=Lang::main('side').Lang::main('colon'); ?></td>
<td class="padded"><?=Lang::main('side'); ?></td>
<td class="padded">&nbsp;<select name="si">
<option></option>
<?php
foreach (Lang::game('si') as $i => $str):
if ($str):
echo ' <option value="'.$i.'" '.((isset($f['si']) && $f['si'] == $i) ? 'selected' : null).'>'.$str."</option>\n";
endif;
endforeach;
?>
<?=$this->makeOptionsList(Lang::game('si'), $f['si'], 36); ?>
</select>
</td>
<td class="padded"><table><tr>
<td>&nbsp;&nbsp;&nbsp;<?=Lang::achievement('points').Lang::main('colon'); ?></td>
<td>&nbsp;<input type="text" name="minpt" maxlength="2" class="smalltextbox" <?=isset($f['minpt']) ? 'value="'.$f['minpt'].'"' : null; ?>/> - <input type="text" name="maxpt" maxlength="2" class="smalltextbox" <?=isset($f['maxpt']) ? 'value="'.$f['maxpt'].'"' : null; ?>/></td>
<td>&nbsp;<input type="text" name="minpt" maxlength="2" class="smalltextbox" <?=$f['minpt'] ? 'value="'.$f['minpt'].'"' : ''; ?>/> - <input type="text" name="maxpt" maxlength="2" class="smalltextbox" <?=$f['maxpt'] ? 'value="'.$f['maxpt'].'"' : ''; ?>/></td>
</tr></table></td>
</tr>
</table>
@@ -51,7 +53,7 @@ endforeach;
<div class="padded2">
<div style="float: right"><?=Lang::main('refineSearch'); ?></div>
<?=Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?=!isset($f['ma']) ? 'checked="checked" ' : null ?>/><label for="ma-0"><?=Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?=isset($f['ma']) ? 'checked="checked" ' : null ?> /><label for="ma-1"><?=Lang::main('oneFilter'); ?></label>
<?=Lang::main('match'); ?><input type="radio" name="ma" value="" id="ma-0" <?=!$f['ma'] ? 'checked="checked" ' : '' ?>/><label for="ma-0"><?=Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?=$f['ma'] ? 'checked="checked" ' : '' ?> /><label for="ma-1"><?=Lang::main('oneFilter'); ?></label>
</div>
<div class="clear"></div>
@@ -65,7 +67,7 @@ endforeach;
<div class="pad"></div>
</div>
<?php $this->brick('filter'); ?>
<?=$this->renderFilter(12); ?>
<?php $this->brick('lvTabs'); ?>