merge branch ?charactergroupsqueststations?

This commit is contained in:
oliver 2016-02-02 10:38:52 +01:00
commit 76ba31c04e
18 changed files with 351 additions and 84 deletions

View file

@ -24,7 +24,7 @@
* *
* @var array * @var array
*/ */
public $models = array('seminaries'); //, 'questgroups', 'quests', 'characters'); public $models = array('seminaries');

View file

@ -23,6 +23,17 @@
/**
* Copy a Station.
*
* @param int $userId ID of creating user
* @param int $sourceStationId ID of Station to copy from
* @param int $targetStationId ID of Station to copy to
* @param int $seminaryMediaIds Mapping of SeminaryMedia-IDs from source Seminary to targetSeminary
*/
public abstract function copyStation($userId, $sourceStationId, $targetStationId, $seminaryMediaIds);
/** /**
* Load a Model. * Load a Model.
* *

View file

@ -103,15 +103,31 @@
$station['id'], $station['id'],
$charactergroup['id'] $charactergroup['id']
); );
if($station['entered']) {
$station['tried'] = $this->Charactergroupsqueststations->hasCharactergroupTriedStation(
$station['id'],
$charactergroup['id']
);
if($station['tried']) {
$station['solved'] = $this->Charactergroupsqueststations->hasCharactergroupSolvedStation( $station['solved'] = $this->Charactergroupsqueststations->hasCharactergroupSolvedStation(
$station['id'], $station['id'],
$charactergroup['id'] $charactergroup['id']
); );
} }
} }
}
}
// 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']);
@ -164,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'];
@ -219,7 +243,6 @@
if(!is_null($this->request->getPostParam('deletemedia'))) if(!is_null($this->request->getPostParam('deletemedia')))
{ {
$uploadIds = $this->request->getPostParam('uploads'); $uploadIds = $this->request->getPostParam('uploads');
var_dump($uploadIds);
foreach($uploadIds as $uploadId) { foreach($uploadIds as $uploadId) {
$this->Uploads->deleteSeminaryupload($uploadId); $this->Uploads->deleteSeminaryupload($uploadId);
} }

View file

@ -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']);
} }
@ -169,12 +169,18 @@
{ {
$groups = $this->Charactergroups->getGroupsForQueststation($station['id']); $groups = $this->Charactergroups->getGroupsForQueststation($station['id']);
foreach($groups as &$group) { foreach($groups as &$group) {
$group['tried'] = $this->Charactergroupsqueststations->hasCharactergroupTriedStation(
$station['id'],
$group['id']
);
if($group['tried']) {
$group['solved'] = $this->Charactergroupsqueststations->hasCharactergroupSolvedStation( $group['solved'] = $this->Charactergroupsqueststations->hasCharactergroupSolvedStation(
$station['id'], $station['id'],
$group['id'] $group['id']
); );
} }
} }
}
// Task // Task
$task = null; $task = null;
@ -194,9 +200,9 @@
$solved = false; $solved = false;
$tried = false; $tried = false;
if(!is_null($charactergroup)) { if(!is_null($charactergroup)) {
$solved = $this->Charactergroupsqueststations->hasCharactergroupSolvedStation($station['id'], $charactergroup['id']);
if(!$solved) {
$tried = $this->Charactergroupsqueststations->hasCharactergroupTriedStation($station['id'], $charactergroup['id']); $tried = $this->Charactergroupsqueststations->hasCharactergroupTriedStation($station['id'], $charactergroup['id']);
if($tried) {
$solved = $this->Charactergroupsqueststations->hasCharactergroupSolvedStation($station['id'], $charactergroup['id']);
} }
} }

View file

@ -162,7 +162,6 @@
$validation = $this->Validation->addValidationResult($validation, 'title', 'exist', true); $validation = $this->Validation->addValidationResult($validation, 'title', 'exist', true);
} }
$text = $this->request->getPostParam('text'); $text = $this->request->getPostParam('text');
var_dump($text);
// Edit // Edit
if($validation === true) if($validation === true)

View file

@ -452,6 +452,7 @@
array_key_exists('achievements', $elements), array_key_exists('achievements', $elements),
array_key_exists('charactergroupsgroups', $elements), array_key_exists('charactergroupsgroups', $elements),
array_key_exists('charactergroupsquests', $elements), array_key_exists('charactergroupsquests', $elements),
array_key_exists('charactergroupsqueststations', $elements),
array_key_exists('map', $elements) array_key_exists('map', $elements)
); );
$seminary = $this->Seminaries->getSeminaryById($seminaryId); $seminary = $this->Seminaries->getSeminaryById($seminaryId);

View file

@ -384,9 +384,11 @@
* @param array $groupsgroupIds Mapping of Character groups-group-IDs from source Seminary to target Seminary * @param array $groupsgroupIds Mapping of Character groups-group-IDs from source Seminary to target Seminary
* @param array $questgroupIds Mapping of Questgroup-IDs from source Seminary to target Seminary * @param array $questgroupIds Mapping of Questgroup-IDs from source Seminary to target Seminary
* @param array $seminaryMediaIds Mapping of Seminarymedia-IDs from source Seminary to target Seminary (optional) * @param array $seminaryMediaIds Mapping of Seminarymedia-IDs from source Seminary to target Seminary (optional)
* @return array Mapping of Quest-IDs from source Seminary to target Seminary
*/ */
public function copyQuestsOfSeminary($userId, $groupsgroupIds, $questgroupIds, $seminaryMediaIds=null) public function copyQuestsOfSeminary($userId, $groupsgroupIds, $questgroupIds, $seminaryMediaIds=null)
{ {
$questIds = array();
foreach($groupsgroupIds as $sourceGroupsgroupId => $targetGroupsgroupId) foreach($groupsgroupIds as $sourceGroupsgroupId => $targetGroupsgroupId)
{ {
// Get Quests // Get Quests
@ -406,7 +408,7 @@
$userId, $targetGroupsgroupId, $questgroupIds[$quest['questgroups_id']], $userId, $targetGroupsgroupId, $questgroupIds[$quest['questgroups_id']],
$quest['id'] $quest['id']
); );
$targetQuestId = $this->db->getInsertId(); $questIds[$quest['id']] = $this->db->getInsertId();
// Copy media // Copy media
if(!is_null($seminaryMediaIds) && !is_null($quest['questsmedia_id'])) if(!is_null($seminaryMediaIds) && !is_null($quest['questsmedia_id']))
@ -418,11 +420,18 @@
'WHERE id = ?', 'WHERE id = ?',
'ii', 'ii',
$seminaryMediaIds[$quest['questsmedia_id']], $seminaryMediaIds[$quest['questsmedia_id']],
$targetQuestId $questIds[$quest['id']]
); );
} }
// TODO Copy Stations
//$this->Charactergroupsqueststations->copyStationsOfQuest($quest['id'], $targetQuestId, $seminaryMediaIds);
} }
} }
// Return target Quest-IDs
return $questIds;
} }

View file

@ -39,6 +39,13 @@
*/ */
const STATUS_SOLVED = 3; const STATUS_SOLVED = 3;
/**
* Required models
*
* @var array
*/
public $models = array('stationtypes');
@ -103,6 +110,7 @@
return $data[0]; return $data[0];
} }
/** /**
* Get all Stations for a Character groups Quest. * Get all Stations for a Character groups Quest.
* *
@ -112,7 +120,7 @@
public function getStationsForQuest($questId) public function getStationsForQuest($questId)
{ {
return $this->db->query( return $this->db->query(
'SELECT id, title, url, stationpicture_id, latitude, longitude '. 'SELECT id, stationtype_id, title, url, stationpicture_id, latitude, longitude, rightimage_id, rightav_id, wrongimage_id, wrongav_id '.
'FROM charactergroupsqueststations '. 'FROM charactergroupsqueststations '.
'WHERE charactergroupsquest_id = ? '. 'WHERE charactergroupsquest_id = ? '.
'ORDER BY pos ASC', 'ORDER BY pos ASC',
@ -123,28 +131,84 @@
/** /**
* 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);
}
/**
* Copy all Character groups Quest Stations of a Seminary.
*
* @param int $userId ID of creating user
* @param array $charactergroupsquestIds Mapping of Character groups Quest-IDs from source Seminary to target Seminary
* @param array $seminaryMediaIds Mapping of Seminary-media-IDs from source Seminary to target Seminary (optional)
*/
public function copyStationsOfSeminary($userId, $charactergroupsquestIds, $seminaryMediaIds)
{
// Go through each Quest
foreach($charactergroupsquestIds as $sourceQuestId => $targetQuestId)
{
// Get Stations
$stations = $this->getStationsForQuest($sourceQuestId);
// Copy each station
foreach($stations as &$station)
{
// Copy Station
$this->db->query(
'INSERT INTO charactergroupsqueststations '.
'(charactergroupsquest_id, stationtype_id, title, url, pos, stationpicture_id, prolog, task, latitude, longitude, righttext, wrongtext, rightimage_id, rightav_id, wrongimage_id, wrongav_id) '.
'SELECT ?, stationtype_id, title, url, pos, ?, prolog, task, latitude, longitude, righttext, wrongtext, ?, ?, ?, ? '.
'FROM charactergroupsqueststations '.
'WHERE id = ?',
'iiiiiii',
$targetQuestId,
(!is_null($station['stationpicture_id'])) ? $seminaryMediaIds[$station['stationpicture_id']] : null,
(!is_null($station['rightimage_id'])) ? $seminaryMediaIds[$station['rightimage_id']] : null,
(!is_null($station['rightav_id'])) ? $seminaryMediaIds[$station['rightav_id']] : null,
(!is_null($station['wrongimage_id'])) ? $seminaryMediaIds[$station['wrongimage_id']] : null,
(!is_null($station['wrongav_id'])) ? $seminaryMediaIds[$station['wrongav_id']] : null,
$station['id']
); );
$targetStationId = $this->db->getInsertId();
// Copy content
$stationtype = $this->Stationtypes->getStationtypeById($station['stationtype_id']);
if(!is_null($stationtype['classname']))
{
// Load Stationtype Model
\hhu\z\models\StationtypeModel::load($stationtype['classname']);
// Construct Station Model
$stationtypeModel = \hhu\z\models\StationtypeModel::factory($stationtype['classname']);
// Copy content
$stationtypeModel->copyStation($userId, $station['id'], $targetStationId, $seminaryMediaIds);
}
}
}
} }
@ -508,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
);
}
} }
?> ?>

