add count of Stations for each Character group (implements #139)
This commit is contained in:
parent
e0f01f7933
commit
5ad86c811a
5 changed files with 68 additions and 19 deletions
|
|
@ -118,8 +118,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Character groups-groups
|
// Get Character groups
|
||||||
$groups = $this->Charactergroups->getGroupsForQuest($quest['id']);
|
$groups = $this->Charactergroups->getGroupsForQuest($quest['id']);
|
||||||
|
foreach($groups as &$group)
|
||||||
|
{
|
||||||
|
// Get count of solved Stations
|
||||||
|
$group['stations'] = $this->Charactergroupsqueststations->getSolvedStationsForQuestAndGroup(
|
||||||
|
$quest['id'],
|
||||||
|
$group['id']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Get uploads
|
// Get uploads
|
||||||
$uploads = $this->Charactergroupsquests->getMediaForQuest($quest['id']);
|
$uploads = $this->Charactergroupsquests->getMediaForQuest($quest['id']);
|
||||||
|
|
@ -172,6 +180,14 @@
|
||||||
|
|
||||||
// Get Character groups
|
// Get Character groups
|
||||||
$groups = $this->Charactergroups->getGroupsForGroupsgroup($groupsgroup['id']);
|
$groups = $this->Charactergroups->getGroupsForGroupsgroup($groupsgroup['id']);
|
||||||
|
foreach($groups as &$group)
|
||||||
|
{
|
||||||
|
// Get count of solved Stations
|
||||||
|
$group['stations'] = $this->Charactergroupsqueststations->getSolvedStationsForQuestAndGroup(
|
||||||
|
$quest['id'],
|
||||||
|
$group['id']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Get allowed mimetypes
|
// Get allowed mimetypes
|
||||||
$mimetypes = \nre\configs\AppConfig::$mimetypes['charactergroupsquests'];
|
$mimetypes = \nre\configs\AppConfig::$mimetypes['charactergroupsquests'];
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@
|
||||||
$stations = $this->Charactergroupsqueststations->getStationsForQuest($quest['id']);
|
$stations = $this->Charactergroupsqueststations->getStationsForQuest($quest['id']);
|
||||||
}
|
}
|
||||||
elseif(!is_null($charactergroup)) {
|
elseif(!is_null($charactergroup)) {
|
||||||
$stations = $this->Charactergroupsqueststations->getStationsForQuestAndGroup($quest['id'], $charactergroup['id']);
|
$stations = $this->Charactergroupsqueststations->getEnteredStationsForQuestAndGroup($quest['id'], $charactergroup['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,28 +131,30 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all Stations for a Character groups Quest and a Character group.
|
* Get all Stations for a Character groups Quest that have been entered
|
||||||
|
* by a Character group.
|
||||||
*
|
*
|
||||||
* @param int $questId ID of Character groups Quest
|
* @param int $questId ID of Character groups Quest
|
||||||
* @param int $groupId ID of Character group
|
* @param int $groupId ID of Character group
|
||||||
* @return array List of Station
|
* @return array List of Station
|
||||||
*/
|
*/
|
||||||
public function getStationsForQuestAndGroup($questId, $groupId)
|
private function getEnteredStationsForQuestAndGroup($questId, $groupId)
|
||||||
{
|
{
|
||||||
return $this->db->query(
|
return $this->getStationsForQuestAndGroup($questId, $groupId, self::STATUS_ENTERED);
|
||||||
'SELECT charactergroupsqueststations.id, charactergroupsqueststations_charactergroups.created, title, url, stationpicture_id, latitude, longitude '.
|
}
|
||||||
'FROM charactergroupsqueststations_charactergroups '.
|
|
||||||
'INNER JOIN charactergroupsqueststations ON charactergroupsqueststations.id = charactergroupsqueststations_charactergroups.charactergroupsqueststation_id '.
|
|
||||||
'WHERE '.
|
/**
|
||||||
'charactergroupsqueststations_charactergroups.charactergroup_id = ? AND '.
|
* Get all Stations for a Character groups Quest that have been solved
|
||||||
'charactergroupsqueststations_charactergroups.status = ? AND '.
|
* by a Character group.
|
||||||
'charactergroupsquest_id = ? '.
|
*
|
||||||
'ORDER BY charactergroupsqueststations_charactergroups.created ASC',
|
* @param int $questId ID of Character groups Quest
|
||||||
'iii',
|
* @param int $groupId ID of Character group
|
||||||
$groupId,
|
* @return array List of Station
|
||||||
self::STATUS_ENTERED,
|
*/
|
||||||
$questId
|
public function getSolvedStationsForQuestAndGroup($questId, $groupId)
|
||||||
);
|
{
|
||||||
|
return $this->getStationsForQuestAndGroup($questId, $groupId, self::STATUS_SOLVED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -570,6 +572,33 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all Stations for a Character groups Quest with a minimum status.
|
||||||
|
*
|
||||||
|
* @param int $questId ID of Character groups Quest
|
||||||
|
* @param int $groupId ID of Character group
|
||||||
|
* @param int $statusMin Minimum status
|
||||||
|
* @return array List of Station
|
||||||
|
*/
|
||||||
|
private function getStationsForQuestAndGroup($questId, $groupId, $statusMin)
|
||||||
|
{
|
||||||
|
return $this->db->query(
|
||||||
|
'SELECT charactergroupsqueststations.id, charactergroupsqueststations_charactergroups.created, title, url, stationpicture_id, latitude, longitude '.
|
||||||
|
'FROM charactergroupsqueststations_charactergroups '.
|
||||||
|
'INNER JOIN charactergroupsqueststations ON charactergroupsqueststations.id = charactergroupsqueststations_charactergroups.charactergroupsqueststation_id '.
|
||||||
|
'WHERE '.
|
||||||
|
'charactergroupsqueststations_charactergroups.charactergroup_id = ? AND '.
|
||||||
|
'charactergroupsqueststations_charactergroups.status >= ? AND '.
|
||||||
|
'charactergroupsquest_id = ? '.
|
||||||
|
'ORDER BY charactergroupsqueststations_charactergroups.created ASC',
|
||||||
|
'iii',
|
||||||
|
$groupId,
|
||||||
|
$statusMin,
|
||||||
|
$questId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@
|
||||||
<li>
|
<li>
|
||||||
<span class="group"><a href="<?=$linker->link(array('charactergroups','group',$seminary['url'],$groupsgroup['url'],$group['url']))?>"><?=$group['name']?></a></span>
|
<span class="group"><a href="<?=$linker->link(array('charactergroups','group',$seminary['url'],$groupsgroup['url'],$group['url']))?>"><?=$group['name']?></a></span>
|
||||||
<span class="xp">
|
<span class="xp">
|
||||||
|
<?=sprintf(_('%d Stations'), count($group['stations']))?>,
|
||||||
<select name="xps[<?=$group['url']?>]">
|
<select name="xps[<?=$group['url']?>]">
|
||||||
<option value="null" <?php if(is_null($group['quest_group'])) : ?>selected="selected"<?php endif ?>><?=_('Not attended')?></option>
|
<option value="null" <?php if(is_null($group['quest_group'])) : ?>selected="selected"<?php endif ?>><?=_('Not attended')?></option>
|
||||||
<?php for($i=0; $i<=$quest['xps']; $i++) : ?>
|
<?php for($i=0; $i<=$quest['xps']; $i++) : ?>
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,10 @@
|
||||||
<li>
|
<li>
|
||||||
<span class="date"><?=$dateFormatter->format(new \DateTime($group['created']))?></span>
|
<span class="date"><?=$dateFormatter->format(new \DateTime($group['created']))?></span>
|
||||||
<span class="group"><a href="<?=$linker->link(array('charactergroups','group',$seminary['url'],$groupsgroup['url'],$group['url']))?>"><?=$group['name']?></a></span>
|
<span class="group"><a href="<?=$linker->link(array('charactergroups','group',$seminary['url'],$groupsgroup['url'],$group['url']))?>"><?=$group['name']?></a></span>
|
||||||
<span class="xp"><?=sprintf(_('%d XPs'), $group['xps'])?></span>
|
<span class="xp">
|
||||||
|
<?=sprintf(_('%d Stations'), count($group['stations']))?>,
|
||||||
|
<?=sprintf(_('%d XPs'), $group['xps'])?>
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue