mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-05-02 20:29:21 +02:00
spells page: Fixed errors when spells is not installed by admin.
This commit is contained in:
parent
bc2a6e2c01
commit
96802cb348
68
spells.php
68
spells.php
@ -94,28 +94,29 @@ if (user_logged_in() && is_admin($user_data)) {
|
|||||||
}
|
}
|
||||||
// End loading spell list
|
// End loading spell list
|
||||||
|
|
||||||
// Preparing data
|
if ($spells) {
|
||||||
$configVoc = $config['vocations'];
|
// Preparing data
|
||||||
$types = array_keys($spells);
|
$configVoc = $config['vocations'];
|
||||||
$itemServer = 'http://'.$config['shop']['imageServer'].'/';
|
$types = array_keys($spells);
|
||||||
|
$itemServer = 'http://'.$config['shop']['imageServer'].'/';
|
||||||
|
|
||||||
// Filter spells by vocation
|
// Filter spells by vocation
|
||||||
$getVoc = (isset($_GET['vocation'])) ? getValue($_GET['vocation']) : 'all';
|
$getVoc = (isset($_GET['vocation'])) ? getValue($_GET['vocation']) : 'all';
|
||||||
if ($getVoc !== 'all') {
|
if ($getVoc !== 'all') {
|
||||||
$getVoc = (int)$getVoc;
|
$getVoc = (int)$getVoc;
|
||||||
foreach ($types as $type)
|
foreach ($types as $type)
|
||||||
foreach ($spells[$type] as $name => $spell)
|
foreach ($spells[$type] as $name => $spell)
|
||||||
if (!empty($spell['vocations']))
|
if (!empty($spell['vocations']))
|
||||||
if (!in_array($getVoc, $spell['vocations']))
|
if (!in_array($getVoc, $spell['vocations']))
|
||||||
unset($spells[$type][$name]);
|
unset($spells[$type][$name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render HTML
|
// Render HTML
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<h1 id="spells">Spells<?php if ($getVoc !== 'all') echo ' ('.$configVoc[$getVoc]['name'].')';?></h1>
|
<h1 id="spells">Spells<?php if ($getVoc !== 'all') echo ' ('.$configVoc[$getVoc]['name'].')';?></h1>
|
||||||
|
|
||||||
<form action="#spells" class="filter_spells">
|
<form action="#spells" class="filter_spells">
|
||||||
<label for="vocation">Filter vocation:</label>
|
<label for="vocation">Filter vocation:</label>
|
||||||
<select id="vocation" name="vocation">
|
<select id="vocation" name="vocation">
|
||||||
<option value="all">All</option>
|
<option value="all">All</option>
|
||||||
@ -124,18 +125,18 @@ if ($getVoc !== 'all') {
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" value="Search">
|
<input type="submit" value="Search">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h2>Spell types:</h2>
|
<h2>Spell types:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach ($types as $type): ?>
|
<?php foreach ($types as $type): ?>
|
||||||
<li><a href="#spell_<?php echo $type; ?>"><?php echo ucfirst($type); ?></a></li>
|
<li><a href="#spell_<?php echo $type; ?>"><?php echo ucfirst($type); ?></a></li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2 id="spell_instant">Instant Spells</h2>
|
<h2 id="spell_instant">Instant Spells</h2>
|
||||||
<a href="#spells">Jump to top</a>
|
<a href="#spells">Jump to top</a>
|
||||||
<table class="table tbl-hover">
|
<table class="table tbl-hover">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="yellow">
|
<tr class="yellow">
|
||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
@ -163,11 +164,11 @@ if ($getVoc !== 'all') {
|
|||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2 id="spell_rune">Magical Runes</h2>
|
<h2 id="spell_rune">Magical Runes</h2>
|
||||||
<a href="#spells">Jump to top</a>
|
<a href="#spells">Jump to top</a>
|
||||||
<table class="table tbl-hover">
|
<table class="table tbl-hover">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="yellow">
|
<tr class="yellow">
|
||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
@ -195,11 +196,11 @@ if ($getVoc !== 'all') {
|
|||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2 id="spell_conjure">Conjure Spells</h2>
|
<h2 id="spell_conjure">Conjure Spells</h2>
|
||||||
<a href="#spells">Jump to top</a>
|
<a href="#spells">Jump to top</a>
|
||||||
<table class="table tbl-hover">
|
<table class="table tbl-hover">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="yellow">
|
<tr class="yellow">
|
||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
@ -233,9 +234,16 @@ if ($getVoc !== 'all') {
|
|||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<a href="#spells">Jump to top</a>
|
<a href="#spells">Jump to top</a>
|
||||||
<?php
|
<?php
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<h1>Spells</h1>
|
||||||
|
<p>Spells have currently not been loaded into the website by the server admin.</p>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
/* Debug tests
|
/* Debug tests
|
||||||
foreach ($spells as $type => $spells) {
|
foreach ($spells as $type => $spells) {
|
||||||
data_dump($spells, false, "Type: $type");
|
data_dump($spells, false, "Type: $type");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user