implement CRUD for Character groups Quests (Issue #30)
This commit is contained in:
parent
c4449c1835
commit
53c1002ab2
10 changed files with 754 additions and 41 deletions
|
|
@ -150,6 +150,15 @@
|
||||||
),
|
),
|
||||||
'motto' => array(
|
'motto' => array(
|
||||||
'maxlength' => 128
|
'maxlength' => 128
|
||||||
|
),
|
||||||
|
'title' => array(
|
||||||
|
'minlength' => 4,
|
||||||
|
'maxlength' => 32,
|
||||||
|
'regex' => '/^(\S| )*$/'
|
||||||
|
),
|
||||||
|
'xps' => array(
|
||||||
|
'minlength' => 1,
|
||||||
|
'regex' => '/^(\d*)$/'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -181,7 +190,9 @@
|
||||||
array('^charactergroups/([^/]+)/([^/]+)/(create)/?$', 'charactergroups/creategroup/$1/$2/$3', true),
|
array('^charactergroups/([^/]+)/([^/]+)/(create)/?$', 'charactergroups/creategroup/$1/$2/$3', true),
|
||||||
array('^charactergroups/([^/]+)/([^/]+)/([^/]+)/?$', 'charactergroups/group/$1/$2/$3', true),
|
array('^charactergroups/([^/]+)/([^/]+)/([^/]+)/?$', 'charactergroups/group/$1/$2/$3', true),
|
||||||
array('^charactergroups/([^/]+)/([^/]+)/([^/]+)/(manage|edit|delete)/?$', 'charactergroups/$4group/$1/$2/$3', true),
|
array('^charactergroups/([^/]+)/([^/]+)/([^/]+)/(manage|edit|delete)/?$', 'charactergroups/$4group/$1/$2/$3', true),
|
||||||
array('^charactergroupsquests/([^/]+)/([^/]+)/([^/]+)/?$', 'charactergroupsquests/quest/$1/$2/$3', true),
|
array('^charactergroupsquests/([^/]+)/([^/]+)/create/?$', 'charactergroupsquests/create/$1/$2', true),
|
||||||
|
array('^charactergroupsquests/([^/]+)/([^/]+)/([^/]+)/?$', 'charactergroupsquests/quest/$1/$2/$3', true),
|
||||||
|
array('^charactergroupsquests/([^/]+)/([^/]+)/([^/]+)/(edit|delete)/?$', 'charactergroupsquests/$4/$1/$2/$3', true),
|
||||||
array('^achievements/([^/]+)/?$', 'achievements/index/$1', true),
|
array('^achievements/([^/]+)/?$', 'achievements/index/$1', true),
|
||||||
array('^library/([^/]+)/?$', 'library/index/$1', true),
|
array('^library/([^/]+)/?$', 'library/index/$1', true),
|
||||||
array('^library/([^/]+)/([^/]+)/?$', 'library/topic/$1/$2', true),
|
array('^library/([^/]+)/([^/]+)/?$', 'library/topic/$1/$2', true),
|
||||||
|
|
@ -215,7 +226,9 @@
|
||||||
array('^charactergroups/creategroup/([^/]+)/([^/]+)$', 'charactergroups/$1/$2/create', true),
|
array('^charactergroups/creategroup/([^/]+)/([^/]+)$', 'charactergroups/$1/$2/create', true),
|
||||||
array('^charactergroups/group/([^/]+)/([^/]+)/([^/]+)$', 'charactergroups/$1/$2/$3', true),
|
array('^charactergroups/group/([^/]+)/([^/]+)/([^/]+)$', 'charactergroups/$1/$2/$3', true),
|
||||||
array('^charactergroups/(manage|edit|delete)group/([^/]+)/([^/]+)/([^/]+)$', 'charactergroups/$2/$3/$4/$1', true),
|
array('^charactergroups/(manage|edit|delete)group/([^/]+)/([^/]+)/([^/]+)$', 'charactergroups/$2/$3/$4/$1', true),
|
||||||
array('^charactergroupsquests/quest/(.*)$', 'charactergroupsquests/$1', true),
|
array('^charactergroupsquests/create/([^/]+)/([^/]+)/?$', 'charactergroupsquests/$1/$2/create', true),
|
||||||
|
array('^charactergroupsquests/quest/(.*)$', 'charactergroupsquests/$1', true),
|
||||||
|
array('^charactergroupsquests/(edit|delete)/([^/]+)/([^/]+)/([^/]+)$', 'charactergroupsquests/$2/$3/$4/$1', true),
|
||||||
array('^achievements/index/(.*)$', 'achievements/$1', true),
|
array('^achievements/index/(.*)$', 'achievements/$1', true),
|
||||||
array('^library/(index|topic)/(.*)$', 'library/$2', true)
|
array('^library/(index|topic)/(.*)$', 'library/$2', true)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,13 @@
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $models = array('seminaries', 'charactergroups', 'charactergroupsquests', 'media');
|
public $models = array('seminaries', 'charactergroups', 'charactergroupsquests', 'media', 'questgroups');
|
||||||
|
/**
|
||||||
|
* Required components
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $components = array('validation');
|
||||||
/**
|
/**
|
||||||
* User permissions
|
* User permissions
|
||||||
*
|
*
|
||||||
|
|
@ -68,6 +74,10 @@
|
||||||
// Get Character groups-group Quests
|
// Get Character groups-group Quests
|
||||||
$quest = $this->Charactergroupsquests->getQuestByUrl($groupsgroup['id'], $questUrl);
|
$quest = $this->Charactergroupsquests->getQuestByUrl($groupsgroup['id'], $questUrl);
|
||||||
|
|
||||||
|
// Get Questgroup
|
||||||
|
$questgroup = $this->Questgroups->getQuestgroupById($quest['questgroups_id']);
|
||||||
|
$questgroup['entered'] = $this->Questgroups->hasCharacterEnteredQuestgroup($questgroup['id'], self::$character['id']);
|
||||||
|
|
||||||
// Get Character groups-groups
|
// Get Character groups-groups
|
||||||
$groups = $this->Charactergroupsquests->getGroupsForQuest($quest['id']);
|
$groups = $this->Charactergroupsquests->getGroupsForQuest($quest['id']);
|
||||||
|
|
||||||
|
|
@ -82,10 +92,269 @@
|
||||||
$this->set('seminary', $seminary);
|
$this->set('seminary', $seminary);
|
||||||
$this->set('groupsgroup', $groupsgroup);
|
$this->set('groupsgroup', $groupsgroup);
|
||||||
$this->set('quest', $quest);
|
$this->set('quest', $quest);
|
||||||
|
$this->set('questgroup', $questgroup);
|
||||||
$this->set('groups', $groups);
|
$this->set('groups', $groups);
|
||||||
$this->set('media', $questmedia);
|
$this->set('media', $questmedia);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action: create.
|
||||||
|
*
|
||||||
|
* Create a new Character groups Quest for a Character
|
||||||
|
* groups-group of a Seminary.
|
||||||
|
*
|
||||||
|
* @param string $seminaryUrl URL-Title of a Seminary
|
||||||
|
* @param string $groupsgroupUrl URL-Title of a Character groups-group
|
||||||
|
*/
|
||||||
|
public function create($seminaryUrl, $groupsgroupUrl)
|
||||||
|
{
|
||||||
|
// Get seminary
|
||||||
|
$seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl);
|
||||||
|
|
||||||
|
// Get Character groups-group
|
||||||
|
$groupsgroup = $this->Charactergroups->getGroupsgroupByUrl($seminary['id'], $groupsgroupUrl);
|
||||||
|
|
||||||
|
// Get Questgroups
|
||||||
|
$questgroups = $this->Questgroups->getQuestgroupsForSeminary($seminary['id']);
|
||||||
|
|
||||||
|
// Values
|
||||||
|
$title = '';
|
||||||
|
$xps = 0;
|
||||||
|
$description = '';
|
||||||
|
$rules = '';
|
||||||
|
$wonText = '';
|
||||||
|
$lostText = '';
|
||||||
|
$fields = array('title', 'xps');
|
||||||
|
$validation = array();
|
||||||
|
|
||||||
|
// Create a new Character groups Quest
|
||||||
|
if($this->request->getRequestMethod() == 'POST' && !is_null($this->request->getPostParam('create')))
|
||||||
|
{
|
||||||
|
// Get params and validate them
|
||||||
|
$validation = $this->Validation->validateParams($this->request->getPostParams(), $fields);
|
||||||
|
$title = $this->request->getPostParam('title');
|
||||||
|
if($this->Charactergroupsquests->characterGroupsQuestTitleExists($title)) {
|
||||||
|
$validation = $this->Validation->addValidationResult($validation, 'title', 'exist', true);
|
||||||
|
}
|
||||||
|
$xps = $this->request->getPostParam('xps');
|
||||||
|
$description = $this->request->getPostParam('description');
|
||||||
|
$rules = $this->request->getPostParam('rules');
|
||||||
|
$wonText = $this->request->getPostParam('wonText');
|
||||||
|
$lostText = $this->request->getPostParam('lostText');
|
||||||
|
|
||||||
|
// Validate Questgroup
|
||||||
|
$questgroupIndex = null;
|
||||||
|
foreach($questgroups as $index => &$questgroup)
|
||||||
|
{
|
||||||
|
$questgroup['selected'] = ($questgroup['url'] == $this->request->getPostParam('questgroup'));
|
||||||
|
if($questgroup['selected']) {
|
||||||
|
$questgroupIndex = $index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(is_null($questgroupIndex)) {
|
||||||
|
throw new \nre\exceptions\ParamsNotValidException($questgroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create groups Quest
|
||||||
|
if($validation === true)
|
||||||
|
{
|
||||||
|
$questId = $this->Charactergroupsquests->createQuest(
|
||||||
|
$this->Auth->getUserId(),
|
||||||
|
$groupsgroup['id'],
|
||||||
|
$questgroups[$questgroupIndex]['id'],
|
||||||
|
$title,
|
||||||
|
$description,
|
||||||
|
$xps,
|
||||||
|
$rules,
|
||||||
|
$wonText,
|
||||||
|
$lostText
|
||||||
|
);
|
||||||
|
|
||||||
|
// Redirect to Quest page
|
||||||
|
$quest = $this->Charactergroupsquests->getQuestById($questId);
|
||||||
|
$this->redirect($this->linker->link(array('quest', $seminary['url'], $groupsgroup['url'], $quest['url']), 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get validation settings
|
||||||
|
$validationSettings = array();
|
||||||
|
foreach($fields as &$field) {
|
||||||
|
$validationSettings[$field] = \nre\configs\AppConfig::$validation[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Pass data to view
|
||||||
|
$this->set('seminary', $seminary);
|
||||||
|
$this->set('groupsgroup', $groupsgroup);
|
||||||
|
$this->set('questgroups', $questgroups);
|
||||||
|
$this->set('title', $title);
|
||||||
|
$this->set('xps', $xps);
|
||||||
|
$this->set('description', $description);
|
||||||
|
$this->set('rules', $rules);
|
||||||
|
$this->set('wonText', $wonText);
|
||||||
|
$this->set('lostText', $lostText);
|
||||||
|
$this->set('validation', $validation);
|
||||||
|
$this->set('validationSettings', $validationSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action: edit.
|
||||||
|
*
|
||||||
|
* Edit a Character groups Quest of a Character groups-group
|
||||||
|
* of a Seminary.
|
||||||
|
*
|
||||||
|
* @throws 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
|
||||||
|
*/
|
||||||
|
public function edit($seminaryUrl, $groupsgroupUrl, $questUrl)
|
||||||
|
{
|
||||||
|
// Get seminary
|
||||||
|
$seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl);
|
||||||
|
|
||||||
|
// Get Character groups-group
|
||||||
|
$groupsgroup = $this->Charactergroups->getGroupsgroupByUrl($seminary['id'], $groupsgroupUrl);
|
||||||
|
|
||||||
|
// Get Character groups-group Quests
|
||||||
|
$quest = $this->Charactergroupsquests->getQuestByUrl($groupsgroup['id'], $questUrl);
|
||||||
|
|
||||||
|
// Get Questgroups
|
||||||
|
$questgroups = $this->Questgroups->getQuestgroupsForSeminary($seminary['id']);
|
||||||
|
foreach($questgroups as $index => &$questgroup) {
|
||||||
|
$questgroup['selected'] = ($questgroup['id'] == $quest['questgroups_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Values
|
||||||
|
$title = $quest['title'];
|
||||||
|
$xps = $quest['xps'];
|
||||||
|
$description = $quest['description'];
|
||||||
|
$rules = $quest['rules'];
|
||||||
|
$wonText = $quest['won_text'];
|
||||||
|
$lostText = $quest['lost_text'];
|
||||||
|
$fields = array('title', 'xps');
|
||||||
|
$validation = array();
|
||||||
|
|
||||||
|
// Edit Character group
|
||||||
|
if($this->request->getRequestMethod() == 'POST' && !is_null($this->request->getPostParam('edit')))
|
||||||
|
{
|
||||||
|
// Get params and validate them
|
||||||
|
$validation = $this->Validation->validateParams($this->request->getPostParams(), $fields);
|
||||||
|
$title = $this->request->getPostParam('title');
|
||||||
|
if($this->Charactergroupsquests->characterGroupsQuestTitleExists($title, $quest['id'])) {
|
||||||
|
$validation = $this->Validation->addValidationResult($validation, 'title', 'exist', true);
|
||||||
|
}
|
||||||
|
$xps = $this->request->getPostParam('xps');
|
||||||
|
$description = $this->request->getPostParam('description');
|
||||||
|
$rules = $this->request->getPostParam('rules');
|
||||||
|
$wonText = $this->request->getPostParam('wonText');
|
||||||
|
$lostText = $this->request->getPostParam('lostText');
|
||||||
|
|
||||||
|
// Validate Questgroup
|
||||||
|
$questgroupIndex = null;
|
||||||
|
foreach($questgroups as $index => &$questgroup)
|
||||||
|
{
|
||||||
|
$questgroup['selected'] = ($questgroup['url'] == $this->request->getPostParam('questgroup'));
|
||||||
|
if($questgroup['selected']) {
|
||||||
|
$questgroupIndex = $index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(is_null($questgroupIndex)) {
|
||||||
|
throw new \nre\exceptions\ParamsNotValidException($questgroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit groups Quest
|
||||||
|
if($validation === true)
|
||||||
|
{
|
||||||
|
$this->Charactergroupsquests->editQuest(
|
||||||
|
$quest['id'],
|
||||||
|
$groupsgroup['id'],
|
||||||
|
$questgroups[$questgroupIndex]['id'],
|
||||||
|
$title,
|
||||||
|
$description,
|
||||||
|
$xps,
|
||||||
|
$rules,
|
||||||
|
$wonText,
|
||||||
|
$lostText
|
||||||
|
);
|
||||||
|
|
||||||
|
// Redirect to Quest page
|
||||||
|
$quest = $this->Charactergroupsquests->getQuestById($quest['id']);
|
||||||
|
$this->redirect($this->linker->link(array('quest', $seminary['url'], $groupsgroup['url'], $quest['url']), 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get validation settings
|
||||||
|
$validationSettings = array();
|
||||||
|
foreach($fields as &$field) {
|
||||||
|
$validationSettings[$field] = \nre\configs\AppConfig::$validation[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Pass data to view
|
||||||
|
$this->set('seminary', $seminary);
|
||||||
|
$this->set('groupsgroup', $groupsgroup);
|
||||||
|
$this->set('quest', $quest);
|
||||||
|
$this->set('questgroups', $questgroups);
|
||||||
|
$this->set('title', $title);
|
||||||
|
$this->set('xps', $xps);
|
||||||
|
$this->set('description', $description);
|
||||||
|
$this->set('rules', $rules);
|
||||||
|
$this->set('wonText', $wonText);
|
||||||
|
$this->set('lostText', $lostText);
|
||||||
|
$this->set('validation', $validation);
|
||||||
|
$this->set('validationSettings', $validationSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action: delete.
|
||||||
|
*
|
||||||
|
* Delete a Character groups Quest of a Character groups-group
|
||||||
|
* of a Seminary.
|
||||||
|
*
|
||||||
|
* @throws 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
|
||||||
|
*/
|
||||||
|
public function delete($seminaryUrl, $groupsgroupUrl, $questUrl)
|
||||||
|
{
|
||||||
|
// Get seminary
|
||||||
|
$seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl);
|
||||||
|
|
||||||
|
// Get Character groups-group
|
||||||
|
$groupsgroup = $this->Charactergroups->getGroupsgroupByUrl($seminary['id'], $groupsgroupUrl);
|
||||||
|
|
||||||
|
// Get Character groups-group Quests
|
||||||
|
$quest = $this->Charactergroupsquests->getQuestByUrl($groupsgroup['id'], $questUrl);
|
||||||
|
|
||||||
|
// Check request method
|
||||||
|
if($this->request->getRequestMethod() == 'POST')
|
||||||
|
{
|
||||||
|
// Check confirmation
|
||||||
|
if(!is_null($this->request->getPostParam('delete')))
|
||||||
|
{
|
||||||
|
// Delete seminary
|
||||||
|
$this->Charactergroupsquests->deleteQuest($quest['id']);
|
||||||
|
|
||||||
|
// Redirect to overview
|
||||||
|
$this->redirect($this->linker->link(array('charactergroups', 'groupsgroup', $seminary['url'], $groupsgroup['url'])));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Redirect to entry
|
||||||
|
$this->redirect($this->linker->link(array('quest', $seminary['url'], $groupsgroup['url'], $quest['url']), 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Pass data to view
|
||||||
|
$this->set('seminary', $seminary);
|
||||||
|
$this->set('groupsgroup', $groupsgroup);
|
||||||
|
$this->set('quest', $quest);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,8 +1,8 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: The Legend of Z\n"
|
"Project-Id-Version: The Legend of Z\n"
|
||||||
"POT-Creation-Date: 2014-04-29 21:29+0100\n"
|
"POT-Creation-Date: 2014-04-30 00:43+0100\n"
|
||||||
"PO-Revision-Date: 2014-04-29 22:03+0100\n"
|
"PO-Revision-Date: 2014-04-30 00:45+0100\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"Language: de_DE\n"
|
"Language: de_DE\n"
|
||||||
|
|
@ -192,6 +192,9 @@ msgstr "Spiele weiter, um diesen geheimen Erfolg freizuschalten"
|
||||||
#: views/html/charactergroups/groupsgroup.tpl:8
|
#: views/html/charactergroups/groupsgroup.tpl:8
|
||||||
#: views/html/charactergroups/index.tpl:9
|
#: views/html/charactergroups/index.tpl:9
|
||||||
#: views/html/charactergroups/managegroup.tpl:8
|
#: views/html/charactergroups/managegroup.tpl:8
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:8
|
||||||
|
#: views/html/charactergroupsquests/delete.tpl:8
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:8
|
||||||
#: views/html/charactergroupsquests/quest.tpl:8
|
#: views/html/charactergroupsquests/quest.tpl:8
|
||||||
#: views/html/characters/character.tpl:85 views/html/seminarymenu/index.tpl:3
|
#: views/html/characters/character.tpl:85 views/html/seminarymenu/index.tpl:3
|
||||||
msgid "Character Groups"
|
msgid "Character Groups"
|
||||||
|
|
@ -271,6 +274,7 @@ msgstr "Motto"
|
||||||
|
|
||||||
#: views/html/charactergroups/creategroup.tpl:59
|
#: views/html/charactergroups/creategroup.tpl:59
|
||||||
#: views/html/charactergroups/creategroupsgroup.tpl:50
|
#: views/html/charactergroups/creategroupsgroup.tpl:50
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:75
|
||||||
#: views/html/characters/register.tpl:87 views/html/seminaries/create.tpl:12
|
#: views/html/characters/register.tpl:87 views/html/seminaries/create.tpl:12
|
||||||
#: views/html/users/create.tpl:20
|
#: views/html/users/create.tpl:20
|
||||||
msgid "create"
|
msgid "create"
|
||||||
|
|
@ -297,12 +301,14 @@ msgstr "Soll die Gruppe „%s“ wirklich gelöscht werden?"
|
||||||
|
|
||||||
#: views/html/charactergroups/deletegroup.tpl:15
|
#: views/html/charactergroups/deletegroup.tpl:15
|
||||||
#: views/html/charactergroups/deletegroupsgroup.tpl:14
|
#: views/html/charactergroups/deletegroupsgroup.tpl:14
|
||||||
|
#: views/html/charactergroupsquests/delete.tpl:15
|
||||||
#: views/html/seminaries/delete.tpl:11 views/html/users/delete.tpl:9
|
#: views/html/seminaries/delete.tpl:11 views/html/users/delete.tpl:9
|
||||||
msgid "delete"
|
msgid "delete"
|
||||||
msgstr "löschen"
|
msgstr "löschen"
|
||||||
|
|
||||||
#: views/html/charactergroups/deletegroup.tpl:16
|
#: views/html/charactergroups/deletegroup.tpl:16
|
||||||
#: views/html/charactergroups/deletegroupsgroup.tpl:15
|
#: views/html/charactergroups/deletegroupsgroup.tpl:15
|
||||||
|
#: views/html/charactergroupsquests/delete.tpl:16
|
||||||
#: views/html/seminaries/delete.tpl:12 views/html/users/delete.tpl:10
|
#: views/html/seminaries/delete.tpl:12 views/html/users/delete.tpl:10
|
||||||
msgid "cancel"
|
msgid "cancel"
|
||||||
msgstr "abbrechen"
|
msgstr "abbrechen"
|
||||||
|
|
@ -324,6 +330,7 @@ msgstr "Gruppe bearbeiten"
|
||||||
|
|
||||||
#: views/html/charactergroups/editgroup.tpl:59
|
#: views/html/charactergroups/editgroup.tpl:59
|
||||||
#: views/html/charactergroups/editgroupsgroup.tpl:50
|
#: views/html/charactergroups/editgroupsgroup.tpl:50
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:75
|
||||||
msgid "edit"
|
msgid "edit"
|
||||||
msgstr "bearbeiten"
|
msgstr "bearbeiten"
|
||||||
|
|
||||||
|
|
@ -357,15 +364,20 @@ msgid "Characters"
|
||||||
msgstr "Charaktere"
|
msgstr "Charaktere"
|
||||||
|
|
||||||
#: views/html/charactergroups/group.tpl:51
|
#: views/html/charactergroups/group.tpl:51
|
||||||
#: views/html/charactergroups/groupsgroup.tpl:27
|
#: views/html/charactergroups/groupsgroup.tpl:31
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "%s-Quests"
|
msgid "%s-Quests"
|
||||||
msgstr "%squests"
|
msgstr "%squests"
|
||||||
|
|
||||||
#: views/html/charactergroups/groupsgroup.tpl:14
|
#: views/html/charactergroups/groupsgroup.tpl:21
|
||||||
msgid "Create new Character group"
|
msgid "Create new Character group"
|
||||||
msgstr "Neue Gruppe"
|
msgstr "Neue Gruppe"
|
||||||
|
|
||||||
|
#: views/html/charactergroups/groupsgroup.tpl:34
|
||||||
|
#, php-format
|
||||||
|
msgid "Create new %s-Quest"
|
||||||
|
msgstr "Neue %s-Quest erstellen"
|
||||||
|
|
||||||
#: views/html/charactergroups/index.tpl:13
|
#: views/html/charactergroups/index.tpl:13
|
||||||
msgid "Create new Character groups-group"
|
msgid "Create new Character groups-group"
|
||||||
msgstr "Neue Gruppengruppe"
|
msgstr "Neue Gruppengruppe"
|
||||||
|
|
@ -388,19 +400,136 @@ msgstr "Füge Charaktere hinzu"
|
||||||
msgid "Quests"
|
msgid "Quests"
|
||||||
msgstr "Quests"
|
msgstr "Quests"
|
||||||
|
|
||||||
#: views/html/charactergroupsquests/quest.tpl:16
|
#: views/html/charactergroupsquests/create.tpl:12
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:12
|
||||||
|
#, php-format
|
||||||
|
msgid "New %s-Quest"
|
||||||
|
msgstr "Neue %s-Quest"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:23
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:23
|
||||||
|
#, php-format
|
||||||
|
msgid "Title is too short (min. %d chars)"
|
||||||
|
msgstr "Der Titel ist zu kurz (min. %d Zeichen)"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:25
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:25
|
||||||
|
#, php-format
|
||||||
|
msgid "Title is too long (max. %d chars)"
|
||||||
|
msgstr "Der Titel ist zu lang (max. %d Zeichen)"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:27
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:27
|
||||||
|
msgid "Title contains illegal characters"
|
||||||
|
msgstr "Der Titel enthält ungültige Zeichen"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:29
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:29
|
||||||
|
msgid "Title already exists"
|
||||||
|
msgstr "Der Titel existiert bereits"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:31
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:31
|
||||||
|
msgid "Title invalid"
|
||||||
|
msgstr "Der Titel ist ungültig"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:36
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:36
|
||||||
|
#, php-format
|
||||||
|
msgid "XPs not set"
|
||||||
|
msgstr "XP nicht angegeben"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:38
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:38
|
||||||
|
msgid "XPs contain illegal characters"
|
||||||
|
msgstr "Die XP-Angabe enthält ungültige Zeichen"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:40
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:40
|
||||||
|
msgid "XPs invalid"
|
||||||
|
msgstr "Die XP-Angabe ist ungültig"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:56
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:57
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:56
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:57
|
||||||
|
#: views/html/questgroups/create.tpl:14 views/html/questgroups/create.tpl:15
|
||||||
|
#: views/html/seminaries/create.tpl:9 views/html/seminaries/create.tpl:10
|
||||||
|
#: views/html/seminaries/edit.tpl:11 views/html/seminaries/edit.tpl:12
|
||||||
|
msgid "Title"
|
||||||
|
msgstr "Titel"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:58
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:59
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:58
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:59
|
||||||
|
#: views/html/characters/index.tpl:21 views/html/characters/manage.tpl:16
|
||||||
|
#: views/html/quests/create.tpl:29 views/html/quests/create.tpl:30
|
||||||
|
msgid "XPs"
|
||||||
|
msgstr "XP"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:60
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:60
|
||||||
|
#: views/html/charactergroupsquests/quest.tpl:21
|
||||||
|
#: views/html/quests/create.tpl:17 views/html/quests/index.tpl:14
|
||||||
|
msgid "Questgroup"
|
||||||
|
msgstr "Questgruppe"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:66
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:67
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:66
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:67
|
||||||
|
#: views/html/charactergroupsquests/quest.tpl:24
|
||||||
msgid "Description"
|
msgid "Description"
|
||||||
msgstr "Beschreibung"
|
msgstr "Beschreibung"
|
||||||
|
|
||||||
#: views/html/charactergroupsquests/quest.tpl:24
|
#: views/html/charactergroupsquests/create.tpl:68
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:69
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:68
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:69
|
||||||
|
#: views/html/charactergroupsquests/quest.tpl:32
|
||||||
msgid "Rules"
|
msgid "Rules"
|
||||||
msgstr "Regeln"
|
msgstr "Regeln"
|
||||||
|
|
||||||
#: views/html/charactergroupsquests/quest.tpl:31
|
#: views/html/charactergroupsquests/create.tpl:70
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:71
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:70
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:71
|
||||||
|
msgid "Won-text"
|
||||||
|
msgstr "Gewonnentext"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:72
|
||||||
|
#: views/html/charactergroupsquests/create.tpl:73
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:72
|
||||||
|
#: views/html/charactergroupsquests/edit.tpl:73
|
||||||
|
msgid "Lost-text"
|
||||||
|
msgstr "Verlorentext"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/delete.tpl:12
|
||||||
|
#: views/html/charactergroupsquests/quest.tpl:15
|
||||||
|
#, php-format
|
||||||
|
msgid "Delete %s-Quest"
|
||||||
|
msgstr "%s-Quest löschen"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/delete.tpl:13
|
||||||
|
#, php-format
|
||||||
|
msgid "Should the %s-Quest “%s” really be deleted?"
|
||||||
|
msgstr "Soll die %s-Quest „%s“ wirklich gelöscht werden?"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/quest.tpl:14
|
||||||
|
#, php-format
|
||||||
|
msgid "Edit %s-Quest"
|
||||||
|
msgstr "%s-Quest bearbeiten"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/quest.tpl:20
|
||||||
|
msgid "Maximum reward"
|
||||||
|
msgstr "Maximale Belohnung"
|
||||||
|
|
||||||
|
#: views/html/charactergroupsquests/quest.tpl:39
|
||||||
msgid "Won Quest"
|
msgid "Won Quest"
|
||||||
msgstr "Gewonnene Quest"
|
msgstr "Gewonnene Quest"
|
||||||
|
|
||||||
#: views/html/charactergroupsquests/quest.tpl:37
|
#: views/html/charactergroupsquests/quest.tpl:45
|
||||||
msgid "Lost Quest"
|
msgid "Lost Quest"
|
||||||
msgstr "Verlorene Quest"
|
msgstr "Verlorene Quest"
|
||||||
|
|
||||||
|
|
@ -446,44 +575,39 @@ msgstr "Thematischer Fortschritt"
|
||||||
msgid "Manage"
|
msgid "Manage"
|
||||||
msgstr "Verwalten"
|
msgstr "Verwalten"
|
||||||
|
|
||||||
#: views/html/characters/index.tpl:20 views/html/characters/register.tpl:42
|
#: views/html/characters/index.tpl:20 views/html/characters/manage.tpl:15
|
||||||
#: views/html/characters/register.tpl:43
|
#: views/html/characters/register.tpl:42 views/html/characters/register.tpl:43
|
||||||
msgid "Character name"
|
msgid "Character name"
|
||||||
msgstr "Charaktername"
|
msgstr "Charaktername"
|
||||||
|
|
||||||
#: views/html/characters/index.tpl:21 views/html/quests/create.tpl:29
|
#: views/html/characters/index.tpl:22 views/html/characters/manage.tpl:17
|
||||||
#: views/html/quests/create.tpl:30
|
|
||||||
msgid "XPs"
|
|
||||||
msgstr "XP"
|
|
||||||
|
|
||||||
#: views/html/characters/index.tpl:22
|
|
||||||
msgid "Role"
|
msgid "Role"
|
||||||
msgstr "Rolle"
|
msgstr "Rolle"
|
||||||
|
|
||||||
#: views/html/characters/index.tpl:27
|
#: views/html/characters/index.tpl:27 views/html/characters/manage.tpl:22
|
||||||
msgid "Sort list"
|
msgid "Sort list"
|
||||||
msgstr "Liste sortieren"
|
msgstr "Liste sortieren"
|
||||||
|
|
||||||
#: views/html/characters/index.tpl:37 views/html/characters/manage.tpl:32
|
#: views/html/characters/index.tpl:37 views/html/characters/manage.tpl:33
|
||||||
#: views/html/characters/manage.tpl:47 views/html/characters/manage.tpl:55
|
#: views/html/characters/manage.tpl:48 views/html/characters/manage.tpl:56
|
||||||
msgid "Admin"
|
msgid "Admin"
|
||||||
msgstr "Administrator"
|
msgstr "Administrator"
|
||||||
|
|
||||||
#: views/html/characters/index.tpl:38 views/html/characters/manage.tpl:33
|
#: views/html/characters/index.tpl:38 views/html/characters/manage.tpl:34
|
||||||
#: views/html/characters/manage.tpl:48 views/html/characters/manage.tpl:56
|
#: views/html/characters/manage.tpl:49 views/html/characters/manage.tpl:57
|
||||||
msgid "Moderator"
|
msgid "Moderator"
|
||||||
msgstr "Moderator"
|
msgstr "Moderator"
|
||||||
|
|
||||||
#: views/html/characters/index.tpl:39 views/html/characters/manage.tpl:34
|
#: views/html/characters/index.tpl:39 views/html/characters/manage.tpl:35
|
||||||
#: views/html/characters/manage.tpl:50 views/html/characters/manage.tpl:58
|
#: views/html/characters/manage.tpl:51 views/html/characters/manage.tpl:59
|
||||||
msgid "User"
|
msgid "User"
|
||||||
msgstr "Benutzer"
|
msgstr "Benutzer"
|
||||||
|
|
||||||
#: views/html/characters/manage.tpl:45
|
#: views/html/characters/manage.tpl:46
|
||||||
msgid "Add role"
|
msgid "Add role"
|
||||||
msgstr "Füge Rolle hinzu"
|
msgstr "Füge Rolle hinzu"
|
||||||
|
|
||||||
#: views/html/characters/manage.tpl:53
|
#: views/html/characters/manage.tpl:54
|
||||||
msgid "Remove role"
|
msgid "Remove role"
|
||||||
msgstr "Entferne Rolle"
|
msgstr "Entferne Rolle"
|
||||||
|
|
||||||
|
|
@ -619,12 +743,6 @@ msgstr "Questgruppen"
|
||||||
msgid "Create Questgroup"
|
msgid "Create Questgroup"
|
||||||
msgstr "Questgruppe erstellen"
|
msgstr "Questgruppe erstellen"
|
||||||
|
|
||||||
#: views/html/questgroups/create.tpl:14 views/html/questgroups/create.tpl:15
|
|
||||||
#: views/html/seminaries/create.tpl:9 views/html/seminaries/create.tpl:10
|
|
||||||
#: views/html/seminaries/edit.tpl:11 views/html/seminaries/edit.tpl:12
|
|
||||||
msgid "Title"
|
|
||||||
msgstr "Titel"
|
|
||||||
|
|
||||||
#: views/html/questgroups/create.tpl:17 views/html/quests/create.tpl:43
|
#: views/html/questgroups/create.tpl:17 views/html/quests/create.tpl:43
|
||||||
msgid "Create"
|
msgid "Create"
|
||||||
msgstr "Erstellen"
|
msgstr "Erstellen"
|
||||||
|
|
@ -637,10 +755,6 @@ msgstr "Optionale Questline gefunden"
|
||||||
msgid "Create Quest"
|
msgid "Create Quest"
|
||||||
msgstr "Quest erstellen"
|
msgstr "Quest erstellen"
|
||||||
|
|
||||||
#: views/html/quests/create.tpl:17 views/html/quests/index.tpl:14
|
|
||||||
msgid "Questgroup"
|
|
||||||
msgstr "Questgruppe"
|
|
||||||
|
|
||||||
#: views/html/quests/create.tpl:37
|
#: views/html/quests/create.tpl:37
|
||||||
msgid "Entry text"
|
msgid "Entry text"
|
||||||
msgstr "Einstiegstext"
|
msgstr "Einstiegstext"
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,31 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a Character groups Quest by its ID.
|
||||||
|
*
|
||||||
|
* @throws IdNotFoundException
|
||||||
|
* @param int $questId ID of the Character groups Quest
|
||||||
|
* @return array Character groups Quest data
|
||||||
|
*/
|
||||||
|
public function getQuestById($questId)
|
||||||
|
{
|
||||||
|
$data = $this->db->query(
|
||||||
|
'SELECT id, questgroups_id, title, url, description, xps, rules, won_text, lost_text, questsmedia_id '.
|
||||||
|
'FROM charactergroupsquests '.
|
||||||
|
'WHERE id = ?',
|
||||||
|
'i',
|
||||||
|
$questId
|
||||||
|
);
|
||||||
|
if(empty($data)) {
|
||||||
|
throw new \nre\exceptions\IdNotFoundException($questUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $data[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Character groups for a Quest.
|
* Get the Character groups for a Quest.
|
||||||
*
|
*
|
||||||
|
|
@ -131,6 +156,112 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a Character groups Quest title already exists.
|
||||||
|
*
|
||||||
|
* @param string $name Character groups Quest title to check
|
||||||
|
* @param int $questId Do not check this ID (for editing)
|
||||||
|
* @return boolean Whether Character groups Quest title exists or not
|
||||||
|
*/
|
||||||
|
public function characterGroupsQuestTitleExists($title, $questId=null)
|
||||||
|
{
|
||||||
|
$data = $this->db->query(
|
||||||
|
'SELECT id '.
|
||||||
|
'FROM charactergroupsquests '.
|
||||||
|
'WHERE title = ? OR url = ?',
|
||||||
|
'ss',
|
||||||
|
$title,
|
||||||
|
\nre\core\Linker::createLinkParam($title)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (!empty($data) && (is_null($questId) || $questId != $data[0]['id']));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Character groups Quest.
|
||||||
|
*
|
||||||
|
* @param int $userId ID of user
|
||||||
|
* @param int $groupsgroupId ID of Character groups-group
|
||||||
|
* @param int $questgroupId ID of Quest group
|
||||||
|
* @param string $title Title of new Quest
|
||||||
|
* @param string $description Description of new Quset
|
||||||
|
* @param int $xps Amount of XPs for new Quest
|
||||||
|
* @param string $rules Rules of new Quest
|
||||||
|
* @param string $wonText Won-text of new Quset
|
||||||
|
* @param string $lostText Lost-text of new Quest
|
||||||
|
* @return int ID of newly created Quest
|
||||||
|
*/
|
||||||
|
public function createQuest($userId, $groupsgroupId, $questgroupId, $title, $description, $xps, $rules, $wonText, $lostText)
|
||||||
|
{
|
||||||
|
$this->db->query(
|
||||||
|
'INSERT INTO charactergroupsquests '.
|
||||||
|
'(created_user_id, charactergroupsgroup_id, questgroups_id, title, url, description, xps, rules, won_text, lost_text) '.
|
||||||
|
'VALUES '.
|
||||||
|
'(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
|
||||||
|
'iiisssdsss',
|
||||||
|
$userId,
|
||||||
|
$groupsgroupId,
|
||||||
|
$questgroupId,
|
||||||
|
$title,
|
||||||
|
\nre\core\Linker::createLinkParam($title),
|
||||||
|
$description,
|
||||||
|
$xps,
|
||||||
|
$rules,
|
||||||
|
$wonText,
|
||||||
|
$lostText
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
return $this->db->getInsertId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit a Character groups Quest.
|
||||||
|
*
|
||||||
|
* @param int $questId ID of Character groups Quest to edit
|
||||||
|
* @param int $groupsgroupId ID of Character groups-group
|
||||||
|
* @param int $questgroupId ID of Quest group
|
||||||
|
* @param string $title Title of new Quest
|
||||||
|
* @param string $description Description of new Quset
|
||||||
|
* @param int $xps Amount of XPs for new Quest
|
||||||
|
* @param string $rules Rules of new Quest
|
||||||
|
* @param string $wonText Won-text of new Quset
|
||||||
|
* @param string $lostText Lost-text of new Quest
|
||||||
|
*/
|
||||||
|
public function editQuest($questId, $groupsgroupId, $questgroupId, $title, $description, $xps, $rules, $wonText, $lostText)
|
||||||
|
{
|
||||||
|
$this->db->query(
|
||||||
|
'UPDATE charactergroupsquests '.
|
||||||
|
'SET charactergroupsgroup_id = ?, questgroups_id = ?, title = ?, url = ?, description = ?, xps = ?, rules = ?, won_text = ?, lost_text= ? '.
|
||||||
|
'WHERE id = ?',
|
||||||
|
'iisssdsssi',
|
||||||
|
$groupsgroupId,
|
||||||
|
$questgroupId,
|
||||||
|
$title,
|
||||||
|
\nre\core\Linker::createLinkParam($title),
|
||||||
|
$description,
|
||||||
|
$xps,
|
||||||
|
$rules,
|
||||||
|
$wonText,
|
||||||
|
$lostText,
|
||||||
|
$questId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a Character groups Quest.
|
||||||
|
*
|
||||||
|
* @param int $questId ID of Character groups Quest to delete
|
||||||
|
*/
|
||||||
|
public function deleteQuest($questId)
|
||||||
|
{
|
||||||
|
$this->db->query('DELETE FROM charactergroupsquests WHERE id = ?', 'i', $questId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,16 @@
|
||||||
<nav class="admin">
|
<nav class="admin">
|
||||||
<li><a href="<?=$linker->link(array('editgroupsgroup',$seminary['url'],$groupsgroup['url']), 1)?>"><?=_('Edit Character groups-group')?></a></li>
|
<li><a href="<?=$linker->link(array('editgroupsgroup',$seminary['url'],$groupsgroup['url']), 1)?>"><?=_('Edit Character groups-group')?></a></li>
|
||||||
<li><a href="<?=$linker->link(array('deletegroupsgroup',$seminary['url'],$groupsgroup['url']), 1)?>"><?=_('Delete Character groups-group')?></a></li>
|
<li><a href="<?=$linker->link(array('deletegroupsgroup',$seminary['url'],$groupsgroup['url']), 1)?>"><?=_('Delete Character groups-group')?></a></li>
|
||||||
<li><a href="<?=$linker->link(array('creategroup',$seminary['url'],$groupsgroup['url']), 1)?>"><?=_('Create new Character group')?></a></li>
|
|
||||||
</nav>
|
</nav>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<h1><?=$groupsgroup['name']?></h1>
|
<h1><?=$groupsgroup['name']?></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('creategroup',$seminary['url'],$groupsgroup['url']), 1)?>"><?=_('Create new Character group')?></a></li>
|
||||||
|
</nav>
|
||||||
|
<?php endif ?>
|
||||||
<ol class="cglist">
|
<ol class="cglist">
|
||||||
<?php foreach($groups as &$group) : ?>
|
<?php foreach($groups as &$group) : ?>
|
||||||
<li><a href="<?=$linker->link(array('group',$seminary['url'],$groupsgroup['url'],$group['url']),1)?>"><?=$group['name']?></a><span class="xp"><?=$group['xps']?> XP</span></li>
|
<li><a href="<?=$linker->link(array('group',$seminary['url'],$groupsgroup['url'],$group['url']),1)?>"><?=$group['name']?></a><span class="xp"><?=$group['xps']?> XP</span></li>
|
||||||
|
|
@ -25,6 +29,11 @@
|
||||||
|
|
||||||
|
|
||||||
<h2><?=sprintf(_('%s-Quests'),$groupsgroup['name'])?></h2>
|
<h2><?=sprintf(_('%s-Quests'),$groupsgroup['name'])?></h2>
|
||||||
|
<?php if(count(array_intersect(array('admin', 'moderator'), \hhu\z\controllers\SeminaryController::$character['characterroles'])) > 0) : ?>
|
||||||
|
<nav class="admin">
|
||||||
|
<li><a href="<?=$linker->link(array('charactergroupsquests','create',$seminary['url'],$groupsgroup['url']))?>"><?=sprintf(_('Create new %s-Quest'), $groupsgroup['name'])?></a></li>
|
||||||
|
</nav>
|
||||||
|
<?php endif ?>
|
||||||
<ul class="cgqlist">
|
<ul class="cgqlist">
|
||||||
<?php foreach($quests as &$quest) : ?>
|
<?php foreach($quests as &$quest) : ?>
|
||||||
<li><a href="<?=$linker->link(array('charactergroupsquests','quest',$seminary['url'],$groupsgroup['url'],$quest['url']))?>"><?=$quest['title']?></a></li>
|
<li><a href="<?=$linker->link(array('charactergroupsquests','quest',$seminary['url'],$groupsgroup['url'],$quest['url']))?>"><?=$quest['title']?></a></li>
|
||||||
|
|
|
||||||
76
views/html/charactergroupsquests/create.tpl
Normal file
76
views/html/charactergroupsquests/create.tpl
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?php if(!is_null($seminary['charactergroups_seminarymedia_id'])) : ?>
|
||||||
|
<div class="moodpic">
|
||||||
|
<img src="<?=$linker->link(array('media','seminarymoodpic',$seminary['url'], 'charactergroups'))?>">
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
<ul class="breadcrumbs">
|
||||||
|
<li><a href="<?=$linker->link(array('seminaries',$seminary['url']))?>"><?=$seminary['title']?></a></li>
|
||||||
|
<li><i class="fa fa-chevron-right fa-fw"></i><a href="<?=$linker->link(array('charactergroups','index',$seminary['url']))?>"><?=_('Character Groups')?></a></li>
|
||||||
|
<li><i class="fa fa-chevron-right fa-fw"></i><a href="<?=$linker->link(array('charactergroups','groupsgroup',$seminary['url'],$groupsgroup['url']))?>"><?=$groupsgroup['name']?></a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h1><?=sprintf(_('New %s-Quest'), $groupsgroup['name'])?></h1>
|
||||||
|
<?php if($validation !== true) : ?>
|
||||||
|
<ul>
|
||||||
|
<?php foreach($validation as $field => &$settings) : ?>
|
||||||
|
<li>
|
||||||
|
<ul>
|
||||||
|
<?php foreach($settings as $setting => $value) : ?>
|
||||||
|
<li>
|
||||||
|
<?php switch($field) {
|
||||||
|
case 'title':
|
||||||
|
switch($setting) {
|
||||||
|
case 'minlength': printf(_('Title is too short (min. %d chars)'), $value);
|
||||||
|
break;
|
||||||
|
case 'maxlength': printf(_('Title is too long (max. %d chars)'), $value);
|
||||||
|
break;
|
||||||
|
case 'regex': echo _('Title contains illegal characters');
|
||||||
|
break;
|
||||||
|
case 'exist': echo _('Title already exists');
|
||||||
|
break;
|
||||||
|
default: echo _('Title invalid');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'xps':
|
||||||
|
switch($setting) {
|
||||||
|
case 'minlength': printf(_('XPs not set'), $value);
|
||||||
|
break;
|
||||||
|
case 'regex': echo _('XPs contain illegal characters');
|
||||||
|
break;
|
||||||
|
default: echo _('XPs invalid');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo $exception->getMessage();
|
||||||
|
break;
|
||||||
|
} ?>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif ?>
|
||||||
|
<form method="post" action="" class="logreg">
|
||||||
|
<fieldset>
|
||||||
|
<label for="title"><?=_('Title')?>:</label>
|
||||||
|
<input type="text" id="title" name="title" placeholder="<?=_('Title')?>" title="<?=_('Title')?>" maxlength="<?=$validationSettings['title']['maxlength']?>" value="<?=$title?>" />
|
||||||
|
<label for="xps"><?=_('XPs')?>:</label>
|
||||||
|
<input type="xps" id="xps" name="xps" placeholder="<?=_('XPs')?>" title="<?=_('XPs')?>" pattern="<?=substr($validationSettings['xps']['regex'],1,strrpos($validationSettings['xps']['regex'],$validationSettings['xps']['regex'][0])-1)?>" value="<?=$xps?>" <?=(array_key_exists('title', $validation)) ? 'class="invalid"' : null?> />
|
||||||
|
<label for="questgroup"><?=_('Questgroup')?></label>
|
||||||
|
<select id="questgroup" name="questgroup">
|
||||||
|
<?php foreach($questgroups as &$questgroup) : ?>
|
||||||
|
<option value="<?=$questgroup['url']?>" <?php if(array_key_exists('selected', $questgroup) && $questgroup['selected']) : ?>selected="selected"<?php endif ?>><?=$questgroup['title']?></option>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</select>
|
||||||
|
<label for="description"><?=_('Description')?>:</label>
|
||||||
|
<textarea id="description" name="description" placeholder="<?=_('Description')?>"><?=$description?></textarea>
|
||||||
|
<label for="rules"><?=_('Rules')?>:</label>
|
||||||
|
<textarea id="rules" name="rules" placeholder="<?=_('Rules')?>"><?=$rules?></textarea>
|
||||||
|
<label for="wonText"><?=_('Won-text')?>:</label>
|
||||||
|
<textarea id="wonText" name="wonText" placeholder="<?=_('Won-text')?>"><?=$wonText?></textarea>
|
||||||
|
<label for="lostText"><?=_('Lost-text')?>:</label>
|
||||||
|
<textarea id="lostText" name="lostText" placeholder="<?=_('Lost-text')?>"><?=$lostText?></textarea>
|
||||||
|
</fieldset>
|
||||||
|
<input type="submit" name="create" value="<?=_('create')?>" />
|
||||||
|
</form>
|
||||||
17
views/html/charactergroupsquests/delete.tpl
Normal file
17
views/html/charactergroupsquests/delete.tpl
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php if(!is_null($seminary['charactergroups_seminarymedia_id'])) : ?>
|
||||||
|
<div class="moodpic">
|
||||||
|
<img src="<?=$linker->link(array('media','seminarymoodpic',$seminary['url'], 'charactergroups'))?>">
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
<ul class="breadcrumbs">
|
||||||
|
<li><a href="<?=$linker->link(array('seminaries',$seminary['url']))?>"><?=$seminary['title']?></a></li>
|
||||||
|
<li><i class="fa fa-chevron-right fa-fw"></i><a href="<?=$linker->link(array('charactergroups','index',$seminary['url']))?>"><?=_('Character Groups')?></a></li>
|
||||||
|
<li><i class="fa fa-chevron-right fa-fw"></i><a href="<?=$linker->link(array('charactergroups','groupsgroup',$seminary['url'],$groupsgroup['url']))?>"><?=$groupsgroup['name']?></a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h1><?=sprintf(_('Delete %s-Quest'), $groupsgroup['name'])?></h1>
|
||||||
|
<?=sprintf(_('Should the %s-Quest “%s” really be deleted?'), $groupsgroup['name'], $quest['title'])?>
|
||||||
|
<form method="post">
|
||||||
|
<input type="submit" name="delete" value="<?=_('delete')?>" />
|
||||||
|
<input type="submit" name="not-delete" value="<?=_('cancel')?>" />
|
||||||
|
</form>
|
||||||
76
views/html/charactergroupsquests/edit.tpl
Normal file
76
views/html/charactergroupsquests/edit.tpl
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?php if(!is_null($seminary['charactergroups_seminarymedia_id'])) : ?>
|
||||||
|
<div class="moodpic">
|
||||||
|
<img src="<?=$linker->link(array('media','seminarymoodpic',$seminary['url'], 'charactergroups'))?>">
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
<ul class="breadcrumbs">
|
||||||
|
<li><a href="<?=$linker->link(array('seminaries',$seminary['url']))?>"><?=$seminary['title']?></a></li>
|
||||||
|
<li><i class="fa fa-chevron-right fa-fw"></i><a href="<?=$linker->link(array('charactergroups','index',$seminary['url']))?>"><?=_('Character Groups')?></a></li>
|
||||||
|
<li><i class="fa fa-chevron-right fa-fw"></i><a href="<?=$linker->link(array('charactergroups','groupsgroup',$seminary['url'],$groupsgroup['url']))?>"><?=$groupsgroup['name']?></a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h1><?=sprintf(_('Edit %s-Quest'), $groupsgroup['name'])?></h1>
|
||||||
|
<?php if($validation !== true) : ?>
|
||||||
|
<ul>
|
||||||
|
<?php foreach($validation as $field => &$settings) : ?>
|
||||||
|
<li>
|
||||||
|
<ul>
|
||||||
|
<?php foreach($settings as $setting => $value) : ?>
|
||||||
|
<li>
|
||||||
|
<?php switch($field) {
|
||||||
|
case 'title':
|
||||||
|
switch($setting) {
|
||||||
|
case 'minlength': printf(_('Title is too short (min. %d chars)'), $value);
|
||||||
|
break;
|
||||||
|
case 'maxlength': printf(_('Title is too long (max. %d chars)'), $value);
|
||||||
|
break;
|
||||||
|
case 'regex': echo _('Title contains illegal characters');
|
||||||
|
break;
|
||||||
|
case 'exist': echo _('Title already exists');
|
||||||
|
break;
|
||||||
|
default: echo _('Title invalid');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'xps':
|
||||||
|
switch($setting) {
|
||||||
|
case 'minlength': printf(_('XPs not set'), $value);
|
||||||
|
break;
|
||||||
|
case 'regex': echo _('XPs contain illegal characters');
|
||||||
|
break;
|
||||||
|
default: echo _('XPs invalid');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo $exception->getMessage();
|
||||||
|
break;
|
||||||
|
} ?>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif ?>
|
||||||
|
<form method="post" action="" class="logreg">
|
||||||
|
<fieldset>
|
||||||
|
<label for="title"><?=_('Title')?>:</label>
|
||||||
|
<input type="text" id="title" name="title" placeholder="<?=_('Title')?>" title="<?=_('Title')?>" maxlength="<?=$validationSettings['title']['maxlength']?>" value="<?=$title?>" />
|
||||||
|
<label for="xps"><?=_('XPs')?>:</label>
|
||||||
|
<input type="xps" id="xps" name="xps" placeholder="<?=_('XPs')?>" title="<?=_('XPs')?>" pattern="<?=substr($validationSettings['xps']['regex'],1,strrpos($validationSettings['xps']['regex'],$validationSettings['xps']['regex'][0])-1)?>" value="<?=$xps?>" <?=(array_key_exists('title', $validation)) ? 'class="invalid"' : null?> />
|
||||||
|
<label for="questgroup"><?=_('Questgroup')?></label>
|
||||||
|
<select id="questgroup" name="questgroup">
|
||||||
|
<?php foreach($questgroups as &$questgroup) : ?>
|
||||||
|
<option value="<?=$questgroup['url']?>" <?php if(array_key_exists('selected', $questgroup) && $questgroup['selected']) : ?>selected="selected"<?php endif ?>><?=$questgroup['title']?></option>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</select>
|
||||||
|
<label for="description"><?=_('Description')?>:</label>
|
||||||
|
<textarea id="description" name="description" placeholder="<?=_('Description')?>"><?=$description?></textarea>
|
||||||
|
<label for="rules"><?=_('Rules')?>:</label>
|
||||||
|
<textarea id="rules" name="rules" placeholder="<?=_('Rules')?>"><?=$rules?></textarea>
|
||||||
|
<label for="wonText"><?=_('Won-text')?>:</label>
|
||||||
|
<textarea id="wonText" name="wonText" placeholder="<?=_('Won-text')?>"><?=$wonText?></textarea>
|
||||||
|
<label for="lostText"><?=_('Lost-text')?>:</label>
|
||||||
|
<textarea id="lostText" name="lostText" placeholder="<?=_('Lost-text')?>"><?=$lostText?></textarea>
|
||||||
|
</fieldset>
|
||||||
|
<input type="submit" name="edit" value="<?=_('edit')?>" />
|
||||||
|
</form>
|
||||||
|
|
@ -9,8 +9,16 @@
|
||||||
<li><i class="fa fa-chevron-right fa-fw"></i><a href="<?=$linker->link(array('charactergroups','groupsgroup',$seminary['url'],$groupsgroup['url']))?>"><?=$groupsgroup['name']?></a></li>
|
<li><i class="fa fa-chevron-right fa-fw"></i><a href="<?=$linker->link(array('charactergroups','groupsgroup',$seminary['url'],$groupsgroup['url']))?>"><?=$groupsgroup['name']?></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<?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']),1)?>"><?=sprintf(_('Edit %s-Quest'), $groupsgroup['name'])?></a></li>
|
||||||
|
<li><a href="<?=$linker->link(array('delete',$seminary['url'],$groupsgroup['url'],$quest['url']),1)?>"><?=sprintf(_('Delete %s-Quest'), $groupsgroup['name'])?></a></li>
|
||||||
|
</nav>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
<h1><?=$quest['title']?></h1>
|
<h1><?=$quest['title']?></h1>
|
||||||
<small>Maximale Belohnung: <span class="fwb"><?=$quest['xps']?> XP</span></small>
|
<small><?=_('Maximum reward')?>: <span class="fwb"><?=$quest['xps']?> XP</span></small><br />
|
||||||
|
<small><?=_('Questgroup')?>: <?php if($questgroup['entered']) : ?><a href="<?=$linker->link(array('questgroups','questgroup',$seminary['url'],$questgroup['url']))?>"><?=$questgroup['title']?></a><?php else : ?><?=$questgroup['title']?><?php endif ?></small>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h1><i class="fa fa-envelope fa-fw"></i><?=_('Description')?></h1>
|
<h1><i class="fa fa-envelope fa-fw"></i><?=_('Description')?></h1>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue