merge branch ?charactergroupsqueststations?
This commit is contained in:
parent
ba97244b15
commit
76ba31c04e
18 changed files with 351 additions and 84 deletions
|
@ -24,7 +24,7 @@
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public $models = array('seminaries'); //, 'questgroups', 'quests', 'characters');
|
||||
public $models = array('seminaries');
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -103,15 +103,31 @@
|
|||
$station['id'],
|
||||
$charactergroup['id']
|
||||
);
|
||||
$station['solved'] = $this->Charactergroupsqueststations->hasCharactergroupSolvedStation(
|
||||
$station['id'],
|
||||
$charactergroup['id']
|
||||
);
|
||||
if($station['entered']) {
|
||||
$station['tried'] = $this->Charactergroupsqueststations->hasCharactergroupTriedStation(
|
||||
$station['id'],
|
||||
$charactergroup['id']
|
||||
);
|
||||
if($station['tried']) {
|
||||
$station['solved'] = $this->Charactergroupsqueststations->hasCharactergroupSolvedStation(
|
||||
$station['id'],
|
||||
$charactergroup['id']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get Character groups-groups
|
||||
// Get Character groups
|
||||
$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
|
||||
$uploads = $this->Charactergroupsquests->getMediaForQuest($quest['id']);
|
||||
|
@ -164,6 +180,14 @@
|
|||
|
||||
// Get Character groups
|
||||
$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
|
||||
$mimetypes = \nre\configs\AppConfig::$mimetypes['charactergroupsquests'];
|
||||
|
@ -219,7 +243,6 @@
|
|||
if(!is_null($this->request->getPostParam('deletemedia')))
|
||||
{
|
||||
$uploadIds = $this->request->getPostParam('uploads');
|
||||
var_dump($uploadIds);
|
||||
foreach($uploadIds as $uploadId) {
|
||||
$this->Uploads->deleteSeminaryupload($uploadId);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
$stations = $this->Charactergroupsqueststations->getStationsForQuest($quest['id']);
|
||||
}
|
||||
elseif(!is_null($charactergroup)) {
|
||||
$stations = $this->Charactergroupsqueststations->getStationsForQuestAndGroup($quest['id'], $charactergroup['id']);
|
||||
$stations = $this->Charactergroupsqueststations->getEnteredStationsForQuestAndGroup($quest['id'], $charactergroup['id']);
|
||||
}
|
||||
|
||||
|
||||
|
@ -169,10 +169,16 @@
|
|||
{
|
||||
$groups = $this->Charactergroups->getGroupsForQueststation($station['id']);
|
||||
foreach($groups as &$group) {
|
||||
$group['solved'] = $this->Charactergroupsqueststations->hasCharactergroupSolvedStation(
|
||||
$group['tried'] = $this->Charactergroupsqueststations->hasCharactergroupTriedStation(
|
||||
$station['id'],
|
||||
$group['id']
|
||||
);
|
||||
if($group['tried']) {
|
||||
$group['solved'] = $this->Charactergroupsqueststations->hasCharactergroupSolvedStation(
|
||||
$station['id'],
|
||||
$group['id']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,9 +200,9 @@
|
|||
$solved = false;
|
||||
$tried = false;
|
||||
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']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,6 @@
|
|||
$validation = $this->Validation->addValidationResult($validation, 'title', 'exist', true);
|
||||
}
|
||||
$text = $this->request->getPostParam('text');
|
||||
var_dump($text);
|
||||
|
||||
// Edit
|
||||
if($validation === true)
|
||||
|
|
|
@ -452,6 +452,7 @@
|
|||
array_key_exists('achievements', $elements),
|
||||
array_key_exists('charactergroupsgroups', $elements),
|
||||
array_key_exists('charactergroupsquests', $elements),
|
||||
array_key_exists('charactergroupsqueststations', $elements),
|
||||
array_key_exists('map', $elements)
|
||||
);
|
||||
$seminary = $this->Seminaries->getSeminaryById($seminaryId);
|
||||
|
|
|
@ -384,9 +384,11 @@
|
|||
* @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 $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)
|
||||
{
|
||||
$questIds = array();
|
||||
foreach($groupsgroupIds as $sourceGroupsgroupId => $targetGroupsgroupId)
|
||||
{
|
||||
// Get Quests
|
||||
|
@ -406,7 +408,7 @@
|
|||
$userId, $targetGroupsgroupId, $questgroupIds[$quest['questgroups_id']],
|
||||
$quest['id']
|
||||
);
|
||||
$targetQuestId = $this->db->getInsertId();
|
||||
$questIds[$quest['id']] = $this->db->getInsertId();
|
||||
|
||||
// Copy media
|
||||
if(!is_null($seminaryMediaIds) && !is_null($quest['questsmedia_id']))
|
||||
|
@ -418,11 +420,18 @@
|
|||
'WHERE id = ?',
|
||||
'ii',
|
||||
$seminaryMediaIds[$quest['questsmedia_id']],
|
||||
$targetQuestId
|
||||
$questIds[$quest['id']]
|
||||
);
|
||||
}
|
||||
|
||||
// TODO Copy Stations
|
||||
//$this->Charactergroupsqueststations->copyStationsOfQuest($quest['id'], $targetQuestId, $seminaryMediaIds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Return target Quest-IDs
|
||||
return $questIds;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,6 +39,13 @@
|
|||
*/
|
||||
const STATUS_SOLVED = 3;
|
||||
|
||||
/**
|
||||
* Required models
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $models = array('stationtypes');
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -103,6 +110,7 @@
|
|||
return $data[0];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all Stations for a Character groups Quest.
|
||||
*
|
||||
|
@ -112,7 +120,7 @@
|
|||
public function getStationsForQuest($questId)
|
||||
{
|
||||
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 '.
|
||||
'WHERE charactergroupsquest_id = ? '.
|
||||
'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 $groupId ID of Character group
|
||||
* @return array List of Station
|
||||
*/
|
||||
public function getStationsForQuestAndGroup($questId, $groupId)
|
||||
private function getEnteredStationsForQuestAndGroup($questId, $groupId)
|
||||
{
|
||||
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,
|
||||
self::STATUS_ENTERED,
|
||||
$questId
|
||||
);
|
||||
return $this->getStationsForQuestAndGroup($questId, $groupId, self::STATUS_ENTERED);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all Stations for a Character groups Quest that have been solved
|
||||
* by a Character group.
|
||||
*
|
||||
* @param int $questId ID of Character groups Quest
|
||||
* @param int $groupId ID of Character group
|
||||
* @return array List of Station
|
||||
*/
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
*
|
||||
* @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');
|
||||
|
||||
|
||||
|
||||
|
@ -328,27 +328,28 @@
|
|||
/**
|
||||
* Copy a Seminary and its content.
|
||||
*
|
||||
* @param int $userId ID of copying user
|
||||
* @param int $sourceSeminaryId ID of Seminary to copy
|
||||
* @param string $title Title of new Seminary
|
||||
* @param string $course Course of now Seminary
|
||||
* @param string $description Description of new Seminary
|
||||
* @param boolean $copySeminaryfields Whether to copy Seminary Character fields of not
|
||||
* @param boolean $copyMedia Whether to copy media or not
|
||||
* @param boolean $copyQuestgroupshierarchy Whether to copy Questgroupshierarchy or not
|
||||
* @param boolean $copyQuestgroups Whether to copy Questgroups or not
|
||||
* @param boolean $copyQuests Whether to copy Quests or not
|
||||
* @param boolean $copyQuesttopics Whether to copy Quest topics or not
|
||||
* @param boolean $copyCharactertypes Whether to copy Charactertypes or not
|
||||
* @param boolean $copyXPlevels Whether to copy XP-levels or not
|
||||
* @param boolean $copyAvatars Whether to copy Avatars or not
|
||||
* @param boolean $copyAchievements Whether to copy Achievements 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 $copyMap Whether to copy Map or not
|
||||
* @return ID of newly created Seminary
|
||||
* @param int $userId ID of copying user
|
||||
* @param int $sourceSeminaryId ID of Seminary to copy
|
||||
* @param string $title Title of new Seminary
|
||||
* @param string $course Course of now Seminary
|
||||
* @param string $description Description of new Seminary
|
||||
* @param boolean $copySeminaryfields Whether to copy Seminary Character fields of not
|
||||
* @param boolean $copyMedia Whether to copy media or not
|
||||
* @param boolean $copyQuestgroupshierarchy Whether to copy Questgroupshierarchy or not
|
||||
* @param boolean $copyQuestgroups Whether to copy Questgroups or not
|
||||
* @param boolean $copyQuests Whether to copy Quests or not
|
||||
* @param boolean $copyQuesttopics Whether to copy Quest topics or not
|
||||
* @param boolean $copyCharactertypes Whether to copy Charactertypes or not
|
||||
* @param boolean $copyXPlevels Whether to copy XP-levels or not
|
||||
* @param boolean $copyAvatars Whether to copy Avatars or not
|
||||
* @param boolean $copyAchievements Whether to copy Achievements 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 $copyCharactergroupsqueststations Whether to copy Character groups Quest Stations or not
|
||||
* @param boolean $copyMap Whether to copy Map or not
|
||||
* @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
|
||||
$seminary = $this->getSeminaryById($sourceSeminaryId);
|
||||
|
@ -437,12 +438,17 @@
|
|||
|
||||
// Copy Charactergroups content
|
||||
// Charactergroupsgroups
|
||||
$characterGroupsgroupIds = null;
|
||||
$charactergroupsquestIds = null;
|
||||
if($copyCharactergroupsgroups)
|
||||
{
|
||||
$characterGroupsgroupIds = $this->Charactergroups->copyGroupsgroupsOfSeminary($userId, $sourceSeminaryId, $targetSeminaryId);
|
||||
// Copy Charactergroupsquests
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -157,9 +157,16 @@
|
|||
*/
|
||||
private function isMatching($regex, $answer)
|
||||
{
|
||||
// Check regex
|
||||
if(empty($regex)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Execute regex
|
||||
$score = preg_match($regex, trim($answer));
|
||||
|
||||
|
||||
// Return result
|
||||
return ($score !== false && $score > 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
@ -89,7 +113,6 @@
|
|||
'iiss',
|
||||
$stationId, $charactergroupId, $answer, $answer
|
||||
);
|
||||
var_dump("saved");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -12,9 +12,19 @@
|
|||
floatval($station['latitude'])
|
||||
);
|
||||
$coordinates[] = $coordinate;
|
||||
// Marker
|
||||
$features[] = array(
|
||||
'type' => 'Feature',
|
||||
'id' => $station['id'],
|
||||
'geometry' => array(
|
||||
'type' => 'Point',
|
||||
'coordinates' => $coordinate
|
||||
)
|
||||
);
|
||||
// Label
|
||||
$features[] = array(
|
||||
'type' => 'Feature',
|
||||
'id' => $station['id'].'-label',
|
||||
'properties' => array(
|
||||
'name' => $station['title'],
|
||||
),
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
<li>
|
||||
<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 Stations'), count($group['stations']))?>,
|
||||
<select name="xps[<?=$group['url']?>]">
|
||||
<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++) : ?>
|
||||
|
|
|
@ -88,9 +88,17 @@
|
|||
<?=_('Station not yet discovered')?>
|
||||
<?php endif ?>
|
||||
</span>
|
||||
<?php if(array_key_exists('solved', $station) && $station['solved']) : ?>
|
||||
<?php if(array_key_exists('entered', $station) && $station['entered']) : ?>
|
||||
<span class="xp">
|
||||
<?php if($station['tried']) : ?>
|
||||
<?php if($station['solved']) : ?>
|
||||
<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>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
|
@ -100,10 +108,18 @@
|
|||
<ol class="grpqslist">
|
||||
<?php foreach($stations as &$station) : ?>
|
||||
<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']))?>">
|
||||
<?php if($station['tried']) : ?>
|
||||
<?php if($station['solved']) : ?>
|
||||
<?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 : ?>
|
||||
<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>
|
||||
<?php endif ?>
|
||||
|
@ -123,7 +139,10 @@
|
|||
<li>
|
||||
<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="xp"><?=sprintf(_('%d XPs'), $group['xps'])?></span>
|
||||
<span class="xp">
|
||||
<?=sprintf(_('%d Stations'), count($group['stations']))?>,
|
||||
<?=sprintf(_('%d XPs'), $group['xps'])?>
|
||||
</span>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ol>
|
||||
|
@ -152,20 +171,36 @@
|
|||
var styles = [];
|
||||
var geometry = feature.getGeometry();
|
||||
if(geometry instanceof ol.geom.Point) {
|
||||
// Point styling
|
||||
styles.push(
|
||||
new ol.style.Style({
|
||||
text: new ol.style.Text({
|
||||
//text: '\uf041',
|
||||
text: '\uf276',
|
||||
font: 'normal 28px FontAwesome',
|
||||
textBaseline: 'Bottom',
|
||||
fill: new ol.style.Fill({
|
||||
color: '#0F373C'
|
||||
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
|
||||
styles.push(
|
||||
new ol.style.Style({
|
||||
text: new ol.style.Text({
|
||||
//text: '\uf041',
|
||||
text: '\uf276',
|
||||
font: 'normal 28px FontAwesome',
|
||||
textBaseline: 'Bottom',
|
||||
fill: new ol.style.Fill({
|
||||
color: '#0F373C'
|
||||
})
|
||||
})
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
else if(geometry instanceof ol.geom.LineString) {
|
||||
// Line styling
|
||||
|
|
|
@ -119,9 +119,9 @@
|
|||
</ul>
|
||||
<?php if(array_key_exists('rightav', $station)) : ?>
|
||||
<?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 : ?>
|
||||
<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 else : ?>
|
||||
<i class="placeholder fa fa-film fa-4x"></i><br />
|
||||
|
@ -153,9 +153,9 @@
|
|||
</ul>
|
||||
<?php if(array_key_exists('wrongav', $station)) : ?>
|
||||
<?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 : ?>
|
||||
<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 else : ?>
|
||||
<i class="placeholder fa fa-film fa-4x"></i><br />
|
||||
|
|
|
@ -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>
|
||||
</ul>
|
||||
|
||||
<h1><?=$station['title']?></h1>
|
||||
<?php if(count(array_intersect(array('admin', 'moderator'), \hhu\z\controllers\SeminaryController::$character['characterroles'])) > 0) : ?>
|
||||
<nav class="admin">
|
||||
<li><a href="<?=$linker->link(array('edit',$seminary['url'],$groupsgroup['url'],$quest['url'],$station['url']),1)?>"><?=_('edit')?></a></li>
|
||||
|
@ -13,7 +14,6 @@
|
|||
</nav>
|
||||
<?php endif ?>
|
||||
|
||||
<h1><?=$station['title']?></h1>
|
||||
<ul class="gdata cf">
|
||||
<?php if(!empty($station['longitude']) && !empty($station['latitude'])) : ?>
|
||||
<li>
|
||||
|
@ -27,9 +27,14 @@
|
|||
</a>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php if($solved !== false) : ?>
|
||||
<?php if($tried) : ?>
|
||||
<li>
|
||||
<?php if($solved) : ?>
|
||||
<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 ?>
|
||||
</ul>
|
||||
|
||||
|
@ -94,12 +99,19 @@
|
|||
<?=$timeFormatter->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>
|
||||
<?php if($group['solved'] !== false) : ?>
|
||||
<span class="xp">
|
||||
<?php if($group['tried']) : ?>
|
||||
<?php if($group['solved']) : ?>
|
||||
<?=_(sprintf('solved at %s', $timeFormatter->format(new \DateTime($group['solved']))))?>
|
||||
<i class="fa fa-check-circle fa-fw"></i>
|
||||
<?php else : ?>
|
||||
<?=_(sprintf('failed at %s', $timeFormatter->format(new \DateTime($group['solved']))))?>
|
||||
<i class="fa fa-times-circle fa-fw"></i>
|
||||
<?php endif ?>
|
||||
<?php else : ?>
|
||||
<i class="fa fa-globe fa-fw"></i>
|
||||
<?php endif ?>
|
||||
</span>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ol>
|
||||
|
@ -120,6 +132,7 @@
|
|||
<section class="task">
|
||||
<h1 id="task"><?=_('Task')?></h1>
|
||||
|
||||
<?php if($tried) : ?>
|
||||
<?php if($solved): ?>
|
||||
<div class="text">
|
||||
<?php if(array_key_exists('rightimage', $station)) : ?>
|
||||
|
@ -129,14 +142,14 @@
|
|||
<?php endif ?>
|
||||
<?php if(array_key_exists('rightav', $station)) : ?>
|
||||
<?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 : ?>
|
||||
<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 ?>
|
||||
<?=$t->t($station['righttext'])?>
|
||||
</div>
|
||||
<?php elseif($tried) : ?>
|
||||
<?php else : ?>
|
||||
<div class="text">
|
||||
<?php if(array_key_exists('wrongimage', $station)) : ?>
|
||||
<a href="<?=$linker->link(array('media','seminary',$seminary['url'],$station['wrongimage']['url']))?>">
|
||||
|
@ -145,13 +158,17 @@
|
|||
<?php endif ?>
|
||||
<?php if(array_key_exists('wrongav', $station)) : ?>
|
||||
<?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 : ?>
|
||||
<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 ?>
|
||||
<?=$t->t($station['wrongtext'])?>
|
||||
</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 : ?>
|
||||
<div class="text">
|
||||
<?=$t->t($station['task'])?>
|
||||
|
|
|
@ -106,6 +106,10 @@
|
|||
<div class="cond">
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue