add Character group selector to Station pages and show groups? status
This commit is contained in:
parent
060282e9c0
commit
54ed53ac33
4 changed files with 83 additions and 21 deletions
|
|
@ -166,13 +166,33 @@
|
||||||
$station['wrongav'] = $this->Media->getSeminaryMediaById($station['wrongav_id']);
|
$station['wrongav'] = $this->Media->getSeminaryMediaById($station['wrongav_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Character group
|
// Get Character group(s)
|
||||||
|
$stationgroups = null;
|
||||||
|
$stationgroup = null;
|
||||||
$charactergroup = null;
|
$charactergroup = null;
|
||||||
$character = $this->Characters->getCharacterForUserAndSeminary($this->Auth->getUserId(), $seminary['id']);
|
if(count(array_intersect(array('admin', 'moderator'), \hhu\z\controllers\SeminaryController::$character['characterroles'])) > 0) {
|
||||||
$charactergroups = $this->Charactergroups->getGroupsForCharacter($character['id']);
|
$stationgroups = $this->Charactergroups->getGroupsForGroupsgroup($groupsgroup['id']);
|
||||||
if(!empty($charactergroups)) {
|
}
|
||||||
// TODO Multiple Character groups
|
else
|
||||||
$charactergroup = $charactergroups[0];
|
{
|
||||||
|
$character = $this->Characters->getCharacterForUserAndSeminary($this->Auth->getUserId(), $seminary['id']);
|
||||||
|
$stationgroups = $this->Charactergroups->getGroupsForCharacter($character['id']);
|
||||||
|
if(!empty($stationgroups)) {
|
||||||
|
$stationgroup = $stationgroups[0];
|
||||||
|
$charactergroup = $stationgroup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Select group by parameter
|
||||||
|
$selectedStationGroupId = $this->request->getGetParam('stationgroup');
|
||||||
|
if(!is_null($selectedStationGroupId))
|
||||||
|
{
|
||||||
|
$selectedStationGroupId = intval($selectedStationGroupId);
|
||||||
|
foreach($stationgroups as &$group) {
|
||||||
|
if($group['id'] == $selectedStationGroupId) {
|
||||||
|
$stationgroup = $group;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Check permissions
|
// TODO Check permissions
|
||||||
|
|
@ -219,18 +239,25 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
$solved = false;
|
$entered = false;
|
||||||
$tried = false;
|
$tried = false;
|
||||||
if(!is_null($charactergroup)) {
|
$solved = false;
|
||||||
$tried = $this->Charactergroupsqueststations->hasCharactergroupTriedStation(
|
if(!is_null($stationgroup)) {
|
||||||
|
$entered = $this->Charactergroupsqueststations->hasCharactergroupEnteredStation(
|
||||||
$station['id'],
|
$station['id'],
|
||||||
$charactergroup['id']
|
$stationgroup['id']
|
||||||
);
|
);
|
||||||
if($tried) {
|
if($entered) {
|
||||||
$solved = $this->Charactergroupsqueststations->hasCharactergroupSolvedStation(
|
$tried = $this->Charactergroupsqueststations->hasCharactergroupTriedStation(
|
||||||
$station['id'],
|
$station['id'],
|
||||||
$charactergroup['id']
|
$stationgroup['id']
|
||||||
);
|
);
|
||||||
|
if($tried) {
|
||||||
|
$solved = $this->Charactergroupsqueststations->hasCharactergroupSolvedStation(
|
||||||
|
$station['id'],
|
||||||
|
$stationgroup['id']
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,9 +275,11 @@
|
||||||
$this->set('station', $station);
|
$this->set('station', $station);
|
||||||
$this->set('task', $task);
|
$this->set('task', $task);
|
||||||
$this->set('groups', $groups);
|
$this->set('groups', $groups);
|
||||||
$this->set('stationgroup', $charactergroup);
|
$this->set('stationgroups', $stationgroups);
|
||||||
$this->set('solved', $solved);
|
$this->set('stationgroup', $stationgroup);
|
||||||
|
$this->set('entered', $entered);
|
||||||
$this->set('tried', $tried);
|
$this->set('tried', $tried);
|
||||||
|
$this->set('solved', $solved);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,11 @@
|
||||||
<li>
|
<li>
|
||||||
<span class="group">
|
<span class="group">
|
||||||
<?php if(!array_key_exists('entered', $station) || $station['entered']) : ?>
|
<?php if(!array_key_exists('entered', $station) || $station['entered']) : ?>
|
||||||
|
<?php if(!is_null($stationgroup)) : ?>
|
||||||
|
<a href="<?=$linker->link(array('charactergroupsqueststations','station',$seminary['url'],$groupsgroup['url'],$quest['url'],$station['url']),0,true,array('stationgroup'=>$stationgroup['id']))?>"><?=$station['title']?></a>
|
||||||
|
<?php else : ?>
|
||||||
<a href="<?=$linker->link(array('charactergroupsqueststations','station',$seminary['url'],$groupsgroup['url'],$quest['url'],$station['url']))?>"><?=$station['title']?></a>
|
<a href="<?=$linker->link(array('charactergroupsqueststations','station',$seminary['url'],$groupsgroup['url'],$quest['url'],$station['url']))?>"><?=$station['title']?></a>
|
||||||
|
<?php endif ?>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<?=_('Station not yet discovered')?>
|
<?=_('Station not yet discovered')?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="grpqsicon">
|
<div class="grpqsicon">
|
||||||
|
<?php if($entered) : ?>
|
||||||
<?php if($tried) : ?>
|
<?php if($tried) : ?>
|
||||||
<?php if($solved) : ?>
|
<?php if($solved) : ?>
|
||||||
<?php if($station['stationpicture_id']) : ?>
|
<?php if($station['stationpicture_id']) : ?>
|
||||||
|
|
@ -24,6 +25,9 @@
|
||||||
<img title="<?=$station['title']?>" src="<?=$linker->link(array('media','charactergroupsqueststation',$seminary['url'],$groupsgroup['url'],$quest['url'],$station['url']),0,true)?>" />
|
<img title="<?=$station['title']?>" src="<?=$linker->link(array('media','charactergroupsqueststation',$seminary['url'],$groupsgroup['url'],$quest['url'],$station['url']),0,true)?>" />
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
<?php else : ?>
|
||||||
|
<i class="fa fa-question-circle"></i>
|
||||||
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1><?=$station['title']?></h1>
|
<h1><?=$station['title']?></h1>
|
||||||
|
|
@ -41,16 +45,40 @@
|
||||||
<i class="fa fa-qrcode"></i>
|
<i class="fa fa-qrcode"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php endif ?>
|
|
||||||
<?php if($tried) : ?>
|
|
||||||
<li>
|
<li>
|
||||||
<?php if($solved) : ?>
|
<?php if(count($stationgroups) > 1) : ?>
|
||||||
<i class="fa fa-check-circle fa-fw"></i>
|
<form method="get">
|
||||||
<?php else : ?>
|
<select id="stationgroup" name="stationgroup" onchange="this.form.submit();">
|
||||||
<i class="fa fa-times-circle fa-fw"></i>
|
<?php if(count(array_intersect(array('admin', 'moderator'), \hhu\z\controllers\SeminaryController::$character['characterroles'])) > 0) : ?>
|
||||||
|
<option><?=sprintf(_('Select %s-Group'), $groupsgroup['name'])?></option>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php foreach($stationgroups as &$group) : ?>
|
||||||
|
<option value="<?=$group['id']?>" <?php if($group['id'] == $stationgroup['id']) : ?>selected="selected"<?php endif ?>><?=$group['name']?></option>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</select>
|
||||||
|
</form>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</li>
|
</li>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
<?php if($entered) : ?>
|
||||||
|
<li>
|
||||||
|
<?php if($tried) : ?>
|
||||||
|
<?php if($solved) : ?>
|
||||||
|
<i class="fa fa-check-circle fa-fw"></i>
|
||||||
|
<?=$dateFormatter->format(new \DateTime($solved))?>
|
||||||
|
<?=$timeFormatter->format(new \DateTime($solved))?>
|
||||||
|
<?php else : ?>
|
||||||
|
<i class="fa fa-times-circle fa-fw"></i>
|
||||||
|
<?=$dateFormatter->format(new \DateTime($tried))?>
|
||||||
|
<?=$timeFormatter->format(new \DateTime($tried))?>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php else : ?>
|
||||||
|
<i class="fa fa-globe fa-fw"></i>
|
||||||
|
<?=$dateFormatter->format(new \DateTime($entered))?>
|
||||||
|
<?=$timeFormatter->format(new \DateTime($entered))?>
|
||||||
|
<?php endif ?>
|
||||||
|
</li>
|
||||||
|
<?php endif ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<?php if(!empty($station['longitude']) && !empty($station['latitude'])) : ?>
|
<?php if(!empty($station['longitude']) && !empty($station['latitude'])) : ?>
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,8 @@ input[type="submit"][disabled]{text-shadow:1px 2px #d48c4e;background:#f9ac69;bo
|
||||||
.grpqslist li{float:left;width:100px;height:100px;text-align:center;margin:5px}
|
.grpqslist li{float:left;width:100px;height:100px;text-align:center;margin:5px}
|
||||||
.grpqslist li a{color:#5e5c58}
|
.grpqslist li a{color:#5e5c58}
|
||||||
.grpqslist li i{font-size:100px;padding:0}
|
.grpqslist li i{font-size:100px;padding:0}
|
||||||
.grpqsicon{float:right;box-shadow:0 0 5px gray}
|
.grpqsicon{float:right;box-shadow:0 0 5px gray;text-align:center}
|
||||||
|
.grpqsicon i{display:block;font-size:100px;width:100px;height:100px;padding:0}
|
||||||
|
|
||||||
|
|
||||||
/** Achievements **/
|
/** Achievements **/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue