<?php
/**
 * Created by CS medien- & kommunikationssysteme.
 * @author Christian Steinle
 * @date 09.09.2016
 *
 * @copyright CS medien- & kommunikationssysteme (http://www.steinle-computer.de)
 */

header('Access-Control-Allow-Origin: *');

$includeFile = dirname(__DIR__) . '/lang/lang-' . $_POST['lang'] . '.php';
if (file_exists(dirname(__DIR__) . '/lang/lang-' . $_POST['lang'] . '.php'))
{
	$includeFile = dirname(__DIR__) . '/lang/lang-' . $_POST['lang'] . '.php';
}

include_once($includeFile);

?>
<form id="editor_form" action="" method="post">
	<input type="hidden" name="userId" id="userId" value=""/>
	<input type="hidden" name="prefix" id="prefix" value=""/>
	<input type="hidden" name="dataSet" id="dataSet" value=""/>
	<input type="hidden" name="siteId" id="siteId" value=""/>
	<input type="hidden" name="request" id="request" value="updateData"/>
	<input type="hidden" name="spieldauer" value="regular"/>

	<div class="editor_slider">
		<div class="inner">
			<label for="headline"><?php echo $lang['spielbericht']['headline']; ?></label>
			<input type="text" name="headline" id="headline" value=""/><br class="fix"/>
			<label for="datum"><?php echo $lang['spielbericht']['date']; ?></label>
			<input type="date" name="datum" id="datum" value=""/><br/>
			<label for="teamname"><?php echo $lang['spielbericht']['team']; ?></label>
			<select name="teamname" id="teamname"></select><br/>
			<label for="spieltyp"><?php echo $lang['spielbericht']['typ']; ?></label>
			<select name="spieltyp" id="spieltyp"></select><br/>
			<label for="verschoben"><?php echo $lang['spielbericht']['delayed']; ?></label>
			<input type="date" name="verschoben" id="verschoben" value=""/><br/>
			<label for="spieldauer"><?php echo $lang['spielbericht']['dauer']; ?></label>
			<select name="spieldauer" id="spieldauer"></select><br/>
			<label for="gegner"><?php echo $lang['spielbericht']['gegner']; ?></label>
			<input type="text" name="gegner" id="gegner" value=""/><br/>
			<label for="heimspiel"><?php echo $lang['spielbericht']['ort']; ?></label>
			<input type="radio" name="heimspiel" id="heimspiel_Y" value="Y"/><label for="heimspiel_Y"><?php echo $lang['spielbericht']['heim']; ?></label><input type="radio" name="heimspiel" id="heimspiel_N" value="N"/><?php echo $lang['spielbericht']['auswaerts']; ?><br/>
			<label><?php echo $lang['spielbericht']['halbzeit']; ?></label>
			<input type="text" class="tiny" name="heimtoreHalb" id="heimtoreHalb" value=""/><label class="tiny">&nbsp;:&nbsp;</label><input type="text" class="tiny" name="gasttoreHalb" id="gasttoreHalb" value=""/><br/>
			<label><?php echo $lang['spielbericht']['ende']; ?></label>
			<input type="text" class="tiny" name="heimtoreEnd" id="heimtoreEnd" value=""/><label class="tiny">&nbsp;:&nbsp;</label><input type="text" class="tiny" name="gasttoreEnd" id="gasttoreEnd" value=""/><br/>
			<label for="spieler"><?php echo $lang['spielbericht']['spieler']; ?></label>
			<textarea name="spieler" id="spieler"></textarea><br/>
			<label for="tore"><?php echo $lang['spielbericht']['tore']; ?></label>
			<textarea name="tore" id="tore"></textarea><br/>
			<label for="besonderes"><?php echo $lang['spielbericht']['besonderes']; ?></label>
			<textarea name="besonderes" id="besonderes"></textarea><br/>
			<label for="vorschau"><?php echo $lang['spielbericht']['vorschau']; ?></label>
			<textarea name="vorschau" id="vorschau"></textarea><br/>
			<div class="bottom">
				<input type="button" class="submitButton formNext" value="<?php echo $lang['button']['next']; ?>">
				<input type="button" class="submitButton formCancel" value="<?php echo $lang['button']['cancel']; ?>">
			</div>
		</div>
		<div class="inner">
			<textarea class="ckeditor" name="text" id="text"></textarea>
			<div class="bottom">
				<input type="button" class="submitButton formSubmit" value="<?php echo $lang['button']['save']; ?>">
				<input type="button" class="submitButton formPrev" value="<?php echo $lang['button']['prev']; ?>">
			</div>
		</div>
	</div>
	<script>
		initEditor();

		function initEditor() {
			if (editor.contentData === null) {
				window.setTimeout(initEditor, 50);
				return false;
			}
			CKEDITOR.replace('text', {
				enterMode: CKEDITOR.ENTER_P,
				extraPlugins: 'divarea',
				height: '500px',
				language: '<?php echo $_POST['lang']; ?>',
				toolbarGroups: [
					{name: 'clipboard', groups: ['clipboard', 'undo']},
					{name: 'editing', groups: ['find', 'selection', 'spellchecker']},
					{name: 'basicstyles', groups: ['basicstyles', 'cleanup']},
					{name: 'paragraph', groups: ['list']},
					{name: 'links'},
					{name: 'about'}
				]
			});
		}
	</script>
</form>