do not let Characters change their type (only moderators are allowed to do that)

This commit is contained in:
coderkun 2014-05-02 01:35:52 +02:00
commit aac24b0595
2 changed files with 8 additions and 1 deletions

View file

@ -491,7 +491,7 @@
$typeIndex = null;
foreach($types as $index => &$type)
{
$type['selected'] = ($type['url'] == $this->request->getPostParam('type'));
$type['selected'] = (count(array_intersect(array('admin','moderator'), \hhu\z\controllers\SeminaryController::$character['characterroles'])) > 0) ? ($type['url'] == $this->request->getPostParam('type')) : ($type['url'] == $character['charactertype_url']);
if($type['selected']) {
$typeIndex = $index;
}

View file

@ -62,7 +62,14 @@
<p><?=$type['name']?></p>
<img id="avatar" src="<?=$linker->link(array('media','avatar',$seminary['url'],$type['url'],$xplevels[0]['level'],'portrait'))?>" />
</label>
<?php if(count(array_intersect(array('admin','moderator'), \hhu\z\controllers\SeminaryController::$character['characterroles'])) > 0) : ?>
<input id="type-<?=$type['id']?>" name="type" type="radio" value="<?=$type['url']?>" <?php if(array_key_exists('selected', $type) && $type['selected']) : ?>checked="checked"<?php endif ?> />
<?php else : ?>
<input id="type-<?=$type['id']?>" name="type" type="radio" disabled="disabled" value="<?=$type['url']?>" <?php if(array_key_exists('selected', $type) && $type['selected']) : ?>checked="checked"<?php endif ?> />
<?php if(array_key_exists('selected', $type) && $type['selected']) : ?>
<input name="type" type="hidden" value="<?=$type['url']?>" />
<?php endif ?>
<?php endif ?>
</li>
<?php endforeach ?>
</ul>