display icons for Character groups Quest Stations
This commit is contained in:
parent
a27352cb66
commit
d5c68803f0
9 changed files with 144 additions and 36 deletions
|
|
@ -104,6 +104,10 @@
|
||||||
'charactergroupsquest' => array(
|
'charactergroupsquest' => array(
|
||||||
'width' => 80,
|
'width' => 80,
|
||||||
'height' => 80
|
'height' => 80
|
||||||
|
),
|
||||||
|
'charactergroupsqueststation' => array(
|
||||||
|
'width' => 100,
|
||||||
|
'height' => 100
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,12 +89,20 @@
|
||||||
|
|
||||||
// Get Stations
|
// Get Stations
|
||||||
$stations = null;
|
$stations = null;
|
||||||
if(count(array_intersect(array('admin', 'moderator'), \hhu\z\controllers\SeminaryController::$character['characterroles'])) > 0) {
|
|
||||||
$stations = $this->Charactergroupsqueststations->getStationsForQuest($quest['id']);
|
$stations = $this->Charactergroupsqueststations->getStationsForQuest($quest['id']);
|
||||||
|
foreach($stations as &$station)
|
||||||
|
{
|
||||||
|
// Icon
|
||||||
|
if(!is_null($station['stationpicture_id'])) {
|
||||||
|
$station['picture'] = $this->Media->getSeminaryMediaById($station['stationpicture_id']);
|
||||||
}
|
}
|
||||||
elseif(!is_null($charactergroup)) {
|
|
||||||
$stations = $this->Charactergroupsqueststations->getStationsForQuestAndGroup($quest['id'], $charactergroup['id']);
|
// Entered state
|
||||||
foreach($stations as &$station) {
|
if(!is_null($charactergroup)) {
|
||||||
|
$station['entered'] = $this->Charactergroupsqueststations->hasCharactergroupEnteredStation(
|
||||||
|
$station['id'],
|
||||||
|
$charactergroup['id']
|
||||||
|
);
|
||||||
$station['solved'] = $this->Charactergroupsqueststations->hasCharactergroupSolvedStation(
|
$station['solved'] = $this->Charactergroupsqueststations->hasCharactergroupSolvedStation(
|
||||||
$station['id'],
|
$station['id'],
|
||||||
$charactergroup['id']
|
$charactergroup['id']
|
||||||
|
|
|
||||||
|
|
@ -124,9 +124,6 @@
|
||||||
|
|
||||||
// Get Station
|
// Get Station
|
||||||
$station = $this->Charactergroupsqueststations->getStationByUrl($quest['id'], $stationUrl);
|
$station = $this->Charactergroupsqueststations->getStationByUrl($quest['id'], $stationUrl);
|
||||||
if(!is_null($station['stationpicture_id'])) {
|
|
||||||
$station['picture'] = $this->Media->getSeminaryMediaById($station['stationpicture_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get Character group
|
// Get Character group
|
||||||
$charactergroup = null;
|
$charactergroup = null;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,8 @@
|
||||||
'avatar' => array('admin', 'moderator', 'user'),
|
'avatar' => array('admin', 'moderator', 'user'),
|
||||||
'achievement' => array('admin', 'moderator', 'user'),
|
'achievement' => array('admin', 'moderator', 'user'),
|
||||||
'charactergroup' => array('admin', 'moderator', 'user'),
|
'charactergroup' => array('admin', 'moderator', 'user'),
|
||||||
'charactergroupsquest' => array('admin', 'moderator', 'user')
|
'charactergroupsquest' => array('admin', 'moderator', 'user'),
|
||||||
|
'charactergroupsqueststation' => array('admin', 'moderator', 'user')
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* User seminary permissions
|
* User seminary permissions
|
||||||
|
|
@ -43,14 +44,15 @@
|
||||||
'seminary' => array('admin', 'moderator', 'user', 'guest'),
|
'seminary' => array('admin', 'moderator', 'user', 'guest'),
|
||||||
'achievement' => array('admin', 'moderator', 'user', 'guest'),
|
'achievement' => array('admin', 'moderator', 'user', 'guest'),
|
||||||
'charactergroup' => array('admin', 'moderator', 'user', 'guest'),
|
'charactergroup' => array('admin', 'moderator', 'user', 'guest'),
|
||||||
'charactergroupsquest' => array('admin', 'moderator', 'user', 'guest')
|
'charactergroupsquest' => array('admin', 'moderator', 'user', 'guest'),
|
||||||
|
'charactergroupsqueststation' => array('admin', 'moderator', 'user', 'guest')
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* Required models
|
* Required models
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $models = array('seminaries', 'achievements', 'media', 'avatars', 'charactergroups', 'charactergroupsquests', 'map');
|
public $models = array('seminaries', 'achievements', 'media', 'avatars', 'charactergroups', 'charactergroupsquests', 'charactergroupsqueststations', 'map');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -403,6 +405,47 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action: charactergroupsqueststation
|
||||||
|
*
|
||||||
|
* Display the icon for a Character groups Quest Station.
|
||||||
|
*
|
||||||
|
* @throws \nre\exceptions\IdNotFoundException
|
||||||
|
* @param string $seminaryUrl URL-Title of a Seminary
|
||||||
|
* @param string $groupsgroupUrl URL-Title of a Character groups-group
|
||||||
|
* @param string $questUrl URL-Title of a Character groups Quest
|
||||||
|
* @param string $stationUrl URL-title of Station
|
||||||
|
*/
|
||||||
|
public function charactergroupsqueststation($seminaryUrl, $groupsgroupUrl, $questUrl, $stationUrl)
|
||||||
|
{
|
||||||
|
// Get seminary
|
||||||
|
$seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl);
|
||||||
|
|
||||||
|
// Get Character groups-group
|
||||||
|
$groupsgroup = $this->Charactergroups->getGroupsgroupByUrl($seminary['id'], $groupsgroupUrl);
|
||||||
|
|
||||||
|
// Get Character groups Quests
|
||||||
|
$quest = $this->Charactergroupsquests->getQuestByUrl($groupsgroup['id'], $questUrl);
|
||||||
|
|
||||||
|
// Get Station
|
||||||
|
$station = $this->Charactergroupsqueststations->getStationByUrl($quest['id'], $stationUrl);
|
||||||
|
|
||||||
|
// Get media
|
||||||
|
$media = $this->Media->getSeminaryMediaById($station['stationpicture_id']);
|
||||||
|
|
||||||
|
// Get file
|
||||||
|
$file = $this->getMediaFile($media, 'charactergroupsqueststation');
|
||||||
|
if(is_null($file)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Pass data to view
|
||||||
|
$this->set('media', $media);
|
||||||
|
$this->set('file', $file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -495,6 +538,14 @@
|
||||||
\nre\configs\AppConfig::$media[$action]['height']
|
\nre\configs\AppConfig::$media[$action]['height']
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case 'charactergroupsqueststation':
|
||||||
|
$file = self::resizeImage(
|
||||||
|
$media['filename'],
|
||||||
|
$format,
|
||||||
|
\nre\configs\AppConfig::$media[$action]['width'],
|
||||||
|
\nre\configs\AppConfig::$media[$action]['height']
|
||||||
|
);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ParamsNotValidException($action);
|
throw new ParamsNotValidException($action);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,33 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a Character group has entered a Station.
|
||||||
|
*
|
||||||
|
* @param int $stationId ID of Station to check
|
||||||
|
* @param int $groupId ID of Character group to check
|
||||||
|
* @return bool Whether the group has tried the station or not
|
||||||
|
*/
|
||||||
|
public function hasCharactergroupEnteredStation($stationId, $groupId)
|
||||||
|
{
|
||||||
|
$data = $this->db->query(
|
||||||
|
'SELECT created '.
|
||||||
|
'FROM charactergroupsqueststations_charactergroups '.
|
||||||
|
'WHERE charactergroupsqueststation_id = ? AND charactergroup_id = ? AND status >= ?',
|
||||||
|
'iii',
|
||||||
|
$stationId,
|
||||||
|
$groupId,
|
||||||
|
self::STATUS_ENTERED
|
||||||
|
);
|
||||||
|
if(!empty($data)) {
|
||||||
|
return $data[0]['created'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a Character group has tried to solve a Station.
|
* Check if a Character group has tried to solve a Station.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
1
views/binary/media/charactergroupsqueststation.tpl
Normal file
1
views/binary/media/charactergroupsqueststation.tpl
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<?=$file?>
|
||||||
|
|
@ -78,27 +78,42 @@
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php if(!empty($stations)) : ?>
|
|
||||||
<ol class="grpqlist">
|
<ol class="grpqlist">
|
||||||
<?php foreach($stations as &$station) : ?>
|
<?php foreach($stations as &$station) : ?>
|
||||||
<li>
|
<li>
|
||||||
<?php if(array_key_exists('created', $station)) : ?>
|
|
||||||
<span class="date">
|
|
||||||
<?=$dateFormatter->format(new \DateTime($station['created']))?>
|
|
||||||
<?=$timeFormatter->format(new \DateTime($station['created']))?>
|
|
||||||
</span>
|
|
||||||
<?php endif ?>
|
|
||||||
<span class="group">
|
<span class="group">
|
||||||
|
<?php if(!array_key_exists('entered', $station) || $station['entered']) : ?>
|
||||||
<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 else : ?>
|
||||||
|
<?=_('Station not yet discovered')?>
|
||||||
|
<?php endif ?>
|
||||||
|
</span>
|
||||||
|
<?php if(array_key_exists('solved', $station) && $station['solved']) : ?>
|
||||||
|
<span class="xp">
|
||||||
|
<i class="fa fa-check-circle fa-fw"></i>
|
||||||
</span>
|
</span>
|
||||||
<?php if(!array_key_exists('created', $station) || $station['solved'] !== false) : ?>
|
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
<ol class="grpqslist">
|
||||||
|
<?php foreach($stations as &$station) : ?>
|
||||||
|
<li>
|
||||||
|
<?php if(!array_key_exists('entered', $station) || $station['entered']) : ?>
|
||||||
|
<a href="<?=$linker->link(array('charactergroupsqueststations','station',$seminary['url'],$groupsgroup['url'],$quest['url'],$station['url']))?>">
|
||||||
|
<?php if(!is_null($station['stationpicture_id'])) : ?>
|
||||||
|
<img title="<?=$station['title']?>" src="<?=$linker->link(array('media','charactergroupsqueststation',$seminary['url'],$groupsgroup['url'],$quest['url'],$station['url']))?>" />
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<p><?=sprintf(_('Your %s-group has not discovered any station yet'), $groupsgroup['name'])?>.</p>
|
<i class="fa fa-globe"></i>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
</a>
|
||||||
|
<?php else : ?>
|
||||||
|
<i class="fa fa-question-circle"></i>
|
||||||
|
<?php endif ?>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ol>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,7 @@
|
||||||
</nav>
|
</nav>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if(array_key_exists('picture', $station)) : ?>
|
|
||||||
<h1><?=$station['title']?></h1>
|
<h1><?=$station['title']?></h1>
|
||||||
<?php endif ?>
|
|
||||||
<ul class="gdata cf">
|
<ul class="gdata cf">
|
||||||
<?php if(!empty($station['longitude']) && !empty($station['latitude'])) : ?>
|
<?php if(!empty($station['longitude']) && !empty($station['latitude'])) : ?>
|
||||||
<li>
|
<li>
|
||||||
|
|
@ -29,6 +27,10 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
<?php if($solved !== false) : ?>
|
||||||
|
<li>
|
||||||
|
<i class="fa fa-check-circle fa-fw"></i>
|
||||||
|
<?php endif ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<?php if(!empty($station['longitude']) && !empty($station['latitude'])) : ?>
|
<?php if(!empty($station['longitude']) && !empty($station['latitude'])) : ?>
|
||||||
|
|
@ -94,8 +96,8 @@
|
||||||
<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>
|
||||||
<?php if($group['solved'] !== false) : ?>
|
<?php if($group['solved'] !== false) : ?>
|
||||||
<span class="xp">
|
<span class="xp">
|
||||||
<i class="fa fa-check-square-o fa-fw"></i>
|
|
||||||
<?=_(sprintf('solved at %s', $timeFormatter->format(new \DateTime($group['solved']))))?>
|
<?=_(sprintf('solved at %s', $timeFormatter->format(new \DateTime($group['solved']))))?>
|
||||||
|
<i class="fa fa-check-circle fa-fw"></i>
|
||||||
</span>
|
</span>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
|
|
@ -298,6 +298,9 @@ input[type="submit"][disabled]{text-shadow:1px 2px #d48c4e;background:#f9ac69;bo
|
||||||
.grpqlist .date{padding:0 15px 0 0;display:block}
|
.grpqlist .date{padding:0 15px 0 0;display:block}
|
||||||
.grpqlist .xp{display:block}
|
.grpqlist .xp{display:block}
|
||||||
.gqgllry li{display:inline-block}
|
.gqgllry li{display:inline-block}
|
||||||
|
.grpqslist li{display:inline-block;width:100px;height:100px}
|
||||||
|
.grpqslist li a{color:#5e5c58}
|
||||||
|
.grpqslist li i{font-size:100px;padding:0}
|
||||||
|
|
||||||
|
|
||||||
/** Achievements **/
|
/** Achievements **/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue