add prolog to Character groups Quest Stations

This commit is contained in:
oliver 2016-01-15 13:21:21 +01:00
commit ad11db6b60
6 changed files with 41 additions and 14 deletions

View file

@ -232,6 +232,7 @@
// Values // Values
$title = ''; $title = '';
$prolog = '';
$task = ''; $task = '';
$longitude = null; $longitude = null;
$latitude = null; $latitude = null;
@ -249,6 +250,7 @@
if($this->Charactergroupsqueststations->stationTitleExists($quest['id'], $title)) { if($this->Charactergroupsqueststations->stationTitleExists($quest['id'], $title)) {
$validation = $this->Validation->addValidationResult($validation, 'title', 'exist', true); $validation = $this->Validation->addValidationResult($validation, 'title', 'exist', true);
} }
$prolog = $this->request->getPostParam('prolog');
$task = $this->request->getPostParam('task'); $task = $this->request->getPostParam('task');
$longitude = $this->request->getPostParam('longitude'); $longitude = $this->request->getPostParam('longitude');
$latitude = $this->request->getPostParam('latitude'); $latitude = $this->request->getPostParam('latitude');
@ -303,6 +305,7 @@
$quest['id'], $quest['id'],
$stationtypes[$stationtypeIndex]['id'], $stationtypes[$stationtypeIndex]['id'],
$title, $title,
$prolog,
$task, $task,
$latitude, $latitude,
$longitude, $longitude,
@ -355,6 +358,7 @@
$this->set('groupsgroup', $groupsgroup); $this->set('groupsgroup', $groupsgroup);
$this->set('quest', $quest); $this->set('quest', $quest);
$this->set('title', $title); $this->set('title', $title);
$this->set('prolog', $prolog);
$this->set('task', $task); $this->set('task', $task);
$this->set('longitude', $longitude); $this->set('longitude', $longitude);
$this->set('latitude', $latitude); $this->set('latitude', $latitude);
@ -402,6 +406,7 @@
// Values // Values
$title = $station['title']; $title = $station['title'];
$prolog = $station['prolog'];
$task = $station['task']; $task = $station['task'];
$longitude = $station['longitude']; $longitude = $station['longitude'];
$latitude = $station['latitude']; $latitude = $station['latitude'];
@ -419,6 +424,7 @@
if($this->Charactergroupsqueststations->stationTitleExists($quest['id'], $title, $station['id'])) { if($this->Charactergroupsqueststations->stationTitleExists($quest['id'], $title, $station['id'])) {
$validation = $this->Validation->addValidationResult($validation, 'title', 'exist', true); $validation = $this->Validation->addValidationResult($validation, 'title', 'exist', true);
} }
$prolog = $this->request->getPostParam('prolog');
$task = $this->request->getPostParam('task'); $task = $this->request->getPostParam('task');
$longitude = $this->request->getPostParam('longitude'); $longitude = $this->request->getPostParam('longitude');
$latitude = $this->request->getPostParam('latitude'); $latitude = $this->request->getPostParam('latitude');
@ -473,6 +479,7 @@
$station['id'], $station['id'],
$stationtypes[$stationtypeIndex]['id'], $stationtypes[$stationtypeIndex]['id'],
$title, $title,
$prolog,
$task, $task,
$latitude, $latitude,
$longitude, $longitude,
@ -544,6 +551,7 @@
$this->set('groupsgroup', $groupsgroup); $this->set('groupsgroup', $groupsgroup);
$this->set('quest', $quest); $this->set('quest', $quest);
$this->set('title', $title); $this->set('title', $title);
$this->set('prolog', $prolog);
$this->set('task', $task); $this->set('task', $task);
$this->set('longitude', $longitude); $this->set('longitude', $longitude);
$this->set('latitude', $latitude); $this->set('latitude', $latitude);

View file

