implement CRUD for Questtopics (library) (Issue #290)
This commit is contained in:
parent
294731e8e2
commit
bc63775920
11 changed files with 752 additions and 26 deletions
|
|
@ -234,8 +234,9 @@
|
||||||
array('^charactergroupsquests/([^/]+)/([^/]+)/([^/]+)/(edit|delete|manage)/?$', 'charactergroupsquests/$4/$1/$2/$3', true),
|
array('^charactergroupsquests/([^/]+)/([^/]+)/([^/]+)/(edit|delete|manage)/?$', '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/([^/]+)/create/?$', 'library/create/$1', true),
|
||||||
array('^library/([^/]+)/([^/]+)/?$', 'library/topic/$1/$2', true),
|
array('^library/([^/]+)/([^/]+)/?$', 'library/topic/$1/$2', true),
|
||||||
array('^library/([^/]+)/([^/]+)/manage/?$', 'library/managetopic/$1/$2', true),
|
array('^library/([^/]+)/([^/]+)/(edit|delete|manage)/?$', 'library/$3/$1/$2', true),
|
||||||
array('^media/(.*)$', 'media/$1?layout=binary', false),
|
array('^media/(.*)$', 'media/$1?layout=binary', false),
|
||||||
array('^uploads/(.*)$', 'uploads/$1?layout=binary', false)
|
array('^uploads/(.*)$', 'uploads/$1?layout=binary', false)
|
||||||
);
|
);
|
||||||
|
|
@ -272,8 +273,10 @@
|
||||||
array('^charactergroupsquests/quest/(.*)$', 'charactergroupsquests/$1', true),
|
array('^charactergroupsquests/quest/(.*)$', 'charactergroupsquests/$1', true),
|
||||||
array('^charactergroupsquests/(edit|delete|manage)/([^/]+)/([^/]+)/([^/]+)$', 'charactergroupsquests/$2/$3/$4/$1', true),
|
array('^charactergroupsquests/(edit|delete|manage)/([^/]+)/([^/]+)/([^/]+)$', '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/([^/]+)/?$', 'library/$1', true),
|
||||||
array('^library/managetopic/(.*)$', 'library/$1/manage', true)
|
array('^library/create/([^/]+)/?$', 'library/$1/create', true),
|
||||||
|
array('^library/topic/([^/]+)/([^/]+)/?$', 'library/$1/$2', true),
|
||||||
|
array('^library/(edit|delete|manage)/([^/]+)/([^/]+)/?$', 'library/$2/$3/$1', true)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,12 @@
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $models = array('questtopics', 'seminaries', 'quests', 'questgroups');
|
public $models = array('questtopics', 'seminaries', 'quests', 'questgroups');
|
||||||
|
/**
|
||||||
|
* Required components
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $components = array('validation');
|
||||||
/**
|
/**
|
||||||
* User permissions
|
* User permissions
|
||||||
*
|
*
|
||||||
|
|
@ -33,7 +39,10 @@
|
||||||
public $permissions = array(
|
public $permissions = array(
|
||||||
'index' => array('admin', 'moderator', 'user'),
|
'index' => array('admin', 'moderator', 'user'),
|
||||||
'topic' => array('admin', 'moderator', 'user'),
|
'topic' => array('admin', 'moderator', 'user'),
|
||||||
'managetopic' => array('admin', 'moderator', 'user')
|
'manage' => array('admin', 'moderator', 'user'),
|
||||||
|
'create' => array('admin', 'moderator', 'user'),
|
||||||
|
'edit' => array('admin', 'moderator', 'user'),
|
||||||
|
'delete' => array('admin', 'moderator', 'user')
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* User seminary permissions
|
* User seminary permissions
|
||||||
|
|
@ -43,7 +52,10 @@
|
||||||
public $seminaryPermissions = array(
|
public $seminaryPermissions = array(
|
||||||
'index' => array('admin', 'moderator', 'user', 'guest'),
|
'index' => array('admin', 'moderator', 'user', 'guest'),
|
||||||
'topic' => array('admin', 'moderator', 'user', 'guest'),
|
'topic' => array('admin', 'moderator', 'user', 'guest'),
|
||||||
'managetopic' => array('admin', 'moderator')
|
'manage' => array('admin', 'moderator'),
|
||||||
|
'create' => array('admin', 'moderator'),
|
||||||
|
'edit' => array('admin', 'moderator'),
|
||||||
|
'delete' => array('admin', 'moderator')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -142,7 +154,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action: managetopic.
|
* Action: manage.
|
||||||
*
|
*
|
||||||
* Manage a Questtopic and its Quests with Questsubtopics.
|
* Manage a Questtopic and its Quests with Questsubtopics.
|
||||||
*
|
*
|
||||||
|
|
@ -150,7 +162,7 @@
|
||||||
* @param string $eminaryUrl URL-Title of Seminary
|
* @param string $eminaryUrl URL-Title of Seminary
|
||||||
* @param string $questtopicUrl URL-Title of Questtopic
|
* @param string $questtopicUrl URL-Title of Questtopic
|
||||||
*/
|
*/
|
||||||
public function managetopic($seminaryUrl, $questtopicUrl)
|
public function manage($seminaryUrl, $questtopicUrl)
|
||||||
{
|
{
|
||||||
// Get Seminary
|
// Get Seminary
|
||||||
$seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl);
|
$seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl);
|
||||||
|
|
@ -214,6 +226,288 @@
|
||||||
$this->set('allQuests', $allQuests);
|
$this->set('allQuests', $allQuests);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action: create.
|
||||||
|
*
|
||||||
|
* Create a new Questtopic for a Seminary.
|
||||||
|
*
|
||||||
|
* @throws IdNotFoundException
|
||||||
|
* @param string $seminaryUrl URL-Title of Seminary
|
||||||
|
*/
|
||||||
|
public function create($seminaryUrl)
|
||||||
|
{
|
||||||
|
// Get Seminary
|
||||||
|
$seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl);
|
||||||
|
|
||||||
|
// Values
|
||||||
|
$title = '';
|
||||||
|
$fields = array('title');
|
||||||
|
$validation = array();
|
||||||
|
|
||||||
|
// Create new Questtopic
|
||||||
|
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->Questtopics->questtopicTitleExists($title)) {
|
||||||
|
$validation = $this->Validation->addValidationResult($validation, 'title', 'exist', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create
|
||||||
|
if($validation === true)
|
||||||
|
{
|
||||||
|
$questtopicId = $this->Questtopics->createQuesttopic(
|
||||||
|
$this->Auth->getUserId(),
|
||||||
|
$seminary['id'],
|
||||||
|
$title
|
||||||
|
);
|
||||||
|
$questtopic = $this->Questtopics->getQuesttopicById($questtopicId);
|
||||||
|
|
||||||
|
// Redirect to Questtopic
|
||||||
|
$this->redirect($this->linker->link(array('topic', $seminary['url'], $questtopic['url']), 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get validation settings
|
||||||
|
$validationSettings = array();
|
||||||
|
foreach($fields as &$field) {
|
||||||
|
$validationSettings[$field] = \nre\configs\AppConfig::$validation[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set title
|
||||||
|
$this->addTitleLocalized('New Questtopic');
|
||||||
|
$this->addTitleLocalized('Library');
|
||||||
|
$this->addTitle($seminary['title']);
|
||||||
|
|
||||||
|
// Pass data to view
|
||||||
|
$this->set('seminary', $seminary);
|
||||||
|
$this->set('title', $title);
|
||||||
|
$this->set('validation', $validation);
|
||||||
|
$this->set('validationSettings', $validationSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action: edit.
|
||||||
|
*
|
||||||
|
* Edit a Questtopic of a Seminary and its Questsubtopics.
|
||||||
|
*
|
||||||
|
* @throws IdNotFoundException
|
||||||
|
* @param string $eminaryUrl URL-Title of Seminary
|
||||||
|
* @param string $questtopicUrl URL-Title of Questtopic
|
||||||
|
*/
|
||||||
|
public function edit($seminaryUrl, $questtopicUrl)
|
||||||
|
{
|
||||||
|
// Get Seminary
|
||||||
|
$seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl);
|
||||||
|
|
||||||
|
// Get Questtopic
|
||||||
|
$questtopic = $this->Questtopics->getQuesttopicByUrl($seminary['id'], $questtopicUrl);
|
||||||
|
|
||||||
|
// Get Questsubtopics
|
||||||
|
$questsubtopics = $this->Questtopics->getSubtopicsForQuesttopic($questtopic['id']);
|
||||||
|
|
||||||
|
// Values
|
||||||
|
$questtopicTitle = $questtopic['title'];
|
||||||
|
$subtopicsTitles = array();
|
||||||
|
foreach($questsubtopics as &$questsubtopic) {
|
||||||
|
$subtopicsTitles[$questsubtopic['id']] = $questsubtopic['title'];
|
||||||
|
}
|
||||||
|
$deleteSubtopics = null;
|
||||||
|
$subtopicTitle = '';
|
||||||
|
$validations = array(
|
||||||
|
'edit' => true,
|
||||||
|
'edit-subtopics' => true,
|
||||||
|
'create-subtopic' => true
|
||||||
|
);
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
$action = null;
|
||||||
|
if($this->request->getRequestMethod() == 'POST')
|
||||||
|
{
|
||||||
|
// Edit Questtopic
|
||||||
|
if(!is_null($this->request->getPostParam('edit')))
|
||||||
|
{
|
||||||
|
$action = 'edit';
|
||||||
|
|
||||||
|
// Get params and validate them
|
||||||
|
$validations[$action] = $this->Validation->validateParams($this->request->getPostParams(), array('title'));
|
||||||
|
$questtopicTitle = $this->request->getPostParam('title');
|
||||||
|
if($this->Questtopics->questsubtopicTitleExists($questtopicTitle, $questtopic['id'])) {
|
||||||
|
$validations[$action] = $this->Validation->addValidationResult($validations[$action], 'title', 'exist', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
if($validations[$action] === true)
|
||||||
|
{
|
||||||
|
$this->Questtopics->editQuesttopic(
|
||||||
|
$questtopic['id'],
|
||||||
|
$questtopicTitle
|
||||||
|
);
|
||||||
|
$questtopic = $this->Questtopics->getQuesttopicById($questtopic['id']);
|
||||||
|
|
||||||
|
// Redirect
|
||||||
|
$this->redirect($this->linker->link(array('topic', $seminary['url'], $questtopic['url']), 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit and delete Questsubtopics
|
||||||
|
elseif(!is_null($this->request->getPostParam('edit-subtopics')))
|
||||||
|
{
|
||||||
|
$action = 'edit-subtopics';
|
||||||
|
|
||||||
|
// Get params and validate them
|
||||||
|
$subtopicsTitles = $this->request->getPostParam('subtopics');
|
||||||
|
$deleteSubtopics = $this->request->getPostParam('delete-subtopics');
|
||||||
|
foreach($questsubtopics as &$questsubtopic)
|
||||||
|
{
|
||||||
|
if(!is_null($deleteSubtopics) && array_key_exists($questsubtopic['id'], $deleteSubtopics)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = $subtopicsTitles[$questsubtopic['id']];
|
||||||
|
$subtopicValidation = $this->Validation->validate($title, \nre\configs\AppConfig::$validation['title']);
|
||||||
|
if($subtopicValidation !== true)
|
||||||
|
{
|
||||||
|
if(!is_array($validations['edit-subtopics'])) {
|
||||||
|
$validations['edit-subtopics'] = array();
|
||||||
|
}
|
||||||
|
if(!array_key_exists($questsubtopic['id'], $validations['edit-subtopics']) || !is_array($validations['edit-subtopics'][$questsubtopic['id']])) {
|
||||||
|
$validations['edit-subtopics'][$questsubtopic['id']] = array();
|
||||||
|
}
|
||||||
|
//$validations['edit-subtopics'][$questsubtopic['id']]['title'] = $subtopicValidation;
|
||||||
|
$validations['edit-subtopics'][$questsubtopic['id']] = $this->Validation->addValidationResults($validations['edit-subtopics'][$questsubtopic['id']], 'title', $subtopicValidation);
|
||||||
|
}
|
||||||
|
if($this->Questtopics->questsubtopicTitleExists($questtopic['id'], $title, $questsubtopic['id']))
|
||||||
|
{
|
||||||
|
if(!is_array($validations['edit-subtopics'])) {
|
||||||
|
$validations['edit-subtopics'] = array();
|
||||||
|
}
|
||||||
|
if(!array_key_exists($questsubtopic['id'], $validations['edit-subtopics']) || !is_array($validations['edit-subtopics'][$questsubtopic['id']])) {
|
||||||
|
$validations['edit-subtopics'][$questsubtopic['id']] = array();
|
||||||
|
}
|
||||||
|
$validations['edit-subtopics'][$questsubtopic['id']] = $this->Validation->addValidationResult($validations['edit-subtopics'][$questsubtopic['id']], 'title', 'exist', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit and delete
|
||||||
|
if($validations['edit-subtopics'] === true)
|
||||||
|
{
|
||||||
|
foreach($questsubtopics as &$questsubtopic)
|
||||||
|
{
|
||||||
|
// Delete
|
||||||
|
if(!is_null($deleteSubtopics) && array_key_exists($questsubtopic['id'], $deleteSubtopics)) {
|
||||||
|
$this->Questtopics->deleteQuestsubtopic($questsubtopic['id']);
|
||||||
|
}
|
||||||
|
// Edit
|
||||||
|
elseif(!is_null($subtopicsTitles) && array_key_exists($questsubtopic['id'], $subtopicsTitles))
|
||||||
|
{
|
||||||
|
$title = $subtopicsTitles[$questsubtopic['id']];
|
||||||
|
$this->Questtopics->editQuestsubtopic($questsubtopic['id'], $title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Redirect
|
||||||
|
$this->redirect($this->linker->link(array($seminary['url'], $questtopic['url']), 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create Questsubtopic
|
||||||
|
elseif(!is_null($this->request->getPostParam('create-subtopic')))
|
||||||
|
{
|
||||||
|
$action = 'create-subtopic';
|
||||||
|
|
||||||
|
// Get params and validate them
|
||||||
|
$validations[$action] = $this->Validation->validateParams($this->request->getPostParams(), array('title'));
|
||||||
|
$subtopicTitle = $this->request->getPostParam('title');
|
||||||
|
if($this->Questtopics->questsubtopicTitleExists($questtopic['id'], $subtopicTitle)) {
|
||||||
|
$validations[$action] = $this->Validation->addValidationResult($validations[$action], 'title', 'exist', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create
|
||||||
|
if($validations[$action] === true)
|
||||||
|
{
|
||||||
|
$this->Questtopics->createQuestsubtopic(
|
||||||
|
$this->Auth->getUserId(),
|
||||||
|
$questtopic['id'],
|
||||||
|
$subtopicTitle
|
||||||
|
);
|
||||||
|
$subtopicTitle = '';
|
||||||
|
|
||||||
|
// Redirect
|
||||||
|
$this->redirect($this->linker->link(null, 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get validation settings
|
||||||
|
$validationSettings = array(
|
||||||
|
'title' => \nre\configs\AppConfig::$validation['title']
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Set title
|
||||||
|
$this->addTitleLocalized('Edit Questtopic');
|
||||||
|
$this->addTitleLocalized('Library');
|
||||||
|
$this->addTitle($seminary['title']);
|
||||||
|
|
||||||
|
// Pass data to view
|
||||||
|
$this->set('seminary', $seminary);
|
||||||
|
$this->set('questtopicTitle', $questtopicTitle);
|
||||||
|
$this->set('subtopicsTitles', $subtopicsTitles);
|
||||||
|
$this->set('deleteSubtopics', $deleteSubtopics);
|
||||||
|
$this->set('subtopicTitle', $subtopicTitle);
|
||||||
|
$this->set('action', $action);
|
||||||
|
$this->set('validations', $validations);
|
||||||
|
$this->set('validationSettings', $validationSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action: delete.
|
||||||
|
*
|
||||||
|
* Delete a Questtopic of a Seminary.
|
||||||
|
*
|
||||||
|
* @throws IdNotFoundException
|
||||||
|
* @param string $eminaryUrl URL-Title of Seminary
|
||||||
|
* @param string $questtopicUrl URL-Title of Questtopic
|
||||||
|
*/
|
||||||
|
public function delete($seminaryUrl, $questtopicUrl)
|
||||||
|
{
|
||||||
|
// Get Seminary
|
||||||
|
$seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl);
|
||||||
|
|
||||||
|
// Get Questtopic
|
||||||
|
$questtopic = $this->Questtopics->getQuesttopicByUrl($seminary['id'], $questtopicUrl);
|
||||||
|
|
||||||
|
// Check request method
|
||||||
|
if($this->request->getRequestMethod() == 'POST')
|
||||||
|
{
|
||||||
|
// Check confirmation
|
||||||
|
if(!is_null($this->request->getPostParam('delete')))
|
||||||
|
{
|
||||||
|
// Delete seminary
|
||||||
|
$this->Questtopics->deleteQuesttopic($questtopic['id']);
|
||||||
|
|
||||||
|
// Redirect to overview
|
||||||
|
$this->redirect($this->linker->link(array('index', $seminary['url']), 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set title
|
||||||
|
$this->addTitleLocalized('Delete Questtopic');
|
||||||
|
$this->addTitleLocalized('Library');
|
||||||
|
$this->addTitle($seminary['title']);
|
||||||
|
|
||||||
|
// Pass data to view
|
||||||
|
$this->set('seminary', $seminary);
|
||||||
|
$this->set('questtopic', $questtopic);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
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-05-16 00:20+0100\n"
|
"POT-Creation-Date: 2014-05-17 13:42+0100\n"
|
||||||
"PO-Revision-Date: 2014-05-16 00:21+0100\n"
|
"PO-Revision-Date: 2014-05-17 13:43+0100\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"Language: de_DE\n"
|
"Language: de_DE\n"
|
||||||
|
|
@ -343,7 +343,8 @@ msgstr "Motto"
|
||||||
#: views/html/charactergroups/creategroup.tpl:77
|
#: views/html/charactergroups/creategroup.tpl:77
|
||||||
#: views/html/charactergroups/creategroupsgroup.tpl:50
|
#: views/html/charactergroups/creategroupsgroup.tpl:50
|
||||||
#: views/html/charactergroupsquests/create.tpl:93
|
#: views/html/charactergroupsquests/create.tpl:93
|
||||||
#: views/html/characters/register.tpl:94 views/html/questgroups/create.tpl:17
|
#: views/html/characters/register.tpl:94 views/html/library/create.tpl:46
|
||||||
|
#: views/html/library/edit.tpl:124 views/html/questgroups/create.tpl:17
|
||||||
#: views/html/quests/create.tpl:43 views/html/seminaries/create.tpl:14
|
#: views/html/quests/create.tpl:43 views/html/seminaries/create.tpl:14
|
||||||
#: views/html/users/create.tpl:96
|
#: views/html/users/create.tpl:96
|
||||||
msgid "create"
|
msgid "create"
|
||||||
|
|
@ -372,7 +373,8 @@ msgstr "Soll die %s-Gruppen „%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/charactergroupsquests/delete.tpl:15
|
||||||
#: views/html/characters/delete.tpl:17 views/html/seminaries/delete.tpl:13
|
#: views/html/characters/delete.tpl:17 views/html/library/delete.tpl:14
|
||||||
|
#: views/html/library/edit.tpl:83 views/html/seminaries/delete.tpl:13
|
||||||
#: views/html/users/delete.tpl:11
|
#: views/html/users/delete.tpl:11
|
||||||
msgid "delete"
|
msgid "delete"
|
||||||
msgstr "löschen"
|
msgstr "löschen"
|
||||||
|
|
@ -380,8 +382,8 @@ 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/charactergroupsquests/delete.tpl:16
|
||||||
#: views/html/characters/delete.tpl:18 views/html/seminaries/delete.tpl:14
|
#: views/html/characters/delete.tpl:18 views/html/library/delete.tpl:15
|
||||||
#: views/html/users/delete.tpl:12
|
#: views/html/seminaries/delete.tpl:14 views/html/users/delete.tpl:12
|
||||||
msgid "cancel"
|
msgid "cancel"
|
||||||
msgstr "abbrechen"
|
msgstr "abbrechen"
|
||||||
|
|
||||||
|
|
@ -510,28 +512,38 @@ msgstr "Neue %s-Quest"
|
||||||
|
|
||||||
#: views/html/charactergroupsquests/create.tpl:34
|
#: views/html/charactergroupsquests/create.tpl:34
|
||||||
#: views/html/charactergroupsquests/edit.tpl:34
|
#: views/html/charactergroupsquests/edit.tpl:34
|
||||||
|
#: views/html/library/create.tpl:22 views/html/library/edit.tpl:22
|
||||||
|
#: views/html/library/edit.tpl:62 views/html/library/edit.tpl:100
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "Title is too short (min. %d chars)"
|
msgid "Title is too short (min. %d chars)"
|
||||||
msgstr "Der Titel ist zu kurz (min. %d Zeichen)"
|
msgstr "Der Titel ist zu kurz (min. %d Zeichen)"
|
||||||
|
|
||||||
#: views/html/charactergroupsquests/create.tpl:36
|
#: views/html/charactergroupsquests/create.tpl:36
|
||||||
#: views/html/charactergroupsquests/edit.tpl:36
|
#: views/html/charactergroupsquests/edit.tpl:36
|
||||||
|
#: views/html/library/create.tpl:24 views/html/library/edit.tpl:24
|
||||||
|
#: views/html/library/edit.tpl:64 views/html/library/edit.tpl:102
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "Title is too long (max. %d chars)"
|
msgid "Title is too long (max. %d chars)"
|
||||||
msgstr "Der Titel ist zu lang (max. %d Zeichen)"
|
msgstr "Der Titel ist zu lang (max. %d Zeichen)"
|
||||||
|
|
||||||
#: views/html/charactergroupsquests/create.tpl:38
|
#: views/html/charactergroupsquests/create.tpl:38
|
||||||
#: views/html/charactergroupsquests/edit.tpl:38
|
#: views/html/charactergroupsquests/edit.tpl:38
|
||||||
|
#: views/html/library/create.tpl:26 views/html/library/edit.tpl:26
|
||||||
|
#: views/html/library/edit.tpl:66 views/html/library/edit.tpl:104
|
||||||
msgid "Title contains illegal characters"
|
msgid "Title contains illegal characters"
|
||||||
msgstr "Der Titel enthält ungültige Zeichen"
|
msgstr "Der Titel enthält ungültige Zeichen"
|
||||||
|
|
||||||
#: views/html/charactergroupsquests/create.tpl:40
|
#: views/html/charactergroupsquests/create.tpl:40
|
||||||
#: views/html/charactergroupsquests/edit.tpl:40
|
#: views/html/charactergroupsquests/edit.tpl:40
|
||||||
|
#: views/html/library/create.tpl:28 views/html/library/edit.tpl:28
|
||||||
|
#: views/html/library/edit.tpl:68 views/html/library/edit.tpl:106
|
||||||
msgid "Title already exists"
|
msgid "Title already exists"
|
||||||
msgstr "Der Titel existiert bereits"
|
msgstr "Der Titel existiert bereits"
|
||||||
|
|
||||||
#: views/html/charactergroupsquests/create.tpl:42
|
#: views/html/charactergroupsquests/create.tpl:42
|
||||||
#: views/html/charactergroupsquests/edit.tpl:42
|
#: views/html/charactergroupsquests/edit.tpl:42
|
||||||
|
#: views/html/library/create.tpl:30 views/html/library/edit.tpl:30
|
||||||
|
#: views/html/library/edit.tpl:70 views/html/library/edit.tpl:108
|
||||||
msgid "Title invalid"
|
msgid "Title invalid"
|
||||||
msgstr "Der Titel ist ungültig"
|
msgstr "Der Titel ist ungültig"
|
||||||
|
|
||||||
|
|
@ -555,6 +567,9 @@ msgstr "Die XP-Angabe ist ungültig"
|
||||||
#: views/html/charactergroupsquests/create.tpl:75
|
#: views/html/charactergroupsquests/create.tpl:75
|
||||||
#: views/html/charactergroupsquests/edit.tpl:75
|
#: views/html/charactergroupsquests/edit.tpl:75
|
||||||
#: views/html/charactergroupsquests/edit.tpl:76
|
#: views/html/charactergroupsquests/edit.tpl:76
|
||||||
|
#: views/html/library/create.tpl:43 views/html/library/create.tpl:44
|
||||||
|
#: views/html/library/edit.tpl:43 views/html/library/edit.tpl:44
|
||||||
|
#: views/html/library/edit.tpl:121 views/html/library/edit.tpl:122
|
||||||
#: views/html/questgroups/create.tpl:14 views/html/questgroups/create.tpl:15
|
#: views/html/questgroups/create.tpl:14 views/html/questgroups/create.tpl:15
|
||||||
#: views/html/seminaries/create.tpl:11 views/html/seminaries/create.tpl:12
|
#: views/html/seminaries/create.tpl:11 views/html/seminaries/create.tpl:12
|
||||||
#: views/html/seminaries/edit.tpl:13 views/html/seminaries/edit.tpl:14
|
#: views/html/seminaries/edit.tpl:13 views/html/seminaries/edit.tpl:14
|
||||||
|
|
@ -624,6 +639,7 @@ msgid "File invalid"
|
||||||
msgstr "Die Datei ist ungültig"
|
msgstr "Die Datei ist ungültig"
|
||||||
|
|
||||||
#: views/html/charactergroupsquests/manage.tpl:66
|
#: views/html/charactergroupsquests/manage.tpl:66
|
||||||
|
#: views/html/library/edit.tpl:46 views/html/library/edit.tpl:86
|
||||||
#: views/html/seminaries/edit.tpl:16 views/html/users/edit.tpl:103
|
#: views/html/seminaries/edit.tpl:16 views/html/users/edit.tpl:103
|
||||||
msgid "save"
|
msgid "save"
|
||||||
msgstr "speichern"
|
msgstr "speichern"
|
||||||
|
|
@ -732,7 +748,7 @@ msgstr "Das Kursfeld „%s“ ist ungültig"
|
||||||
msgid "Seminary fields"
|
msgid "Seminary fields"
|
||||||
msgstr "Kursfelder"
|
msgstr "Kursfelder"
|
||||||
|
|
||||||
#: views/html/characters/index.tpl:13 views/html/library/managetopic.tpl:26
|
#: views/html/characters/index.tpl:13 views/html/library/manage.tpl:39
|
||||||
#: views/html/users/index.tpl:7
|
#: views/html/users/index.tpl:7
|
||||||
msgid "Manage"
|
msgid "Manage"
|
||||||
msgstr "Verwalten"
|
msgstr "Verwalten"
|
||||||
|
|
@ -843,12 +859,43 @@ msgstr "Du hast Level %d erreicht"
|
||||||
msgid "Introduction"
|
msgid "Introduction"
|
||||||
msgstr "Einführung"
|
msgstr "Einführung"
|
||||||
|
|
||||||
#: views/html/library/index.tpl:9 views/html/library/managetopic.tpl:8
|
#: views/html/library/create.tpl:8 views/html/library/delete.tpl:8
|
||||||
#: views/html/library/topic.tpl:8 views/html/seminarymenu/index.tpl:7
|
#: views/html/library/edit.tpl:8 views/html/library/index.tpl:9
|
||||||
|
#: views/html/library/manage.tpl:8 views/html/library/topic.tpl:8
|
||||||
|
#: views/html/seminarymenu/index.tpl:7
|
||||||
msgid "Library"
|
msgid "Library"
|
||||||
msgstr "Bibliothek"
|
msgstr "Bibliothek"
|
||||||
|
|
||||||
#: views/html/library/index.tpl:10
|
#: views/html/library/create.tpl:10
|
||||||
|
msgid "New Questtopic"
|
||||||
|
msgstr "Neues Thema"
|
||||||
|
|
||||||
|
#: views/html/library/delete.tpl:11 views/html/library/topic.tpl:14
|
||||||
|
msgid "Delete Questtopic"
|
||||||
|
msgstr "Thema löschen"
|
||||||
|
|
||||||
|
#: views/html/library/delete.tpl:12
|
||||||
|
#, php-format
|
||||||
|
msgid "Should the Questtopic “%s” really be deleted?"
|
||||||
|
msgstr "Soll das Thema „%s“ wirklich gelöscht werden?"
|
||||||
|
|
||||||
|
#: views/html/library/edit.tpl:11 views/html/library/topic.tpl:13
|
||||||
|
msgid "Edit Questtopic"
|
||||||
|
msgstr "Thema bearbeiten"
|
||||||
|
|
||||||
|
#: views/html/library/edit.tpl:49
|
||||||
|
msgid "Edit Questsubtopics"
|
||||||
|
msgstr "Unterthemen bearbeiten"
|
||||||
|
|
||||||
|
#: views/html/library/edit.tpl:89
|
||||||
|
msgid "Create new Questsubtopic"
|
||||||
|
msgstr "Neues Unterthema erstellen"
|
||||||
|
|
||||||
|
#: views/html/library/index.tpl:12
|
||||||
|
msgid "Create new Questtopic"
|
||||||
|
msgstr "Neues Thema erstellen"
|
||||||
|
|
||||||
|
#: views/html/library/index.tpl:15
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "Library description, %s, %s"
|
msgid "Library description, %s, %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
@ -857,13 +904,17 @@ msgstr ""
|
||||||
"Umfang der Bibliothek, spiele also regelmäßig weiter und schalte so Quest "
|
"Umfang der Bibliothek, spiele also regelmäßig weiter und schalte so Quest "
|
||||||
"für Quest alle Inhalte frei."
|
"für Quest alle Inhalte frei."
|
||||||
|
|
||||||
#: views/html/library/index.tpl:12
|
#: views/html/library/index.tpl:17
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "Total progress: %d %%"
|
msgid "Total progress: %d %%"
|
||||||
msgstr "Gesamtfortschritt: %d%%"
|
msgstr "Gesamtfortschritt: %d%%"
|
||||||
|
|
||||||
#: views/html/library/topic.tpl:13
|
#: views/html/library/manage.tpl:27
|
||||||
msgid "Manage topic"
|
msgid "Add Quest"
|
||||||
|
msgstr "Quest hinzufügen"
|
||||||
|
|
||||||
|
#: views/html/library/topic.tpl:15
|
||||||
|
msgid "Manage Questtopic"
|
||||||
msgstr "Thema verwalten"
|
msgstr "Thema verwalten"
|
||||||
|
|
||||||
#: views/html/menu/index.tpl:2 views/html/users/create.tpl:5
|
#: views/html/menu/index.tpl:2 views/html/users/create.tpl:5
|
||||||
|
|
@ -1278,9 +1329,6 @@ msgstr "Rollen"
|
||||||
#~ msgid "Character type"
|
#~ msgid "Character type"
|
||||||
#~ msgstr "Charaktertyp"
|
#~ msgstr "Charaktertyp"
|
||||||
|
|
||||||
#~ msgid "Questtopics"
|
|
||||||
#~ msgstr "Themen"
|
|
||||||
|
|
||||||
#~ msgid "Questname"
|
#~ msgid "Questname"
|
||||||
#~ msgstr "Questname"
|
#~ msgstr "Questname"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,30 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a Questtopic by its ID.
|
||||||
|
*
|
||||||
|
* @param int $questtopicId ID of Questtopic
|
||||||
|
* @return array Questtopic data
|
||||||
|
*/
|
||||||
|
public function getQuesttopicById($questtopicId)
|
||||||
|
{
|
||||||
|
$data = $this->db->query(
|
||||||
|
'SELECT id, title, url '.
|
||||||
|
'FROM questtopics '.
|
||||||
|
'WHERE id = ?',
|
||||||
|
'i',
|
||||||
|
$questtopicId
|
||||||
|
);
|
||||||
|
if(empty($data)) {
|
||||||
|
throw new \nre\exceptions\IdNotFoundException($questtopicId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $data[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all Questtopics for a Seminary.
|
* Get all Questtopics for a Seminary.
|
||||||
*
|
*
|
||||||
|
|
@ -70,7 +94,8 @@
|
||||||
return $this->db->query(
|
return $this->db->query(
|
||||||
'SELECT id, title, url '.
|
'SELECT id, title, url '.
|
||||||
'FROM questtopics '.
|
'FROM questtopics '.
|
||||||
'WHERE seminary_id = ?',
|
'WHERE seminary_id = ? '.
|
||||||
|
'ORDER BY title ASC',
|
||||||
'i',
|
'i',
|
||||||
$seminaryId
|
$seminaryId
|
||||||
);
|
);
|
||||||
|
|
@ -162,7 +187,8 @@
|
||||||
'SELECT DISTINCT id, questtopic_id, title, url '.
|
'SELECT DISTINCT id, questtopic_id, title, url '.
|
||||||
'FROM quests_questsubtopics '.
|
'FROM quests_questsubtopics '.
|
||||||
'INNER JOIN questsubtopics ON questsubtopics.id = quests_questsubtopics.questsubtopic_id '.
|
'INNER JOIN questsubtopics ON questsubtopics.id = quests_questsubtopics.questsubtopic_id '.
|
||||||
'WHERE quests_questsubtopics.quest_id = ?',
|
'WHERE quests_questsubtopics.quest_id = ? '.
|
||||||
|
'ORDER BY questsubtopics.title ASC',
|
||||||
'i',
|
'i',
|
||||||
$questId
|
$questId
|
||||||
);
|
);
|
||||||
|
|
@ -209,6 +235,166 @@
|
||||||
$this->db->setAutocommit(true);
|
$this->db->setAutocommit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a Questtopic title already exists.
|
||||||
|
*
|
||||||
|
* @param string $title Questtopic title to check
|
||||||
|
* @param int $questtopicId Do not check this ID (for editing)
|
||||||
|
* @return boolean Whether Questtopic title exists or not
|
||||||
|
*/
|
||||||
|
public function questtopicTitleExists($title, $questtopicId=null)
|
||||||
|
{
|
||||||
|
$data = $this->db->query(
|
||||||
|
'SELECT id '.
|
||||||
|
'FROM questtopics '.
|
||||||
|
'WHERE title = ? OR url = ?',
|
||||||
|
'ss',
|
||||||
|
$title,
|
||||||
|
\nre\core\Linker::createLinkParam($title)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (!empty($data) && (is_null($questtopicId) || $questtopicId != $data[0]['id']));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Questtopic for a Seminary.
|
||||||
|
*
|
||||||
|
* @param int $userId ID of creating user
|
||||||
|
* @param int $seminaryId ID of Seminary
|
||||||
|
* @param string $title Title for new Questtopic
|
||||||
|
* @return int ID of newly created Questtopic
|
||||||
|
*/
|
||||||
|
public function createQuesttopic($userId, $seminaryId, $title)
|
||||||
|
{
|
||||||
|
$this->db->query(
|
||||||
|
'INSERT INTO questtopics '.
|
||||||
|
'(created_user_id, seminary_id, title, url) '.
|
||||||
|
'VALUES '.
|
||||||
|
'(?, ?, ?, ?) ',
|
||||||
|
'iiss',
|
||||||
|
$userId,
|
||||||
|
$seminaryId,
|
||||||
|
$title,
|
||||||
|
\nre\core\Linker::createLinkParam($title)
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this->db->getInsertId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit a Questtopic.
|
||||||
|
*
|
||||||
|
* @param int $questtopicId ID of Questtopic to edit
|
||||||
|
* @param string $title New title of Questtopic
|
||||||
|
*/
|
||||||
|
public function editQuesttopic($questtopicId, $title)
|
||||||
|
{
|
||||||
|
$this->db->query(
|
||||||
|
'UPDATE questtopics '.
|
||||||
|
'SET title = ?, url = ? '.
|
||||||
|
'WHERE id = ?',
|
||||||
|
'ssi',
|
||||||
|
$title,
|
||||||
|
\nre\core\Linker::createLinkParam($title),
|
||||||
|
$questtopicId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a Questtopic.
|
||||||
|
*
|
||||||
|
* @param int $questtopicId ID of Questtopic to delete
|
||||||
|
*/
|
||||||
|
public function deleteQuesttopic($questtopicId)
|
||||||
|
{
|
||||||
|
$this->db->query('DELETE FROM questtopics WHERE id = ?', 'i', $questtopicId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a Questsubtopic title already exists.
|
||||||
|
*
|
||||||
|
* @param int $questtopicId ID of Questtopic
|
||||||
|
* @param string $title Questsubtopic title to check
|
||||||
|
* @param int $questsubtopicId Do not check this ID (for editing)
|
||||||
|
* @return boolean Whether Questsubtopic title exists or not
|
||||||
|
*/
|
||||||
|
public function questsubtopicTitleExists($questtopicId, $title, $questsubtopicId=null)
|
||||||
|
{
|
||||||
|
$data = $this->db->query(
|
||||||
|
'SELECT id '.
|
||||||
|
'FROM questsubtopics '.
|
||||||
|
'WHERE questtopic_id = ? AND (title = ? OR url = ?)',
|
||||||
|
'iss',
|
||||||
|
$questtopicId,
|
||||||
|
$title,
|
||||||
|
\nre\core\Linker::createLinkParam($title)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (!empty($data) && (is_null($questsubtopicId) || $questsubtopicId != $data[0]['id']));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Questsubtopic for a Questtopic.
|
||||||
|
*
|
||||||
|
* @param int $userId ID of creating user
|
||||||
|
* @param int $questtopicId ID of Qusttopic
|
||||||
|
* @param string $title Title for new Questtopic
|
||||||
|
* @return int ID of newly created Questsubtopic
|
||||||
|
*/
|
||||||
|
public function createQuestsubtopic($userId, $questtopicId, $title)
|
||||||
|
{
|
||||||
|
$this->db->query(
|
||||||
|
'INSERT INTO questsubtopics '.
|
||||||
|
'(created_user_id, questtopic_id, title, url) '.
|
||||||
|
'VALUES '.
|
||||||
|
'(?, ?, ?, ?) ',
|
||||||
|
'iiss',
|
||||||
|
$userId,
|
||||||
|
$questtopicId,
|
||||||
|
$title,
|
||||||
|
\nre\core\Linker::createLinkParam($title)
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this->db->getInsertId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit a Questsubtopic.
|
||||||
|
*
|
||||||
|
* @param int $questsubtopicId ID of Questsubtopic to edit
|
||||||
|
* @param string $title New title of Questsubtopic
|
||||||
|
*/
|
||||||
|
public function editQuestsubtopic($questsubtopicId, $title)
|
||||||
|
{
|
||||||
|
$this->db->query(
|
||||||
|
'UPDATE questsubtopics '.
|
||||||
|
'SET title = ?, url = ? '.
|
||||||
|
'WHERE id = ?',
|
||||||
|
'ssi',
|
||||||
|
$title,
|
||||||
|
\nre\core\Linker::createLinkParam($title),
|
||||||
|
$questsubtopicId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a Questsubtopic.
|
||||||
|
*
|
||||||
|
* @param int $questsubtopicId ID of Questsubtopic to delete
|
||||||
|
*/
|
||||||
|
public function deleteQuestsubtopic($questtopicId)
|
||||||
|
{
|
||||||
|
$this->db->query('DELETE FROM questsubtopics WHERE id = ?', 'i', $questtopicId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
47
views/html/library/create.tpl
Normal file
47
views/html/library/create.tpl
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php if(!is_null($seminary['library_seminarymedia_id'])) : ?>
|
||||||
|
<div class="moodpic">
|
||||||
|
<img src="<?=$linker->link(array('media','seminarymoodpic',$seminary['url'], 'library'))?>">
|
||||||
|
</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('index',$seminary['url']),1)?>"><?=_('Library')?></a></li>
|
||||||
|
</ul>
|
||||||
|
<h1><i class="fa fa-book fa-fw"></i><?=_('New Questtopic')?></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;
|
||||||
|
} ?>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif ?>
|
||||||
|
<form method="post">
|
||||||
|
<fieldset>
|
||||||
|
<label for="title"><?=_('Title')?>:</label>
|
||||||
|
<input id="title" type="text" name="title" placeholder="<?=_('Title')?>" title="<?=_('Title')?>" required="required" maxlength="<?=$validationSettings['title']['maxlength']?>" value="<?=$title?>" <?=(array_key_exists('title', $validation)) ? 'class="invalid"' : null?> />
|
||||||
|
</fieldset>
|
||||||
|
<input type="submit" name="create" value="<?=_('create')?>" />
|
||||||
|
</form>
|
||||||
16
views/html/library/delete.tpl
Normal file
16
views/html/library/delete.tpl
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php if(!is_null($seminary['library_seminarymedia_id'])) : ?>
|
||||||
|
<div class="moodpic">
|
||||||
|
<img src="<?=$linker->link(array('media','seminarymoodpic',$seminary['url'], 'library'))?>">
|
||||||
|
</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('index',$seminary['url']),1)?>"><?=_('Library')?></a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h1><i class="fa fa-book fa-fw"></i><?=_('Delete Questtopic')?></h1>
|
||||||
|
<?=sprintf(_('Should the Questtopic “%s” really be deleted?'), $questtopic['title'])?>
|
||||||
|
<form method="post">
|
||||||
|
<input type="submit" name="delete" value="<?=_('delete')?>" />
|
||||||
|
<input type="submit" name="not-delete" value="<?=_('cancel')?>" />
|
||||||
|
</form>
|
||||||
125
views/html/library/edit.tpl
Normal file
125
views/html/library/edit.tpl
Normal file
|
|
@ -0,0 +1,125 @@
|
||||||
|
<?php if(!is_null($seminary['library_seminarymedia_id'])) : ?>
|
||||||
|
<div class="moodpic">
|
||||||
|
<img src="<?=$linker->link(array('media','seminarymoodpic',$seminary['url'], 'library'))?>">
|
||||||
|
</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('index',$seminary['url']),1)?>"><?=_('Library')?></a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h1><i class="fa fa-book fa-fw"></i><?=_('Edit Questtopic')?></h1>
|
||||||
|
<?php if($validations['edit'] !== true) : ?>
|
||||||
|
<ul>
|
||||||
|
<?php foreach($validations['edit'] 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;
|
||||||
|
} ?>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif ?>
|
||||||
|
<form method="post">
|
||||||
|
<fieldset>
|
||||||
|
<label for="title"><?=_('Title')?>:</label>
|
||||||
|
<input id="title" type="text" name="title" placeholder="<?=_('Title')?>" title="<?=_('Title')?>" required="required" maxlength="<?=$validationSettings['title']['maxlength']?>" value="<?=$questtopicTitle?>" <?=($validations['edit'] !== true && array_key_exists('title', $validations['edit'])) ? 'class="invalid"' : null?> />
|
||||||
|
</fieldset>
|
||||||
|
<input type="submit" name="edit" value="<?=_('save')?>" />
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<h2><?=_('Edit Questsubtopics')?></h2>
|
||||||
|
<form method="post">
|
||||||
|
<?php foreach($subtopicsTitles as $subtopicId => &$title) : ?>
|
||||||
|
<?php if($validations['edit-subtopics'] !== true && array_key_exists($subtopicId, $validations['edit-subtopics']) && $validations['edit-subtopics'][$subtopicId] !== true) : ?>
|
||||||
|
<ul>
|
||||||
|
<?php foreach($validations['edit-subtopics'][$subtopicId] 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;
|
||||||
|
} ?>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif ?>
|
||||||
|
<input id="subtopic-<?=$subtopicId?>" type="text" name="subtopics[<?=$subtopicId?>]" placeholder="<?=$title?>" title="<?=$title?>" required="required" maxlength="<?=$validationSettings['title']['maxlength']?>" value="<?=$title?>" <?=($validations['edit-subtopics'] !== true && array_key_exists($subtopicId, $validations['edit-subtopics']) && $validations['edit-subtopics'][$subtopicId] !== true && array_key_exists('title', $validations['edit-subtopics'][$subtopicId])) ? 'class="invalid"' : null?>/>
|
||||||
|
<input id="subtopic-<?=$subtopicId?>-delete" type="checkbox" name="delete-subtopics[<?=$subtopicId?>]" <?php if(!is_null($deleteSubtopics) && array_key_exists($subtopicId, $deleteSubtopics)) : ?>checked="checked"<?php endif ?> />
|
||||||
|
<label for="subtopic-<?=$subtopicId?>-delete"><?=_('delete')?></label><br />
|
||||||
|
<?php endforeach ?>
|
||||||
|
|
||||||
|
<input type="submit" name="edit-subtopics" value="<?=_('save')?>" />
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<h2><?=_('Create new Questsubtopic')?></h2>
|
||||||
|
<?php if($validations['create-subtopic'] !== true) : ?>
|
||||||
|
<ul>
|
||||||
|
<?php foreach($validations['create-subtopic'] 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;
|
||||||
|
} ?>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif ?>
|
||||||
|
<form method="post">
|
||||||
|
<fieldset>
|
||||||
|
<label for="subtopictitle"><?=_('Title')?>:</legend>
|
||||||
|
<input id="subtopictitle" type="text" name="title" placeholder="<?=_('Title')?>" title="<?=_('Title')?>" required="required" maxlength="<?=$validationSettings['title']['maxlength']?>" value="<?=$subtopicTitle?>" <?=($validations['create-subtopic'] !== true && array_key_exists('title', $validations['create-subtopic'])) ? 'class="invalid"' : null?> />
|
||||||
|
</fieldset>
|
||||||
|
<input type="submit" name="create-subtopic" value="<?=_('create')?>" />
|
||||||
|
</form>
|
||||||
|
|
@ -7,6 +7,11 @@
|
||||||
<li><a href="<?=$linker->link(array('seminaries',$seminary['url']))?>"><?=$seminary['title']?></a></li>
|
<li><a href="<?=$linker->link(array('seminaries',$seminary['url']))?>"><?=$seminary['title']?></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<h1><i class="fa fa-book fa-fw"></i><?=_('Library')?></h1>
|
<h1><i class="fa fa-book fa-fw"></i><?=_('Library')?></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('create',$seminary['url']),1)?>"><?=_('Create new Questtopic')?></a></li>
|
||||||
|
</nav>
|
||||||
|
<?php endif ?>
|
||||||
<p><?=sprintf(_('Library description, %s, %s'), $seminary['course'], $seminary['title'])?></p>
|
<p><?=sprintf(_('Library description, %s, %s'), $seminary['course'], $seminary['title'])?></p>
|
||||||
<div class="libindxpr cf">
|
<div class="libindxpr cf">
|
||||||
<p><small><?=sprintf(_('Total progress: %d %%'), ($totalQuestcount > 0) ? round($totalCharacterQuestcount/$totalQuestcount*100) : 0) ?></small></p>
|
<p><small><?=sprintf(_('Total progress: %d %%'), ($totalQuestcount > 0) ? round($totalCharacterQuestcount/$totalQuestcount*100) : 0) ?></small></p>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,9 @@
|
||||||
<h1><i class="fa fa-book fa-fw"></i><?=$questtopic['title']?></h1>
|
<h1><i class="fa fa-book fa-fw"></i><?=$questtopic['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('managetopic',$seminary['url'],$questtopic['url']),1)?>"><?=_('Manage topic')?></a></li>
|
<li><a href="<?=$linker->link(array('edit',$seminary['url'],$questtopic['url']),1)?>"><?=_('Edit Questtopic')?></a></li>
|
||||||
|
<li><a href="<?=$linker->link(array('delete',$seminary['url'],$questtopic['url']),1)?>"><?=_('Delete Questtopic')?></a></li>
|
||||||
|
<li><a href="<?=$linker->link(array('manage',$seminary['url'],$questtopic['url']),1)?>"><?=_('Manage Questtopic')?></a></li>
|
||||||
</nav>
|
</nav>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<div class="libindxpr cf">
|
<div class="libindxpr cf">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue