Umfragen
scheduleOption.class.php
Go to the documentation of this file.
1 <?php
2 class scheduleOption extends widget implements iWidget{
3  public $typ = "scheduleOption";
4  public $direct_result = false;
5 
6 
7  public function set_value($val){
8  $val = htmlspecialchars($val , ENT_QUOTES , "UTF-8",true);
9 
10  $err_reason = "";
11  if( (strlen($val) > 256) ){
12  $err_reason = "Wert der Option mit der ID {$this->ID} enthält mehr als 256 Zeichen.";
13  }
14  if( (strlen($val) == 0) ){
15  $err_reason = "Bitte Wert für die Wert Option mit der ID {$this->ID} angeben.";
16  }
17 
18  if($err_reason == ""){
19  $this->value = $val;
20  return true;
21  }else{
22  return $err_reason;
23  }
24 
25  }
26 
27  public function set_default_values($db){
28 
29  }
30 
31 
32 
33  public function display_option_edit(){
34  $edited ="";
35  if( (isset($_SESSION["last_option_edit"])) AND ( $_SESSION["last_option_edit"] == $this->ID ) ){
36  $edited = "option_last_edit";
37  unset($_SESSION["last_option_edit"] );
38  }
39 
40  echo "<tr class='$edited'>";
41  echo "<td>{$this->ID}</td>";
42  echo "<td style='text-align:center'>
43  <input type='text' value='{$this->value}' name='option_ID{$this->ID}_value' placeholder='Antwort' style='width:90%'/>
44  </td>";
45  echo "<td style='text-align:center'>
46  <input type='text' value='{$this->dispName}' name='option_ID{$this->ID}_name' placeholder='optionale Beschreibung' style='width:90%'/>
47  </td>";
48 
49  echo "
50  <td>
51  <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;' />
52  <input type='submit' name='rm_option_ID{$this->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;' />
53  <input type='submit' name='mvup_option_ID{$this->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;' />
54  <input type='submit' name='mvdwn_option_ID{$this->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' />
55  </td>";
56  echo "</tr>";
57  }
58 
59  public function handle_option_edit(){
60  if( (isset($_POST["option_ID{$this->ID}_name"])) AND ($_POST["option_ID{$this->ID}_name"] != "") ){
61  $dispName = htmlspecialchars($_POST["option_ID{$this->ID}_name"] , ENT_QUOTES , "UTF-8",true);
62  if(strlen($dispName) < 256){
63  $this->dispName = $dispName;
64  }else{
65  return "Name der Option mit ID {$this->ID} enthält mehr als 256 Zeichen!";
66  }
67  }else{
68  $this->dispName = "";
69  }
70  // dispName gültig, sonst return vorher schon.
71  if( isset($_POST["option_ID{$this->ID}_value"]) ){
72  if( ($_POST["option_ID{$this->ID}_value"] != "") ){
73  return $this->set_value( $_POST["option_ID{$this->ID}_value"] );
74  }else{
75  return "Keinen Wert angegeben.";//$this->set_value( $this->dispName);
76  }
77  }else{
78  return "Keinen Wert angegeben."; //return $this->set_value( $this->dispName);
79  }
80  return true;
81  }
82 
83  public function handle_inpt(){
84  return true;
85  }
86  public function display_edit(){
87 
88  }
89  public function display(){
90 
91  }
92 
93 
94 }
95 
96 // ! no ending newLine
97 ?>