add prolog to Character groups Quest Stations

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

View file

@ -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);

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
-- ------------------------------------------------------
-- 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

View file

@ -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
);
}

View file

@ -84,6 +84,8 @@
<fieldset>
<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?> />
<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 />
<textarea id="task" name="task" placeholder="<?=_('Task')?>" style="width:100%; height:10em;"><?=$task?></textarea><br />
<label for="rightText"><?=('Right text')?>:</label><br />
@ -95,6 +97,7 @@
</form>
<script>
$(function() {
$("#prolog").markItUp(mySettings);
$("#task").markItUp(mySettings);
$("#rightText").markItUp(mySettings);
$("#wrongText").markItUp(mySettings);

View file

@ -84,6 +84,8 @@
<fieldset>
<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?> />
<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 />
<textarea id="task" name="task" placeholder="<?=_('Task')?>" style="width:100%; height:10em;"><?=$task?></textarea><br />
<label for="rightText"><?=('Right text')?>:</label><br />
@ -98,6 +100,7 @@
</form>
<script>
$(function() {
$("#prolog").markItUp(mySettings);
$("#task").markItUp(mySettings);
$("#rightText").markItUp(mySettings);
$("#wrongText").markItUp(mySettings);

View file

@ -104,6 +104,16 @@
</section>
<?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)) : ?>
<section class="task">
<h1 id="task"><?=_('Task')?></h1>