View file

@ -24,7 +24,7 @@
* *
* @var array * @var array
*/ */
public $models = array('questgroupshierarchy', 'questgroups', 'quests', 'questtopics', 'media', 'characters', 'charactertypes', 'xplevels', 'avatars', 'achievements', 'charactergroups', 'charactergroupsquests', 'seminarycharacterfields', 'map', 'uploads'); public $models = array('questgroupshierarchy', 'questgroups', 'quests', 'questtopics', 'media', 'characters', 'charactertypes', 'xplevels', 'avatars', 'achievements', 'charactergroups', 'charactergroupsquests', 'charactergroupsqueststations', 'seminarycharacterfields', 'map', 'uploads');
@ -345,10 +345,11 @@
* @param boolean $copyAchievements Whether to copy Achievements or not * @param boolean $copyAchievements Whether to copy Achievements or not
* @param boolean $copyCharactergroupsgroups Whether to copy Character groups-groups or not * @param boolean $copyCharactergroupsgroups Whether to copy Character groups-groups or not
* @param boolean $copyCharactergroupsquests Whether to copy Character groups Quests or not * @param boolean $copyCharactergroupsquests Whether to copy Character groups Quests or not
* @param boolean $copyCharactergroupsqueststations Whether to copy Character groups Quest Stations or not
* @param boolean $copyMap Whether to copy Map or not * @param boolean $copyMap Whether to copy Map or not
* @return ID of newly created Seminary * @return ID of newly created Seminary
*/ */
public function copySeminary($userId, $sourceSeminaryId, $title, $course, $description, $copySeminaryfields, $copyMedia, $copyQuestgroupshierarchy, $copyQuestgroups, $copyQuests, $copyQuesttopics, $copyCharactertypes, $copyXPlevels, $copyAvatars, $copyAchievements, $copyCharactergroupsgroups, $copyCharactergroupsquests, $copyMap) public function copySeminary($userId, $sourceSeminaryId, $title, $course, $description, $copySeminaryfields, $copyMedia, $copyQuestgroupshierarchy, $copyQuestgroups, $copyQuests, $copyQuesttopics, $copyCharactertypes, $copyXPlevels, $copyAvatars, $copyAchievements, $copyCharactergroupsgroups, $copyCharactergroupsquests, $copyCharactergroupsqueststations, $copyMap)
{ {
// Get Seminary // Get Seminary
$seminary = $this->getSeminaryById($sourceSeminaryId); $seminary = $this->getSeminaryById($sourceSeminaryId);
@ -437,12 +438,17 @@
// Copy Charactergroups content // Copy Charactergroups content
// Charactergroupsgroups // Charactergroupsgroups
$characterGroupsgroupIds = null;
$charactergroupsquestIds = null;
if($copyCharactergroupsgroups) if($copyCharactergroupsgroups)
{ {
$characterGroupsgroupIds = $this->Charactergroups->copyGroupsgroupsOfSeminary($userId, $sourceSeminaryId, $targetSeminaryId); $characterGroupsgroupIds = $this->Charactergroups->copyGroupsgroupsOfSeminary($userId, $sourceSeminaryId, $targetSeminaryId);
// Copy Charactergroupsquests // Copy Charactergroupsquests
if($copyCharactergroupsquests &!is_null($questgroupIds)) { if($copyCharactergroupsquests &!is_null($questgroupIds)) {
$this->Charactergroupsquests->copyQuestsOfSeminary($userId, $characterGroupsgroupIds, $questgroupIds, $seminaryMediaIds); $charactergroupsquestIds = $this->Charactergroupsquests->copyQuestsOfSeminary($userId, $characterGroupsgroupIds, $questgroupIds, $seminaryMediaIds);
if($copyCharactergroupsqueststations && !is_null($charactergroupsquestIds)) {
$this->Charactergroupsqueststations->copyStationsOfSeminary($userId, $charactergroupsquestIds, $seminaryMediaIds);
}
} }
} }

View file

@ -157,9 +157,16 @@
*/ */
private function isMatching($regex, $answer) private function isMatching($regex, $answer)
{ {
// Check regex
if(empty($regex)) {
return false;
}
// Execute regex
$score = preg_match($regex, trim($answer)); $score = preg_match($regex, trim($answer));
// Return result
return ($score !== false && $score > 0); return ($score !== false && $score > 0);
} }

View file

@ -23,6 +23,30 @@
/**
* Copy a Station.
*
* @param int $userId ID of creating user
* @param int $sourceStationId ID of Station to copy from
* @param int $targetStationId ID of Station to copy to
* @param int $seminaryMediaIds Mapping of SeminaryMedia-IDs from source Seminary to targetSeminary
*/
public function copyStation($userId, $sourceStationId, $targetStationId, $seminaryMediaIds)
{
// Copy keyword
$this->db->query(
'INSERT INTO stationtypes_keyword '.
'(station_id, created_user_id, keyword_regex) '.
'SELECT ?, ?, keyword_regex '.
'FROM stationtypes_keyword '.
'WHERE station_id = ?',
'iii',
$targetStationId, $userId,
$sourceStationId
);
}
/** /**
* Get the task of a keyword Station * Get the task of a keyword Station
* *
@ -89,7 +113,6 @@
'iiss', 'iiss',
$stationId, $charactergroupId, $answer, $answer $stationId, $charactergroupId, $answer, $answer
); );
var_dump("saved");
} }
} }

View file

@ -23,6 +23,30 @@
/**
* Copy a Station.
*
* @param int $userId ID of creating user
* @param int $sourceStationId ID of Station to copy from
* @param int $targetStationId ID of Station to copy to
* @param int $seminaryMediaIds Mapping of SeminaryMedia-IDs from source Seminary to targetSeminary
*/
public function copyStation($userId, $sourceStationId, $targetStationId, $seminaryMediaIds)
{
// Copy answers
$this->db->query(
'INSERT INTO stationtypes_multiplechoice '.
'(created_user_id, station_id, pos, answer, tick) '.
'SELECT ?, ?, pos, answer, tick '.
'FROM stationtypes_multiplechoice '.
'WHERE station_id = ?',
'iii',
$userId, $targetStationId,
$sourceStationId
);
}
/** /**
* Get all answers for a Station * Get all answers for a Station
* *

View file

@ -12,9 +12,19 @@
floatval($station['latitude']) floatval($station['latitude'])
); );
$coordinates[] = $coordinate; $coordinates[] = $coordinate;
// Marker
$features[] = array( $features[] = array(
'type' => 'Feature', 'type' => 'Feature',
'id' => $station['id'], 'id' => $station['id'],
'geometry' => array(
'type' => 'Point',
'coordinates' => $coordinate
)
);
// Label
$features[] = array(
'type' => 'Feature',
'id' => $station['id'].'-label',
'properties' => array( 'properties' => array(
'name' => $station['title'], 'name' => $station['title'],
), ),

View file

@ -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(_('%dStations'), 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++) : ?>

View file

@ -88,9 +88,17 @@
<?=_('Station not yet discovered')?> <?=_('Station not yet discovered')?>
<?php endif ?> <?php endif ?>
</span> </span>
<?php if(array_key_exists('solved', $station) && $station['solved']) : ?> <?php if(array_key_exists('entered', $station) && $station['entered']) : ?>
<span class="xp"> <span class="xp">
<?php if($station['tried']) : ?>
<?php if($station['solved']) : ?>
<i class="fa fa-check-circle fa-fw"></i> <i class="fa fa-check-circle fa-fw"></i>
<?php else : ?>
<i class="fa fa-times-circle fa-fw"></i>
<?php endif ?>
<?php else : ?>
<i class="fa fa-globe fa-fw"></i>
<?php endif ?>
</span> </span>
<?php endif ?> <?php endif ?>
</li> </li>
@ -100,11 +108,19 @@
<ol class="grpqslist"> <ol class="grpqslist">
<?php foreach($stations as &$station) : ?> <?php foreach($stations as &$station) : ?>
<li> <li>
<?php if(!array_key_exists('entered', $station) || $station['entered']) : ?> <?php if(array_key_exists('entered', $station) && $station['entered']) : ?>
<a href="<?=$linker->link(array('charactergroupsqueststations','station',$seminary['url'],$groupsgroup['url'],$quest['url'],$station['url']))?>"> <a href="<?=$linker->link(array('charactergroupsqueststations','station',$seminary['url'],$groupsgroup['url'],$quest['url'],$station['url']))?>">
<?php if($station['tried']) : ?>
<?php if($station['solved']) : ?>
<?php if(!is_null($station['stationpicture_id'])) : ?> <?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']))?>" /> <img title="<?=$station['title']?>" src="<?=$linker->link(array('media','charactergroupsqueststation',$seminary['url'],$groupsgroup['url'],$quest['url'],$station['url']))?>" />
<?php else : ?> <?php else : ?>
<i class="fa fa-circle"></i>
<?php endif ?>
<?php else : ?>
<i class="fa fa-times-circle"></i>
<?php endif ?>
<?php else : ?>
<i class="fa fa-globe"></i> <i class="fa fa-globe"></i>
<?php endif ?> <?php endif ?>
</a> </a>
@ -123,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(_('%dXPs'), $group['xps'])?></span> <span class="xp">
<?=sprintf(_('%dStations'), count($group['stations']))?>,
<?=sprintf(_('%dXPs'), $group['xps'])?>
</span>
</li> </li>
<?php endforeach ?> <?php endforeach ?>
</ol> </ol>
@ -152,6 +171,21 @@
var styles = []; var styles = [];
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
if(geometry instanceof ol.geom.Point) { if(geometry instanceof ol.geom.Point) {
var name = feature.get('name');
if(name) {
// Label styling
styles.push(
new ol.style.Style({
text: new ol.style.Text({
text: name,
textBaseline: 'Bottom',
offsetY: 14,
scale: 1.2
})
})
);
}
else {
// Point styling // Point styling
styles.push( styles.push(
new ol.style.Style({ new ol.style.Style({
@ -167,6 +201,7 @@
}) })
); );
} }
}
else if(geometry instanceof ol.geom.LineString) { else if(geometry instanceof ol.geom.LineString) {
// Line styling // Line styling
styles.push( styles.push(

View file

@ -119,9 +119,9 @@
</ul> </ul>
<?php if(array_key_exists('rightav', $station)) : ?> <?php if(array_key_exists('rightav', $station)) : ?>
<?php if(strpos($station['rightav']['mimetype'], 'audio') !== false) : ?> <?php if(strpos($station['rightav']['mimetype'], 'audio') !== false) : ?>
<audio controls="controls" autoplay="false" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['rightav']['url'],'charactergroupsqueststation'))?>"></audio> <audio controls="controls" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['rightav']['url']))?>"></audio>
<?php else : ?> <?php else : ?>
<video controls="controls" autoplay="false" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['rightav']['url'],'charactergroupsqueststation'))?>"></video> <video controls="controls" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['rightav']['url']))?>"></video>
<?php endif ?> <?php endif ?>
<?php else : ?> <?php else : ?>
<i class="placeholder fa fa-film fa-4x"></i><br /> <i class="placeholder fa fa-film fa-4x"></i><br />
@ -153,9 +153,9 @@
</ul> </ul>
<?php if(array_key_exists('wrongav', $station)) : ?> <?php if(array_key_exists('wrongav', $station)) : ?>
<?php if(strpos($station['wrongav']['mimetype'], 'audio') !== false) : ?> <?php if(strpos($station['wrongav']['mimetype'], 'audio') !== false) : ?>
<audio controls="controls" autoplay="false" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['wrongav']['url'],'charactergroupsqueststation'))?>"></audio> <audio controls="controls" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['wrongav']['url']))?>"></audio>
<?php else : ?> <?php else : ?>
<video controls="controls" autoplay="false" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['wrongav']['url'],'charactergroupsqueststation'))?>"></video> <video controls="controls" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['wrongav']['url']))?>"></video>
<?php endif ?> <?php endif ?>
<?php else : ?> <?php else : ?>
<i class="placeholder fa fa-film fa-4x"></i><br /> <i class="placeholder fa fa-film fa-4x"></i><br />

View file

@ -6,6 +6,7 @@
<li><i class="fa fa-chevron-right fa-fw"></i><a href="<?=$linker->link(array('charactergroupsquests','quest',$seminary['url'],$groupsgroup['url'],$quest['url']))?>"><?=$quest['title']?></a></li> <li><i class="fa fa-chevron-right fa-fw"></i><a href="<?=$linker->link(array('charactergroupsquests','quest',$seminary['url'],$groupsgroup['url'],$quest['url']))?>"><?=$quest['title']?></a></li>
</ul> </ul>
<h1><?=$station['title']?></h1>
<?php if(count(array_intersect(array('admin', 'moderator'), \hhu\z\controllers\SeminaryController::$character['characterroles'])) > 0) : ?> <?php if(count(array_intersect(array('admin', 'moderator'), \hhu\z\controllers\SeminaryController::$character['characterroles'])) > 0) : ?>
<nav class="admin"> <nav class="admin">
<li><a href="<?=$linker->link(array('edit',$seminary['url'],$groupsgroup['url'],$quest['url'],$station['url']),1)?>"><?=_('edit')?></a></li> <li><a href="<?=$linker->link(array('edit',$seminary['url'],$groupsgroup['url'],$quest['url'],$station['url']),1)?>"><?=_('edit')?></a></li>
@ -13,7 +14,6 @@
</nav> </nav>
<?php endif ?> <?php endif ?>
<h1><?=$station['title']?></h1>
<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>
@ -27,9 +27,14 @@
</a> </a>
</li> </li>
<?php endif ?> <?php endif ?>
<?php if($solved !== false) : ?> <?php if($tried) : ?>
<li> <li>
<?php if($solved) : ?>
<i class="fa fa-check-circle fa-fw"></i> <i class="fa fa-check-circle fa-fw"></i>
<?php else : ?>
<i class="fa fa-times-circle fa-fw"></i>
<?php endif ?>
</li>
<?php endif ?> <?php endif ?>
</ul> </ul>
@ -94,12 +99,19 @@
<?=$timeFormatter->format(new \DateTime($group['created']))?> <?=$timeFormatter->format(new \DateTime($group['created']))?>
</span> </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>
<?php if($group['solved'] !== false) : ?>
<span class="xp"> <span class="xp">
<?php if($group['tried']) : ?>
<?php if($group['solved']) : ?>
<?=_(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> <i class="fa fa-check-circle fa-fw"></i>
</span> <?php else : ?>
<?=_(sprintf('failed at %s', $timeFormatter->format(new \DateTime($group['solved']))))?>
<i class="fa fa-times-circle fa-fw"></i>
<?php endif ?> <?php endif ?>
<?php else : ?>
<i class="fa fa-globe fa-fw"></i>
<?php endif ?>
</span>
</li> </li>
<?php endforeach ?> <?php endforeach ?>
</ol> </ol>
@ -120,6 +132,7 @@
<section class="task"> <section class="task">
<h1 id="task"><?=_('Task')?></h1> <h1 id="task"><?=_('Task')?></h1>
<?php if($tried) : ?>
<?php if($solved): ?> <?php if($solved): ?>
<div class="text"> <div class="text">
<?php if(array_key_exists('rightimage', $station)) : ?> <?php if(array_key_exists('rightimage', $station)) : ?>
@ -129,14 +142,14 @@
<?php endif ?> <?php endif ?>
<?php if(array_key_exists('rightav', $station)) : ?> <?php if(array_key_exists('rightav', $station)) : ?>
<?php if(strpos($station['rightav']['mimetype'], 'audio') !== false) : ?> <?php if(strpos($station['rightav']['mimetype'], 'audio') !== false) : ?>
<audio controls="controls" autoplay="autoplay" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['rightav']['url'],'charactergroupsqueststation'))?>"></audio> <audio controls="controls" autoplay="autoplay" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['rightav']['url']))?>"></audio>
<?php else : ?> <?php else : ?>
<video controls="controls" autoplay="autoplay" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['rightav']['url'],'charactergroupsqueststation'))?>"></video> <video controls="controls" autoplay="autoplay" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['rightav']['url']))?>"></video>
<?php endif ?> <?php endif ?>
<?php endif ?> <?php endif ?>
<?=$t->t($station['righttext'])?> <?=$t->t($station['righttext'])?>
</div> </div>
<?php elseif($tried) : ?> <?php else : ?>
<div class="text"> <div class="text">
<?php if(array_key_exists('wrongimage', $station)) : ?> <?php if(array_key_exists('wrongimage', $station)) : ?>
<a href="<?=$linker->link(array('media','seminary',$seminary['url'],$station['wrongimage']['url']))?>"> <a href="<?=$linker->link(array('media','seminary',$seminary['url'],$station['wrongimage']['url']))?>">
@ -145,13 +158,17 @@
<?php endif ?> <?php endif ?>
<?php if(array_key_exists('wrongav', $station)) : ?> <?php if(array_key_exists('wrongav', $station)) : ?>
<?php if(strpos($station['wrongav']['mimetype'], 'audio') !== false) : ?> <?php if(strpos($station['wrongav']['mimetype'], 'audio') !== false) : ?>
<audio controls="controls" autoplay="autoplay" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['wrongav']['url'],'charactergroupsqueststation'))?>"></audio> <audio controls="controls" autoplay="autoplay" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['wrongav']['url']))?>"></audio>
<?php else : ?> <?php else : ?>
<video controls="controls" autoplay="autoplay" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['wrongav']['url'],'charactergroupsqueststation'))?>" poster="<?=$linker->link(array('media','seminary',$seminary['url'],$station['wrongimage']['url']))?>"></video> <video controls="controls" autoplay="autoplay" preload="metadata" src="<?=$linker->link(array('media','seminary',$seminary['url'],$station['wrongav']['url']))?>"></video>
<?php endif ?> <?php endif ?>
<?php endif ?> <?php endif ?>
<?=$t->t($station['wrongtext'])?> <?=$t->t($station['wrongtext'])?>
</div> </div>
<?php endif ?>
<p>
<a class="cta orange" href="<?=$linker->link(array('charactergroupsquests','quest',$seminary['url'],$groupsgroup['url'],$quest['url']))?>"><?=_('Back to overview')?></a>
</p>
<?php else : ?> <?php else : ?>
<div class="text"> <div class="text">
<?=$t->t($station['task'])?> <?=$t->t($station['task'])?>

View file

@ -106,6 +106,10 @@
<div class="cond"> <div class="cond">
<input type="checkbox" id="elements_charactergroupsquests" name="elements[charactergroupsquests]" <?php if(array_key_exists('charactergroupsquests', $elements)) : ?>checked="checked"<?php endif ?> /> <input type="checkbox" id="elements_charactergroupsquests" name="elements[charactergroupsquests]" <?php if(array_key_exists('charactergroupsquests', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_charactergroupsquests"><?=_('Character Groups Quests')?></label> <label for="elements_charactergroupsquests"><?=_('Character Groups Quests')?></label>
<div class="cond">
<input type="checkbox" id="elements_charactergroupsqueststations" name="elements[charactergroupsqueststations]" <?php if(array_key_exists('charactergroupsqueststations', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_charactergroupsqueststations"><?=_('Character Groups Quest Stations')?></label>
</div>
</div> </div>
<input type="checkbox" id="elements_map" name="elements[map]" <?php if(array_key_exists('map', $elements)) : ?>checked="checked"<?php endif ?> /> <input type="checkbox" id="elements_map" name="elements[map]" <?php if(array_key_exists('map', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_map"><?=_('Map')?></label> <label for="elements_map"><?=_('Map')?></label>