set motto and rank for Character groups

This commit is contained in:
coderkun 2014-04-09 00:08:05 +02:00
commit 56f6e79907
2 changed files with 28 additions and 3 deletions

View file

@ -88,7 +88,7 @@
public function getGroupsForGroupsgroup($groupsgroupId)
{
return $this->db->query(
'SELECT id, name, url, xps '.
'SELECT id, name, url, xps, motto '.
'FROM v_charactergroups '.
'WHERE charactergroupsgroup_id = ?',
'i',
@ -128,7 +128,7 @@
public function getGroupByUrl($groupsgroupId, $groupUrl)
{
$data = $this->db->query(
'SELECT id, name, url, xps '.
'SELECT id, name, url, xps, motto '.
'FROM v_charactergroups '.
'WHERE charactergroupsgroup_id = ? AND url = ?',
'is',
@ -142,6 +142,31 @@
return $data[0];
}
/**
* Get the rank of a XP-value of a Character.
*
* @param int $seminaryId ID of Seminary
* @param int $xps XP-value to get rank for
* @return int Rank of XP-value
*/
public function getXPRank($groupsgroupId, $xps)
{
$data = $this->db->query(
'SELECT count(id) AS c '.
'FROM v_charactergroups '.
'WHERE charactergroupsgroup_id = ? AND xps > ?',
'id',
$groupsgroupId, $xps
);
if(!empty($data)) {
return $data[0]['c'] + 1;
}
return 1;
}
}
?>

View file

@ -12,7 +12,7 @@
</div>
<div class="gdesc">
<h3><?=$group['name']?></h3>
<span>Schweb wie ein Schmetterling! Stich wie eine Biene!</span>
<span><?=$group['motto']?></span>
</div>
<ul>
<li><i class="fa fa-th-list fa-fw"></i><?=$group['rank']?>. <?=_('Rank')?></li>