show Character groups members in Seminarybar
This commit is contained in:
parent
399d0bf014
commit
bf16cb9c9d
4 changed files with 63 additions and 29 deletions
|
|
@ -25,7 +25,7 @@
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $models = array('characters', 'quests', 'questgroups', 'achievements');
|
public $models = array('characters', 'quests', 'questgroups', 'achievements', 'charactergroups', 'avatars', 'media');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -60,12 +60,35 @@
|
||||||
$achievements = $this->Achievements->getAchievedAchievementsForCharacter($character['id']);
|
$achievements = $this->Achievements->getAchievedAchievementsForCharacter($character['id']);
|
||||||
$lastAchievement = array_shift($achievements);
|
$lastAchievement = array_shift($achievements);
|
||||||
|
|
||||||
|
// Get Character group members
|
||||||
|
$characterGroups = array();
|
||||||
|
foreach($this->Charactergroups->getGroupsForCharacter($character['id']) as $group)
|
||||||
|
{
|
||||||
|
$groupsgroup = $this->Charactergroups->getGroupsgroupById($group['charactergroupsgroup_id']);
|
||||||
|
if($groupsgroup['preferred'])
|
||||||
|
{
|
||||||
|
$group['members'] = $this->Characters->getCharactersForGroup($group['id']);
|
||||||
|
foreach($group['members'] as &$member)
|
||||||
|
{
|
||||||
|
if(!is_null($member['avatar_id']))
|
||||||
|
{
|
||||||
|
$avatar = $this->Avatars->getAvatarById($member['avatar_id']);
|
||||||
|
if(!is_null($avatar['small_avatarpicture_id'])) {
|
||||||
|
$member['small_avatar'] = $this->Media->getSeminaryMediaById($avatar['small_avatarpicture_id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$characterGroups[] = $group;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Pass data to view
|
// Pass data to view
|
||||||
$this->set('seminary', $seminary);
|
$this->set('seminary', $seminary);
|
||||||
$this->set('character', $character);
|
$this->set('character', $character);
|
||||||
$this->set('lastQuest', $lastQuest);
|
$this->set('lastQuest', $lastQuest);
|
||||||
$this->set('lastAchievement', $lastAchievement);
|
$this->set('lastAchievement', $lastAchievement);
|
||||||
|
$this->set('characterGroups', $characterGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
public function getGroupsroupsForSeminary($seminaryId)
|
public function getGroupsroupsForSeminary($seminaryId)
|
||||||
{
|
{
|
||||||
return $this->db->query(
|
return $this->db->query(
|
||||||
'SELECT id, name, url '.
|
'SELECT id, name, url, preferred '.
|
||||||
'FROM charactergroupsgroups '.
|
'FROM charactergroupsgroups '.
|
||||||
'WHERE seminary_id = ?',
|
'WHERE seminary_id = ?',
|
||||||
'i',
|
'i',
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
public function getGroupsgroupByUrl($seminaryId, $groupsgroupUrl)
|
public function getGroupsgroupByUrl($seminaryId, $groupsgroupUrl)
|
||||||
{
|
{
|
||||||
$data = $this->db->query(
|
$data = $this->db->query(
|
||||||
'SELECT id, name, url '.
|
'SELECT id, name, url, preferred '.
|
||||||
'FROM charactergroupsgroups '.
|
'FROM charactergroupsgroups '.
|
||||||
'WHERE seminary_id = ? AND url = ?',
|
'WHERE seminary_id = ? AND url = ?',
|
||||||
'is',
|
'is',
|
||||||
|
|
@ -79,6 +79,31 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a Character groups-group by its ID.
|
||||||
|
*
|
||||||
|
* @throws IdNotFoundException
|
||||||
|
* @param string $groupsgroupId ID of the Character groups-group
|
||||||
|
* @return array Character groups-group data
|
||||||
|
*/
|
||||||
|
public function getGroupsgroupById($groupsgroupId)
|
||||||
|
{
|
||||||
|
$data = $this->db->query(
|
||||||
|
'SELECT id, name, url, preferred '.
|
||||||
|
'FROM charactergroupsgroups '.
|
||||||
|
'WHERE id = ?',
|
||||||
|
'i',
|
||||||
|
$groupsgroupId
|
||||||
|
);
|
||||||
|
if(empty($data)) {
|
||||||
|
throw new \nre\exceptions\IdNotFoundException($groupsgroupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $data[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Character groups for a Character groups-group.
|
* Get Character groups for a Character groups-group.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
public function getCharactersForGroup($groupId)
|
public function getCharactersForGroup($groupId)
|
||||||
{
|
{
|
||||||
return $this->db->query(
|
return $this->db->query(
|
||||||
'SELECT characters.id, characters.created, characters.charactertype_id, characters.name, characters.url, characters.user_id, characters.xps, characters.avatar_id, charactertypes.name AS charactertype_name, charactertypes.url AS charactertypes_url '.
|
'SELECT characters.id, characters.created, characters.charactertype_id, characters.name, characters.url, characters.user_id, characters.xps, characters.xplevel, characters.avatar_id, charactertypes.name AS charactertype_name, charactertypes.url AS charactertypes_url '.
|
||||||
'FROM v_characters AS characters '.
|
'FROM v_characters AS characters '.
|
||||||
'LEFT JOIN characters_charactergroups ON characters_charactergroups.character_id = characters.id '.
|
'LEFT JOIN characters_charactergroups ON characters_charactergroups.character_id = characters.id '.
|
||||||
'LEFT JOIN charactertypes ON charactertypes.id = characters.charactertype_id '.
|
'LEFT JOIN charactertypes ON charactertypes.id = characters.charactertype_id '.
|
||||||
|
|
|
||||||
|
|
@ -32,33 +32,19 @@
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h1>Wille und die Majas</h1>
|
<?php foreach($characterGroups as &$group) : ?>
|
||||||
|
<h1><?=$group['name']?></h1>
|
||||||
<ul class="cranks">
|
<ul class="cranks">
|
||||||
|
<?php foreach($group['members'] as &$member) : ?>
|
||||||
<li>
|
<li>
|
||||||
<a href="#" title="Achievement-Titel"><img src="http://s7.directupload.net/images/140325/e2wdqhqa.png"></a>
|
<?php if(array_key_exists('small_avatar', $member)) : ?>
|
||||||
<p><a href="#">Anduin</a></p>
|
<a href="#" title="Achievement-Titel"><img src="<?=$linker->link(array('media','seminary',$seminary['url'],$member['small_avatar']['url']))?>"></a>
|
||||||
<p><small>Level 27 (1500 XP)</small></p>
|
<?php endif ?>
|
||||||
</li>
|
<p><a href="<?=$linker->link(array('characters','character',$seminary['url'],$member['url']))?>"><?=$member['name']?></a></p>
|
||||||
<li>
|
<p><small><?=_('Level')?> <?=$member['xplevel']?> (<?=$member['xps']?> XPs)</small></p>
|
||||||
<a href="#" title="Achievement-Titel"><img src="http://s1.directupload.net/images/140325/upv2dg2r.png"></a>
|
|
||||||
<p><a href="#">Jaina</a></p>
|
|
||||||
<p><small>Level 26 (1400 XP)</small></p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#" title="Achievement-Titel"><img src="http://s14.directupload.net/images/140325/x9ny5kgu.png"></a>
|
|
||||||
<p><a href="#">Uther</a></p>
|
|
||||||
<p><small>Level 25 (1300 XP)</small></p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#" title="Achievement-Titel"><img src="http://s7.directupload.net/images/140325/e2wdqhqa.png"></a>
|
|
||||||
<p><a href="#">Lothar</a></p>
|
|
||||||
<p><small>Level 24 (1200 XP)</small></p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#" title="Achievement-Titel"><img src="http://s1.directupload.net/images/140325/whre34td.png"></a>
|
|
||||||
<p><a href="#">Morris</a></p>
|
|
||||||
<p><small>Level 23 (1100 XP)</small></p>
|
|
||||||
</li>
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
</ul>
|
</ul>
|
||||||
<p><i class="fa fa-users fa-fw"></i><a href="#">Gildenprofil ansehen</a></p>
|
<p><i class="fa fa-users fa-fw"></i><a href="<?=$linker->link(array('charactergroups','group',$seminary['url'],$group['charactergroupsgroup_url'],$group['url']))?>"><?=sprintf(_('Show %s-Profile'),$group['charactergroupsgroup_name'])?></a></p>
|
||||||
|
<?php endforeach ?>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue