add Character type pictures to Character registration page (Issue #97)

This commit is contained in:
coderkun 2014-04-24 03:53:51 +02:00
commit 8d728241b0
3 changed files with 23 additions and 4 deletions

View file

@ -242,6 +242,9 @@
}
}
// Get XP-levels
$xplevels = $this->Characters->getXPLevelsForSeminary($seminary['id']);
// Pass data to view
$this->set('seminary', $seminary);
@ -250,6 +253,7 @@
$this->set('charactername', $charactername);
$this->set('validation', $validation);
$this->set('fieldsValidation', $fieldsValidation);
$this->set('xplevels', $xplevels);
}

View file

@ -392,6 +392,19 @@
}
public function getXPLevelsForSeminary($seminaryId)
{
return $this->db->query(
'SELECT id, xps, level, name '.
'FROM xplevels '.
'WHERE seminary_id = ? '.
'ORDER BY level ASC',
'i',
$seminaryId
);
}
/**
* Check if a Character name already exists.
*

View file

@ -40,12 +40,14 @@
<legend><?=_('Character properties')?></legend>
<label for="charactername"><?=_('Character name')?>:</label>
<input type="text" name="charactername" placeholder="<?=_('Character name')?>" required="required" value="<?=$charactername?>" /><br />
<label for="type"><?=_('Character type')?>:</label>
<select name="type" required="required">
<ul>
<?php foreach($types as &$type) : ?>
<option value="<?=$type['url']?>" <?php if(array_key_exists('selected', $type) && $type['selected']) : ?>selected="selected"<?php endif ?>><?=$type['name']?></option>
<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 ?> />
<label for="type-<?=$type['id']?>">
<img id="avatar" src="<?=$linker->link(array('media','avatar',$seminary['url'],$type['url'],$xplevels[0]['level']))?>" />
</label>
<?php endforeach ?>
</select>
</ul>
</fieldset>
<?php if($fieldsValidation !== true) : ?>