@ -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 -- 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_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!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, `url` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`pos` int(10) unsigned NOT NULL, `pos` int(10) unsigned NOT NULL,
`stationpicture_id` int(11) DEFAULT NULL, `stationpicture_id` int(11) DEFAULT NULL,
`prolog` text COLLATE utf8mb4_unicode_ci NOT NULL,
`task` text COLLATE utf8mb4_unicode_ci NOT NULL, `task` text COLLATE utf8mb4_unicode_ci NOT NULL,
`latitude` decimal(10,6) DEFAULT NULL, `latitude` decimal(10,6) DEFAULT NULL,
`longitude` decimal(10,6) DEFAULT NULL, `longitude` decimal(10,6) DEFAULT NULL,
@ -2470,4 +2471,4 @@ DELIMITER ;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!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

View file

@ -63,7 +63,7 @@
public function getStationById($stationId) public function getStationById($stationId)
{ {
$data = $this->db->query( $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 '. 'FROM charactergroupsqueststations '.
'WHERE id = ?', 'WHERE id = ?',
'i', 'i',
@ -88,7 +88,7 @@
public function getStationByUrl($groupsquestId, $stationUrl) public function getStationByUrl($groupsquestId, $stationUrl)
{ {
$data = $this->db->query( $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 '. 'FROM charactergroupsqueststations '.
'WHERE charactergroupsquest_id = ? AND url = ?', 'WHERE charactergroupsquest_id = ? AND url = ?',
'is', 'is',
@ -288,6 +288,7 @@
* @param int $questId ID of Quest to create the Station for * @param int $questId ID of Quest to create the Station for
* @param int $stationtypeId ID of Station type * @param int $stationtypeId ID of Station type
* @param string $title Title * @param string $title Title
* @param string $prolog Prolog
* @param string $task Task description * @param string $task Task description
* @param int $latitude GPS latitude * @param int $latitude GPS latitude
* @param int $longitude GPS longitude * @param int $longitude GPS longitude
@ -295,7 +296,7 @@
* @param string $wrongtext Text for failed task * @param string $wrongtext Text for failed task
* @return int ID of newly created station * @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 // Get position
$pos = $this->db->query( $pos = $this->db->query(
@ -310,13 +311,13 @@
// Create Station // Create Station
$this->db->query( $this->db->query(
'INSERT INTO charactergroupsqueststations '. '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 '. 'VALUES '.
'(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', '(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
'iissisddss', 'iississddss',
$questId, $stationtypeId, $title, $questId, $stationtypeId, $title,
\nre\core\Linker::createLinkParam($title), $pos, \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 $stationId ID of Station to edit
* @param int $stationtypeId ID of Station type * @param int $stationtypeId ID of Station type
* @param string $title Title * @param string $title Title
* @param string $prolog Prolog
* @param string $task Task description * @param string $task Task description
* @param int $latitude GPS latitude * @param int $latitude GPS latitude
* @param int $longitude GPS longitude * @param int $longitude GPS longitude
* @param string $righttext Text for correctly solved task * @param string $righttext Text for correctly solved task
* @param string $wrongtext Text for failed 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( $this->db->query(
'UPDATE charactergroupsqueststations '. '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 = ?', 'WHERE id = ?',
'isssddssi', 'issssddssi',
$stationtypeId, $title, $stationtypeId, $title,
\nre\core\Linker::createLinkParam($title), \nre\core\Linker::createLinkParam($title),
$task, $latitude, $longitude, $righttext, $wrongtext, $prolog, $task, $latitude, $longitude, $righttext, $wrongtext,
$stationId $stationId
); );
} }

View file

@ -84,6 +84,8 @@
<fieldset> <fieldset>
<label for="title"><?=_('Title')?>:</label> <label for="title"><?=_('Title')?>:</label>
<input type="text" id="title" name="title" placeholder="<?=_('Title')?>" title="<?=_('Title')?>" maxlength="<?=$validationSettings['title']['maxlength']?>" value="<?=$title?>" <?=($validation !== true && array_key_exists('title', $validation)) ? 'class="invalid"' : null?> /> <input type="text" id="title" name="title" placeholder="<?=_('Title')?>" title="<?=_('Title')?>" maxlength="<?=$validationSettings['title']['maxlength']?>" value="<?=$title?>" <?=($validation !== true && array_key_exists('title', $validation)) ? 'class="invalid"' : null?> />
<label for="prolog"><?=_('Prolog')?>:</label><br />
<textarea id="prolog" name="prolog" placeholder="<?=_('Prolog')?>" style="width:100%; height:10em;"><?=$prolog?></textarea><br />
<label for="task"><?=_('Task')?>:</label><br /> <label for="task"><?=_('Task')?>:</label><br />
<textarea id="task" name="task" placeholder="<?=_('Task')?>" style="width:100%; height:10em;"><?=$task?></textarea><br /> <textarea id="task" name="task" placeholder="<?=_('Task')?>" style="width:100%; height:10em;"><?=$task?></textarea><br />
<label for="rightText"><?=('Right text')?>:</label><br /> <label for="rightText"><?=('Right text')?>:</label><br />
@ -95,6 +97,7 @@
</form> </form>
<script> <script>
$(function() { $(function() {
$("#prolog").markItUp(mySettings);
$("#task").markItUp(mySettings); $("#task").markItUp(mySettings);
$("#rightText").markItUp(mySettings); $("#rightText").markItUp(mySettings);
$("#wrongText").markItUp(mySettings); $("#wrongText").markItUp(mySettings);

View file

@ -84,6 +84,8 @@
<fieldset> <fieldset>
<label for="title"><?=_('Title')?>:</label> <label for="title"><?=_('Title')?>:</label>
<input type="text" id="title" name="title" placeholder="<?=_('Title')?>" title="<?=_('Title')?>" maxlength="<?=$validationSettings['title']['maxlength']?>" value="<?=$title?>" <?=($validation !== true && array_key_exists('title', $validation)) ? 'class="invalid"' : null?> /> <input type="text" id="title" name="title" placeholder="<?=_('Title')?>" title="<?=_('Title')?>" maxlength="<?=$validationSettings['title']['maxlength']?>" value="<?=$title?>" <?=($validation !== true && array_key_exists('title', $validation)) ? 'class="invalid"' : null?> />
<label for="prolog"><?=_('Prolog')?>:</label><br />
<textarea id="prolog" name="prolog" placeholder="<?=_('Prolog')?>" style="width:100%; height:10em;"><?=$prolog?></textarea><br />
<label for="task"><?=_('Task')?>:</label><br /> <label for="task"><?=_('Task')?>:</label><br />
<textarea id="task" name="task" placeholder="<?=_('Task')?>" style="width:100%; height:10em;"><?=$task?></textarea><br /> <textarea id="task" name="task" placeholder="<?=_('Task')?>" style="width:100%; height:10em;"><?=$task?></textarea><br />
<label for="rightText"><?=('Right text')?>:</label><br /> <label for="rightText"><?=('Right text')?>:</label><br />
@ -98,6 +100,7 @@
</form> </form>
<script> <script>
$(function() { $(function() {
$("#prolog").markItUp(mySettings);
$("#task").markItUp(mySettings); $("#task").markItUp(mySettings);
$("#rightText").markItUp(mySettings); $("#rightText").markItUp(mySettings);
$("#wrongText").markItUp(mySettings); $("#wrongText").markItUp(mySettings);

View file

@ -104,6 +104,16 @@
</section> </section>
<?php endif ?> <?php endif ?>
<?php if(!empty($station['prolog'])) : ?>
<section>
<div class="qtextbox">
<p class="qtext cf">
<?=str_replace('<p>', '', str_replace('</p>', '', $t->t($station['prolog'])))?>
</p>
</div>
</section>
<?php endif ?>
<?php if(!is_null($task)) : ?> <?php if(!is_null($task)) : ?>
<section class="task"> <section class="task">
<h1 id="task"><?=_('Task')?></h1> <h1 id="task"><?=_('Task')?></h1>