diff --git a/controllers/CharactergroupsqueststationsController.inc b/controllers/CharactergroupsqueststationsController.inc index e026094d..6000f874 100644 --- a/controllers/CharactergroupsqueststationsController.inc +++ b/controllers/CharactergroupsqueststationsController.inc @@ -232,6 +232,7 @@ // Values $title = ''; + $prolog = ''; $task = ''; $longitude = null; $latitude = null; @@ -249,6 +250,7 @@ if($this->Charactergroupsqueststations->stationTitleExists($quest['id'], $title)) { $validation = $this->Validation->addValidationResult($validation, 'title', 'exist', true); } + $prolog = $this->request->getPostParam('prolog'); $task = $this->request->getPostParam('task'); $longitude = $this->request->getPostParam('longitude'); $latitude = $this->request->getPostParam('latitude'); @@ -303,6 +305,7 @@ $quest['id'], $stationtypes[$stationtypeIndex]['id'], $title, + $prolog, $task, $latitude, $longitude, @@ -355,6 +358,7 @@ $this->set('groupsgroup', $groupsgroup); $this->set('quest', $quest); $this->set('title', $title); + $this->set('prolog', $prolog); $this->set('task', $task); $this->set('longitude', $longitude); $this->set('latitude', $latitude); @@ -402,6 +406,7 @@ // Values $title = $station['title']; + $prolog = $station['prolog']; $task = $station['task']; $longitude = $station['longitude']; $latitude = $station['latitude']; @@ -419,6 +424,7 @@ if($this->Charactergroupsqueststations->stationTitleExists($quest['id'], $title, $station['id'])) { $validation = $this->Validation->addValidationResult($validation, 'title', 'exist', true); } + $prolog = $this->request->getPostParam('prolog'); $task = $this->request->getPostParam('task'); $longitude = $this->request->getPostParam('longitude'); $latitude = $this->request->getPostParam('latitude'); @@ -473,6 +479,7 @@ $station['id'], $stationtypes[$stationtypeIndex]['id'], $title, + $prolog, $task, $latitude, $longitude, @@ -544,6 +551,7 @@ $this->set('groupsgroup', $groupsgroup); $this->set('quest', $quest); $this->set('title', $title); + $this->set('prolog', $prolog); $this->set('task', $task); $this->set('longitude', $longitude); $this->set('latitude', $latitude); diff --git a/db/create.sql b/db/create.sql index 3ab98d6a..cb2f4b87 100644 --- a/db/create.sql +++ b/db/create.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.15 Distrib 10.0.22-MariaDB, for Linux (x86_64) +-- MySQL dump 10.16 Distrib 10.1.10-MariaDB, for Linux (x86_64) -- -- Host: localhost Database: z -- ------------------------------------------------------ --- Server version 10.0.22-MariaDB-log +-- Server version 10.1.10-MariaDB-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -584,6 +584,7 @@ CREATE TABLE `charactergroupsqueststations` ( `url` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, `pos` int(10) unsigned NOT NULL, `stationpicture_id` int(11) DEFAULT NULL, + `prolog` text COLLATE utf8mb4_unicode_ci NOT NULL, `task` text COLLATE utf8mb4_unicode_ci NOT NULL, `latitude` decimal(10,6) DEFAULT NULL, `longitude` decimal(10,6) DEFAULT NULL, @@ -2470,4 +2471,4 @@ DELIMITER ; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2015-10-30 22:27:53 +-- Dump completed on 2016-01-15 13:19:51 diff --git a/models/CharactergroupsqueststationsModel.inc b/models/CharactergroupsqueststationsModel.inc index 15508747..9169b5b0 100644 --- a/models/CharactergroupsqueststationsModel.inc +++ b/models/CharactergroupsqueststationsModel.inc @@ -63,7 +63,7 @@ public function getStationById($stationId) { $data = $this->db->query( - 'SELECT id, charactergroupsquest_id, stationtype_id, title, url, stationpicture_id, task, latitude, longitude, righttext, wrongtext '. + 'SELECT id, charactergroupsquest_id, stationtype_id, title, url, stationpicture_id, prolog, task, latitude, longitude, righttext, wrongtext '. 'FROM charactergroupsqueststations '. 'WHERE id = ?', 'i', @@ -88,7 +88,7 @@ public function getStationByUrl($groupsquestId, $stationUrl) { $data = $this->db->query( - 'SELECT id, charactergroupsquest_id, stationtype_id, title, url, stationpicture_id, task, latitude, longitude, righttext, wrongtext '. + 'SELECT id, charactergroupsquest_id, stationtype_id, title, url, stationpicture_id, prolog, task, latitude, longitude, righttext, wrongtext '. 'FROM charactergroupsqueststations '. 'WHERE charactergroupsquest_id = ? AND url = ?', 'is', @@ -288,6 +288,7 @@ * @param int $questId ID of Quest to create the Station for * @param int $stationtypeId ID of Station type * @param string $title Title + * @param string $prolog Prolog * @param string $task Task description * @param int $latitude GPS latitude * @param int $longitude GPS longitude @@ -295,7 +296,7 @@ * @param string $wrongtext Text for failed task * @return int ID of newly created station */ - public function createStation($questId, $stationtypeId, $title, $task, $latitude, $longitude, $righttext, $wrongtext) + public function createStation($questId, $stationtypeId, $title, $prolog, $task, $latitude, $longitude, $righttext, $wrongtext) { // Get position $pos = $this->db->query( @@ -310,13 +311,13 @@ // Create Station $this->db->query( 'INSERT INTO charactergroupsqueststations '. - '(charactergroupsquest_id, stationtype_id, title, url, pos, task, latitude, longitude, righttext, wrongtext) '. + '(charactergroupsquest_id, stationtype_id, title, url, pos, prolog, task, latitude, longitude, righttext, wrongtext) '. 'VALUES '. - '(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', - 'iissisddss', + '(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', + 'iississddss', $questId, $stationtypeId, $title, \nre\core\Linker::createLinkParam($title), $pos, - $task, $latitude, $longitude, $righttext, $wrongtext + $prolog, $task, $latitude, $longitude, $righttext, $wrongtext ); @@ -331,22 +332,23 @@ * @param int $stationId ID of Station to edit * @param int $stationtypeId ID of Station type * @param string $title Title + * @param string $prolog Prolog * @param string $task Task description * @param int $latitude GPS latitude * @param int $longitude GPS longitude * @param string $righttext Text for correctly solved task * @param string $wrongtext Text for failed task */ - public function editStation($stationId, $stationtypeId, $title, $task, $latitude, $longitude, $righttext, $wrongtext) + public function editStation($stationId, $stationtypeId, $title, $prolog, $task, $latitude, $longitude, $righttext, $wrongtext) { $this->db->query( 'UPDATE charactergroupsqueststations '. - 'SET stationtype_id = ?, title = ?, url = ?, task = ?, latitude = ?, longitude = ?, righttext = ?, wrongtext = ? '. + 'SET stationtype_id = ?, title = ?, url = ?, prolog = ?, task = ?, latitude = ?, longitude = ?, righttext = ?, wrongtext = ? '. 'WHERE id = ?', - 'isssddssi', + 'issssddssi', $stationtypeId, $title, \nre\core\Linker::createLinkParam($title), - $task, $latitude, $longitude, $righttext, $wrongtext, + $prolog, $task, $latitude, $longitude, $righttext, $wrongtext, $stationId ); } diff --git a/views/html/charactergroupsqueststations/create.tpl b/views/html/charactergroupsqueststations/create.tpl index 2921112b..c46c3374 100644 --- a/views/html/charactergroupsqueststations/create.tpl +++ b/views/html/charactergroupsqueststations/create.tpl @@ -84,6 +84,8 @@