34 if (is_null($offset)) {
36 if( $object->name ==
""){
42 $object->is_child =
true;
43 $object->is_required = (bool) $object->is_required ;
44 $object->parent = $this->parentID;
46 $this->object_list[] = $object;
50 if ( (is_numeric($offset)) AND ($offset >= 0) AND ($offset <
sizeof($this->
object_list)) ){
58 $temp[
sizeof($temp)-1]->index = $temp[
sizeof($temp)-1]->index+1;
66 $object->index =
$i+1;
68 $object->is_child =
true;
69 $object->is_required = (bool) $object->is_required ;
70 $object->parent = $this->parentID;
86 $del_w_passed =
false;
91 if($del_w_passed ==
true){
153 if ($opt->ID == $ID){
165 $del_w_passed =
false;
170 if($del_w_passed ==
true){
176 $del_w_passed =
true;
188 public function move($index1,$index2){
229 return $this->option_list->get_by_ID(
$ID);
238 return $this->widget_list->get_by_ID(
$ID);
247 foreach( $this->widget_list as
$widget ){
250 foreach( $this->option_list as $option){
251 $widgets[] = $option;
262 foreach($options as $option){
263 $option->unserialize_config();
264 $this->option_list[] = $option;
275 $widget->unserialize_config();
276 $this->widget_list[] =
$widget;
287 if ( isset($this->option_list[
$index]) ){
288 $this->option_list[
$index] = $opt;
294 $this->option_list[] = $opt;
305 if ( isset($this->widget_list[
$index]) ){
306 $this->widget_list[
$index] = $opt;
312 $this->widget_list[] = $opt;
322 $this->option_list->delete_by_ID($id);
334 $this->widget_list->delete_by_ID($id);
349 $r = $this->option_list->move($index1,$index2);
351 $r1 =
$db->update_widget_field($this->option_list[$index1],
"index",$this->option_list[$index1]->index);
352 $r2 =
$db->update_widget_field($this->option_list[$index2],
"index",$this->option_list[$index2]->index);
353 return ($r1 AND $r2);
367 $r = $this->widget_list->move($index1,$index2);
369 $r1 =
$db->update_widget_field($this->widget_list[$index1],
"index",$this->widget_list[$index1]->index);
370 $r2 =
$db->update_widget_field($this->widget_list[$index2],
"index",$this->widget_list[$index2]->index);
371 return ($r1 AND $r2);
385 if( (isset($this->
pollID)) AND (isset($this->ID)) AND (!empty($this->
pollID)) AND (!empty($this->ID)) AND ($this->
pollID != -1) AND ($this->ID != -1) ){
397 $required_err = array();
398 foreach( $this->widget_list as
$widget ){
399 if( $widget->is_required ===
true ){
400 $r = $widget->check_required();
406 if(
sizeof($required_err) != 0 ){
407 return $required_err;
420 echo
"<table class='table_1' > ";
422 echo
"<tr> <th>ID</th> <th>Option</th> <th>Wert</th> <th style='max-width:2em'>Bearbeiten</th> </tr>";
424 echo
"<tr> <th>ID</th> <th>Option</th> <th style='max-width:2em'>Bearbeiten</th> </tr>";
426 if(
sizeof($this->option_list) != 0 ){
427 foreach($this->option_list as $opt){
428 $opt->display_option_edit($polltype);
431 echo
"<td></td> <td></td>
432 <td> <input type='submit' name='add_option_ID{$this->ID}' title='Option Einfügen' value='' style='padding:0px;margin:0px;background-color:transparent;background-image:url( ".APP_ROOT.
"/icons/22/list-add.png );background-repeat:no-repeat;width:26px;height:26px;' /> </td>";
446 $options_seen = array();
448 $post_keys = array_keys($_POST);
449 foreach($post_keys as $post){
451 if( substr($post,0,strlen(
"option_ID")) ==
"option_ID"){
453 if( substr($post,-1*strlen(
"name")) ==
"name"){
455 }
else if( substr($post,-1*strlen(
"value")) ==
"value" ){
457 }
else if( substr($post,-1*strlen(
"linebr")) ==
"linebr" ){
459 }
else if( substr($post,-1*strlen(
"max")) ==
"max" ){
465 $id = substr( $post , strlen(
"option_ID") , strlen($post)-strlen(
"option_ID")-strlen(
"_".$prop) );
467 if( ($id !=
false) AND (is_numeric($id)) AND (!in_array(intval($id),$options_seen) ) ){
473 $options_seen[] = $id;
477 if($all_errs !==
""){
489 $db->mass_update_widget($this->option_list);
497 $db->mass_update_widget($this->widget_list);
520 if(!is_array($this->
config)){
524 if( is_array($this->
config) ){
526 if(
$name ==
"columns" ){
527 if( isset($this->
config[
"columns"]) ){
528 return $this->
config[
"columns"];
544 if( (isset($this->
config)) AND (is_string($this->
config)) AND ($this->
config !=
"") ){
548 if(
$name ==
"columns" ){
549 if( in_array($val,array(
"columns",
"rows")) ){
550 $this->
config[
"columns"] = $val;
562 $allowed = array(
"pieChart",
"barChart",
"doughnutChart",
"radarChart");
563 $allowed_names = array(
"Kreisdiagramm",
"Säulendiagramm",
"Ringdiagramm",
"Netzdiagramm");
568 $allowed = array(
"pieChart",
"barChart",
"doughnutChart",
"radarChart");
573 $options = array(
"rows" =>
"Zeilenumbruch" ,
"columns" =>
"Spaltenumbruch" );
575 echo
"Umbrüche als: <select name='widget_columns_break'>";
576 foreach( array_keys($options) as
$name ){
578 echo
"<option value='$name' selected='selected'>{$options[$name]}</option>";
580 echo
"<option value='$name'>{$options[$name]}</option>";
587 $options = array(
"rows",
"columns");
588 if( (isset($_POST[
"widget_columns_break"])) AND (in_array($_POST[
"widget_columns_break"],$options)) ){
589 $r = $this->
set_config(
"columns",$_POST[
"widget_columns_break"]);
597 if($cnf ==
true ){ $ckd =
"checked='checked'"; }
598 echo
"<input type='checkbox' name='show_charts' value='true' id='show_charts' $ckd/>
599 <label for='show_charts'>Aswertung der Frage nach dem Ausfüllen der Umfrage anzeigen</label>";
603 if( (isset($_POST[
"show_charts"])) AND ($_POST[
"show_charts"]==
"true") ){
625 $column_list = array( array() );
629 foreach( $this->option_list as $option ){
630 $column_list[
$c][] = $option;
632 if( $option->get_config(
"br") ){
635 $column_list[
$c] = array();
639 if(
sizeof( $column_list[
sizeof( $column_list) -1 ] ) == 0 ){
640 $column_list = array_slice($column_list, 0,
sizeof($column_list)-1 );
643 if(
sizeof($column_list) == 1 ){
644 $count[0] =
sizeof( $column_list[0] );
651 for(
$i=0 ;
$i<
sizeof($column_list) ; ++
$i){
653 for( $j=0 ; $j<$max ; ++$j){
656 if( isset($column_list[
$i][$j]) ){
658 if( !isset($column_list[
$i+1][$j]) ){
659 $column_list[
$i][$j]->set_data(
"br",
true);
662 if( isset($row_list[$j]) ){
663 $row_list[$j][] = $column_list[
$i][$j];
665 $row_list[$j] = array($column_list[
$i][$j]);
672 if( !isset($column_list[
$i+1][$j]) ){
673 $obj->set_data(
"br",
true);
676 if( isset($row_list[$j]) ){
677 $row_list[$j][] = $obj ;
679 $row_list[$j] = array($obj);
686 foreach( $row_list as $row ){
687 foreach( $row as $option ){