5 public $typ =
"textExt";
14 if( (isset($this->
pollID)) AND (isset($this->ID)) AND (!empty($this->
pollID)) AND (!empty($this->ID)) AND ($this->
pollID != -1) AND ($this->ID != -1) ){
19 $w1->set_default_values(
$db);
20 $w2->set_default_values(
$db);
21 $this->widget_list[] = $w1;
22 $this->widget_list[] = $w2;
34 $widgets = array( array(
"name"=>
"Text abfragen" ,
"type"=>
"text") , array(
"name"=>
"Text anzeigen",
"type"=>
"labelTiny") );
35 echo
"Element <select name='add_widget_type' style='margin-right:.4em'>";
37 echo
"<option value='{$widget["type
"]}'>{$widget["name"]}</option>";
41 echo
"<input type='hidden' name='pollID' value='{$this->pollID}'/>";
42 echo
"<input type='hidden' name='wID' value='{$this->ID}'/>";
43 echo
"<input type='submit' name='addq_option_ID{$this->ID}' value='Hinzufügen' />";
47 $widgets = array( array(
"name"=>
"Textabfrage" ,
"type"=>
"text") , array(
"name"=>
"Text anzeigen",
"type"=>
"labelTiny") );
48 if( isset( $_POST[
"add_widget_type"])){
50 if( $widget[
"type"] === $_POST[
"add_widget_type"]){
51 return $_POST[
"add_widget_type"];
59 echo
"<table class='table_1' > ";
61 echo
"<tr> <th>ID</th> <th style='width:8em'>Typ</th> <th>Fragestellung/Text</th> <th>Datenbank Name</th> <th></th> <th>Breite , Abstand</th> <th>Rechts</th> <th style='width:100px'></th> </tr>";
63 echo
"<tr> <th>ID</th> <th style='width:8em'>Typ</th> <th>Fragestellung/Text</th> <th></th> <th>Breite , Abstand</th> <th>Rechts</th> <th style='width:100px'></th> </tr>";
65 $passed_float =
false;
66 if(
sizeof($this->widget_list) != 0 ){
67 foreach($this->widget_list as
$widget){
68 $width= $widget->get_config(
"width");
69 $margin_left= $widget->get_config(
"margin-left");
70 $margin_right= $widget->get_config(
"margin-right");
71 $float = $widget->get_config(
"float");
74 if( (isset($_SESSION[
"last_option_edit"])) AND ( $_SESSION[
"last_option_edit"] == $widget->ID ) ){
75 $edited =
"option_last_edit";
76 unset($_SESSION[
"last_option_edit"] );
78 echo
"<tr class='$edited'>";
79 echo
"<td>{$widget->ID}</td>";
82 if( $widget instanceof
text ){
83 echo
"<td><img src='".APP_ROOT.
"/icons/22/go-first.png' alt='' style='vertical-align:middle;margin-right:5px'/>Abfragen</td>";
84 echo
"<td style='text-align:center'>
85 <input type='text' value='{$widget->dispName}' name='option_ID{$widget->ID}_name' placeholder='Fragestellung' style='width:90%' size='20'/>
88 echo
"<td><img src='".APP_ROOT.
"/icons/22/go-last.png' alt='' style='vertical-align:middle;margin-right:5px'/>Anzeigen</td>";
89 echo
"<td style='text-align:center'>
90 <input type='text' value='{$widget->value}' name='option_ID{$widget->ID}_value' placeholder='Angezeigter Text' style='width:90%' size='20'/>
96 echo
"<td style='text-align:center'>
97 <input type='text' value='{$widget->name}' name='option_ID{$widget->ID}_name2' placeholder='Name in der Datenbank' style='width:90%' size='10'/>
105 if( $widget instanceof text ){
106 $conf = $widget->get_config(
"regexp");
108 echo
"<select name='option_ID{$widget->ID}_regexp'>";
109 echo
"<option value=''></option>";
110 foreach( $widget->regexp as $reg){
111 if( (isset($conf)) AND ($conf->exp == $reg->exp) ){
112 echo
"<option value='{$reg->name}' selected='selected'> {$reg->desc_tiny} </option>";
114 echo
"<option value='{$reg->name}'> {$reg->desc_tiny} </option>";
124 echo
"<td style='text-align:center'>";
125 echo
"<input type='text' value='$width' size='2' name='option_ID{$widget->ID}_width'/>,";
126 echo
" l:<input type='text' value='$margin_left' size='2' name='option_ID{$widget->ID}_marginleft'/>";
127 echo
" r:<input type='text' value='$margin_right' size='2' name='option_ID{$widget->ID}_marginright'/>";
130 if(($float ==
"right") AND ($passed_float ==
false) ){$float_sel =
"checked='checked'";}
else{$float_sel =
"";}
131 echo
"<td style='text-align:center'><input type='radio' value='{$widget->ID}' name='option_alignright' $float_sel/></td>";
132 if($float ==
"right" ){$passed_float =
true;}
else{$passed_float=
false;}
136 <input type='submit' name='rmq_option_ID{$widget->ID}' title='Option Löschen' tabindex='-1' value='' style='padding:0px;margin:0px;background-color:transparent;background-image:url( ".APP_ROOT.
"/icons/22/edit-delete.png );background-repeat:no-repeat;width:26px;height:26px;' />
137 <input type='submit' name='mvupq_option_ID{$widget->ID}' title='Option nach Oben schieben' tabindex='-1' value='' style='padding:0px;margin:0px;background-color:transparent;background-image:url( ".APP_ROOT.
"/icons/22/go-up.png );background-repeat:no-repeat;width:26px;height:26px;' />
138 <input type='submit' name='mvdwnq_option_ID{$widget->ID}' title='Option nach Unten schieben' tabindex='-1' value='' style='padding:0px;margin:0px;background-color:transparent;background-image:url( ".APP_ROOT.
"/icons/22/go-down.png );background-repeat:no-repeat;width:26px;height:26px' />
142 if( ($passed_float ==
false) ){$float_sel =
"checked='checked'";}
else{$float_sel =
"";}
144 echo
"<tr> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
145 <td style='text-align:center'><input type='radio' value='-1' name='option_alignright' $float_sel/></td>
148 echo
"<tr> <td></td> <td></td> <td></td> <td></td> <td></td>
149 <td style='text-align:center'><input type='radio' value='-1' name='option_alignright' $float_sel/></td>
162 $err =
$widget->set_dispName( $_POST[
"option_ID{$widget->ID}_name"] );
164 $err =
$widget->set_value( $_POST[
"option_ID{$widget->ID}_value"] );
170 if( (isset($_POST[
"option_ID{$widget->ID}_name2"])) AND ($_POST[
"option_ID{$widget->ID}_name2"] !=
"") AND (
$widget instanceof
input_widget) ) {
171 $err =
$widget->set_name( $_POST[
"option_ID{$widget->ID}_name2"] );
179 if( (isset($_POST[
"option_ID{$widget->ID}_width"])) AND ($_POST[
"option_ID{$widget->ID}_width"] !=
"-1") ){
180 $err =
$widget->set_config(
"width",$_POST[
"option_ID{$widget->ID}_width"]);
188 if( (isset($_POST[
"option_ID{$widget->ID}_marginleft"])) ){
189 $err =
$widget->set_config(
"margin-left",$_POST[
"option_ID{$widget->ID}_marginleft"]);
197 if( (isset($_POST[
"option_ID{$widget->ID}_marginright"])) ){
198 $err =
$widget->set_config(
"margin-right",$_POST[
"option_ID{$widget->ID}_marginright"]);
206 if( (isset($_POST[
"option_ID{$widget->ID}_regexp"])) AND ($_POST[
"option_ID{$widget->ID}_regexp"] !=
"") ){
207 foreach(
$widget->regexp as $exp ){
208 if( $exp->name === $_POST[
"option_ID{$widget->ID}_regexp"] ){
209 $widget->set_config(
"regexp",$exp->exp);
221 $options_seen = array();
223 $post_keys = array_keys($_POST);
224 foreach($post_keys as $post){
226 if( substr($post,0,strlen(
"option_ID")) ==
"option_ID"){
228 if( substr($post,-1*strlen(
"name")) ==
"name"){
230 }
else if( substr($post,-1*strlen(
"value")) ==
"value" ){
232 }
else if( substr($post,-1*strlen(
"marginleft")) ==
"marginleft" ){
233 $prop =
"marginleft";
234 }
else if( substr($post,-1*strlen(
"marginright")) ==
"marginright" ){
235 $prop =
"marginright";
236 }
else if( substr($post,-1*strlen(
"width")) ==
"width" ){
238 }
else if( substr($post,-1*strlen(
"name2")) ==
"name2" ){
240 }
else if( substr($post,-1*strlen(
"regexp")) ==
"regexp" ){
251 $id = substr( $post , strlen(
"option_ID") , strlen($post)-strlen(
"option_ID")-strlen(
"_".$prop) );
253 if( ($id !=
false) AND (is_numeric($id)) AND (!in_array(intval($id),$options_seen) ) ){
258 $all_errs = $all_errs.
"<br/>".
$err;
261 $options_seen[] = $id;
265 if( $_POST[
"option_alignright"] ==
"-1" ){
270 if( (isset($_POST[
"option_alignright"])) AND ( isset($float_right) ) ){
272 foreach( $this->widget_list as $child){
273 if( ($child->ID == $_POST[
"option_alignright"]) OR ($passed ==
true) ){
275 $child->set_config(
"float",
"right");
277 $child->set_config(
"float",
"left");
281 if($all_errs !==
""){
290 if( $this->dispName ==
"-" ){
295 echo
"<label for='widget_dispname'>Gemeinsame Beschreibung der Antworten</label> <br/>
296 <input type='text' name='widget_dispname' id='widget_dispname' value='{$value}' placeholder='Optionaler Beschribungstext für alle Antworten' size='40' style='margin-left:1.5em' />";
300 if( (isset($_POST[
"widget_dispname"])) AND ($_POST[
"widget_dispname"] !=
"") ){
317 if( $font_bold ==
true){ $font_bold =
"font-weight:bold"; }
else{ $font_bold=
""; }
321 $float_passed =
false;
322 foreach( $this->widget_list as
$widget){
323 $float = $widget->get_config(
"float");
324 if( ($float ==
"right") AND ($float_passed ==
false) ){
325 echo
"<td style='width:100%;'> </td>";
326 $float_passed =
true;
328 echo
"<td style='text-align:{$float};'>";
329 if( $widget instanceof
text ){
330 $widget->display_child();
336 echo
"</tr></table>";
342 $font_family= $this->
get_config(
"font-family");
346 if( $font_family !=
""){ $font_family =
"font-family:".$font_family; }
347 if( $font_size !=
""){ $font_size =
"font-size:".$font_size; }
348 if( $font_bold ==
true){ $font_bold =
"font-weight:bold"; }
else{ $font_bold=
""; }
350 echo
"<div class='widget_container textExt_widget' style='$font_family;$font_size;'>";
353 $float_passed =
false;
354 foreach( $this->widget_list as
$widget){
355 $float = $widget->get_config(
"float");
356 if( ($float ==
"right") AND ($float_passed ==
false) ){
357 echo
"<td style='width:100%;'> </td>";
358 $float_passed =
true;
360 echo
"<td style='text-align:{$float};'>";
361 if( $widget instanceof
text ){
362 $widget->display_child();
368 echo
"</tr></table>";
375 foreach( $this->widget_list as
$widget ){
376 $err = $widget->handle_inpt();
381 if(
sizeof($all_errs) > 0 ){
382 return implode(
"<br/>",$all_errs);