From 53c1002ab2032aaad9217d47113daf546773c895 Mon Sep 17 00:00:00 2001 From: coderkun Date: Wed, 30 Apr 2014 00:49:32 +0200 Subject: [PATCH] implement CRUD for Character groups Quests (Issue #30) --- configs/AppConfig.inc | 17 +- .../CharactergroupsquestsController.inc | 271 +++++++++++++++++- locale/de_DE/LC_MESSAGES/The Legend of Z.mo | Bin 11800 -> 12916 bytes locale/de_DE/LC_MESSAGES/The Legend of Z.po | 184 +++++++++--- models/CharactergroupsquestsModel.inc | 131 +++++++++ views/html/charactergroups/groupsgroup.tpl | 13 +- views/html/charactergroupsquests/create.tpl | 76 +++++ views/html/charactergroupsquests/delete.tpl | 17 ++ views/html/charactergroupsquests/edit.tpl | 76 +++++ views/html/charactergroupsquests/quest.tpl | 10 +- 10 files changed, 754 insertions(+), 41 deletions(-) create mode 100644 views/html/charactergroupsquests/create.tpl create mode 100644 views/html/charactergroupsquests/delete.tpl create mode 100644 views/html/charactergroupsquests/edit.tpl diff --git a/configs/AppConfig.inc b/configs/AppConfig.inc index 5f8d6d75..f36c78c5 100644 --- a/configs/AppConfig.inc +++ b/configs/AppConfig.inc @@ -150,6 +150,15 @@ ), 'motto' => array( '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/([^/]+)/([^/]+)/([^/]+)/?$', 'charactergroups/group/$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('^library/([^/]+)/?$', 'library/index/$1', true), array('^library/([^/]+)/([^/]+)/?$', 'library/topic/$1/$2', true), @@ -215,7 +226,9 @@ array('^charactergroups/creategroup/([^/]+)/([^/]+)$', 'charactergroups/$1/$2/create', true), array('^charactergroups/group/([^/]+)/([^/]+)/([^/]+)$', 'charactergroups/$1/$2/$3', 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('^library/(index|topic)/(.*)$', 'library/$2', true) ); diff --git a/controllers/CharactergroupsquestsController.inc b/controllers/CharactergroupsquestsController.inc index 0285db3e..df8fa687 100644 --- a/controllers/CharactergroupsquestsController.inc +++ b/controllers/CharactergroupsquestsController.inc @@ -25,7 +25,13 @@ * * @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 * @@ -68,6 +74,10 @@ // Get Character groups-group Quests $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 $groups = $this->Charactergroupsquests->getGroupsForQuest($quest['id']); @@ -82,10 +92,269 @@ $this->set('seminary', $seminary); $this->set('groupsgroup', $groupsgroup); $this->set('quest', $quest); + $this->set('questgroup', $questgroup); $this->set('groups', $groups); $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); + } + } ?> diff --git a/locale/de_DE/LC_MESSAGES/The Legend of Z.mo b/locale/de_DE/LC_MESSAGES/The Legend of Z.mo index 7369af28bf6bad164e2d52dd525457ac28afe343..4d4d2a4e913993108dfda29c30d3506f0c51f233 100644 GIT binary patch delta 4838 zcmbOc^ChMJo)F7a1_lO(BMb}-G7Jn1Hf#(G?2HTyF+3nq28Id&1_llW28K!j1_n+B z28Jdmzej+9ft!JWVX6QFgE#{N!$JWD25klghMfWo3?Qvf1sE9k7#J8nLDe$~GBB_* zFfeclGB5}+Ffa%RGBEHmFw`?B3o!!99+0}etJToPhn5M*FrxGw~8=|>?324MyU z1{Prk1}O#x1_@yX21N!224i7}c&IP~13v=;Lnf526oxpoQyAib1yJ#Q!jKR<2c>Tb zGcfShGcYhb6NdQUi!j8coFd?$VNex;1i7&Y#Ami55TAL7K!Va=1QKPTA`lN0i7+t8 zGcYhTi!d-qFfcGI7GYqJWME*}166lT1mdyJPUnL3&(gsn8!+N3mr-(uvJ|8N+QWO#*8$=;ddmJi$O_ZS?97lJd z8lOTneh`HO^)IMJqGFH`krsmly`~rg0}BHKgS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roups_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. * @@ -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); + } + + } ?> diff --git a/views/html/charactergroups/groupsgroup.tpl b/views/html/charactergroups/groupsgroup.tpl index 82f23436..5f391183 100644 --- a/views/html/charactergroups/groupsgroup.tpl +++ b/views/html/charactergroups/groupsgroup.tpl @@ -11,12 +11,16 @@

- + 0) : ?> + +
  1. XP
  2. @@ -25,6 +29,11 @@

    + 0) : ?> + +
    • diff --git a/views/html/charactergroupsquests/create.tpl b/views/html/charactergroupsquests/create.tpl new file mode 100644 index 00000000..58efa071 --- /dev/null +++ b/views/html/charactergroupsquests/create.tpl @@ -0,0 +1,76 @@ + +
      + +
      + + + +

      + +
        + &$settings) : ?> +
      • +
          + $value) : ?> +
        • + getMessage(); + break; + } ?> +
        • + +
        +
      • + +
      + +
      +
      + + + + /> + + + + + + + + + + +
      + +
      diff --git a/views/html/charactergroupsquests/delete.tpl b/views/html/charactergroupsquests/delete.tpl new file mode 100644 index 00000000..919dd29a --- /dev/null +++ b/views/html/charactergroupsquests/delete.tpl @@ -0,0 +1,17 @@ + +
      + +
      + + + +

      + +
      + + +
      diff --git a/views/html/charactergroupsquests/edit.tpl b/views/html/charactergroupsquests/edit.tpl new file mode 100644 index 00000000..e5eff9f2 --- /dev/null +++ b/views/html/charactergroupsquests/edit.tpl @@ -0,0 +1,76 @@ + +
      + +
      + + + +

      + +
        + &$settings) : ?> +
      • +
          + $value) : ?> +
        • + getMessage(); + break; + } ?> +
        • + +
        +
      • + +
      + +
      +
      + + + + /> + + + + + + + + + + +
      + +
      diff --git a/views/html/charactergroupsquests/quest.tpl b/views/html/charactergroupsquests/quest.tpl index 6cb8b605..3669b453 100644 --- a/views/html/charactergroupsquests/quest.tpl +++ b/views/html/charactergroupsquests/quest.tpl @@ -9,8 +9,16 @@
    + 0) : ?> + + +

    -Maximale Belohnung: XP +: XP
    +: