improve map implementation including edit functionality
This commit is contained in:
parent
d561cc78ed
commit
1f1d91850e
10 changed files with 341 additions and 10 deletions
|
|
@ -24,7 +24,7 @@
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public $models = array('questgroupshierarchy', 'questgroups', 'quests', 'questtopics', 'media', 'charactertypes', 'xplevels', 'avatars', 'achievements', 'charactergroups', 'charactergroupsquests', 'seminarycharacterfields');
|
||||
public $models = array('questgroupshierarchy', 'questgroups', 'quests', 'questtopics', 'media', 'charactertypes', 'xplevels', 'avatars', 'achievements', 'charactergroups', 'charactergroupsquests', 'seminarycharacterfields', 'map');
|
||||
|
||||
|
||||
|
||||
|
|
@ -259,6 +259,25 @@
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the moodpic for the map of a Seminary.
|
||||
*
|
||||
* @param int $seminaryId ID of Seminary to set moodpic for Map for
|
||||
* @param int $seminaryMediaId ID of Seminarymedia to set as moodpic
|
||||
*/
|
||||
public function setMoodpicForMap($seminaryId, $seminaryMediaId)
|
||||
{
|
||||
$this->db->query(
|
||||
'UPDATE seminaries '.
|
||||
'SET map_seminarymedia_id = ? '.
|
||||
'WHERE id = ?',
|
||||
'ii',
|
||||
$seminaryMediaId,
|
||||
$seminaryId
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (Re-) Calculate the amount of achievable XPs for a Seminary.
|
||||
*
|
||||
|
|
@ -326,9 +345,10 @@
|
|||
* @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
|
||||
*/
|
||||
public function copySeminary($userId, $sourceSeminaryId, $title, $course, $description, $copySeminaryfields, $copyMedia, $copyQuestgroupshierarchy, $copyQuestgroups, $copyQuests, $copyQuesttopics, $copyCharactertypes, $copyXPlevels, $copyAvatars, $copyAchievements, $copyCharactergroupsgroups, $copyCharactergroupsquests)
|
||||
public function copySeminary($userId, $sourceSeminaryId, $title, $course, $description, $copySeminaryfields, $copyMedia, $copyQuestgroupshierarchy, $copyQuestgroups, $copyQuests, $copyQuesttopics, $copyCharactertypes, $copyXPlevels, $copyAvatars, $copyAchievements, $copyCharactergroupsgroups, $copyCharactergroupsquests, $copyMap)
|
||||
{
|
||||
// Get Seminary
|
||||
$seminary = $this->getSeminaryById($sourceSeminaryId);
|
||||
|
|
@ -362,6 +382,9 @@
|
|||
if(!is_null($seminary['library_seminarymedia_id'])) {
|
||||
$this->setMoodpicForLibrary($targetSeminaryId, $seminaryMediaIds[$seminary['library_seminarymedia_id']]);
|
||||
}
|
||||
if(!is_null($seminary['map_seminarymedia_id'])) {
|
||||
$this->setMoodpicForMap($targetSeminaryId, $seminaryMediaIds[$seminary['map_seminarymedia_id']]);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy Quest content
|
||||
|
|
@ -423,6 +446,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Copy Map
|
||||
if($copyMap && !is_null($seminaryMediaIds)) {
|
||||
$this->Map->copyMapOfSeminary($sourceSeminaryId, $targetSeminaryId, $seminaryMediaIds);
|
||||
}
|
||||
|
||||
// Recalculate XPs
|
||||
$this->calculateXPsForSeminary($targetSeminaryId);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue