1<?php
2	require_once '../config.php';
3?>
4<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5<html xmlns="http://www.w3.org/1999/xhtml">
6	<head>
7		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8		<link rel="stylesheet" type="text/css" href="tw_style.css" media="all" />
9		<!--<script src="packery.pkgd.min.js"></script>-->
10		<title><? echo "Checklist"; ?></title>
11
12		<style type="text/css">
13			h2, .geprueft span {
14				color: <?php echo $conf['farbcode'];?> !important;
15			}
16
17			img.rolle_pm {
18				height: 100%;
19				left: 0;
20				position: absolute;
21				top: 0;
22				width: 100%;
23				z-index: 0;
24			}
25
26			.ebene2.rolle_pm .ebene2_inner  {
27				background: none repeat scroll 0 0 #F4F4F4 !important;
28				border-color: #EAEAEA;
29			}
30
31			.ebene2.rolle_pm .ebene2_inner * {
32				background: none repeat scroll 0 0 #F4F4F4 !important;
33			}
34
35			.checkliste_checkbox {
36				border: 1px solid <?php echo $conf['farbcode'];?>;
37			}
38			.geprueft {
39				border-bottom: 2px solid <?php echo $conf['farbcode'];?>;
40			}
41		</style>
42	</head>
43	<body>
44
45		<table width="100%">
46			<tr>
47				<td align="left" valign="top"><? echo $content -> headertext; ?></td>
48				<td align="right" valign="top"><img src="<?php echo $conf['logo'];?>" border="0" /></td>
49			</tr>
50		</table>
51		<div class="checklist<? echo $_POST['match_kind'];?>">
52		<?
53			$content = new tw_checkliste();
54			$content -> createChecklist($conf['footertext']);
55		?>
56
57	</div>
58</div>
59</div>
60	</body>
61</html>
62
63<?
64class tw_checkliste {
65
66	function createChecklist($footertext) {
67
68		$this -> optionGroup = 0;
69		$this -> group = 0;
70		$this -> eingabefeldAktiv = 0;
71		$this -> eingabefeld = "...........................................";
72		$this -> eingabefeldshort = ".....................";
73
74		$this -> checkliste = "";
75
76		foreach ($_POST['checklist_data'] as $key => $value) {
77			/*?><pre><? print_r($value); ?></pre><?*/
78			$this->buildEbene1($value, $footertext);
79
80		}
81	}
82	function buildEbene1($daten, $footertext){
83		?><div class="ebene1">
84		<h1><? echo $daten[HL]; ?></h1><?
85		if(array_key_exists("LP",$daten)){
86			$this->buildCheckPoint($daten['LP']);
87		}
88		if(array_key_exists("H3",$daten)){
89			foreach($daten["H3"] as $ebene2){
90				$this->buildEbene2($ebene2, $footertext);
91			}
92		}
93
94
95		?></div><?
96	}
97	function buildEbene2($daten, $footertext){
98
99		if (stripos($daten['HL'], "ROLLE_PM")){
100			$addClass="rolle_pm";
101		} else {
102			$addClass="";
103		}
104
105		$daten['HL'] = str_replace("ROLLE_PM", "", $daten['HL']);
106		$daten['HL'] = str_replace("UNCHECKED", "", $daten['HL']);
107
108		?><div class="ebene2 <?=$addClass?>"><div class="ebene2_inner"><?
109		?><h2 class="<?=$addClass?>"><?=$daten['HL']?></h2><?
110
111		if (stripos($daten['HL'], "ROLLE_PM")){
112			echo '<img class="'.$addClass.'" src="/lib/plugins/twcheckliste/theme_twCheckliste/img/print-bg.jpg" />';
113		}
114
115		if(array_key_exists("LP",$daten)){
116			$this->buildCheckPoint($daten['LP']);
117		}
118		if(array_key_exists("H4",$daten)){
119			$x = 1;
120			$open = 0;
121
122			?><div class="ebene3_wrap"><?
123			foreach($daten["H4"] as $ebene3){
124				if ($x==1){
125					?><!--<div class="ebene3_group">--><?
126					$open = 1;
127				}
128
129				$this->buildEbene3($ebene3);
130
131				if ($x==2){
132					?><!--</div>--><?
133					$x = 0;
134					$open = 0;
135				}
136				$x++;
137			}
138
139			if ($open == 1){
140				?><!--</div>--><?
141			}
142			?></div><?
143		}
144
145
146		if ($_POST['match_kind'] == 0){
147			?></div><div class="geprueft"><!--<span><? echo $footertext;?></span> <? echo $this -> eingabefeld;?>--></div><?
148		}
149		?></div><?
150	}
151	function buildEbene3($daten){
152
153		if (stripos($daten['HL'], "ROLLE_PM")){
154			$addClass="rolle_pm";
155		} else {
156			$addClass="";
157		}
158
159		$daten['HL'] = str_replace("ROLLE_PM", "", $daten['HL']);
160		$daten['HL'] = str_replace("UNCHECKED", "", $daten['HL']);
161
162		?><div class="ebene3 <?=$addClass?>"><?
163		?><h3 class="<?=$addClass?>"><?=$daten['HL']?></h3><?
164
165		if (stripos($daten['HL'], "ROLLE_PM")){
166			echo '<img class="'.$addClass.'" src="/lib/plugins/twcheckliste/theme_twCheckliste/img/print-bg.jpg" />';
167		}
168
169		if(array_key_exists("LP",$daten)){
170			$this->buildCheckPoint($daten['LP']);
171		}
172		?></div><?
173	}
174	function buildCheckPoint($daten){
175		?><div class="checkpointlist clearfix"><?
176		foreach($daten as $listenpunkt){
177
178			if(stripos($listenpunkt,"EINGABEFELDLANG") || stripos($listenpunkt,"EINGABEFELD")){
179				$addClass="checkliste_eingabefeld";
180			} else {
181				$addClass="";
182			}
183
184			if(stripos($listenpunkt,"EINGABEFELDLANG")>-1){
185				?><div class="checkliste_option_long <?=$addClass?>"><?
186			}else{
187				?><div class="checkliste_option <?=$addClass?>"><?
188			}
189			$listenpunkt=str_replace("EINGABEFELDLANG", $this -> eingabefeld, $listenpunkt);
190			$listenpunkt=str_replace("EINGABEFELD", $this -> eingabefeldshort, $listenpunkt);
191			?><div class="checkliste_checkbox">&nbsp;</div><?=$listenpunkt?></div><?
192		}
193		?></div><?
194	}
195
196	function checkH1($value) {
197			$value = str_replace("UNCHECKED", "", $value);
198		if (stristr($value, 'h1_') != "") {
199			$value = "<h1>" . str_replace("h1_", "", strip_tags($value)) . "</h1>";
200			return $value;
201		}
202
203	}
204
205	function checkH2($value) {
206
207	$value = str_replace("UNCHECKED", "", $value);
208		if (stristr($value, 'h2_') != "") {
209			if ($this -> group == 1) {
210				$value = "<h2>" . str_replace("h2_", "", strip_tags($value)) . "</h2>";
211			} else {
212				$this -> group = 1;
213				$value = "<h2 class='first_h2'>" . str_replace("h2_", "", strip_tags($value)) . "</h2>";
214			}
215			return $value;
216		}
217
218	}
219
220	function checkH3($value) {
221
222		if (stristr($value, 'h3_') != "") {
223			$this -> eingabefeldAktiv = 1;
224			if ($this -> optionGroup == 1) {
225				$value = "</div><div class='optiongroup'><h3>" . str_replace("h3_", "", strip_tags($value)) . "</h3>";
226			} else {
227				$this -> optionGroup = 1;
228				$value = "<div class='optiongroup'><h3>" . str_replace("h3_", "", strip_tags($value)) . "</h3>";
229			}
230
231			return $value;
232		}
233
234	}
235
236	function checkLI($value) {
237		if (stristr($value, 'li_') != "") {
238			$value = '<div class="checkliste_option"><div class="checkliste_checkbox">&nbsp;</div>&nbsp;' . str_replace("li_", "", strip_tags($value)) . "</div>";
239			$value = str_replace("EINGABEFELD", $this -> eingabefeld, $value);
240			return $value;
241		}
242
243	}
244
245	function checkP($value) {
246
247		if (stristr($value, 'p_') != "") {
248			$this -> eingabefeldAktiv = 1;
249			if ($this -> optionGroup == 1) {
250				$value = "</div><div class='optiongroup'><p>" . str_replace("p_", "", strip_tags($value)) . "</p>";
251			} else {
252				$this -> optionGroup = 1;
253				$value = "<div class='optiongroup'><p>" . str_replace("p_", "", strip_tags($value)) . "</p>";
254			}
255
256			$value = str_replace("EINGABEFELD", $this -> eingabefeld, $value);
257			return $value;
258		}
259
260	}
261
262}
263?>